# HG changeset patch # User Luke Schierer # Date 1045612768 0 # Node ID 2778ebd04b63558d52b8343760a603b9d1dd3589 # Parent 5040b5ea12e908f4565e7e335357822cd2ce41d6 [gaim-migrate @ 4872] Arun A Tharuvai (aat) writes: "I've fixed the following problems which I ran into recently. When subscribing getenv("USER") is used instead of ZGetSender() , causing subscriptions of the form class,instance,%me% to fail where a person's Zephyr username is different from their local username. Also, it segfaults whenever receiving zephyrs from senders that have no realm field. e.g. people with usernames of the form username instead of username@realmname . " committer: Tailor Script diff -r 5040b5ea12e9 -r 2778ebd04b63 src/protocols/zephyr/zephyr.c --- a/src/protocols/zephyr/zephyr.c Tue Feb 18 15:15:51 2003 +0000 +++ b/src/protocols/zephyr/zephyr.c Tue Feb 18 23:59:28 2003 +0000 @@ -387,17 +387,19 @@ /* If the person is in the default Realm, then strip the Realm from the sender field */ sendertmp = g_strdup_printf("%s",notice.z_sender); - realmptr = strchr(sendertmp,'@'); - realmptr++; - if (!g_strcasecmp(realmptr,ZGetRealm())) { - realmptr--; - sprintf(realmptr,"%c",'\0'); - send_inst = g_strdup_printf("%s %s",sendertmp, - notice.z_class_inst); - + if (realmptr = strchr(sendertmp,'@')) { + realmptr++; + if (!g_strcasecmp(realmptr,ZGetRealm())) { + realmptr--; + sprintf(realmptr,"%c",'\0'); + send_inst = g_strdup_printf("%s %s",sendertmp, + notice.z_class_inst); + } else { + send_inst = g_strdup_printf("%s %s",notice.z_sender, + notice.z_class_inst); + } } else { - send_inst = g_strdup_printf("%s %s",notice.z_sender, - notice.z_class_inst); + send_inst = g_strdup_printf("%s %s",sendertmp,notice.z_class_inst); } serv_got_chat_in(zgc, zt2->id, send_inst, FALSE, buf2, time(NULL)); @@ -512,16 +514,16 @@ if (buff[0]) { triple = g_strsplit(buff, ",", 3); if (triple[0] && triple[1] ) { - char *tmp = g_strdup_printf("%s@%s", g_getenv("USER"), - ZGetRealm()); + /* char *tmp = g_strdup_printf("%s@%s", g_getenv("USER"), + ZGetRealm());*/ + char *tmp = g_strdup_printf("%s",ZGetSender()); char *atptr; sub.zsub_class = triple[0]; sub.zsub_classinst = triple[1]; if(triple[2] == NULL) { recip = g_malloc0(1); } else if (!g_strcasecmp(triple[2], "%me%")) { - recip = g_strdup_printf("%s@%s", g_getenv("USER"), - ZGetRealm()); + recip = g_strdup_printf("%s",ZGetSender()); } else if (!g_strcasecmp(triple[2], "*")) { /* wildcard * form of class,instance,* */ @@ -586,7 +588,7 @@ if (zgc) { do_error_dialog("Already logged in with Zephyr", "Because Zephyr uses your system username, you are unable to " - "have multiple accounts on it when logged in as the same user.", GAIM_ERROR); + "have multiple accounts on it when logged in as the same user.", GAIM_ERROR); return; } @@ -904,7 +906,7 @@ instname = data->next->data; recip = data->next->next->data; if (!g_strcasecmp(recip, "%me%")) - recip = g_getenv("USER"); + recip = ZGetSender(); zt1 = new_triple(classname, instname, recip); zt2 = find_sub_by_triple(zt1);