Mercurial > pidgin
changeset 3277:ec20536eaeb0
[gaim-migrate @ 3295]
Arun says to do this.
committer: Tailor Script <tailor@pidgin.im>
author | Sean Egan <seanegan@gmail.com> |
---|---|
date | Tue, 28 May 2002 08:40:48 +0000 |
parents | a334dada69c3 |
children | 30ca1b76ad0c |
files | ChangeLog src/protocols/zephyr/ZSubs.c src/protocols/zephyr/zephyr.c |
diffstat | 3 files changed, 57 insertions(+), 16 deletions(-) [+] |
line wrap: on
line diff
--- a/ChangeLog Tue May 28 08:05:59 2002 +0000 +++ b/ChangeLog Tue May 28 08:40:48 2002 +0000 @@ -20,6 +20,7 @@ the hat to Christian Hammond for the graphic) * Conversation struct has pointer to toolbar (thanks Brent Priddy and Paul Miller) + * Zephyr fixes (thanks, (Arun A. Tharuvai) version 0.58 (05/13/2002): * Bulgarian translation added (Thanks, Igel Itzo)
--- a/src/protocols/zephyr/ZSubs.c Tue May 28 08:05:59 2002 +0000 +++ b/src/protocols/zephyr/ZSubs.c Tue May 28 08:40:48 2002 +0000 @@ -5,7 +5,7 @@ * Created by: Robert French * * $Source$ - * $Author: warmenhoven $ + * $Author: seanegan $ * * Copyright (c) 1987,1988 by the Massachusetts Institute of Technology. * For copying and distribution information, see the file @@ -16,7 +16,7 @@ #include <internal.h> #ifndef lint -static const char rcsid_ZSubscriptions_c[] = "$Id: ZSubs.c 2432 2001-10-03 19:38:28Z warmenhoven $"; +static const char rcsid_ZSubscriptions_c[] = "$Id: ZSubs.c 3295 2002-05-28 08:40:48Z seanegan $"; #endif static Code_t Z_Subscriptions __P((register ZSubscription_t *sublist, @@ -76,6 +76,7 @@ ZNotice_t notice; char header[Z_MAXHEADERLEN]; char **list; + char *recip; int hdrlen; int size_avail = Z_MAXPKTLEN-Z_FRAGFUDGE; /* space avail for data, adjusted below */ @@ -117,11 +118,12 @@ for (i=0;i<nitems;i++) { list[i*3] = sublist[i].zsub_class; list[i*3+1] = sublist[i].zsub_classinst; - if (sublist[i].zsub_recipient && *sublist[i].zsub_recipient && - *sublist[i].zsub_recipient != '*') - list[i*3+2] = ZGetSender(); - else - list[i*3+2] = ""; + recip = sublist[i].zsub_recipient; + if (recip && *recip == '*') + recip++; + if (!recip || (*recip != 0 && *recip != '@')) + recip = ZGetSender(); + list[i*3+2] = recip; } start = -1;
--- a/src/protocols/zephyr/zephyr.c Tue May 28 08:05:59 2002 +0000 +++ b/src/protocols/zephyr/zephyr.c Tue May 28 08:40:48 2002 +0000 @@ -316,7 +316,7 @@ static void handle_message(ZNotice_t notice, struct sockaddr_in from) { if (!g_strcasecmp(notice.z_class, LOGIN_CLASS)) { - /* well, we'll be updating in 2 seconds anyway, might as well ignore this. */ + /* well, we'll be updating in 20 seconds anyway, might as well ignore this. */ } else if (!g_strcasecmp(notice.z_class, LOCATE_CLASS)) { if (!g_strcasecmp(notice.z_opcode, LOCATE_LOCATE)) { int nlocs; @@ -359,6 +359,8 @@ } else { char *buf, *buf2; char *send_inst; + char *realmptr; + char *sendertmp; char *ptr = notice.z_message + strlen(notice.z_message) + 1; int len = notice.z_message_len - (ptr - notice.z_message); int away; @@ -387,10 +389,24 @@ zt2->open = TRUE; serv_got_joined_chat(zgc, zt2->id, zt2->name); } - send_inst = g_strdup_printf("%s %s", notice.z_sender, - notice.z_class_inst); + /* 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); + + } else { + send_inst = g_strdup_printf("%s %s",notice.z_sender, + notice.z_class_inst); + } serv_got_chat_in(zgc, zt2->id, send_inst, FALSE, buf2, time(NULL)); + g_free(sendertmp); g_free(send_inst); } free_triple(zt1); @@ -498,13 +514,15 @@ strip_comments(buff); if (buff[0]) { triple = g_strsplit(buff, ",", 3); - if (triple[0] && triple[1] && triple[2]) { + if (triple[0] && triple[1] ) { char *tmp = g_strdup_printf("%s@%s", g_getenv("USER"), ZGetRealm()); char *atptr; sub.zsub_class = triple[0]; sub.zsub_classinst = triple[1]; - if (!g_strcasecmp(triple[2], "%me%")) { + 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()); } else if (!g_strcasecmp(triple[2], "*")) { @@ -608,6 +626,7 @@ FILE *fd; char *fname; + char** triple; fname = g_strdup_printf("%s/.zephyr.subs", g_get_home_dir()); fd = fopen(fname, "w"); @@ -618,7 +637,19 @@ while (s) { zt = s->data; - fprintf(fd, "%s\n", zt->name); + triple = g_strsplit(zt->name,",",3); + if (triple[2] != NULL) { + if (!g_strcasecmp(triple[2], "")) { + fprintf(fd, "%s,%s,*\n", triple[0], triple[1]); + } else if (!g_strcasecmp(triple[2], ZGetSender())) { + fprintf(fd, "%s,%s,%%me%%\n",triple[0],triple[1]); + } else { + fprintf(fd, "%s\n", zt->name); + } + } else { + fprintf(fd, "%s,%s,*\n",triple[0], triple[1]); + } + g_free(triple); s = s->next; } g_free(fname); @@ -630,7 +661,7 @@ GSList *gr, *m; struct group *g; struct buddy *b; - char *ptr, *fname; + char *ptr, *fname, *ptr2; FILE *fd; fname = g_strdup_printf("%s/.anyone", g_get_home_dir()); @@ -646,8 +677,15 @@ m = g->members; while (m) { b = m->data; - if ((ptr = strchr(b->name, '@')) != NULL) - *ptr = '\0'; + if ((ptr = strchr(b->name, '@')) != NULL) { + ptr2 = ptr + 1; + /* We should only strip the realm name if the principal + is in the user's realm + */ + if (!g_strcasecmp(ptr2,ZGetRealm())) { + *ptr = '\0'; + } + } fprintf(fd, "%s\n", b->name); if (ptr) *ptr = '@';