Mercurial > pidgin
changeset 2820:b917845dad3c
[gaim-migrate @ 2833]
remove chat reason
committer: Tailor Script <tailor@pidgin.im>
author | Eric Warmenhoven <eric@warmenhoven.org> |
---|---|
date | Fri, 30 Nov 2001 21:16:28 +0000 |
parents | bcc9d7a0015d |
children | 9467e4ee81be |
files | src/buddy_chat.c src/gaim.h src/protocols/irc/irc.c src/protocols/jabber/jabber.c src/protocols/msn/msn.c src/protocols/napster/napster.c src/protocols/oscar/oscar.c src/protocols/toc/toc.c |
diffstat | 8 files changed, 25 insertions(+), 15 deletions(-) [+] |
line wrap: on
line diff
--- a/src/buddy_chat.c Fri Nov 30 09:51:23 2001 +0000 +++ b/src/buddy_chat.c Fri Nov 30 21:16:28 2001 +0000 @@ -958,7 +958,7 @@ } -void remove_chat_buddy(struct conversation *b, char *buddy) +void remove_chat_buddy(struct conversation *b, char *buddy, char *reason) { GList *names = b->in_room; GList *items = GTK_LIST(b->list)->children; @@ -998,7 +998,10 @@ play_sound(CHAT_LEAVE); if (chat_options & OPT_CHAT_LOGON) { - g_snprintf(tmp, sizeof(tmp), _("%s left the room."), buddy); + if (reason && *reason) + g_snprintf(tmp, sizeof(tmp), _("%s left the room (%s)."), buddy, reason); + else + g_snprintf(tmp, sizeof(tmp), _("%s left the room."), buddy); write_to_conv(b, tmp, WFLAG_SYSTEM, NULL, time(NULL)); } }
--- a/src/gaim.h Fri Nov 30 09:51:23 2001 +0000 +++ b/src/gaim.h Fri Nov 30 21:16:28 2001 +0000 @@ -326,7 +326,7 @@ extern void chat_set_topic(struct conversation*, char*, char*); extern void add_chat_buddy(struct conversation *, char *); extern void rename_chat_buddy(struct conversation *, char *, char *); -extern void remove_chat_buddy(struct conversation *, char *); +extern void remove_chat_buddy(struct conversation *, char *, char *); /* Functions in conversation.c */ extern void write_to_conv(struct conversation *, char *, int, char *, time_t);
--- a/src/protocols/irc/irc.c Fri Nov 30 09:51:23 2001 +0000 +++ b/src/protocols/irc/irc.c Fri Nov 30 21:16:28 2001 +0000 @@ -677,7 +677,7 @@ return FALSE; } -static void irc_rem_chat_bud(struct gaim_connection *gc, char *nick) +static void irc_rem_chat_bud(struct gaim_connection *gc, char *nick, char *reason) { GSList *bcs = gc->buddy_chats; @@ -693,7 +693,7 @@ who++; if (!g_strcasecmp(who, nick)) { char *tmp = g_strdup(r->data); - remove_chat_buddy(b, tmp); + remove_chat_buddy(b, tmp, reason); g_free(tmp); break; } @@ -865,10 +865,14 @@ gc->buddy_chats = g_slist_remove(gc->buddy_chats, c); c->gc = NULL; g_snprintf(outbuf, sizeof(outbuf), _("You have been kicked from %s: %s"), - word[3], *word_eol[5] == ':' ? word_eol[5] + 1: word_eol[5]); + word[3], *word_eol[5] == ':' ? word_eol[5] + 1 : word_eol[5]); do_error_dialog(outbuf, _("IRC Error")); - } else - irc_rem_chat_bud(gc, word[4]); + } else { + char *reason = *word_eol[5] == ':' ? word_eol[5] + 1 : word_eol[5]; + char *msg = g_strdup_printf(_("Kicked by %s: %s"), nick, reason); + irc_rem_chat_bud(gc, word[4], msg); + g_free(msg); + } } else if (!strcmp(cmd, "KILL")) { /* */ } else if (!strcmp(cmd, "MODE")) { handle_mode(gc, word, word_eol, FALSE); @@ -884,9 +888,12 @@ } else if (!strcmp(cmd, "PART")) { char *chan = cmd + 5; struct conversation *c; + char *reason = word_eol[4]; GList *r; if (*chan == ':') chan++; + if (*reason == ':') + reason++; if (!(c = irc_find_chat(gc, chan))) return FALSE; if (!strcmp(nick, gc->displayname)) { @@ -902,7 +909,7 @@ who++; if (!g_strcasecmp(who, nick)) { char *tmp = g_strdup(r->data); - remove_chat_buddy(c, tmp); + remove_chat_buddy(c, tmp, reason); g_free(tmp); break; } @@ -923,7 +930,7 @@ } } else if (!strcmp(cmd, "PONG")) { /* */ } else if (!strcmp(cmd, "QUIT")) { - irc_rem_chat_bud(gc, nick); + irc_rem_chat_bud(gc, nick, *word_eol[3] == ':' ? word_eol[3] + 1 : word_eol[3]); } else if (!strcmp(cmd, "TOPIC")) { struct conversation *c = irc_find_chat(gc, word[3]); char *topic = *word_eol[4] == ':' ? word_eol[4] + 1 : word_eol[4];
--- a/src/protocols/jabber/jabber.c Fri Nov 30 09:51:23 2001 +0000 +++ b/src/protocols/jabber/jabber.c Fri Nov 30 21:16:28 2001 +0000 @@ -828,7 +828,7 @@ } jd = jc->gc->proto_data; if (strcmp(who->resource, jc->Jid->resource) && jc->b) { - remove_chat_buddy(jc->b, who->resource); + remove_chat_buddy(jc->b, who->resource, NULL); return; }
--- a/src/protocols/msn/msn.c Fri Nov 30 09:51:23 2001 +0000 +++ b/src/protocols/msn/msn.c Fri Nov 30 21:16:28 2001 +0000 @@ -391,7 +391,7 @@ char *user, *tmp = buf; GET_NEXT(tmp); user = tmp; - remove_chat_buddy(ms->chat, user); + remove_chat_buddy(ms->chat, user, NULL); } else { msn_kill_switch(ms); return 0;
--- a/src/protocols/napster/napster.c Fri Nov 30 09:51:23 2001 +0000 +++ b/src/protocols/napster/napster.c Fri Nov 30 21:16:28 2001 +0000 @@ -257,7 +257,7 @@ channel = find_channel_by_name(gc, res[0]); convo = find_conversation_by_id(gc, channel->id); - remove_chat_buddy(convo, res[1]); + remove_chat_buddy(convo, res[1], NULL); g_strfreev(res); g_free(buf);
--- a/src/protocols/oscar/oscar.c Fri Nov 30 09:51:23 2001 +0000 +++ b/src/protocols/oscar/oscar.c Fri Nov 30 21:16:28 2001 +0000 @@ -1774,7 +1774,7 @@ return 1; for (i = 0; i < count; i++) - remove_chat_buddy(c->cnv, info[i].sn); + remove_chat_buddy(c->cnv, info[i].sn, NULL); return 1; }
--- a/src/protocols/toc/toc.c Fri Nov 30 09:51:23 2001 +0000 +++ b/src/protocols/toc/toc.c Fri Nov 30 21:16:28 2001 +0000 @@ -720,7 +720,7 @@ add_chat_buddy(b, buddy); else while ((buddy = strtok(NULL, ":")) != NULL) - remove_chat_buddy(b, buddy); + remove_chat_buddy(b, buddy, NULL); } else if (!strcasecmp(c, "CHAT_INVITE")) { char *name, *who, *message; int *id = g_new0(int, 1);