Mercurial > pidgin.yaz
changeset 1682:4328efeb531e
[gaim-migrate @ 1692]
fix for links in messages, and also some chat updates (chat still does funny things but i think now at least you won't see 5 of the same person in the room)
committer: Tailor Script <tailor@pidgin.im>
author | Eric Warmenhoven <eric@warmenhoven.org> |
---|---|
date | Wed, 04 Apr 2001 16:45:20 +0000 |
parents | 4a129d9f9b4f |
children | 394a3a344273 |
files | plugins/jabber/jabber.c |
diffstat | 1 files changed, 36 insertions(+), 5 deletions(-) [+] |
line wrap: on
line diff
--- a/plugins/jabber/jabber.c Tue Apr 03 01:52:08 2001 +0000 +++ b/plugins/jabber/jabber.c Wed Apr 04 16:45:20 2001 +0000 @@ -457,12 +457,26 @@ return b; } +static gboolean find_chat_buddy(struct conversation *b, char *name) +{ + GList *m = b->in_room; + + while (m) { + if (!strcasecmp(m->data, name)) + return TRUE; + m = m->next; + } + + return FALSE; +} + static void jabber_handlemessage(gjconn j, jpacket p) { xmlnode y; gboolean same = TRUE; char *from = NULL, *msg = NULL, *type = NULL; + char m[BUF_LONG * 2]; type = xmlnode_get_attrib(p->x, "type"); @@ -481,7 +495,8 @@ same = FALSE; } - serv_got_im(GJ_GC(j), from, msg, 0); + g_snprintf(m, sizeof(m), "%s", msg); + serv_got_im(GJ_GC(j), from, m, 0); if (!same) g_free(from); @@ -524,9 +539,17 @@ } } if (p->from->resource) { - if (!y) - add_chat_buddy(b, p->from->resource); - else if (msg) + if (!y) { + if (!find_chat_buddy(b, p->from->resource)) + add_chat_buddy(b, p->from->resource); + else if ((y = xmlnode_get_tag(p->x, "status"))) { + char buf[8192]; + msg = xmlnode_get_data(y); + g_snprintf(buf, sizeof(buf), "%s now has status: %s", + p->from->resource, msg); + write_to_conv(b, buf, WFLAG_SYSTEM, NULL); + } + } else if (msg) serv_got_chat_in(GJ_GC(j), b->id, p->from->resource, 0, msg); /* } else if (msg) { @@ -653,7 +676,15 @@ jd->existing_chats = g_slist_remove(jd->existing_chats, bcs->data); serv_got_chat_left(GJ_GC(j), cnv->id); } else { - add_chat_buddy(cnv, who->resource); + if (!find_chat_buddy(cnv, who->resource)) + add_chat_buddy(cnv, who->resource); + else if ((y = xmlnode_get_tag(p->x, "status"))) { + char buf[8192]; + char *msg = xmlnode_get_data(y); + g_snprintf(buf, sizeof(buf), "%s now has status: %s", + p->from->resource, msg); + write_to_conv(cnv, buf, WFLAG_SYSTEM, NULL); + } } } }