annotate src/protocols/irc/msgs.c @ 9251:45d2ad4ac1c1

[gaim-migrate @ 10050] Stu Tomlinson has provided a nice patch to move the separation of IM and Chat windows back into the core from the extplacement plugin. It's awesome to have crazy patch writers, and even better to have crazy patch writers who write what I want to write before I do it, thus saving me the effort. committer: Tailor Script <tailor@pidgin.im>
author Ethan Blanton <elb@pidgin.im>
date Wed, 09 Jun 2004 20:47:07 +0000
parents f4f210e47b60
children f5c08be60098
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
6333
e06e04e44914 [gaim-migrate @ 6832]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
1 /**
e06e04e44914 [gaim-migrate @ 6832]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
2 * @file msgs.c
e06e04e44914 [gaim-migrate @ 6832]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
3 *
e06e04e44914 [gaim-migrate @ 6832]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
4 * gaim
e06e04e44914 [gaim-migrate @ 6832]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
5 *
e06e04e44914 [gaim-migrate @ 6832]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
6 * Copyright (C) 2003, Ethan Blanton <eblanton@cs.purdue.edu>
e06e04e44914 [gaim-migrate @ 6832]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
7 *
e06e04e44914 [gaim-migrate @ 6832]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
8 * This program is free software; you can redistribute it and/or modify
e06e04e44914 [gaim-migrate @ 6832]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
9 * it under the terms of the GNU General Public License as published by
e06e04e44914 [gaim-migrate @ 6832]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
10 * the Free Software Foundation; either version 2 of the License, or
e06e04e44914 [gaim-migrate @ 6832]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
11 * (at your option) any later version.
e06e04e44914 [gaim-migrate @ 6832]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
12 *
e06e04e44914 [gaim-migrate @ 6832]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
13 * This program is distributed in the hope that it will be useful,
e06e04e44914 [gaim-migrate @ 6832]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
e06e04e44914 [gaim-migrate @ 6832]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
e06e04e44914 [gaim-migrate @ 6832]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
16 * GNU General Public License for more details.
e06e04e44914 [gaim-migrate @ 6832]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
17 *
e06e04e44914 [gaim-migrate @ 6832]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
18 * You should have received a copy of the GNU General Public License
e06e04e44914 [gaim-migrate @ 6832]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
19 * along with this program; if not, write to the Free Software
e06e04e44914 [gaim-migrate @ 6832]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
20 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
e06e04e44914 [gaim-migrate @ 6832]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
21 */
e06e04e44914 [gaim-migrate @ 6832]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
22
e06e04e44914 [gaim-migrate @ 6832]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
23 #include "internal.h"
e06e04e44914 [gaim-migrate @ 6832]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
24
e06e04e44914 [gaim-migrate @ 6832]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
25 #include "conversation.h"
e06e04e44914 [gaim-migrate @ 6832]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
26 #include "blist.h"
e06e04e44914 [gaim-migrate @ 6832]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
27 #include "notify.h"
e06e04e44914 [gaim-migrate @ 6832]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
28 #include "util.h"
e06e04e44914 [gaim-migrate @ 6832]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
29 #include "debug.h"
e06e04e44914 [gaim-migrate @ 6832]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
30 #include "irc.h"
e06e04e44914 [gaim-migrate @ 6832]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
31
e06e04e44914 [gaim-migrate @ 6832]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
32 #include <stdio.h>
e06e04e44914 [gaim-migrate @ 6832]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
33
e06e04e44914 [gaim-migrate @ 6832]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
34 static char *irc_mask_nick(const char *mask);
e06e04e44914 [gaim-migrate @ 6832]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
35 static char *irc_mask_userhost(const char *mask);
e06e04e44914 [gaim-migrate @ 6832]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
36 static void irc_chat_remove_buddy(GaimConversation *convo, char *data[2]);
e06e04e44914 [gaim-migrate @ 6832]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
37 static void irc_buddy_status(char *name, struct irc_buddy *ib, struct irc_conn *irc);
e06e04e44914 [gaim-migrate @ 6832]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
38
e06e04e44914 [gaim-migrate @ 6832]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
39 static char *irc_mask_nick(const char *mask)
e06e04e44914 [gaim-migrate @ 6832]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
40 {
e06e04e44914 [gaim-migrate @ 6832]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
41 char *end, *buf;
e06e04e44914 [gaim-migrate @ 6832]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
42
e06e04e44914 [gaim-migrate @ 6832]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
43 end = strchr(mask, '!');
e06e04e44914 [gaim-migrate @ 6832]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
44 if (!end)
e06e04e44914 [gaim-migrate @ 6832]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
45 buf = g_strdup(mask);
e06e04e44914 [gaim-migrate @ 6832]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
46 else
e06e04e44914 [gaim-migrate @ 6832]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
47 buf = g_strndup(mask, end - mask);
e06e04e44914 [gaim-migrate @ 6832]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
48
e06e04e44914 [gaim-migrate @ 6832]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
49 return buf;
e06e04e44914 [gaim-migrate @ 6832]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
50 }
e06e04e44914 [gaim-migrate @ 6832]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
51
e06e04e44914 [gaim-migrate @ 6832]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
52 static char *irc_mask_userhost(const char *mask)
e06e04e44914 [gaim-migrate @ 6832]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
53 {
e06e04e44914 [gaim-migrate @ 6832]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
54 return g_strdup(strchr(mask, '!') + 1);
e06e04e44914 [gaim-migrate @ 6832]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
55 }
e06e04e44914 [gaim-migrate @ 6832]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
56
e06e04e44914 [gaim-migrate @ 6832]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
57 static void irc_chat_remove_buddy(GaimConversation *convo, char *data[2])
e06e04e44914 [gaim-migrate @ 6832]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
58 {
7118
bf630f7dfdcd [gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents: 7108
diff changeset
59 GList *users = gaim_conv_chat_get_users(GAIM_CONV_CHAT(convo));
6333
e06e04e44914 [gaim-migrate @ 6832]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
60 char *message = g_strdup_printf("quit: %s", data[1]);
e06e04e44914 [gaim-migrate @ 6832]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
61
e06e04e44914 [gaim-migrate @ 6832]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
62 if (g_list_find_custom(users, data[0], (GCompareFunc)(strcmp)))
7118
bf630f7dfdcd [gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents: 7108
diff changeset
63 gaim_conv_chat_remove_user(GAIM_CONV_CHAT(convo), data[0], message);
6333
e06e04e44914 [gaim-migrate @ 6832]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
64
e06e04e44914 [gaim-migrate @ 6832]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
65 g_free(message);
e06e04e44914 [gaim-migrate @ 6832]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
66 }
e06e04e44914 [gaim-migrate @ 6832]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
67
e06e04e44914 [gaim-migrate @ 6832]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
68 void irc_msg_default(struct irc_conn *irc, const char *name, const char *from, char **args)
e06e04e44914 [gaim-migrate @ 6832]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
69 {
e06e04e44914 [gaim-migrate @ 6832]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
70 gaim_debug(GAIM_DEBUG_INFO, "irc", "Unrecognized message: %s\n", args[0]);
e06e04e44914 [gaim-migrate @ 6832]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
71 }
e06e04e44914 [gaim-migrate @ 6832]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
72
e06e04e44914 [gaim-migrate @ 6832]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
73 void irc_msg_away(struct irc_conn *irc, const char *name, const char *from, char **args)
e06e04e44914 [gaim-migrate @ 6832]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
74 {
e06e04e44914 [gaim-migrate @ 6832]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
75 GaimConnection *gc;
e06e04e44914 [gaim-migrate @ 6832]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
76
e06e04e44914 [gaim-migrate @ 6832]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
77 if (!args || !args[1])
e06e04e44914 [gaim-migrate @ 6832]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
78 return;
e06e04e44914 [gaim-migrate @ 6832]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
79
e06e04e44914 [gaim-migrate @ 6832]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
80 if (irc->whois.nick && !gaim_utf8_strcasecmp(irc->whois.nick, args[1])) {
e06e04e44914 [gaim-migrate @ 6832]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
81 /* We're doing a whois, show this in the whois dialog */
e06e04e44914 [gaim-migrate @ 6832]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
82 irc_msg_whois(irc, name, from, args);
e06e04e44914 [gaim-migrate @ 6832]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
83 return;
e06e04e44914 [gaim-migrate @ 6832]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
84 }
e06e04e44914 [gaim-migrate @ 6832]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
85
e06e04e44914 [gaim-migrate @ 6832]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
86 gc = gaim_account_get_connection(irc->account);
e06e04e44914 [gaim-migrate @ 6832]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
87 if (gc)
7118
bf630f7dfdcd [gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents: 7108
diff changeset
88 serv_got_im(gc, args[1], args[2], GAIM_CONV_IM_AUTO_RESP, time(NULL));
6333
e06e04e44914 [gaim-migrate @ 6832]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
89 }
e06e04e44914 [gaim-migrate @ 6832]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
90
e06e04e44914 [gaim-migrate @ 6832]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
91 void irc_msg_badmode(struct irc_conn *irc, const char *name, const char *from, char **args)
e06e04e44914 [gaim-migrate @ 6832]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
92 {
e06e04e44914 [gaim-migrate @ 6832]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
93 GaimConnection *gc = gaim_account_get_connection(irc->account);
e06e04e44914 [gaim-migrate @ 6832]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
94
e06e04e44914 [gaim-migrate @ 6832]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
95 if (!args || !args[1] || !gc)
e06e04e44914 [gaim-migrate @ 6832]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
96 return;
e06e04e44914 [gaim-migrate @ 6832]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
97
e06e04e44914 [gaim-migrate @ 6832]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
98 gaim_notify_error(gc, NULL, _("Bad mode"), args[1]);
e06e04e44914 [gaim-migrate @ 6832]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
99 }
e06e04e44914 [gaim-migrate @ 6832]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
100
e06e04e44914 [gaim-migrate @ 6832]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
101 void irc_msg_banned(struct irc_conn *irc, const char *name, const char *from, char **args)
e06e04e44914 [gaim-migrate @ 6832]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
102 {
e06e04e44914 [gaim-migrate @ 6832]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
103 GaimConnection *gc = gaim_account_get_connection(irc->account);
e06e04e44914 [gaim-migrate @ 6832]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
104 char *buf;
e06e04e44914 [gaim-migrate @ 6832]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
105
e06e04e44914 [gaim-migrate @ 6832]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
106 if (!args || !args[1] || !gc)
e06e04e44914 [gaim-migrate @ 6832]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
107 return;
e06e04e44914 [gaim-migrate @ 6832]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
108
e06e04e44914 [gaim-migrate @ 6832]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
109 buf = g_strdup_printf(_("You are banned from %s."), args[1]);
e06e04e44914 [gaim-migrate @ 6832]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
110 gaim_notify_error(gc, _("Banned"), _("Banned"), buf);
e06e04e44914 [gaim-migrate @ 6832]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
111 g_free(buf);
e06e04e44914 [gaim-migrate @ 6832]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
112 }
e06e04e44914 [gaim-migrate @ 6832]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
113
e06e04e44914 [gaim-migrate @ 6832]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
114 void irc_msg_chanmode(struct irc_conn *irc, const char *name, const char *from, char **args)
e06e04e44914 [gaim-migrate @ 6832]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
115 {
e06e04e44914 [gaim-migrate @ 6832]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
116 GaimConversation *convo;
e06e04e44914 [gaim-migrate @ 6832]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
117 char *buf;
e06e04e44914 [gaim-migrate @ 6832]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
118
e06e04e44914 [gaim-migrate @ 6832]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
119 if (!args || !args[1] || !args[2])
e06e04e44914 [gaim-migrate @ 6832]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
120 return;
e06e04e44914 [gaim-migrate @ 6832]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
121
e06e04e44914 [gaim-migrate @ 6832]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
122 convo = gaim_find_conversation_with_account(args[1], irc->account);
e06e04e44914 [gaim-migrate @ 6832]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
123 if (!convo) /* XXX punt on channels we are not in for now */
e06e04e44914 [gaim-migrate @ 6832]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
124 return;
e06e04e44914 [gaim-migrate @ 6832]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
125
e06e04e44914 [gaim-migrate @ 6832]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
126 buf = g_strdup_printf("mode for %s: %s %s", args[1], args[2], args[3] ? args[3] : "");
7118
bf630f7dfdcd [gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents: 7108
diff changeset
127 gaim_conv_chat_write(GAIM_CONV_CHAT(convo), "", buf, GAIM_MESSAGE_SYSTEM|GAIM_MESSAGE_NO_LOG, time(NULL));
6333
e06e04e44914 [gaim-migrate @ 6832]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
128 g_free(buf);
e06e04e44914 [gaim-migrate @ 6832]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
129
e06e04e44914 [gaim-migrate @ 6832]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
130 return;
e06e04e44914 [gaim-migrate @ 6832]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
131 }
e06e04e44914 [gaim-migrate @ 6832]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
132
e06e04e44914 [gaim-migrate @ 6832]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
133 void irc_msg_whois(struct irc_conn *irc, const char *name, const char *from, char **args)
e06e04e44914 [gaim-migrate @ 6832]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
134 {
e06e04e44914 [gaim-migrate @ 6832]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
135 if (!irc->whois.nick) {
e06e04e44914 [gaim-migrate @ 6832]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
136 gaim_debug(GAIM_DEBUG_WARNING, "irc", "Unexpected WHOIS reply for %s\n", args[1]);
e06e04e44914 [gaim-migrate @ 6832]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
137 return;
e06e04e44914 [gaim-migrate @ 6832]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
138 }
e06e04e44914 [gaim-migrate @ 6832]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
139
e06e04e44914 [gaim-migrate @ 6832]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
140 if (gaim_utf8_strcasecmp(irc->whois.nick, args[1])) {
e06e04e44914 [gaim-migrate @ 6832]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
141 gaim_debug(GAIM_DEBUG_WARNING, "irc", "Got WHOIS reply for %s while waiting for %s\n", args[1], irc->whois.nick);
e06e04e44914 [gaim-migrate @ 6832]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
142 return;
e06e04e44914 [gaim-migrate @ 6832]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
143 }
e06e04e44914 [gaim-migrate @ 6832]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
144
e06e04e44914 [gaim-migrate @ 6832]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
145 if (!strcmp(name, "301")) {
e06e04e44914 [gaim-migrate @ 6832]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
146 irc->whois.away = g_strdup(args[2]);
e06e04e44914 [gaim-migrate @ 6832]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
147 } else if (!strcmp(name, "311")) {
e06e04e44914 [gaim-migrate @ 6832]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
148 irc->whois.userhost = g_strdup_printf("%s@%s", args[2], args[3]);
e06e04e44914 [gaim-migrate @ 6832]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
149 irc->whois.name = g_strdup(args[5]);
e06e04e44914 [gaim-migrate @ 6832]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
150 } else if (!strcmp(name, "312")) {
e06e04e44914 [gaim-migrate @ 6832]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
151 irc->whois.server = g_strdup(args[2]);
e06e04e44914 [gaim-migrate @ 6832]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
152 irc->whois.serverinfo = g_strdup(args[3]);
e06e04e44914 [gaim-migrate @ 6832]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
153 } else if (!strcmp(name, "313")) {
e06e04e44914 [gaim-migrate @ 6832]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
154 irc->whois.ircop = 1;
e06e04e44914 [gaim-migrate @ 6832]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
155 } else if (!strcmp(name, "317")) {
e06e04e44914 [gaim-migrate @ 6832]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
156 irc->whois.idle = atoi(args[2]);
e06e04e44914 [gaim-migrate @ 6832]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
157 if (args[3])
e06e04e44914 [gaim-migrate @ 6832]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
158 irc->whois.signon = (time_t)atoi(args[3]);
e06e04e44914 [gaim-migrate @ 6832]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
159 } else if (!strcmp(name, "319")) {
e06e04e44914 [gaim-migrate @ 6832]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
160 irc->whois.channels = g_strdup(args[2]);
e06e04e44914 [gaim-migrate @ 6832]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
161 } else if (!strcmp(name, "320")) {
e06e04e44914 [gaim-migrate @ 6832]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
162 irc->whois.identified = 1;
e06e04e44914 [gaim-migrate @ 6832]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
163 }
e06e04e44914 [gaim-migrate @ 6832]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
164 }
e06e04e44914 [gaim-migrate @ 6832]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
165
e06e04e44914 [gaim-migrate @ 6832]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
166 void irc_msg_endwhois(struct irc_conn *irc, const char *name, const char *from, char **args)
e06e04e44914 [gaim-migrate @ 6832]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
167 {
e06e04e44914 [gaim-migrate @ 6832]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
168 GaimConnection *gc;
e06e04e44914 [gaim-migrate @ 6832]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
169 GString *info;
7062
86ed8b2aa665 [gaim-migrate @ 7626]
Christian Hammond <chipx86@chipx86.com>
parents: 6982
diff changeset
170 char buffer[256];
6333
e06e04e44914 [gaim-migrate @ 6832]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
171 char *str;
e06e04e44914 [gaim-migrate @ 6832]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
172
e06e04e44914 [gaim-migrate @ 6832]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
173 if (!irc->whois.nick) {
e06e04e44914 [gaim-migrate @ 6832]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
174 gaim_debug(GAIM_DEBUG_WARNING, "irc", "Unexpected End of WHOIS for %s\n", args[1]);
e06e04e44914 [gaim-migrate @ 6832]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
175 return;
e06e04e44914 [gaim-migrate @ 6832]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
176 }
e06e04e44914 [gaim-migrate @ 6832]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
177 if (gaim_utf8_strcasecmp(irc->whois.nick, args[1])) {
e06e04e44914 [gaim-migrate @ 6832]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
178 gaim_debug(GAIM_DEBUG_WARNING, "irc", "Received end of WHOIS for %s, expecting %s\n", args[1], irc->whois.nick);
e06e04e44914 [gaim-migrate @ 6832]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
179 return;
e06e04e44914 [gaim-migrate @ 6832]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
180 }
e06e04e44914 [gaim-migrate @ 6832]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
181
e06e04e44914 [gaim-migrate @ 6832]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
182 info = g_string_new("");
e06e04e44914 [gaim-migrate @ 6832]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
183 g_string_append_printf(info, "<b>%s:</b> %s%s%s<br>", _("Nick"), args[1],
e06e04e44914 [gaim-migrate @ 6832]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
184 irc->whois.ircop ? _(" <i>(ircop)</i>") : "",
e06e04e44914 [gaim-migrate @ 6832]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
185 irc->whois.identified ? _(" <i>(identified)</i>") : "");
e06e04e44914 [gaim-migrate @ 6832]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
186 if (irc->whois.away) {
e06e04e44914 [gaim-migrate @ 6832]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
187 g_string_append_printf(info, "<b>%s:</b> %s<br>", _("Away"), irc->whois.away);
e06e04e44914 [gaim-migrate @ 6832]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
188 g_free(irc->whois.away);
e06e04e44914 [gaim-migrate @ 6832]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
189 }
e06e04e44914 [gaim-migrate @ 6832]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
190 if (irc->whois.userhost) {
e06e04e44914 [gaim-migrate @ 6832]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
191 g_string_append_printf(info, "<b>%s:</b> %s<br>", _("Username"), irc->whois.userhost);
e06e04e44914 [gaim-migrate @ 6832]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
192 g_string_append_printf(info, "<b>%s:</b> %s<br>", _("Realname"), irc->whois.name);
e06e04e44914 [gaim-migrate @ 6832]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
193 g_free(irc->whois.userhost);
e06e04e44914 [gaim-migrate @ 6832]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
194 g_free(irc->whois.name);
e06e04e44914 [gaim-migrate @ 6832]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
195 }
e06e04e44914 [gaim-migrate @ 6832]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
196 if (irc->whois.server) {
e06e04e44914 [gaim-migrate @ 6832]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
197 g_string_append_printf(info, "<b>%s:</b> %s (%s)<br>", _("Server"), irc->whois.server, irc->whois.serverinfo);
e06e04e44914 [gaim-migrate @ 6832]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
198 g_free(irc->whois.server);
e06e04e44914 [gaim-migrate @ 6832]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
199 g_free(irc->whois.serverinfo);
e06e04e44914 [gaim-migrate @ 6832]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
200 }
e06e04e44914 [gaim-migrate @ 6832]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
201 if (irc->whois.channels) {
e06e04e44914 [gaim-migrate @ 6832]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
202 g_string_append_printf(info, "<b>%s:</b> %s<br>", _("Currently on"), irc->whois.channels);
e06e04e44914 [gaim-migrate @ 6832]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
203 g_free(irc->whois.channels);
e06e04e44914 [gaim-migrate @ 6832]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
204 }
e06e04e44914 [gaim-migrate @ 6832]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
205 if (irc->whois.idle) {
7108
6faeeecab0dc [gaim-migrate @ 7673]
Christian Hammond <chipx86@chipx86.com>
parents: 7062
diff changeset
206 gchar *timex = gaim_str_seconds_to_string(irc->whois.idle);
6357
1fa4410d2e13 [gaim-migrate @ 6856]
Mark Doliner <mark@kingant.net>
parents: 6351
diff changeset
207 g_string_append_printf(info, _("<b>Idle for:</b> %s<br>"), timex);
1fa4410d2e13 [gaim-migrate @ 6856]
Mark Doliner <mark@kingant.net>
parents: 6351
diff changeset
208 g_free(timex);
6333
e06e04e44914 [gaim-migrate @ 6832]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
209 g_string_append_printf(info, "<b>%s:</b> %s", _("Online since"), ctime(&irc->whois.signon));
e06e04e44914 [gaim-migrate @ 6832]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
210 }
e06e04e44914 [gaim-migrate @ 6832]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
211 if (!strcmp(irc->whois.nick, "Paco-Paco")) {
e06e04e44914 [gaim-migrate @ 6832]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
212 g_string_append_printf(info, _("<br><b>Defining adjective:</b> Glorious<br>"));
e06e04e44914 [gaim-migrate @ 6832]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
213 }
e06e04e44914 [gaim-migrate @ 6832]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
214
e06e04e44914 [gaim-migrate @ 6832]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
215 gc = gaim_account_get_connection(irc->account);
e06e04e44914 [gaim-migrate @ 6832]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
216 str = g_string_free(info, FALSE);
7062
86ed8b2aa665 [gaim-migrate @ 7626]
Christian Hammond <chipx86@chipx86.com>
parents: 6982
diff changeset
217
86ed8b2aa665 [gaim-migrate @ 7626]
Christian Hammond <chipx86@chipx86.com>
parents: 6982
diff changeset
218 g_snprintf(buffer, sizeof(buffer),
86ed8b2aa665 [gaim-migrate @ 7626]
Christian Hammond <chipx86@chipx86.com>
parents: 6982
diff changeset
219 _("Buddy Information for %s"), irc->whois.nick);
86ed8b2aa665 [gaim-migrate @ 7626]
Christian Hammond <chipx86@chipx86.com>
parents: 6982
diff changeset
220 gaim_notify_formatted(gc, NULL, buffer, NULL, str, NULL, NULL);
86ed8b2aa665 [gaim-migrate @ 7626]
Christian Hammond <chipx86@chipx86.com>
parents: 6982
diff changeset
221
6333
e06e04e44914 [gaim-migrate @ 6832]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
222 g_free(str);
e06e04e44914 [gaim-migrate @ 6832]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
223 memset(&irc->whois, 0, sizeof(irc->whois));
e06e04e44914 [gaim-migrate @ 6832]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
224 }
e06e04e44914 [gaim-migrate @ 6832]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
225
8114
7a6e30eb7aad [gaim-migrate @ 8818]
Ethan Blanton <elb@pidgin.im>
parents: 7877
diff changeset
226 void irc_msg_list(struct irc_conn *irc, const char *name, const char *from, char **args)
7a6e30eb7aad [gaim-migrate @ 8818]
Ethan Blanton <elb@pidgin.im>
parents: 7877
diff changeset
227 {
7a6e30eb7aad [gaim-migrate @ 8818]
Ethan Blanton <elb@pidgin.im>
parents: 7877
diff changeset
228 if (!irc->roomlist)
7a6e30eb7aad [gaim-migrate @ 8818]
Ethan Blanton <elb@pidgin.im>
parents: 7877
diff changeset
229 return;
7a6e30eb7aad [gaim-migrate @ 8818]
Ethan Blanton <elb@pidgin.im>
parents: 7877
diff changeset
230
7a6e30eb7aad [gaim-migrate @ 8818]
Ethan Blanton <elb@pidgin.im>
parents: 7877
diff changeset
231 if (!strcmp(name, "321")) {
7a6e30eb7aad [gaim-migrate @ 8818]
Ethan Blanton <elb@pidgin.im>
parents: 7877
diff changeset
232 gaim_roomlist_set_in_progress(irc->roomlist, TRUE);
7a6e30eb7aad [gaim-migrate @ 8818]
Ethan Blanton <elb@pidgin.im>
parents: 7877
diff changeset
233 return;
7a6e30eb7aad [gaim-migrate @ 8818]
Ethan Blanton <elb@pidgin.im>
parents: 7877
diff changeset
234 }
7a6e30eb7aad [gaim-migrate @ 8818]
Ethan Blanton <elb@pidgin.im>
parents: 7877
diff changeset
235
7a6e30eb7aad [gaim-migrate @ 8818]
Ethan Blanton <elb@pidgin.im>
parents: 7877
diff changeset
236 if (!strcmp(name, "323")) {
7a6e30eb7aad [gaim-migrate @ 8818]
Ethan Blanton <elb@pidgin.im>
parents: 7877
diff changeset
237 gaim_roomlist_set_in_progress(irc->roomlist, FALSE);
7a6e30eb7aad [gaim-migrate @ 8818]
Ethan Blanton <elb@pidgin.im>
parents: 7877
diff changeset
238 gaim_roomlist_unref(irc->roomlist);
7a6e30eb7aad [gaim-migrate @ 8818]
Ethan Blanton <elb@pidgin.im>
parents: 7877
diff changeset
239 irc->roomlist = NULL;
7a6e30eb7aad [gaim-migrate @ 8818]
Ethan Blanton <elb@pidgin.im>
parents: 7877
diff changeset
240 }
7a6e30eb7aad [gaim-migrate @ 8818]
Ethan Blanton <elb@pidgin.im>
parents: 7877
diff changeset
241
7a6e30eb7aad [gaim-migrate @ 8818]
Ethan Blanton <elb@pidgin.im>
parents: 7877
diff changeset
242 if (!strcmp(name, "322")) {
7a6e30eb7aad [gaim-migrate @ 8818]
Ethan Blanton <elb@pidgin.im>
parents: 7877
diff changeset
243 GaimRoomlistRoom *room;
7a6e30eb7aad [gaim-migrate @ 8818]
Ethan Blanton <elb@pidgin.im>
parents: 7877
diff changeset
244
7a6e30eb7aad [gaim-migrate @ 8818]
Ethan Blanton <elb@pidgin.im>
parents: 7877
diff changeset
245 if (!args[0] || !args[1] || !args[2] || !args[3])
7a6e30eb7aad [gaim-migrate @ 8818]
Ethan Blanton <elb@pidgin.im>
parents: 7877
diff changeset
246 return;
7a6e30eb7aad [gaim-migrate @ 8818]
Ethan Blanton <elb@pidgin.im>
parents: 7877
diff changeset
247
7a6e30eb7aad [gaim-migrate @ 8818]
Ethan Blanton <elb@pidgin.im>
parents: 7877
diff changeset
248 room = gaim_roomlist_room_new(GAIM_ROOMLIST_ROOMTYPE_ROOM, args[1], NULL);
7a6e30eb7aad [gaim-migrate @ 8818]
Ethan Blanton <elb@pidgin.im>
parents: 7877
diff changeset
249 gaim_roomlist_room_add_field(irc->roomlist, room, args[1]);
7a6e30eb7aad [gaim-migrate @ 8818]
Ethan Blanton <elb@pidgin.im>
parents: 7877
diff changeset
250 gaim_roomlist_room_add_field(irc->roomlist, room, GINT_TO_POINTER(strtol(args[2], NULL, 10)));
7a6e30eb7aad [gaim-migrate @ 8818]
Ethan Blanton <elb@pidgin.im>
parents: 7877
diff changeset
251 gaim_roomlist_room_add_field(irc->roomlist, room, args[3]);
7a6e30eb7aad [gaim-migrate @ 8818]
Ethan Blanton <elb@pidgin.im>
parents: 7877
diff changeset
252 gaim_roomlist_room_add(irc->roomlist, room);
7a6e30eb7aad [gaim-migrate @ 8818]
Ethan Blanton <elb@pidgin.im>
parents: 7877
diff changeset
253 }
7a6e30eb7aad [gaim-migrate @ 8818]
Ethan Blanton <elb@pidgin.im>
parents: 7877
diff changeset
254 }
7a6e30eb7aad [gaim-migrate @ 8818]
Ethan Blanton <elb@pidgin.im>
parents: 7877
diff changeset
255
6333
e06e04e44914 [gaim-migrate @ 6832]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
256 void irc_msg_topic(struct irc_conn *irc, const char *name, const char *from, char **args)
e06e04e44914 [gaim-migrate @ 6832]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
257 {
8504
534b479692d0 [gaim-migrate @ 9240]
Mark Doliner <mark@kingant.net>
parents: 8273
diff changeset
258 char *chan, *topic, *msg, *nick, *tmp;
6333
e06e04e44914 [gaim-migrate @ 6832]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
259 GaimConversation *convo;
e06e04e44914 [gaim-migrate @ 6832]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
260
e06e04e44914 [gaim-migrate @ 6832]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
261 if (!strcmp(name, "topic")) {
e06e04e44914 [gaim-migrate @ 6832]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
262 chan = args[0];
8529
2f505651ac03 [gaim-migrate @ 9268]
Ethan Blanton <elb@pidgin.im>
parents: 8504
diff changeset
263 topic = irc_mirc2txt (args[1]);
6333
e06e04e44914 [gaim-migrate @ 6832]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
264 } else {
e06e04e44914 [gaim-migrate @ 6832]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
265 chan = args[1];
8529
2f505651ac03 [gaim-migrate @ 9268]
Ethan Blanton <elb@pidgin.im>
parents: 8504
diff changeset
266 topic = irc_mirc2txt (args[2]);
6333
e06e04e44914 [gaim-migrate @ 6832]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
267 }
e06e04e44914 [gaim-migrate @ 6832]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
268
e06e04e44914 [gaim-migrate @ 6832]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
269 convo = gaim_find_conversation_with_account(chan, irc->account);
e06e04e44914 [gaim-migrate @ 6832]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
270 if (!convo) {
e06e04e44914 [gaim-migrate @ 6832]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
271 gaim_debug(GAIM_DEBUG_ERROR, "irc", "Got a topic for %s, which doesn't exist\n", chan);
e06e04e44914 [gaim-migrate @ 6832]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
272 }
7118
bf630f7dfdcd [gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents: 7108
diff changeset
273 gaim_conv_chat_set_topic(GAIM_CONV_CHAT(convo), NULL, topic);
6333
e06e04e44914 [gaim-migrate @ 6832]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
274 /* If this is an interactive update, print it out */
8504
534b479692d0 [gaim-migrate @ 9240]
Mark Doliner <mark@kingant.net>
parents: 8273
diff changeset
275 tmp = gaim_escape_html(topic);
6333
e06e04e44914 [gaim-migrate @ 6832]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
276 if (!strcmp(name, "topic")) {
e06e04e44914 [gaim-migrate @ 6832]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
277 nick = irc_mask_nick(from);
8504
534b479692d0 [gaim-migrate @ 9240]
Mark Doliner <mark@kingant.net>
parents: 8273
diff changeset
278 msg = g_strdup_printf(_("%s has changed the topic to: %s"), nick, tmp);
6333
e06e04e44914 [gaim-migrate @ 6832]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
279 g_free(nick);
7118
bf630f7dfdcd [gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents: 7108
diff changeset
280 gaim_conv_chat_write(GAIM_CONV_CHAT(convo), from, msg, GAIM_MESSAGE_SYSTEM, time(NULL));
6333
e06e04e44914 [gaim-migrate @ 6832]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
281 g_free(msg);
e06e04e44914 [gaim-migrate @ 6832]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
282 } else {
8504
534b479692d0 [gaim-migrate @ 9240]
Mark Doliner <mark@kingant.net>
parents: 8273
diff changeset
283 msg = g_strdup_printf(_("The topic for %s is: %s"), chan, tmp);
7118
bf630f7dfdcd [gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents: 7108
diff changeset
284 gaim_conv_chat_write(GAIM_CONV_CHAT(convo), "", msg, GAIM_MESSAGE_SYSTEM, time(NULL));
6333
e06e04e44914 [gaim-migrate @ 6832]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
285 g_free(msg);
e06e04e44914 [gaim-migrate @ 6832]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
286 }
8504
534b479692d0 [gaim-migrate @ 9240]
Mark Doliner <mark@kingant.net>
parents: 8273
diff changeset
287 g_free(tmp);
8529
2f505651ac03 [gaim-migrate @ 9268]
Ethan Blanton <elb@pidgin.im>
parents: 8504
diff changeset
288 g_free(topic);
6333
e06e04e44914 [gaim-migrate @ 6832]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
289 }
e06e04e44914 [gaim-migrate @ 6832]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
290
e06e04e44914 [gaim-migrate @ 6832]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
291 void irc_msg_unknown(struct irc_conn *irc, const char *name, const char *from, char **args)
e06e04e44914 [gaim-migrate @ 6832]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
292 {
e06e04e44914 [gaim-migrate @ 6832]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
293 GaimConnection *gc = gaim_account_get_connection(irc->account);
e06e04e44914 [gaim-migrate @ 6832]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
294 char *buf;
e06e04e44914 [gaim-migrate @ 6832]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
295
e06e04e44914 [gaim-migrate @ 6832]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
296 if (!args || !args[1] || !gc)
e06e04e44914 [gaim-migrate @ 6832]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
297 return;
e06e04e44914 [gaim-migrate @ 6832]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
298
e06e04e44914 [gaim-migrate @ 6832]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
299 buf = g_strdup_printf(_("Unknown message '%s'"), args[1]);
e06e04e44914 [gaim-migrate @ 6832]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
300 gaim_notify_error(gc, _("Unknown message"), buf, _("Gaim has sent a message the IRC server did not understand."));
e06e04e44914 [gaim-migrate @ 6832]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
301 g_free(buf);
e06e04e44914 [gaim-migrate @ 6832]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
302 }
e06e04e44914 [gaim-migrate @ 6832]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
303
e06e04e44914 [gaim-migrate @ 6832]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
304 void irc_msg_names(struct irc_conn *irc, const char *name, const char *from, char **args)
e06e04e44914 [gaim-migrate @ 6832]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
305 {
e06e04e44914 [gaim-migrate @ 6832]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
306 char *names, *cur, *end, *tmp, *msg;
e06e04e44914 [gaim-migrate @ 6832]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
307 GaimConversation *convo;
e06e04e44914 [gaim-migrate @ 6832]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
308
e06e04e44914 [gaim-migrate @ 6832]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
309 if (!strcmp(name, "366")) {
e06e04e44914 [gaim-migrate @ 6832]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
310 convo = gaim_find_conversation_with_account(irc->nameconv ? irc->nameconv : args[1], irc->account);
e06e04e44914 [gaim-migrate @ 6832]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
311 if (!convo) {
e06e04e44914 [gaim-migrate @ 6832]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
312 gaim_debug(GAIM_DEBUG_ERROR, "irc", "Got a NAMES list for %s, which doesn't exist\n", args[2]);
e06e04e44914 [gaim-migrate @ 6832]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
313 g_string_free(irc->names, TRUE);
e06e04e44914 [gaim-migrate @ 6832]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
314 irc->names = NULL;
e06e04e44914 [gaim-migrate @ 6832]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
315 g_free(irc->nameconv);
e06e04e44914 [gaim-migrate @ 6832]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
316 irc->nameconv = NULL;
e06e04e44914 [gaim-migrate @ 6832]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
317 return;
e06e04e44914 [gaim-migrate @ 6832]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
318 }
e06e04e44914 [gaim-migrate @ 6832]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
319
e06e04e44914 [gaim-migrate @ 6832]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
320 names = cur = g_string_free(irc->names, FALSE);
e06e04e44914 [gaim-migrate @ 6832]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
321 irc->names = NULL;
e06e04e44914 [gaim-migrate @ 6832]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
322 if (irc->nameconv) {
e06e04e44914 [gaim-migrate @ 6832]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
323 msg = g_strdup_printf("Users on %s: %s", args[1], names);
e06e04e44914 [gaim-migrate @ 6832]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
324 if (gaim_conversation_get_type(convo) == GAIM_CONV_CHAT)
7118
bf630f7dfdcd [gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents: 7108
diff changeset
325 gaim_conv_chat_write(GAIM_CONV_CHAT(convo), "", msg, GAIM_MESSAGE_SYSTEM|GAIM_MESSAGE_NO_LOG, time(NULL));
6333
e06e04e44914 [gaim-migrate @ 6832]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
326 else
7118
bf630f7dfdcd [gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents: 7108
diff changeset
327 gaim_conv_im_write(GAIM_CONV_IM(convo), "", msg, GAIM_MESSAGE_SYSTEM|GAIM_MESSAGE_NO_LOG, time(NULL));
6333
e06e04e44914 [gaim-migrate @ 6832]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
328 g_free(msg);
e06e04e44914 [gaim-migrate @ 6832]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
329 g_free(irc->nameconv);
e06e04e44914 [gaim-migrate @ 6832]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
330 irc->nameconv = NULL;
e06e04e44914 [gaim-migrate @ 6832]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
331 } else {
6407
ba0b99a72be2 [gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents: 6357
diff changeset
332 GList *users = NULL;
ba0b99a72be2 [gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents: 6357
diff changeset
333
6333
e06e04e44914 [gaim-migrate @ 6832]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
334 while (*cur) {
e06e04e44914 [gaim-migrate @ 6832]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
335 end = strchr(cur, ' ');
e06e04e44914 [gaim-migrate @ 6832]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
336 if (!end)
e06e04e44914 [gaim-migrate @ 6832]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
337 end = cur + strlen(cur);
e06e04e44914 [gaim-migrate @ 6832]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
338 if (*cur == '@' || *cur == '%' || *cur == '+')
e06e04e44914 [gaim-migrate @ 6832]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
339 cur++;
e06e04e44914 [gaim-migrate @ 6832]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
340 tmp = g_strndup(cur, end - cur);
6407
ba0b99a72be2 [gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents: 6357
diff changeset
341 users = g_list_append(users, tmp);
6333
e06e04e44914 [gaim-migrate @ 6832]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
342 cur = end;
e06e04e44914 [gaim-migrate @ 6832]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
343 if (*cur)
e06e04e44914 [gaim-migrate @ 6832]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
344 cur++;
e06e04e44914 [gaim-migrate @ 6832]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
345 }
6407
ba0b99a72be2 [gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents: 6357
diff changeset
346
ba0b99a72be2 [gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents: 6357
diff changeset
347 if (users != NULL) {
ba0b99a72be2 [gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents: 6357
diff changeset
348 GList *l;
ba0b99a72be2 [gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents: 6357
diff changeset
349
7118
bf630f7dfdcd [gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents: 7108
diff changeset
350 gaim_conv_chat_add_users(GAIM_CONV_CHAT(convo), users);
6407
ba0b99a72be2 [gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents: 6357
diff changeset
351
ba0b99a72be2 [gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents: 6357
diff changeset
352 for (l = users; l != NULL; l = l->next)
ba0b99a72be2 [gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents: 6357
diff changeset
353 g_free(l->data);
ba0b99a72be2 [gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents: 6357
diff changeset
354
ba0b99a72be2 [gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents: 6357
diff changeset
355 g_list_free(users);
ba0b99a72be2 [gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents: 6357
diff changeset
356 }
6333
e06e04e44914 [gaim-migrate @ 6832]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
357 }
e06e04e44914 [gaim-migrate @ 6832]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
358 g_free(names);
e06e04e44914 [gaim-migrate @ 6832]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
359 } else {
e06e04e44914 [gaim-migrate @ 6832]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
360 if (!irc->names)
e06e04e44914 [gaim-migrate @ 6832]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
361 irc->names = g_string_new("");
e06e04e44914 [gaim-migrate @ 6832]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
362
e06e04e44914 [gaim-migrate @ 6832]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
363 irc->names = g_string_append(irc->names, args[3]);
e06e04e44914 [gaim-migrate @ 6832]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
364 }
e06e04e44914 [gaim-migrate @ 6832]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
365 }
e06e04e44914 [gaim-migrate @ 6832]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
366
e06e04e44914 [gaim-migrate @ 6832]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
367 void irc_msg_motd(struct irc_conn *irc, const char *name, const char *from, char **args)
e06e04e44914 [gaim-migrate @ 6832]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
368 {
e06e04e44914 [gaim-migrate @ 6832]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
369 GaimConnection *gc;
e06e04e44914 [gaim-migrate @ 6832]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
370 if (!strcmp(name, "375")) {
e06e04e44914 [gaim-migrate @ 6832]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
371 gc = gaim_account_get_connection(irc->account);
e06e04e44914 [gaim-migrate @ 6832]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
372 if (gc)
e06e04e44914 [gaim-migrate @ 6832]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
373 gaim_connection_set_display_name(gc, args[0]);
e06e04e44914 [gaim-migrate @ 6832]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
374 }
e06e04e44914 [gaim-migrate @ 6832]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
375
e06e04e44914 [gaim-migrate @ 6832]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
376 if (!irc->motd)
e06e04e44914 [gaim-migrate @ 6832]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
377 irc->motd = g_string_new("");
e06e04e44914 [gaim-migrate @ 6832]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
378
e06e04e44914 [gaim-migrate @ 6832]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
379 g_string_append_printf(irc->motd, "%s<br>", args[1]);
e06e04e44914 [gaim-migrate @ 6832]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
380 }
e06e04e44914 [gaim-migrate @ 6832]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
381
e06e04e44914 [gaim-migrate @ 6832]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
382 void irc_msg_endmotd(struct irc_conn *irc, const char *name, const char *from, char **args)
e06e04e44914 [gaim-migrate @ 6832]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
383 {
e06e04e44914 [gaim-migrate @ 6832]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
384 GaimConnection *gc;
e06e04e44914 [gaim-migrate @ 6832]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
385
e06e04e44914 [gaim-migrate @ 6832]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
386 gc = gaim_account_get_connection(irc->account);
e06e04e44914 [gaim-migrate @ 6832]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
387 if (!gc)
e06e04e44914 [gaim-migrate @ 6832]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
388 return;
e06e04e44914 [gaim-migrate @ 6832]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
389
e06e04e44914 [gaim-migrate @ 6832]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
390 gaim_connection_set_state(gc, GAIM_CONNECTED);
9057
c55aa23bf56e [gaim-migrate @ 9833]
Ethan Blanton <elb@pidgin.im>
parents: 8965
diff changeset
391 serv_finish_login (gc);
6333
e06e04e44914 [gaim-migrate @ 6832]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
392
e06e04e44914 [gaim-migrate @ 6832]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
393 irc_blist_timeout(irc);
8872
07404dc25af8 [gaim-migrate @ 9640]
Ethan Blanton <elb@pidgin.im>
parents: 8529
diff changeset
394 if (!irc->timer)
07404dc25af8 [gaim-migrate @ 9640]
Ethan Blanton <elb@pidgin.im>
parents: 8529
diff changeset
395 irc->timer = gaim_timeout_add(45000, (GSourceFunc)irc_blist_timeout, (gpointer)irc);
6333
e06e04e44914 [gaim-migrate @ 6832]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
396 }
e06e04e44914 [gaim-migrate @ 6832]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
397
7877
828856b7fe30 [gaim-migrate @ 8531]
Ethan Blanton <elb@pidgin.im>
parents: 7118
diff changeset
398 void irc_msg_nochan(struct irc_conn *irc, const char *name, const char *from, char **args)
828856b7fe30 [gaim-migrate @ 8531]
Ethan Blanton <elb@pidgin.im>
parents: 7118
diff changeset
399 {
828856b7fe30 [gaim-migrate @ 8531]
Ethan Blanton <elb@pidgin.im>
parents: 7118
diff changeset
400 GaimConnection *gc = gaim_account_get_connection(irc->account);
828856b7fe30 [gaim-migrate @ 8531]
Ethan Blanton <elb@pidgin.im>
parents: 7118
diff changeset
401
828856b7fe30 [gaim-migrate @ 8531]
Ethan Blanton <elb@pidgin.im>
parents: 7118
diff changeset
402 if (gc == NULL || args == NULL || args[1] == NULL)
828856b7fe30 [gaim-migrate @ 8531]
Ethan Blanton <elb@pidgin.im>
parents: 7118
diff changeset
403 return;
828856b7fe30 [gaim-migrate @ 8531]
Ethan Blanton <elb@pidgin.im>
parents: 7118
diff changeset
404
828856b7fe30 [gaim-migrate @ 8531]
Ethan Blanton <elb@pidgin.im>
parents: 7118
diff changeset
405 gaim_notify_error(gc, NULL, _("No such channel"), args[1]);
828856b7fe30 [gaim-migrate @ 8531]
Ethan Blanton <elb@pidgin.im>
parents: 7118
diff changeset
406 }
828856b7fe30 [gaim-migrate @ 8531]
Ethan Blanton <elb@pidgin.im>
parents: 7118
diff changeset
407
6333
e06e04e44914 [gaim-migrate @ 6832]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
408 void irc_msg_nonick(struct irc_conn *irc, const char *name, const char *from, char **args)
e06e04e44914 [gaim-migrate @ 6832]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
409 {
e06e04e44914 [gaim-migrate @ 6832]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
410 GaimConnection *gc;
e06e04e44914 [gaim-migrate @ 6832]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
411 GaimConversation *convo;
e06e04e44914 [gaim-migrate @ 6832]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
412
e06e04e44914 [gaim-migrate @ 6832]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
413 convo = gaim_find_conversation_with_account(args[1], irc->account);
e06e04e44914 [gaim-migrate @ 6832]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
414 if (convo) {
e06e04e44914 [gaim-migrate @ 6832]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
415 if (gaim_conversation_get_type(convo) == GAIM_CONV_CHAT) /* does this happen? */
7118
bf630f7dfdcd [gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents: 7108
diff changeset
416 gaim_conv_chat_write(GAIM_CONV_CHAT(convo), args[1], _("no such channel"),
6621
42fdf16f1dad [gaim-migrate @ 7145]
Mark Doliner <mark@kingant.net>
parents: 6407
diff changeset
417 GAIM_MESSAGE_SYSTEM|GAIM_MESSAGE_NO_LOG, time(NULL));
6333
e06e04e44914 [gaim-migrate @ 6832]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
418 else
7118
bf630f7dfdcd [gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents: 7108
diff changeset
419 gaim_conv_im_write(GAIM_CONV_IM(convo), args[1], _("User is not logged in"),
6621
42fdf16f1dad [gaim-migrate @ 7145]
Mark Doliner <mark@kingant.net>
parents: 6407
diff changeset
420 GAIM_MESSAGE_SYSTEM|GAIM_MESSAGE_NO_LOG, time(NULL));
6333
e06e04e44914 [gaim-migrate @ 6832]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
421 } else {
e06e04e44914 [gaim-migrate @ 6832]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
422 if ((gc = gaim_account_get_connection(irc->account)) == NULL)
e06e04e44914 [gaim-migrate @ 6832]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
423 return;
e06e04e44914 [gaim-migrate @ 6832]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
424 gaim_notify_error(gc, NULL, _("No such nick or channel"), args[1]);
e06e04e44914 [gaim-migrate @ 6832]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
425 }
e06e04e44914 [gaim-migrate @ 6832]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
426
e06e04e44914 [gaim-migrate @ 6832]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
427 if (irc->whois.nick && !gaim_utf8_strcasecmp(irc->whois.nick, args[1])) {
e06e04e44914 [gaim-migrate @ 6832]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
428 g_free(irc->whois.nick);
e06e04e44914 [gaim-migrate @ 6832]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
429 irc->whois.nick = NULL;
e06e04e44914 [gaim-migrate @ 6832]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
430 }
e06e04e44914 [gaim-migrate @ 6832]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
431 }
e06e04e44914 [gaim-migrate @ 6832]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
432
e06e04e44914 [gaim-migrate @ 6832]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
433 void irc_msg_nosend(struct irc_conn *irc, const char *name, const char *from, char **args)
e06e04e44914 [gaim-migrate @ 6832]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
434 {
e06e04e44914 [gaim-migrate @ 6832]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
435 GaimConnection *gc;
e06e04e44914 [gaim-migrate @ 6832]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
436 GaimConversation *convo;
e06e04e44914 [gaim-migrate @ 6832]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
437
e06e04e44914 [gaim-migrate @ 6832]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
438 convo = gaim_find_conversation_with_account(args[1], irc->account);
e06e04e44914 [gaim-migrate @ 6832]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
439 if (convo) {
7118
bf630f7dfdcd [gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents: 7108
diff changeset
440 gaim_conv_chat_write(GAIM_CONV_CHAT(convo), args[1], args[2], GAIM_MESSAGE_SYSTEM|GAIM_MESSAGE_NO_LOG, time(NULL));
6333
e06e04e44914 [gaim-migrate @ 6832]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
441 } else {
e06e04e44914 [gaim-migrate @ 6832]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
442 if ((gc = gaim_account_get_connection(irc->account)) == NULL)
e06e04e44914 [gaim-migrate @ 6832]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
443 return;
e06e04e44914 [gaim-migrate @ 6832]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
444 gaim_notify_error(gc, NULL, _("Could not send"), args[2]);
e06e04e44914 [gaim-migrate @ 6832]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
445 }
e06e04e44914 [gaim-migrate @ 6832]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
446 }
e06e04e44914 [gaim-migrate @ 6832]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
447
e06e04e44914 [gaim-migrate @ 6832]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
448 void irc_msg_notinchan(struct irc_conn *irc, const char *name, const char *from, char **args)
e06e04e44914 [gaim-migrate @ 6832]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
449 {
e06e04e44914 [gaim-migrate @ 6832]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
450 GaimConversation *convo = gaim_find_conversation_with_account(args[1], irc->account);
e06e04e44914 [gaim-migrate @ 6832]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
451
e06e04e44914 [gaim-migrate @ 6832]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
452 gaim_debug(GAIM_DEBUG_INFO, "irc", "We're apparently not in %s, but tried to use it\n", args[1]);
e06e04e44914 [gaim-migrate @ 6832]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
453 if (convo) {
e06e04e44914 [gaim-migrate @ 6832]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
454 /*g_slist_remove(irc->gc->buddy_chats, convo);
e06e04e44914 [gaim-migrate @ 6832]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
455 gaim_conversation_set_account(convo, NULL);*/
7118
bf630f7dfdcd [gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents: 7108
diff changeset
456 gaim_conv_chat_write(GAIM_CONV_CHAT(convo), args[1], args[2], GAIM_MESSAGE_SYSTEM|GAIM_MESSAGE_NO_LOG, time(NULL));
6333
e06e04e44914 [gaim-migrate @ 6832]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
457 }
e06e04e44914 [gaim-migrate @ 6832]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
458 }
e06e04e44914 [gaim-migrate @ 6832]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
459
e06e04e44914 [gaim-migrate @ 6832]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
460 void irc_msg_notop(struct irc_conn *irc, const char *name, const char *from, char **args)
e06e04e44914 [gaim-migrate @ 6832]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
461 {
e06e04e44914 [gaim-migrate @ 6832]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
462 GaimConversation *convo;
e06e04e44914 [gaim-migrate @ 6832]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
463
e06e04e44914 [gaim-migrate @ 6832]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
464 if (!args || !args[1] || !args[2])
e06e04e44914 [gaim-migrate @ 6832]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
465 return;
e06e04e44914 [gaim-migrate @ 6832]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
466
e06e04e44914 [gaim-migrate @ 6832]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
467 convo = gaim_find_conversation_with_account(args[1], irc->account);
e06e04e44914 [gaim-migrate @ 6832]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
468 if (!convo)
e06e04e44914 [gaim-migrate @ 6832]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
469 return;
e06e04e44914 [gaim-migrate @ 6832]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
470
7118
bf630f7dfdcd [gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents: 7108
diff changeset
471 gaim_conv_chat_write(GAIM_CONV_CHAT(convo), "", args[2], GAIM_MESSAGE_SYSTEM, time(NULL));
6333
e06e04e44914 [gaim-migrate @ 6832]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
472 }
e06e04e44914 [gaim-migrate @ 6832]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
473
e06e04e44914 [gaim-migrate @ 6832]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
474 void irc_msg_invite(struct irc_conn *irc, const char *name, const char *from, char **args)
e06e04e44914 [gaim-migrate @ 6832]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
475 {
e06e04e44914 [gaim-migrate @ 6832]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
476 GaimConnection *gc = gaim_account_get_connection(irc->account);
e06e04e44914 [gaim-migrate @ 6832]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
477 GHashTable *components = g_hash_table_new_full(g_str_hash, g_str_equal, g_free, g_free);
e06e04e44914 [gaim-migrate @ 6832]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
478 char *nick = irc_mask_nick(from);
e06e04e44914 [gaim-migrate @ 6832]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
479
e06e04e44914 [gaim-migrate @ 6832]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
480 if (!args || !args[1] || !gc) {
e06e04e44914 [gaim-migrate @ 6832]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
481 g_free(nick);
e06e04e44914 [gaim-migrate @ 6832]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
482 g_hash_table_destroy(components);
e06e04e44914 [gaim-migrate @ 6832]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
483 return;
e06e04e44914 [gaim-migrate @ 6832]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
484 }
e06e04e44914 [gaim-migrate @ 6832]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
485
e06e04e44914 [gaim-migrate @ 6832]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
486 g_hash_table_insert(components, strdup("channel"), strdup(args[1]));
e06e04e44914 [gaim-migrate @ 6832]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
487
e06e04e44914 [gaim-migrate @ 6832]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
488 serv_got_chat_invite(gc, args[1], nick, NULL, components);
e06e04e44914 [gaim-migrate @ 6832]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
489 g_free(nick);
e06e04e44914 [gaim-migrate @ 6832]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
490 }
e06e04e44914 [gaim-migrate @ 6832]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
491
e06e04e44914 [gaim-migrate @ 6832]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
492 void irc_msg_inviteonly(struct irc_conn *irc, const char *name, const char *from, char **args)
e06e04e44914 [gaim-migrate @ 6832]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
493 {
e06e04e44914 [gaim-migrate @ 6832]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
494 GaimConnection *gc = gaim_account_get_connection(irc->account);
e06e04e44914 [gaim-migrate @ 6832]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
495 char *buf;
e06e04e44914 [gaim-migrate @ 6832]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
496
e06e04e44914 [gaim-migrate @ 6832]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
497 if (!args || !args[1] || !gc)
e06e04e44914 [gaim-migrate @ 6832]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
498 return;
e06e04e44914 [gaim-migrate @ 6832]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
499
e06e04e44914 [gaim-migrate @ 6832]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
500 buf = g_strdup_printf(_("Joining %s requires an invitation."), args[1]);
e06e04e44914 [gaim-migrate @ 6832]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
501 gaim_notify_error(gc, _("Invitation only"), _("Invitation only"), buf);
e06e04e44914 [gaim-migrate @ 6832]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
502 g_free(buf);
e06e04e44914 [gaim-migrate @ 6832]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
503 }
e06e04e44914 [gaim-migrate @ 6832]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
504
e06e04e44914 [gaim-migrate @ 6832]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
505 void irc_msg_ison(struct irc_conn *irc, const char *name, const char *from, char **args)
e06e04e44914 [gaim-migrate @ 6832]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
506 {
e06e04e44914 [gaim-migrate @ 6832]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
507 char **nicks;
e06e04e44914 [gaim-migrate @ 6832]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
508 struct irc_buddy *ib;
e06e04e44914 [gaim-migrate @ 6832]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
509 int i;
e06e04e44914 [gaim-migrate @ 6832]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
510
e06e04e44914 [gaim-migrate @ 6832]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
511 if (!args || !args[1])
e06e04e44914 [gaim-migrate @ 6832]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
512 return;
e06e04e44914 [gaim-migrate @ 6832]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
513
e06e04e44914 [gaim-migrate @ 6832]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
514 nicks = g_strsplit(args[1], " ", -1);
e06e04e44914 [gaim-migrate @ 6832]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
515
e06e04e44914 [gaim-migrate @ 6832]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
516 for (i = 0; nicks[i]; i++) {
e06e04e44914 [gaim-migrate @ 6832]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
517 if ((ib = g_hash_table_lookup(irc->buddies, (gconstpointer)nicks[i])) == NULL) {
e06e04e44914 [gaim-migrate @ 6832]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
518 continue;
e06e04e44914 [gaim-migrate @ 6832]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
519 }
e06e04e44914 [gaim-migrate @ 6832]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
520 ib->flag = TRUE;
e06e04e44914 [gaim-migrate @ 6832]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
521 }
e06e04e44914 [gaim-migrate @ 6832]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
522
6350
34c07f5f34a0 [gaim-migrate @ 6849]
Mark Doliner <mark@kingant.net>
parents: 6333
diff changeset
523 g_strfreev(nicks);
34c07f5f34a0 [gaim-migrate @ 6849]
Mark Doliner <mark@kingant.net>
parents: 6333
diff changeset
524
6333
e06e04e44914 [gaim-migrate @ 6832]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
525 g_hash_table_foreach(irc->buddies, (GHFunc)irc_buddy_status, (gpointer)irc);
e06e04e44914 [gaim-migrate @ 6832]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
526 }
e06e04e44914 [gaim-migrate @ 6832]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
527
e06e04e44914 [gaim-migrate @ 6832]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
528 static void irc_buddy_status(char *name, struct irc_buddy *ib, struct irc_conn *irc)
e06e04e44914 [gaim-migrate @ 6832]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
529 {
e06e04e44914 [gaim-migrate @ 6832]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
530 GaimConnection *gc = gaim_account_get_connection(irc->account);
6695
0c5637b5462e [gaim-migrate @ 7221]
Nathan Walp <nwalp@pidgin.im>
parents: 6622
diff changeset
531 GaimBuddy *buddy = gaim_find_buddy(irc->account, name);
6333
e06e04e44914 [gaim-migrate @ 6832]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
532
e06e04e44914 [gaim-migrate @ 6832]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
533 if (!gc || !buddy)
e06e04e44914 [gaim-migrate @ 6832]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
534 return;
e06e04e44914 [gaim-migrate @ 6832]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
535
e06e04e44914 [gaim-migrate @ 6832]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
536 if (ib->online && !ib->flag) {
e06e04e44914 [gaim-migrate @ 6832]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
537 serv_got_update(gc, buddy->name, 0, 0, 0, 0, 0);
e06e04e44914 [gaim-migrate @ 6832]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
538 ib->online = FALSE;
e06e04e44914 [gaim-migrate @ 6832]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
539 }
e06e04e44914 [gaim-migrate @ 6832]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
540
e06e04e44914 [gaim-migrate @ 6832]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
541 if (!ib->online && ib->flag) {
e06e04e44914 [gaim-migrate @ 6832]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
542 serv_got_update(gc, buddy->name, 1, 0, 0, 0, 0);
e06e04e44914 [gaim-migrate @ 6832]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
543 ib->online = TRUE;
e06e04e44914 [gaim-migrate @ 6832]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
544 }
e06e04e44914 [gaim-migrate @ 6832]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
545 }
e06e04e44914 [gaim-migrate @ 6832]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
546
e06e04e44914 [gaim-migrate @ 6832]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
547 void irc_msg_join(struct irc_conn *irc, const char *name, const char *from, char **args)
e06e04e44914 [gaim-migrate @ 6832]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
548 {
e06e04e44914 [gaim-migrate @ 6832]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
549 GaimConnection *gc = gaim_account_get_connection(irc->account);
e06e04e44914 [gaim-migrate @ 6832]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
550 GaimConversation *convo;
e06e04e44914 [gaim-migrate @ 6832]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
551 char *nick = irc_mask_nick(from), *userhost;
9238
f4f210e47b60 [gaim-migrate @ 10036]
Ethan Blanton <elb@pidgin.im>
parents: 9057
diff changeset
552 struct irc_buddy *ib;
6333
e06e04e44914 [gaim-migrate @ 6832]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
553 static int id = 1;
e06e04e44914 [gaim-migrate @ 6832]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
554
e06e04e44914 [gaim-migrate @ 6832]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
555 if (!gc) {
e06e04e44914 [gaim-migrate @ 6832]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
556 g_free(nick);
e06e04e44914 [gaim-migrate @ 6832]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
557 return;
e06e04e44914 [gaim-migrate @ 6832]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
558 }
e06e04e44914 [gaim-migrate @ 6832]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
559
e06e04e44914 [gaim-migrate @ 6832]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
560 if (!gaim_utf8_strcasecmp(nick, gaim_connection_get_display_name(gc))) {
e06e04e44914 [gaim-migrate @ 6832]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
561 /* We are joining a channel for the first time */
e06e04e44914 [gaim-migrate @ 6832]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
562 serv_got_joined_chat(gc, id++, args[0]);
e06e04e44914 [gaim-migrate @ 6832]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
563 g_free(nick);
e06e04e44914 [gaim-migrate @ 6832]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
564 return;
e06e04e44914 [gaim-migrate @ 6832]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
565 }
e06e04e44914 [gaim-migrate @ 6832]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
566
e06e04e44914 [gaim-migrate @ 6832]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
567 convo = gaim_find_conversation_with_account(args[0], irc->account);
e06e04e44914 [gaim-migrate @ 6832]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
568 if (convo == NULL) {
e06e04e44914 [gaim-migrate @ 6832]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
569 gaim_debug(GAIM_DEBUG_ERROR, "irc", "JOIN for %s failed\n", args[0]);
e06e04e44914 [gaim-migrate @ 6832]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
570 g_free(nick);
e06e04e44914 [gaim-migrate @ 6832]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
571 return;
e06e04e44914 [gaim-migrate @ 6832]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
572 }
e06e04e44914 [gaim-migrate @ 6832]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
573
e06e04e44914 [gaim-migrate @ 6832]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
574 userhost = irc_mask_userhost(from);
7118
bf630f7dfdcd [gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents: 7108
diff changeset
575 gaim_conv_chat_add_user(GAIM_CONV_CHAT(convo), nick, userhost);
9238
f4f210e47b60 [gaim-migrate @ 10036]
Ethan Blanton <elb@pidgin.im>
parents: 9057
diff changeset
576
f4f210e47b60 [gaim-migrate @ 10036]
Ethan Blanton <elb@pidgin.im>
parents: 9057
diff changeset
577 if ((ib = g_hash_table_lookup(irc->buddies, nick)) != NULL) {
f4f210e47b60 [gaim-migrate @ 10036]
Ethan Blanton <elb@pidgin.im>
parents: 9057
diff changeset
578 ib->flag = TRUE;
f4f210e47b60 [gaim-migrate @ 10036]
Ethan Blanton <elb@pidgin.im>
parents: 9057
diff changeset
579 irc_buddy_status(nick, ib, irc);
f4f210e47b60 [gaim-migrate @ 10036]
Ethan Blanton <elb@pidgin.im>
parents: 9057
diff changeset
580 }
f4f210e47b60 [gaim-migrate @ 10036]
Ethan Blanton <elb@pidgin.im>
parents: 9057
diff changeset
581
6333
e06e04e44914 [gaim-migrate @ 6832]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
582 g_free(userhost);
e06e04e44914 [gaim-migrate @ 6832]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
583 g_free(nick);
e06e04e44914 [gaim-migrate @ 6832]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
584 }
e06e04e44914 [gaim-migrate @ 6832]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
585
e06e04e44914 [gaim-migrate @ 6832]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
586 void irc_msg_kick(struct irc_conn *irc, const char *name, const char *from, char **args)
e06e04e44914 [gaim-migrate @ 6832]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
587 {
e06e04e44914 [gaim-migrate @ 6832]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
588 GaimConnection *gc = gaim_account_get_connection(irc->account);
e06e04e44914 [gaim-migrate @ 6832]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
589 GaimConversation *convo = gaim_find_conversation_with_account(args[0], irc->account);
e06e04e44914 [gaim-migrate @ 6832]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
590 char *nick = irc_mask_nick(from), *buf;
e06e04e44914 [gaim-migrate @ 6832]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
591
e06e04e44914 [gaim-migrate @ 6832]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
592 if (!gc) {
e06e04e44914 [gaim-migrate @ 6832]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
593 g_free(nick);
e06e04e44914 [gaim-migrate @ 6832]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
594 return;
e06e04e44914 [gaim-migrate @ 6832]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
595 }
e06e04e44914 [gaim-migrate @ 6832]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
596
e06e04e44914 [gaim-migrate @ 6832]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
597 if (!convo) {
e06e04e44914 [gaim-migrate @ 6832]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
598 gaim_debug(GAIM_DEBUG_ERROR, "irc", "Recieved a KICK for unknown channel %s\n", args[0]);
e06e04e44914 [gaim-migrate @ 6832]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
599 g_free(nick);
e06e04e44914 [gaim-migrate @ 6832]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
600 return;
e06e04e44914 [gaim-migrate @ 6832]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
601 }
e06e04e44914 [gaim-migrate @ 6832]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
602
e06e04e44914 [gaim-migrate @ 6832]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
603 if (!gaim_utf8_strcasecmp(gaim_connection_get_display_name(gc), args[1])) {
e06e04e44914 [gaim-migrate @ 6832]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
604 buf = g_strdup_printf(_("You have been kicked by %s: (%s)"), nick, args[2]);
7118
bf630f7dfdcd [gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents: 7108
diff changeset
605 gaim_conv_chat_write(GAIM_CONV_CHAT(convo), args[0], buf, GAIM_MESSAGE_SYSTEM, time(NULL));
6333
e06e04e44914 [gaim-migrate @ 6832]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
606 g_free(buf);
8256
1d86096ae0f4 [gaim-migrate @ 8979]
Christian Hammond <chipx86@chipx86.com>
parents: 8186
diff changeset
607 serv_got_chat_left(gc, gaim_conv_chat_get_id(GAIM_CONV_CHAT(convo)));
6333
e06e04e44914 [gaim-migrate @ 6832]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
608 } else {
e06e04e44914 [gaim-migrate @ 6832]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
609 buf = g_strdup_printf(_("Kicked by %s (%s)"), nick, args[2]);
7118
bf630f7dfdcd [gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents: 7108
diff changeset
610 gaim_conv_chat_remove_user(GAIM_CONV_CHAT(convo), args[1], buf);
6333
e06e04e44914 [gaim-migrate @ 6832]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
611 g_free(buf);
e06e04e44914 [gaim-migrate @ 6832]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
612 }
e06e04e44914 [gaim-migrate @ 6832]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
613
e06e04e44914 [gaim-migrate @ 6832]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
614 g_free(nick);
e06e04e44914 [gaim-migrate @ 6832]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
615 return;
e06e04e44914 [gaim-migrate @ 6832]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
616 }
e06e04e44914 [gaim-migrate @ 6832]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
617
e06e04e44914 [gaim-migrate @ 6832]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
618 void irc_msg_mode(struct irc_conn *irc, const char *name, const char *from, char **args)
e06e04e44914 [gaim-migrate @ 6832]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
619 {
e06e04e44914 [gaim-migrate @ 6832]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
620 GaimConversation *convo;
e06e04e44914 [gaim-migrate @ 6832]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
621 char *nick = irc_mask_nick(from), *buf;
e06e04e44914 [gaim-migrate @ 6832]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
622
e06e04e44914 [gaim-migrate @ 6832]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
623 if (*args[0] == '#' || *args[0] == '&') { /* Channel */
e06e04e44914 [gaim-migrate @ 6832]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
624 convo = gaim_find_conversation_with_account(args[0], irc->account);
e06e04e44914 [gaim-migrate @ 6832]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
625 if (!convo) {
e06e04e44914 [gaim-migrate @ 6832]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
626 gaim_debug(GAIM_DEBUG_ERROR, "irc", "MODE received for %s, which we are not in\n", args[0]);
e06e04e44914 [gaim-migrate @ 6832]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
627 g_free(nick);
e06e04e44914 [gaim-migrate @ 6832]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
628 return;
e06e04e44914 [gaim-migrate @ 6832]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
629 }
e06e04e44914 [gaim-migrate @ 6832]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
630 buf = g_strdup_printf(_("mode (%s %s) by %s"), args[1], args[2] ? args[2] : "", nick);
7118
bf630f7dfdcd [gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents: 7108
diff changeset
631 gaim_conv_chat_write(GAIM_CONV_CHAT(convo), args[0], buf, GAIM_MESSAGE_SYSTEM|GAIM_MESSAGE_NO_LOG, time(NULL));
6333
e06e04e44914 [gaim-migrate @ 6832]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
632 g_free(buf);
e06e04e44914 [gaim-migrate @ 6832]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
633 } else { /* User */
e06e04e44914 [gaim-migrate @ 6832]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
634 }
e06e04e44914 [gaim-migrate @ 6832]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
635 g_free(nick);
e06e04e44914 [gaim-migrate @ 6832]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
636 }
e06e04e44914 [gaim-migrate @ 6832]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
637
e06e04e44914 [gaim-migrate @ 6832]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
638 void irc_msg_nick(struct irc_conn *irc, const char *name, const char *from, char **args)
e06e04e44914 [gaim-migrate @ 6832]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
639 {
e06e04e44914 [gaim-migrate @ 6832]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
640 GaimConnection *gc = gaim_account_get_connection(irc->account);
e06e04e44914 [gaim-migrate @ 6832]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
641 GSList *chats;
e06e04e44914 [gaim-migrate @ 6832]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
642 char *nick = irc_mask_nick(from);
e06e04e44914 [gaim-migrate @ 6832]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
643
e06e04e44914 [gaim-migrate @ 6832]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
644 if (!gc) {
e06e04e44914 [gaim-migrate @ 6832]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
645 g_free(nick);
e06e04e44914 [gaim-migrate @ 6832]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
646 return;
e06e04e44914 [gaim-migrate @ 6832]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
647 }
e06e04e44914 [gaim-migrate @ 6832]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
648 chats = gc->buddy_chats;
e06e04e44914 [gaim-migrate @ 6832]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
649
e06e04e44914 [gaim-migrate @ 6832]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
650 if (!gaim_utf8_strcasecmp(nick, gaim_connection_get_display_name(gc))) {
e06e04e44914 [gaim-migrate @ 6832]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
651 gaim_connection_set_display_name(gc, args[0]);
e06e04e44914 [gaim-migrate @ 6832]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
652 }
e06e04e44914 [gaim-migrate @ 6832]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
653
e06e04e44914 [gaim-migrate @ 6832]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
654 while (chats) {
7118
bf630f7dfdcd [gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents: 7108
diff changeset
655 GaimConvChat *chat = GAIM_CONV_CHAT(chats->data);
bf630f7dfdcd [gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents: 7108
diff changeset
656 GList *users = gaim_conv_chat_get_users(chat);
6333
e06e04e44914 [gaim-migrate @ 6832]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
657
e06e04e44914 [gaim-migrate @ 6832]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
658 while (users) {
e06e04e44914 [gaim-migrate @ 6832]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
659 char *user = users->data;
e06e04e44914 [gaim-migrate @ 6832]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
660
e06e04e44914 [gaim-migrate @ 6832]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
661 if (!strcmp(nick, user)) {
7118
bf630f7dfdcd [gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents: 7108
diff changeset
662 gaim_conv_chat_rename_user(chat, user, args[0]);
bf630f7dfdcd [gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents: 7108
diff changeset
663 users = gaim_conv_chat_get_users(chat);
6333
e06e04e44914 [gaim-migrate @ 6832]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
664 break;
e06e04e44914 [gaim-migrate @ 6832]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
665 }
e06e04e44914 [gaim-migrate @ 6832]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
666 users = users->next;
e06e04e44914 [gaim-migrate @ 6832]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
667 }
e06e04e44914 [gaim-migrate @ 6832]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
668 chats = chats->next;
e06e04e44914 [gaim-migrate @ 6832]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
669 }
e06e04e44914 [gaim-migrate @ 6832]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
670 g_free(nick);
e06e04e44914 [gaim-migrate @ 6832]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
671 }
e06e04e44914 [gaim-migrate @ 6832]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
672
e06e04e44914 [gaim-migrate @ 6832]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
673 void irc_msg_nickused(struct irc_conn *irc, const char *name, const char *from, char **args)
e06e04e44914 [gaim-migrate @ 6832]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
674 {
e06e04e44914 [gaim-migrate @ 6832]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
675 char *newnick, *buf, *end;
e06e04e44914 [gaim-migrate @ 6832]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
676
e06e04e44914 [gaim-migrate @ 6832]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
677 if (!args || !args[1])
e06e04e44914 [gaim-migrate @ 6832]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
678 return;
e06e04e44914 [gaim-migrate @ 6832]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
679
e06e04e44914 [gaim-migrate @ 6832]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
680 newnick = strdup(args[1]);
e06e04e44914 [gaim-migrate @ 6832]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
681 end = newnick + strlen(newnick) - 1;
e06e04e44914 [gaim-migrate @ 6832]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
682 /* try three fallbacks */
e06e04e44914 [gaim-migrate @ 6832]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
683 if (*end == 2) *end = '3';
e06e04e44914 [gaim-migrate @ 6832]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
684 else if (*end == 1) *end = '2';
e06e04e44914 [gaim-migrate @ 6832]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
685 else *end = '1';
e06e04e44914 [gaim-migrate @ 6832]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
686
e06e04e44914 [gaim-migrate @ 6832]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
687 buf = irc_format(irc, "vn", "NICK", newnick);
e06e04e44914 [gaim-migrate @ 6832]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
688 irc_send(irc, buf);
e06e04e44914 [gaim-migrate @ 6832]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
689 g_free(buf);
e06e04e44914 [gaim-migrate @ 6832]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
690 }
e06e04e44914 [gaim-migrate @ 6832]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
691
e06e04e44914 [gaim-migrate @ 6832]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
692 void irc_msg_notice(struct irc_conn *irc, const char *name, const char *from, char **args)
e06e04e44914 [gaim-migrate @ 6832]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
693 {
e06e04e44914 [gaim-migrate @ 6832]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
694 char *newargs[2];
e06e04e44914 [gaim-migrate @ 6832]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
695
e06e04e44914 [gaim-migrate @ 6832]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
696 newargs[0] = " notice "; /* The spaces are magic, leave 'em in! */
e06e04e44914 [gaim-migrate @ 6832]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
697 newargs[1] = args[1];
e06e04e44914 [gaim-migrate @ 6832]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
698 irc_msg_privmsg(irc, name, from, newargs);
e06e04e44914 [gaim-migrate @ 6832]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
699 }
e06e04e44914 [gaim-migrate @ 6832]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
700
6718
37af5dea14d1 [gaim-migrate @ 7245]
Ethan Blanton <elb@pidgin.im>
parents: 6714
diff changeset
701 void irc_msg_nochangenick(struct irc_conn *irc, const char *name, const char *from, char **args)
37af5dea14d1 [gaim-migrate @ 7245]
Ethan Blanton <elb@pidgin.im>
parents: 6714
diff changeset
702 {
37af5dea14d1 [gaim-migrate @ 7245]
Ethan Blanton <elb@pidgin.im>
parents: 6714
diff changeset
703 GaimConnection *gc = gaim_account_get_connection(irc->account);
37af5dea14d1 [gaim-migrate @ 7245]
Ethan Blanton <elb@pidgin.im>
parents: 6714
diff changeset
704 char *msg;
37af5dea14d1 [gaim-migrate @ 7245]
Ethan Blanton <elb@pidgin.im>
parents: 6714
diff changeset
705
6753
c3d8e8190d77 [gaim-migrate @ 7285]
Ethan Blanton <elb@pidgin.im>
parents: 6718
diff changeset
706 if (!args || !args[2] || !gc)
6718
37af5dea14d1 [gaim-migrate @ 7245]
Ethan Blanton <elb@pidgin.im>
parents: 6714
diff changeset
707 return;
37af5dea14d1 [gaim-migrate @ 7245]
Ethan Blanton <elb@pidgin.im>
parents: 6714
diff changeset
708
6753
c3d8e8190d77 [gaim-migrate @ 7285]
Ethan Blanton <elb@pidgin.im>
parents: 6718
diff changeset
709 msg = g_strdup_printf(_("Could not change nick"));
6718
37af5dea14d1 [gaim-migrate @ 7245]
Ethan Blanton <elb@pidgin.im>
parents: 6714
diff changeset
710 gaim_notify_error(gc, _("Cannot change nick"), msg, args[2]);
37af5dea14d1 [gaim-migrate @ 7245]
Ethan Blanton <elb@pidgin.im>
parents: 6714
diff changeset
711 g_free(msg);
37af5dea14d1 [gaim-migrate @ 7245]
Ethan Blanton <elb@pidgin.im>
parents: 6714
diff changeset
712 }
37af5dea14d1 [gaim-migrate @ 7245]
Ethan Blanton <elb@pidgin.im>
parents: 6714
diff changeset
713
6333
e06e04e44914 [gaim-migrate @ 6832]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
714 void irc_msg_part(struct irc_conn *irc, const char *name, const char *from, char **args)
e06e04e44914 [gaim-migrate @ 6832]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
715 {
e06e04e44914 [gaim-migrate @ 6832]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
716 GaimConnection *gc = gaim_account_get_connection(irc->account);
e06e04e44914 [gaim-migrate @ 6832]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
717 GaimConversation *convo;
e06e04e44914 [gaim-migrate @ 6832]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
718 char *nick, *msg;
e06e04e44914 [gaim-migrate @ 6832]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
719
8186
8efff3aa4e39 [gaim-migrate @ 8907]
Ethan Blanton <elb@pidgin.im>
parents: 8163
diff changeset
720 if (!args || !args[0] || !gc)
6333
e06e04e44914 [gaim-migrate @ 6832]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
721 return;
e06e04e44914 [gaim-migrate @ 6832]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
722
e06e04e44914 [gaim-migrate @ 6832]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
723 convo = gaim_find_conversation_with_account(args[0], irc->account);
e06e04e44914 [gaim-migrate @ 6832]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
724 if (!convo) {
e06e04e44914 [gaim-migrate @ 6832]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
725 gaim_debug(GAIM_DEBUG_INFO, "irc", "Got a PART on %s, which doesn't exist -- probably closed\n", args[0]);
e06e04e44914 [gaim-migrate @ 6832]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
726 return;
e06e04e44914 [gaim-migrate @ 6832]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
727 }
e06e04e44914 [gaim-migrate @ 6832]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
728
e06e04e44914 [gaim-migrate @ 6832]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
729 nick = irc_mask_nick(from);
e06e04e44914 [gaim-migrate @ 6832]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
730 if (!gaim_utf8_strcasecmp(nick, gaim_connection_get_display_name(gc))) {
8186
8efff3aa4e39 [gaim-migrate @ 8907]
Ethan Blanton <elb@pidgin.im>
parents: 8163
diff changeset
731 msg = g_strdup_printf(_("You have parted the channel%s%s"),
8efff3aa4e39 [gaim-migrate @ 8907]
Ethan Blanton <elb@pidgin.im>
parents: 8163
diff changeset
732 (args[1] && *args[1]) ? ": " : "", args[1]);
7118
bf630f7dfdcd [gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents: 7108
diff changeset
733 gaim_conv_chat_write(GAIM_CONV_CHAT(convo), args[0], msg, GAIM_MESSAGE_SYSTEM, time(NULL));
6333
e06e04e44914 [gaim-migrate @ 6832]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
734 g_free(msg);
8256
1d86096ae0f4 [gaim-migrate @ 8979]
Christian Hammond <chipx86@chipx86.com>
parents: 8186
diff changeset
735 serv_got_chat_left(gc, gaim_conv_chat_get_id(GAIM_CONV_CHAT(convo)));
6333
e06e04e44914 [gaim-migrate @ 6832]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
736 } else {
7118
bf630f7dfdcd [gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents: 7108
diff changeset
737 gaim_conv_chat_remove_user(GAIM_CONV_CHAT(convo), nick, args[1]);
6333
e06e04e44914 [gaim-migrate @ 6832]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
738 }
e06e04e44914 [gaim-migrate @ 6832]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
739 g_free(nick);
e06e04e44914 [gaim-migrate @ 6832]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
740 }
e06e04e44914 [gaim-migrate @ 6832]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
741
e06e04e44914 [gaim-migrate @ 6832]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
742 void irc_msg_ping(struct irc_conn *irc, const char *name, const char *from, char **args)
e06e04e44914 [gaim-migrate @ 6832]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
743 {
e06e04e44914 [gaim-migrate @ 6832]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
744 char *buf;
e06e04e44914 [gaim-migrate @ 6832]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
745 if (!args || !args[0])
e06e04e44914 [gaim-migrate @ 6832]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
746 return;
e06e04e44914 [gaim-migrate @ 6832]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
747
e06e04e44914 [gaim-migrate @ 6832]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
748 buf = irc_format(irc, "v:", "PONG", args[0]);
e06e04e44914 [gaim-migrate @ 6832]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
749 irc_send(irc, buf);
e06e04e44914 [gaim-migrate @ 6832]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
750 g_free(buf);
e06e04e44914 [gaim-migrate @ 6832]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
751 }
e06e04e44914 [gaim-migrate @ 6832]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
752
e06e04e44914 [gaim-migrate @ 6832]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
753 void irc_msg_pong(struct irc_conn *irc, const char *name, const char *from, char **args)
e06e04e44914 [gaim-migrate @ 6832]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
754 {
e06e04e44914 [gaim-migrate @ 6832]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
755 GaimConversation *convo;
e06e04e44914 [gaim-migrate @ 6832]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
756 GaimConnection *gc;
e06e04e44914 [gaim-migrate @ 6832]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
757 char **parts, *msg;
e06e04e44914 [gaim-migrate @ 6832]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
758 time_t oldstamp;
e06e04e44914 [gaim-migrate @ 6832]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
759
e06e04e44914 [gaim-migrate @ 6832]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
760 if (!args || !args[1])
e06e04e44914 [gaim-migrate @ 6832]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
761 return;
e06e04e44914 [gaim-migrate @ 6832]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
762
e06e04e44914 [gaim-migrate @ 6832]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
763 parts = g_strsplit(args[1], " ", 2);
e06e04e44914 [gaim-migrate @ 6832]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
764
e06e04e44914 [gaim-migrate @ 6832]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
765 if (!parts[0] || !parts[1]) {
e06e04e44914 [gaim-migrate @ 6832]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
766 g_strfreev(parts);
e06e04e44914 [gaim-migrate @ 6832]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
767 return;
e06e04e44914 [gaim-migrate @ 6832]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
768 }
e06e04e44914 [gaim-migrate @ 6832]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
769
e06e04e44914 [gaim-migrate @ 6832]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
770 if (sscanf(parts[1], "%lu", &oldstamp) != 1) {
e06e04e44914 [gaim-migrate @ 6832]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
771 msg = g_strdup(_("Error: invalid PONG from server"));
e06e04e44914 [gaim-migrate @ 6832]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
772 } else {
6350
34c07f5f34a0 [gaim-migrate @ 6849]
Mark Doliner <mark@kingant.net>
parents: 6333
diff changeset
773 msg = g_strdup_printf(_("PING reply -- Lag: %lu seconds"), time(NULL) - oldstamp);
6333
e06e04e44914 [gaim-migrate @ 6832]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
774 }
e06e04e44914 [gaim-migrate @ 6832]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
775
e06e04e44914 [gaim-migrate @ 6832]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
776 convo = gaim_find_conversation_with_account(parts[0], irc->account);
e06e04e44914 [gaim-migrate @ 6832]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
777 g_strfreev(parts);
e06e04e44914 [gaim-migrate @ 6832]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
778 if (convo) {
e06e04e44914 [gaim-migrate @ 6832]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
779 if (gaim_conversation_get_type (convo) == GAIM_CONV_CHAT)
7118
bf630f7dfdcd [gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents: 7108
diff changeset
780 gaim_conv_chat_write(GAIM_CONV_CHAT(convo), "PONG", msg, GAIM_MESSAGE_SYSTEM|GAIM_MESSAGE_NO_LOG, time(NULL));
6333
e06e04e44914 [gaim-migrate @ 6832]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
781 else
7118
bf630f7dfdcd [gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents: 7108
diff changeset
782 gaim_conv_im_write(GAIM_CONV_IM(convo), "PONG", msg, GAIM_MESSAGE_SYSTEM|GAIM_MESSAGE_NO_LOG, time(NULL));
6333
e06e04e44914 [gaim-migrate @ 6832]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
783 } else {
e06e04e44914 [gaim-migrate @ 6832]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
784 gc = gaim_account_get_connection(irc->account);
e06e04e44914 [gaim-migrate @ 6832]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
785 if (!gc) {
e06e04e44914 [gaim-migrate @ 6832]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
786 g_free(msg);
e06e04e44914 [gaim-migrate @ 6832]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
787 return;
e06e04e44914 [gaim-migrate @ 6832]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
788 }
e06e04e44914 [gaim-migrate @ 6832]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
789 gaim_notify_info(gc, NULL, "PONG", msg);
e06e04e44914 [gaim-migrate @ 6832]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
790 }
e06e04e44914 [gaim-migrate @ 6832]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
791 g_free(msg);
e06e04e44914 [gaim-migrate @ 6832]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
792 }
e06e04e44914 [gaim-migrate @ 6832]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
793
e06e04e44914 [gaim-migrate @ 6832]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
794 void irc_msg_privmsg(struct irc_conn *irc, const char *name, const char *from, char **args)
e06e04e44914 [gaim-migrate @ 6832]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
795 {
e06e04e44914 [gaim-migrate @ 6832]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
796 GaimConnection *gc = gaim_account_get_connection(irc->account);
e06e04e44914 [gaim-migrate @ 6832]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
797 GaimConversation *convo;
e06e04e44914 [gaim-migrate @ 6832]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
798 char *nick = irc_mask_nick(from), *tmp, *msg;
e06e04e44914 [gaim-migrate @ 6832]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
799 int notice = 0;
e06e04e44914 [gaim-migrate @ 6832]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
800
e06e04e44914 [gaim-migrate @ 6832]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
801 if (!args || !args[0] || !args[1] || !gc) {
e06e04e44914 [gaim-migrate @ 6832]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
802 g_free(nick);
e06e04e44914 [gaim-migrate @ 6832]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
803 return;
e06e04e44914 [gaim-migrate @ 6832]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
804 }
e06e04e44914 [gaim-migrate @ 6832]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
805
e06e04e44914 [gaim-migrate @ 6832]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
806 notice = !strcmp(args[0], " notice ");
e06e04e44914 [gaim-migrate @ 6832]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
807 tmp = irc_parse_ctcp(irc, nick, args[0], args[1], notice);
e06e04e44914 [gaim-migrate @ 6832]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
808 if (!tmp) {
e06e04e44914 [gaim-migrate @ 6832]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
809 g_free(nick);
e06e04e44914 [gaim-migrate @ 6832]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
810 return;
e06e04e44914 [gaim-migrate @ 6832]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
811 }
8163
da57fb60680a [gaim-migrate @ 8875]
Ethan Blanton <elb@pidgin.im>
parents: 8114
diff changeset
812
da57fb60680a [gaim-migrate @ 8875]
Ethan Blanton <elb@pidgin.im>
parents: 8114
diff changeset
813 msg = gaim_escape_html(tmp);
6333
e06e04e44914 [gaim-migrate @ 6832]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
814 g_free(tmp);
8163
da57fb60680a [gaim-migrate @ 8875]
Ethan Blanton <elb@pidgin.im>
parents: 8114
diff changeset
815
da57fb60680a [gaim-migrate @ 8875]
Ethan Blanton <elb@pidgin.im>
parents: 8114
diff changeset
816 tmp = irc_mirc2html(msg);
da57fb60680a [gaim-migrate @ 8875]
Ethan Blanton <elb@pidgin.im>
parents: 8114
diff changeset
817 g_free(msg);
da57fb60680a [gaim-migrate @ 8875]
Ethan Blanton <elb@pidgin.im>
parents: 8114
diff changeset
818 msg = tmp;
6333
e06e04e44914 [gaim-migrate @ 6832]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
819 if (notice) {
e06e04e44914 [gaim-migrate @ 6832]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
820 tmp = g_strdup_printf("(notice) %s", msg);
e06e04e44914 [gaim-migrate @ 6832]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
821 g_free(msg);
e06e04e44914 [gaim-migrate @ 6832]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
822 msg = tmp;
e06e04e44914 [gaim-migrate @ 6832]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
823 }
e06e04e44914 [gaim-migrate @ 6832]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
824
e06e04e44914 [gaim-migrate @ 6832]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
825 if (!gaim_utf8_strcasecmp(args[0], gaim_connection_get_display_name(gc))) {
6982
083d1e4a9c78 [gaim-migrate @ 7538]
Mark Doliner <mark@kingant.net>
parents: 6753
diff changeset
826 serv_got_im(gc, nick, msg, 0, time(NULL));
6333
e06e04e44914 [gaim-migrate @ 6832]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
827 } else if (notice) {
6982
083d1e4a9c78 [gaim-migrate @ 7538]
Mark Doliner <mark@kingant.net>
parents: 6753
diff changeset
828 serv_got_im(gc, nick, msg, 0, time(NULL));
6333
e06e04e44914 [gaim-migrate @ 6832]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
829 } else {
e06e04e44914 [gaim-migrate @ 6832]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
830 convo = gaim_find_conversation_with_account(args[0], irc->account);
e06e04e44914 [gaim-migrate @ 6832]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
831 if (convo)
7118
bf630f7dfdcd [gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents: 7108
diff changeset
832 serv_got_chat_in(gc, gaim_conv_chat_get_id(GAIM_CONV_CHAT(convo)), nick, 0, msg, time(NULL));
6333
e06e04e44914 [gaim-migrate @ 6832]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
833 else
e06e04e44914 [gaim-migrate @ 6832]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
834 gaim_debug(GAIM_DEBUG_ERROR, "irc", "Got a PRIVMSG on %s, which does not exist\n", args[0]);
e06e04e44914 [gaim-migrate @ 6832]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
835 }
e06e04e44914 [gaim-migrate @ 6832]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
836 g_free(msg);
e06e04e44914 [gaim-migrate @ 6832]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
837 g_free(nick);
e06e04e44914 [gaim-migrate @ 6832]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
838 }
e06e04e44914 [gaim-migrate @ 6832]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
839
6714
0c260c4e753e [gaim-migrate @ 7240]
Ethan Blanton <elb@pidgin.im>
parents: 6695
diff changeset
840 void irc_msg_regonly(struct irc_conn *irc, const char *name, const char *from, char **args)
0c260c4e753e [gaim-migrate @ 7240]
Ethan Blanton <elb@pidgin.im>
parents: 6695
diff changeset
841 {
0c260c4e753e [gaim-migrate @ 7240]
Ethan Blanton <elb@pidgin.im>
parents: 6695
diff changeset
842 GaimConnection *gc = gaim_account_get_connection(irc->account);
0c260c4e753e [gaim-migrate @ 7240]
Ethan Blanton <elb@pidgin.im>
parents: 6695
diff changeset
843 char *msg;
0c260c4e753e [gaim-migrate @ 7240]
Ethan Blanton <elb@pidgin.im>
parents: 6695
diff changeset
844
0c260c4e753e [gaim-migrate @ 7240]
Ethan Blanton <elb@pidgin.im>
parents: 6695
diff changeset
845 if (!args || !args[1] || !args[2] || !gc)
0c260c4e753e [gaim-migrate @ 7240]
Ethan Blanton <elb@pidgin.im>
parents: 6695
diff changeset
846 return;
0c260c4e753e [gaim-migrate @ 7240]
Ethan Blanton <elb@pidgin.im>
parents: 6695
diff changeset
847
0c260c4e753e [gaim-migrate @ 7240]
Ethan Blanton <elb@pidgin.im>
parents: 6695
diff changeset
848 msg = g_strdup_printf(_("Cannot join %s:"), args[1]);
0c260c4e753e [gaim-migrate @ 7240]
Ethan Blanton <elb@pidgin.im>
parents: 6695
diff changeset
849 gaim_notify_error(gc, _("Cannot join channel"), msg, args[2]);
0c260c4e753e [gaim-migrate @ 7240]
Ethan Blanton <elb@pidgin.im>
parents: 6695
diff changeset
850 g_free(msg);
0c260c4e753e [gaim-migrate @ 7240]
Ethan Blanton <elb@pidgin.im>
parents: 6695
diff changeset
851 }
0c260c4e753e [gaim-migrate @ 7240]
Ethan Blanton <elb@pidgin.im>
parents: 6695
diff changeset
852
6333
e06e04e44914 [gaim-migrate @ 6832]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
853 void irc_msg_quit(struct irc_conn *irc, const char *name, const char *from, char **args)
e06e04e44914 [gaim-migrate @ 6832]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
854 {
e06e04e44914 [gaim-migrate @ 6832]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
855 GaimConnection *gc = gaim_account_get_connection(irc->account);
9238
f4f210e47b60 [gaim-migrate @ 10036]
Ethan Blanton <elb@pidgin.im>
parents: 9057
diff changeset
856 struct irc_buddy *ib;
6333
e06e04e44914 [gaim-migrate @ 6832]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
857 char *data[2];
e06e04e44914 [gaim-migrate @ 6832]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
858
e06e04e44914 [gaim-migrate @ 6832]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
859 if (!args || !args[0] || !gc)
e06e04e44914 [gaim-migrate @ 6832]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
860 return;
e06e04e44914 [gaim-migrate @ 6832]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
861
e06e04e44914 [gaim-migrate @ 6832]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
862 data[0] = irc_mask_nick(from);
e06e04e44914 [gaim-migrate @ 6832]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
863 data[1] = args[0];
e06e04e44914 [gaim-migrate @ 6832]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
864 /* XXX this should have an API, I shouldn't grab this directly */
e06e04e44914 [gaim-migrate @ 6832]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
865 g_slist_foreach(gc->buddy_chats, (GFunc)irc_chat_remove_buddy, data);
9238
f4f210e47b60 [gaim-migrate @ 10036]
Ethan Blanton <elb@pidgin.im>
parents: 9057
diff changeset
866
f4f210e47b60 [gaim-migrate @ 10036]
Ethan Blanton <elb@pidgin.im>
parents: 9057
diff changeset
867 if ((ib = g_hash_table_lookup(irc->buddies, data[0])) != NULL) {
f4f210e47b60 [gaim-migrate @ 10036]
Ethan Blanton <elb@pidgin.im>
parents: 9057
diff changeset
868 ib->flag = FALSE;
f4f210e47b60 [gaim-migrate @ 10036]
Ethan Blanton <elb@pidgin.im>
parents: 9057
diff changeset
869 irc_buddy_status(data[0], ib, irc);
f4f210e47b60 [gaim-migrate @ 10036]
Ethan Blanton <elb@pidgin.im>
parents: 9057
diff changeset
870 }
6333
e06e04e44914 [gaim-migrate @ 6832]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
871 g_free(data[0]);
e06e04e44914 [gaim-migrate @ 6832]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
872
e06e04e44914 [gaim-migrate @ 6832]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
873 return;
e06e04e44914 [gaim-migrate @ 6832]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
874 }
e06e04e44914 [gaim-migrate @ 6832]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
875
e06e04e44914 [gaim-migrate @ 6832]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
876 void irc_msg_wallops(struct irc_conn *irc, const char *name, const char *from, char **args)
e06e04e44914 [gaim-migrate @ 6832]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
877 {
e06e04e44914 [gaim-migrate @ 6832]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
878 GaimConnection *gc = gaim_account_get_connection(irc->account);
8965
0c435a36b5bf [gaim-migrate @ 9739]
Luke Schierer <lschiere@pidgin.im>
parents: 8872
diff changeset
879 char *nick, *msg, *wallop;
6333
e06e04e44914 [gaim-migrate @ 6832]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
880
e06e04e44914 [gaim-migrate @ 6832]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
881 if (!args || !args[0] || !gc)
e06e04e44914 [gaim-migrate @ 6832]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
882 return;
e06e04e44914 [gaim-migrate @ 6832]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
883
e06e04e44914 [gaim-migrate @ 6832]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
884 nick = irc_mask_nick(from);
e06e04e44914 [gaim-migrate @ 6832]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
885 msg = g_strdup_printf (_("Wallops from %s"), nick);
e06e04e44914 [gaim-migrate @ 6832]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
886 g_free(nick);
8965
0c435a36b5bf [gaim-migrate @ 9739]
Luke Schierer <lschiere@pidgin.im>
parents: 8872
diff changeset
887 wallop = g_markup_escape_text(args[0], strlen(args[0]));
0c435a36b5bf [gaim-migrate @ 9739]
Luke Schierer <lschiere@pidgin.im>
parents: 8872
diff changeset
888 gaim_notify_info(gc, NULL, msg, wallop);
6333
e06e04e44914 [gaim-migrate @ 6832]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
889 g_free(msg);
8965
0c435a36b5bf [gaim-migrate @ 9739]
Luke Schierer <lschiere@pidgin.im>
parents: 8872
diff changeset
890 g_free(wallop);
6333
e06e04e44914 [gaim-migrate @ 6832]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
891 }
e06e04e44914 [gaim-migrate @ 6832]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
892
e06e04e44914 [gaim-migrate @ 6832]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
893 void irc_msg_ignore(struct irc_conn *irc, const char *name, const char *from, char **args)
e06e04e44914 [gaim-migrate @ 6832]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
894 {
e06e04e44914 [gaim-migrate @ 6832]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
895 return;
e06e04e44914 [gaim-migrate @ 6832]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
896 }