comparison src/protocols/irc/irc.c @ 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 04f97d65bdc1
children e3f98544eae0
comparison
equal deleted inserted replaced
2819:bcc9d7a0015d 2820:b917845dad3c
675 if (strchr(id->chantypes, *name)) 675 if (strchr(id->chantypes, *name))
676 return TRUE; 676 return TRUE;
677 return FALSE; 677 return FALSE;
678 } 678 }
679 679
680 static void irc_rem_chat_bud(struct gaim_connection *gc, char *nick) 680 static void irc_rem_chat_bud(struct gaim_connection *gc, char *nick, char *reason)
681 { 681 {
682 GSList *bcs = gc->buddy_chats; 682 GSList *bcs = gc->buddy_chats;
683 683
684 while (bcs) { 684 while (bcs) {
685 struct conversation *b = bcs->data; 685 struct conversation *b = bcs->data;
691 who++; 691 who++;
692 if (*who == '+') 692 if (*who == '+')
693 who++; 693 who++;
694 if (!g_strcasecmp(who, nick)) { 694 if (!g_strcasecmp(who, nick)) {
695 char *tmp = g_strdup(r->data); 695 char *tmp = g_strdup(r->data);
696 remove_chat_buddy(b, tmp); 696 remove_chat_buddy(b, tmp, reason);
697 g_free(tmp); 697 g_free(tmp);
698 break; 698 break;
699 } 699 }
700 r = r->next; 700 r = r->next;
701 } 701 }
863 if (!c) 863 if (!c)
864 return FALSE; 864 return FALSE;
865 gc->buddy_chats = g_slist_remove(gc->buddy_chats, c); 865 gc->buddy_chats = g_slist_remove(gc->buddy_chats, c);
866 c->gc = NULL; 866 c->gc = NULL;
867 g_snprintf(outbuf, sizeof(outbuf), _("You have been kicked from %s: %s"), 867 g_snprintf(outbuf, sizeof(outbuf), _("You have been kicked from %s: %s"),
868 word[3], *word_eol[5] == ':' ? word_eol[5] + 1: word_eol[5]); 868 word[3], *word_eol[5] == ':' ? word_eol[5] + 1 : word_eol[5]);
869 do_error_dialog(outbuf, _("IRC Error")); 869 do_error_dialog(outbuf, _("IRC Error"));
870 } else 870 } else {
871 irc_rem_chat_bud(gc, word[4]); 871 char *reason = *word_eol[5] == ':' ? word_eol[5] + 1 : word_eol[5];
872 char *msg = g_strdup_printf(_("Kicked by %s: %s"), nick, reason);
873 irc_rem_chat_bud(gc, word[4], msg);
874 g_free(msg);
875 }
872 } else if (!strcmp(cmd, "KILL")) { /* */ 876 } else if (!strcmp(cmd, "KILL")) { /* */
873 } else if (!strcmp(cmd, "MODE")) { 877 } else if (!strcmp(cmd, "MODE")) {
874 handle_mode(gc, word, word_eol, FALSE); 878 handle_mode(gc, word, word_eol, FALSE);
875 } else if (!strcmp(cmd, "NICK")) { 879 } else if (!strcmp(cmd, "NICK")) {
876 char *new = *word_eol[3] == ':' ? word_eol[3] + 1 : word_eol[3]; 880 char *new = *word_eol[3] == ':' ? word_eol[3] + 1 : word_eol[3];
882 if (ex) 886 if (ex)
883 irc_got_im(gc, nick, word_eol[4], 0, time(NULL)); 887 irc_got_im(gc, nick, word_eol[4], 0, time(NULL));
884 } else if (!strcmp(cmd, "PART")) { 888 } else if (!strcmp(cmd, "PART")) {
885 char *chan = cmd + 5; 889 char *chan = cmd + 5;
886 struct conversation *c; 890 struct conversation *c;
891 char *reason = word_eol[4];
887 GList *r; 892 GList *r;
888 if (*chan == ':') 893 if (*chan == ':')
889 chan++; 894 chan++;
895 if (*reason == ':')
896 reason++;
890 if (!(c = irc_find_chat(gc, chan))) 897 if (!(c = irc_find_chat(gc, chan)))
891 return FALSE; 898 return FALSE;
892 if (!strcmp(nick, gc->displayname)) { 899 if (!strcmp(nick, gc->displayname)) {
893 serv_got_chat_left(gc, c->id); 900 serv_got_chat_left(gc, c->id);
894 return FALSE; 901 return FALSE;
900 who++; 907 who++;
901 if (*who == '+') 908 if (*who == '+')
902 who++; 909 who++;
903 if (!g_strcasecmp(who, nick)) { 910 if (!g_strcasecmp(who, nick)) {
904 char *tmp = g_strdup(r->data); 911 char *tmp = g_strdup(r->data);
905 remove_chat_buddy(c, tmp); 912 remove_chat_buddy(c, tmp, reason);
906 g_free(tmp); 913 g_free(tmp);
907 break; 914 break;
908 } 915 }
909 r = r->next; 916 r = r->next;
910 } 917 }
921 } else { 928 } else {
922 handle_privmsg(gc, to, nick, msg); 929 handle_privmsg(gc, to, nick, msg);
923 } 930 }
924 } else if (!strcmp(cmd, "PONG")) { /* */ 931 } else if (!strcmp(cmd, "PONG")) { /* */
925 } else if (!strcmp(cmd, "QUIT")) { 932 } else if (!strcmp(cmd, "QUIT")) {
926 irc_rem_chat_bud(gc, nick); 933 irc_rem_chat_bud(gc, nick, *word_eol[3] == ':' ? word_eol[3] + 1 : word_eol[3]);
927 } else if (!strcmp(cmd, "TOPIC")) { 934 } else if (!strcmp(cmd, "TOPIC")) {
928 struct conversation *c = irc_find_chat(gc, word[3]); 935 struct conversation *c = irc_find_chat(gc, word[3]);
929 char *topic = *word_eol[4] == ':' ? word_eol[4] + 1 : word_eol[4]; 936 char *topic = *word_eol[4] == ':' ? word_eol[4] + 1 : word_eol[4];
930 if (c) { 937 if (c) {
931 char buf[IRC_BUF_LEN]; 938 char buf[IRC_BUF_LEN];