annotate src/protocols/irc/msgs.c @ 13522:5ddae6fe983e

[gaim-migrate @ 15898] SF Patch #1451956 from Philip Derrin "The IRC client displays any /notice in an IM window, even when the /notice was actually sent to a channel. It does so even if the sender of the /notice is being ignored in that channel. A patch to fix this is attached. I'm aware the fix is a little seedy, but so is the code it's fixing." committer: Tailor Script <tailor@pidgin.im>
author Richard Laager <rlaager@wiktel.com>
date Fri, 17 Mar 2006 05:45:48 +0000
parents eb0ce960ff60
children 57bde2deabcb
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 {
12855
f9401180115a [gaim-migrate @ 15206]
Richard Laager <rlaager@wiktel.com>
parents: 12216
diff changeset
59 char *message;
10730
e84b1ef01905 [gaim-migrate @ 12331]
Stu Tomlinson <stu@nosnilmot.com>
parents: 10712
diff changeset
60
12855
f9401180115a [gaim-migrate @ 15206]
Richard Laager <rlaager@wiktel.com>
parents: 12216
diff changeset
61 message = g_strdup_printf("quit: %s", data[1]);
6333
e06e04e44914 [gaim-migrate @ 6832]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
62
9554
8b2451878e26 [gaim-migrate @ 10387]
Luke Schierer <lschiere@pidgin.im>
parents: 9518
diff changeset
63 if (gaim_conv_chat_find_user(GAIM_CONV_CHAT(convo), data[0]))
7118
bf630f7dfdcd [gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents: 7108
diff changeset
64 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
65
e06e04e44914 [gaim-migrate @ 6832]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
66 g_free(message);
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
e06e04e44914 [gaim-migrate @ 6832]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
69 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
70 {
e06e04e44914 [gaim-migrate @ 6832]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
71 gaim_debug(GAIM_DEBUG_INFO, "irc", "Unrecognized message: %s\n", args[0]);
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
e06e04e44914 [gaim-migrate @ 6832]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
74 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
75 {
e06e04e44914 [gaim-migrate @ 6832]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
76 GaimConnection *gc;
10774
d83f745c997b [gaim-migrate @ 12383]
Stu Tomlinson <stu@nosnilmot.com>
parents: 10751
diff changeset
77 char *msg;
6333
e06e04e44914 [gaim-migrate @ 6832]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
78
e06e04e44914 [gaim-migrate @ 6832]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
79 if (!args || !args[1])
e06e04e44914 [gaim-migrate @ 6832]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
80 return;
e06e04e44914 [gaim-migrate @ 6832]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
81
e06e04e44914 [gaim-migrate @ 6832]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
82 if (irc->whois.nick && !gaim_utf8_strcasecmp(irc->whois.nick, args[1])) {
e06e04e44914 [gaim-migrate @ 6832]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
83 /* We're doing a whois, show this in the whois dialog */
e06e04e44914 [gaim-migrate @ 6832]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
84 irc_msg_whois(irc, name, from, args);
e06e04e44914 [gaim-migrate @ 6832]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
85 return;
e06e04e44914 [gaim-migrate @ 6832]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
86 }
e06e04e44914 [gaim-migrate @ 6832]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
87
e06e04e44914 [gaim-migrate @ 6832]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
88 gc = gaim_account_get_connection(irc->account);
10774
d83f745c997b [gaim-migrate @ 12383]
Stu Tomlinson <stu@nosnilmot.com>
parents: 10751
diff changeset
89 if (gc) {
d83f745c997b [gaim-migrate @ 12383]
Stu Tomlinson <stu@nosnilmot.com>
parents: 10751
diff changeset
90 msg = g_markup_escape_text(args[2], -1);
12216
4d3119205a33 [gaim-migrate @ 14518]
Stu Tomlinson <stu@nosnilmot.com>
parents: 12069
diff changeset
91 serv_got_im(gc, args[1], msg, GAIM_MESSAGE_AUTO_RESP, time(NULL));
10774
d83f745c997b [gaim-migrate @ 12383]
Stu Tomlinson <stu@nosnilmot.com>
parents: 10751
diff changeset
92 g_free(msg);
d83f745c997b [gaim-migrate @ 12383]
Stu Tomlinson <stu@nosnilmot.com>
parents: 10751
diff changeset
93 }
6333
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
e06e04e44914 [gaim-migrate @ 6832]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
96 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
97 {
e06e04e44914 [gaim-migrate @ 6832]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
98 GaimConnection *gc = gaim_account_get_connection(irc->account);
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 if (!args || !args[1] || !gc)
e06e04e44914 [gaim-migrate @ 6832]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
101 return;
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 gaim_notify_error(gc, NULL, _("Bad mode"), args[1]);
e06e04e44914 [gaim-migrate @ 6832]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
104 }
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 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
107 {
e06e04e44914 [gaim-migrate @ 6832]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
108 GaimConnection *gc = gaim_account_get_connection(irc->account);
e06e04e44914 [gaim-migrate @ 6832]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
109 char *buf;
e06e04e44914 [gaim-migrate @ 6832]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
110
e06e04e44914 [gaim-migrate @ 6832]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
111 if (!args || !args[1] || !gc)
e06e04e44914 [gaim-migrate @ 6832]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
112 return;
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 buf = g_strdup_printf(_("You are banned from %s."), args[1]);
e06e04e44914 [gaim-migrate @ 6832]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
115 gaim_notify_error(gc, _("Banned"), _("Banned"), buf);
e06e04e44914 [gaim-migrate @ 6832]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
116 g_free(buf);
e06e04e44914 [gaim-migrate @ 6832]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
117 }
e06e04e44914 [gaim-migrate @ 6832]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
118
10659
861ae6ee7b6c [gaim-migrate @ 12192]
Stu Tomlinson <stu@nosnilmot.com>
parents: 10637
diff changeset
119 void irc_msg_banfull(struct irc_conn *irc, const char *name, const char *from, char **args)
861ae6ee7b6c [gaim-migrate @ 12192]
Stu Tomlinson <stu@nosnilmot.com>
parents: 10637
diff changeset
120 {
861ae6ee7b6c [gaim-migrate @ 12192]
Stu Tomlinson <stu@nosnilmot.com>
parents: 10637
diff changeset
121 GaimConversation *convo;
861ae6ee7b6c [gaim-migrate @ 12192]
Stu Tomlinson <stu@nosnilmot.com>
parents: 10637
diff changeset
122 char *buf, *nick;
861ae6ee7b6c [gaim-migrate @ 12192]
Stu Tomlinson <stu@nosnilmot.com>
parents: 10637
diff changeset
123
861ae6ee7b6c [gaim-migrate @ 12192]
Stu Tomlinson <stu@nosnilmot.com>
parents: 10637
diff changeset
124 if (!args || !args[0] || !args[1] || !args[2])
861ae6ee7b6c [gaim-migrate @ 12192]
Stu Tomlinson <stu@nosnilmot.com>
parents: 10637
diff changeset
125 return;
861ae6ee7b6c [gaim-migrate @ 12192]
Stu Tomlinson <stu@nosnilmot.com>
parents: 10637
diff changeset
126
11338
17142948653e [gaim-migrate @ 13551]
Mark Doliner <mark@kingant.net>
parents: 11026
diff changeset
127 convo = gaim_find_conversation_with_account(GAIM_CONV_TYPE_CHAT, args[1], irc->account);
10659
861ae6ee7b6c [gaim-migrate @ 12192]
Stu Tomlinson <stu@nosnilmot.com>
parents: 10637
diff changeset
128 if (!convo)
861ae6ee7b6c [gaim-migrate @ 12192]
Stu Tomlinson <stu@nosnilmot.com>
parents: 10637
diff changeset
129 return;
861ae6ee7b6c [gaim-migrate @ 12192]
Stu Tomlinson <stu@nosnilmot.com>
parents: 10637
diff changeset
130
861ae6ee7b6c [gaim-migrate @ 12192]
Stu Tomlinson <stu@nosnilmot.com>
parents: 10637
diff changeset
131 nick = g_markup_escape_text(args[2], -1);
861ae6ee7b6c [gaim-migrate @ 12192]
Stu Tomlinson <stu@nosnilmot.com>
parents: 10637
diff changeset
132 buf = g_strdup_printf(_("Cannot ban %s: banlist is full"), nick);
861ae6ee7b6c [gaim-migrate @ 12192]
Stu Tomlinson <stu@nosnilmot.com>
parents: 10637
diff changeset
133 g_free(nick);
861ae6ee7b6c [gaim-migrate @ 12192]
Stu Tomlinson <stu@nosnilmot.com>
parents: 10637
diff changeset
134 gaim_conv_chat_write(GAIM_CONV_CHAT(convo), "", buf,
861ae6ee7b6c [gaim-migrate @ 12192]
Stu Tomlinson <stu@nosnilmot.com>
parents: 10637
diff changeset
135 GAIM_MESSAGE_SYSTEM|GAIM_MESSAGE_NO_LOG,
861ae6ee7b6c [gaim-migrate @ 12192]
Stu Tomlinson <stu@nosnilmot.com>
parents: 10637
diff changeset
136 time(NULL));
861ae6ee7b6c [gaim-migrate @ 12192]
Stu Tomlinson <stu@nosnilmot.com>
parents: 10637
diff changeset
137 g_free(buf);
861ae6ee7b6c [gaim-migrate @ 12192]
Stu Tomlinson <stu@nosnilmot.com>
parents: 10637
diff changeset
138 }
861ae6ee7b6c [gaim-migrate @ 12192]
Stu Tomlinson <stu@nosnilmot.com>
parents: 10637
diff changeset
139
6333
e06e04e44914 [gaim-migrate @ 6832]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
140 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
141 {
e06e04e44914 [gaim-migrate @ 6832]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
142 GaimConversation *convo;
10774
d83f745c997b [gaim-migrate @ 12383]
Stu Tomlinson <stu@nosnilmot.com>
parents: 10751
diff changeset
143 char *buf, *escaped;
6333
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 (!args || !args[1] || !args[2])
e06e04e44914 [gaim-migrate @ 6832]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
146 return;
e06e04e44914 [gaim-migrate @ 6832]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
147
11338
17142948653e [gaim-migrate @ 13551]
Mark Doliner <mark@kingant.net>
parents: 11026
diff changeset
148 convo = gaim_find_conversation_with_account(GAIM_CONV_TYPE_CHAT, args[1], irc->account);
6333
e06e04e44914 [gaim-migrate @ 6832]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
149 if (!convo) /* XXX punt on channels we are not in for now */
e06e04e44914 [gaim-migrate @ 6832]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
150 return;
e06e04e44914 [gaim-migrate @ 6832]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
151
10774
d83f745c997b [gaim-migrate @ 12383]
Stu Tomlinson <stu@nosnilmot.com>
parents: 10751
diff changeset
152 escaped = (args[3] != NULL) ? g_markup_escape_text(args[3], -1) : NULL;
d83f745c997b [gaim-migrate @ 12383]
Stu Tomlinson <stu@nosnilmot.com>
parents: 10751
diff changeset
153 buf = g_strdup_printf("mode for %s: %s %s", args[1], args[2], escaped ? escaped : "");
12069
1019f1d510d6 [gaim-migrate @ 14364]
Richard Laager <rlaager@wiktel.com>
parents: 12001
diff changeset
154 gaim_conv_chat_write(GAIM_CONV_CHAT(convo), "", buf, GAIM_MESSAGE_SYSTEM, time(NULL));
10774
d83f745c997b [gaim-migrate @ 12383]
Stu Tomlinson <stu@nosnilmot.com>
parents: 10751
diff changeset
155 g_free(escaped);
6333
e06e04e44914 [gaim-migrate @ 6832]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
156 g_free(buf);
e06e04e44914 [gaim-migrate @ 6832]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
157
e06e04e44914 [gaim-migrate @ 6832]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
158 return;
e06e04e44914 [gaim-migrate @ 6832]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
159 }
e06e04e44914 [gaim-migrate @ 6832]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
160
e06e04e44914 [gaim-migrate @ 6832]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
161 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
162 {
e06e04e44914 [gaim-migrate @ 6832]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
163 if (!irc->whois.nick) {
e06e04e44914 [gaim-migrate @ 6832]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
164 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
165 return;
e06e04e44914 [gaim-migrate @ 6832]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
166 }
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 if (gaim_utf8_strcasecmp(irc->whois.nick, args[1])) {
e06e04e44914 [gaim-migrate @ 6832]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
169 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
170 return;
e06e04e44914 [gaim-migrate @ 6832]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
171 }
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 (!strcmp(name, "301")) {
e06e04e44914 [gaim-migrate @ 6832]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
174 irc->whois.away = g_strdup(args[2]);
e06e04e44914 [gaim-migrate @ 6832]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
175 } else if (!strcmp(name, "311")) {
e06e04e44914 [gaim-migrate @ 6832]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
176 irc->whois.userhost = g_strdup_printf("%s@%s", args[2], args[3]);
e06e04e44914 [gaim-migrate @ 6832]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
177 irc->whois.name = g_strdup(args[5]);
e06e04e44914 [gaim-migrate @ 6832]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
178 } else if (!strcmp(name, "312")) {
e06e04e44914 [gaim-migrate @ 6832]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
179 irc->whois.server = g_strdup(args[2]);
e06e04e44914 [gaim-migrate @ 6832]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
180 irc->whois.serverinfo = g_strdup(args[3]);
e06e04e44914 [gaim-migrate @ 6832]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
181 } else if (!strcmp(name, "313")) {
e06e04e44914 [gaim-migrate @ 6832]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
182 irc->whois.ircop = 1;
e06e04e44914 [gaim-migrate @ 6832]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
183 } else if (!strcmp(name, "317")) {
e06e04e44914 [gaim-migrate @ 6832]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
184 irc->whois.idle = atoi(args[2]);
e06e04e44914 [gaim-migrate @ 6832]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
185 if (args[3])
e06e04e44914 [gaim-migrate @ 6832]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
186 irc->whois.signon = (time_t)atoi(args[3]);
e06e04e44914 [gaim-migrate @ 6832]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
187 } else if (!strcmp(name, "319")) {
e06e04e44914 [gaim-migrate @ 6832]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
188 irc->whois.channels = g_strdup(args[2]);
e06e04e44914 [gaim-migrate @ 6832]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
189 } else if (!strcmp(name, "320")) {
e06e04e44914 [gaim-migrate @ 6832]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
190 irc->whois.identified = 1;
e06e04e44914 [gaim-migrate @ 6832]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
191 }
e06e04e44914 [gaim-migrate @ 6832]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
192 }
e06e04e44914 [gaim-migrate @ 6832]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
193
e06e04e44914 [gaim-migrate @ 6832]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
194 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
195 {
e06e04e44914 [gaim-migrate @ 6832]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
196 GaimConnection *gc;
e06e04e44914 [gaim-migrate @ 6832]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
197 GString *info;
10634
483765e4a26c [gaim-migrate @ 12114]
Ethan Blanton <elb@pidgin.im>
parents: 10633
diff changeset
198 char *str, *tmp;
6333
e06e04e44914 [gaim-migrate @ 6832]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
199
e06e04e44914 [gaim-migrate @ 6832]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
200 if (!irc->whois.nick) {
e06e04e44914 [gaim-migrate @ 6832]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
201 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
202 return;
e06e04e44914 [gaim-migrate @ 6832]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
203 }
e06e04e44914 [gaim-migrate @ 6832]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
204 if (gaim_utf8_strcasecmp(irc->whois.nick, args[1])) {
e06e04e44914 [gaim-migrate @ 6832]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
205 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
206 return;
e06e04e44914 [gaim-migrate @ 6832]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
207 }
e06e04e44914 [gaim-migrate @ 6832]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
208
e06e04e44914 [gaim-migrate @ 6832]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
209 info = g_string_new("");
10634
483765e4a26c [gaim-migrate @ 12114]
Ethan Blanton <elb@pidgin.im>
parents: 10633
diff changeset
210 tmp = g_markup_escape_text(args[1], -1);
483765e4a26c [gaim-migrate @ 12114]
Ethan Blanton <elb@pidgin.im>
parents: 10633
diff changeset
211 g_string_append_printf(info, _("<b>%s:</b> %s"), _("Nick"), tmp);
483765e4a26c [gaim-migrate @ 12114]
Ethan Blanton <elb@pidgin.im>
parents: 10633
diff changeset
212 g_free(tmp);
9558
f1137cf462d8 [gaim-migrate @ 10394]
Luke Schierer <lschiere@pidgin.im>
parents: 9554
diff changeset
213 g_string_append_printf(info, "%s%s<br>",
6333
e06e04e44914 [gaim-migrate @ 6832]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
214 irc->whois.ircop ? _(" <i>(ircop)</i>") : "",
e06e04e44914 [gaim-migrate @ 6832]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
215 irc->whois.identified ? _(" <i>(identified)</i>") : "");
e06e04e44914 [gaim-migrate @ 6832]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
216 if (irc->whois.away) {
10634
483765e4a26c [gaim-migrate @ 12114]
Ethan Blanton <elb@pidgin.im>
parents: 10633
diff changeset
217 tmp = g_markup_escape_text(irc->whois.away, strlen(irc->whois.away));
6333
e06e04e44914 [gaim-migrate @ 6832]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
218 g_free(irc->whois.away);
9589
f4654d3b7b8d [gaim-migrate @ 10432]
Ethan Blanton <elb@pidgin.im>
parents: 9558
diff changeset
219 g_string_append_printf(info, _("<b>%s:</b> %s<br>"), _("Away"), tmp);
f4654d3b7b8d [gaim-migrate @ 10432]
Ethan Blanton <elb@pidgin.im>
parents: 9558
diff changeset
220 g_free(tmp);
6333
e06e04e44914 [gaim-migrate @ 6832]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
221 }
e06e04e44914 [gaim-migrate @ 6832]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
222 if (irc->whois.userhost) {
10634
483765e4a26c [gaim-migrate @ 12114]
Ethan Blanton <elb@pidgin.im>
parents: 10633
diff changeset
223 tmp = g_markup_escape_text(irc->whois.name, strlen(irc->whois.name));
9589
f4654d3b7b8d [gaim-migrate @ 10432]
Ethan Blanton <elb@pidgin.im>
parents: 9558
diff changeset
224 g_free(irc->whois.name);
9558
f1137cf462d8 [gaim-migrate @ 10394]
Luke Schierer <lschiere@pidgin.im>
parents: 9554
diff changeset
225 g_string_append_printf(info, _("<b>%s:</b> %s<br>"), _("Username"), irc->whois.userhost);
9589
f4654d3b7b8d [gaim-migrate @ 10432]
Ethan Blanton <elb@pidgin.im>
parents: 9558
diff changeset
226 g_string_append_printf(info, _("<b>%s:</b> %s<br>"), _("Realname"), tmp);
6333
e06e04e44914 [gaim-migrate @ 6832]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
227 g_free(irc->whois.userhost);
9589
f4654d3b7b8d [gaim-migrate @ 10432]
Ethan Blanton <elb@pidgin.im>
parents: 9558
diff changeset
228 g_free(tmp);
6333
e06e04e44914 [gaim-migrate @ 6832]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
229 }
e06e04e44914 [gaim-migrate @ 6832]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
230 if (irc->whois.server) {
9558
f1137cf462d8 [gaim-migrate @ 10394]
Luke Schierer <lschiere@pidgin.im>
parents: 9554
diff changeset
231 g_string_append_printf(info, _("<b>%s:</b> %s"), _("Server"), irc->whois.server);
f1137cf462d8 [gaim-migrate @ 10394]
Luke Schierer <lschiere@pidgin.im>
parents: 9554
diff changeset
232 g_string_append_printf(info, " (%s)<br>", irc->whois.serverinfo);
6333
e06e04e44914 [gaim-migrate @ 6832]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
233 g_free(irc->whois.server);
e06e04e44914 [gaim-migrate @ 6832]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
234 g_free(irc->whois.serverinfo);
e06e04e44914 [gaim-migrate @ 6832]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
235 }
e06e04e44914 [gaim-migrate @ 6832]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
236 if (irc->whois.channels) {
9558
f1137cf462d8 [gaim-migrate @ 10394]
Luke Schierer <lschiere@pidgin.im>
parents: 9554
diff changeset
237 g_string_append_printf(info, _("<b>%s:</b> %s<br>"), _("Currently on"), irc->whois.channels);
6333
e06e04e44914 [gaim-migrate @ 6832]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
238 g_free(irc->whois.channels);
e06e04e44914 [gaim-migrate @ 6832]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
239 }
e06e04e44914 [gaim-migrate @ 6832]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
240 if (irc->whois.idle) {
7108
6faeeecab0dc [gaim-migrate @ 7673]
Christian Hammond <chipx86@chipx86.com>
parents: 7062
diff changeset
241 gchar *timex = gaim_str_seconds_to_string(irc->whois.idle);
6357
1fa4410d2e13 [gaim-migrate @ 6856]
Mark Doliner <mark@kingant.net>
parents: 6351
diff changeset
242 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
243 g_free(timex);
13119
fcde3faa1f57 [gaim-migrate @ 15481]
Richard Laager <rlaager@wiktel.com>
parents: 13104
diff changeset
244 g_string_append_printf(info, _("<b>%s:</b> %s"), _("Online since"),
fcde3faa1f57 [gaim-migrate @ 15481]
Richard Laager <rlaager@wiktel.com>
parents: 13104
diff changeset
245 gaim_date_format_full(localtime(&irc->whois.signon)));
6333
e06e04e44914 [gaim-migrate @ 6832]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
246 }
e06e04e44914 [gaim-migrate @ 6832]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
247 if (!strcmp(irc->whois.nick, "Paco-Paco")) {
e06e04e44914 [gaim-migrate @ 6832]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
248 g_string_append_printf(info, _("<br><b>Defining adjective:</b> Glorious<br>"));
e06e04e44914 [gaim-migrate @ 6832]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
249 }
e06e04e44914 [gaim-migrate @ 6832]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
250
e06e04e44914 [gaim-migrate @ 6832]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
251 gc = gaim_account_get_connection(irc->account);
e06e04e44914 [gaim-migrate @ 6832]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
252 str = g_string_free(info, FALSE);
7062
86ed8b2aa665 [gaim-migrate @ 7626]
Christian Hammond <chipx86@chipx86.com>
parents: 6982
diff changeset
253
11533
c9b815aeddc1 [gaim-migrate @ 13782]
Richard Laager <rlaager@wiktel.com>
parents: 11531
diff changeset
254 gaim_notify_userinfo(gc, irc->whois.nick, str, NULL, NULL);
7062
86ed8b2aa665 [gaim-migrate @ 7626]
Christian Hammond <chipx86@chipx86.com>
parents: 6982
diff changeset
255
10504
1a97d5e88d12 [gaim-migrate @ 11796]
Stu Tomlinson <stu@nosnilmot.com>
parents: 10246
diff changeset
256 g_free(irc->whois.nick);
6333
e06e04e44914 [gaim-migrate @ 6832]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
257 g_free(str);
e06e04e44914 [gaim-migrate @ 6832]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
258 memset(&irc->whois, 0, sizeof(irc->whois));
e06e04e44914 [gaim-migrate @ 6832]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
259 }
e06e04e44914 [gaim-migrate @ 6832]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
260
8114
7a6e30eb7aad [gaim-migrate @ 8818]
Ethan Blanton <elb@pidgin.im>
parents: 7877
diff changeset
261 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
262 {
7a6e30eb7aad [gaim-migrate @ 8818]
Ethan Blanton <elb@pidgin.im>
parents: 7877
diff changeset
263 if (!irc->roomlist)
7a6e30eb7aad [gaim-migrate @ 8818]
Ethan Blanton <elb@pidgin.im>
parents: 7877
diff changeset
264 return;
7a6e30eb7aad [gaim-migrate @ 8818]
Ethan Blanton <elb@pidgin.im>
parents: 7877
diff changeset
265
7a6e30eb7aad [gaim-migrate @ 8818]
Ethan Blanton <elb@pidgin.im>
parents: 7877
diff changeset
266 if (!strcmp(name, "321")) {
7a6e30eb7aad [gaim-migrate @ 8818]
Ethan Blanton <elb@pidgin.im>
parents: 7877
diff changeset
267 gaim_roomlist_set_in_progress(irc->roomlist, TRUE);
7a6e30eb7aad [gaim-migrate @ 8818]
Ethan Blanton <elb@pidgin.im>
parents: 7877
diff changeset
268 return;
7a6e30eb7aad [gaim-migrate @ 8818]
Ethan Blanton <elb@pidgin.im>
parents: 7877
diff changeset
269 }
7a6e30eb7aad [gaim-migrate @ 8818]
Ethan Blanton <elb@pidgin.im>
parents: 7877
diff changeset
270
7a6e30eb7aad [gaim-migrate @ 8818]
Ethan Blanton <elb@pidgin.im>
parents: 7877
diff changeset
271 if (!strcmp(name, "323")) {
7a6e30eb7aad [gaim-migrate @ 8818]
Ethan Blanton <elb@pidgin.im>
parents: 7877
diff changeset
272 gaim_roomlist_set_in_progress(irc->roomlist, FALSE);
7a6e30eb7aad [gaim-migrate @ 8818]
Ethan Blanton <elb@pidgin.im>
parents: 7877
diff changeset
273 gaim_roomlist_unref(irc->roomlist);
7a6e30eb7aad [gaim-migrate @ 8818]
Ethan Blanton <elb@pidgin.im>
parents: 7877
diff changeset
274 irc->roomlist = NULL;
7a6e30eb7aad [gaim-migrate @ 8818]
Ethan Blanton <elb@pidgin.im>
parents: 7877
diff changeset
275 }
7a6e30eb7aad [gaim-migrate @ 8818]
Ethan Blanton <elb@pidgin.im>
parents: 7877
diff changeset
276
7a6e30eb7aad [gaim-migrate @ 8818]
Ethan Blanton <elb@pidgin.im>
parents: 7877
diff changeset
277 if (!strcmp(name, "322")) {
7a6e30eb7aad [gaim-migrate @ 8818]
Ethan Blanton <elb@pidgin.im>
parents: 7877
diff changeset
278 GaimRoomlistRoom *room;
7a6e30eb7aad [gaim-migrate @ 8818]
Ethan Blanton <elb@pidgin.im>
parents: 7877
diff changeset
279
7a6e30eb7aad [gaim-migrate @ 8818]
Ethan Blanton <elb@pidgin.im>
parents: 7877
diff changeset
280 if (!args[0] || !args[1] || !args[2] || !args[3])
7a6e30eb7aad [gaim-migrate @ 8818]
Ethan Blanton <elb@pidgin.im>
parents: 7877
diff changeset
281 return;
7a6e30eb7aad [gaim-migrate @ 8818]
Ethan Blanton <elb@pidgin.im>
parents: 7877
diff changeset
282
7a6e30eb7aad [gaim-migrate @ 8818]
Ethan Blanton <elb@pidgin.im>
parents: 7877
diff changeset
283 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
284 gaim_roomlist_room_add_field(irc->roomlist, room, args[1]);
7a6e30eb7aad [gaim-migrate @ 8818]
Ethan Blanton <elb@pidgin.im>
parents: 7877
diff changeset
285 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
286 gaim_roomlist_room_add_field(irc->roomlist, room, args[3]);
7a6e30eb7aad [gaim-migrate @ 8818]
Ethan Blanton <elb@pidgin.im>
parents: 7877
diff changeset
287 gaim_roomlist_room_add(irc->roomlist, room);
7a6e30eb7aad [gaim-migrate @ 8818]
Ethan Blanton <elb@pidgin.im>
parents: 7877
diff changeset
288 }
7a6e30eb7aad [gaim-migrate @ 8818]
Ethan Blanton <elb@pidgin.im>
parents: 7877
diff changeset
289 }
7a6e30eb7aad [gaim-migrate @ 8818]
Ethan Blanton <elb@pidgin.im>
parents: 7877
diff changeset
290
6333
e06e04e44914 [gaim-migrate @ 6832]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
291 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
292 {
9762
3f97624e7753 [gaim-migrate @ 10630]
Tim Ringenbach <marv@pidgin.im>
parents: 9741
diff changeset
293 char *chan, *topic, *msg, *nick, *tmp, *tmp2;
6333
e06e04e44914 [gaim-migrate @ 6832]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
294 GaimConversation *convo;
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 (!strcmp(name, "topic")) {
e06e04e44914 [gaim-migrate @ 6832]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
297 chan = args[0];
8529
2f505651ac03 [gaim-migrate @ 9268]
Ethan Blanton <elb@pidgin.im>
parents: 8504
diff changeset
298 topic = irc_mirc2txt (args[1]);
6333
e06e04e44914 [gaim-migrate @ 6832]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
299 } else {
e06e04e44914 [gaim-migrate @ 6832]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
300 chan = args[1];
8529
2f505651ac03 [gaim-migrate @ 9268]
Ethan Blanton <elb@pidgin.im>
parents: 8504
diff changeset
301 topic = irc_mirc2txt (args[2]);
6333
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
11338
17142948653e [gaim-migrate @ 13551]
Mark Doliner <mark@kingant.net>
parents: 11026
diff changeset
304 convo = gaim_find_conversation_with_account(GAIM_CONV_TYPE_CHAT, chan, irc->account);
6333
e06e04e44914 [gaim-migrate @ 6832]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
305 if (!convo) {
e06e04e44914 [gaim-migrate @ 6832]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
306 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
307 }
9518
6c24a6f07256 [gaim-migrate @ 10345]
Luke Schierer <lschiere@pidgin.im>
parents: 9274
diff changeset
308
6333
e06e04e44914 [gaim-migrate @ 6832]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
309 /* If this is an interactive update, print it out */
10732
c4cb90065e1d [gaim-migrate @ 12334]
Luke Schierer <lschiere@pidgin.im>
parents: 10730
diff changeset
310 tmp = g_markup_escape_text(topic, -1);
9762
3f97624e7753 [gaim-migrate @ 10630]
Tim Ringenbach <marv@pidgin.im>
parents: 9741
diff changeset
311 tmp2 = gaim_markup_linkify(tmp);
3f97624e7753 [gaim-migrate @ 10630]
Tim Ringenbach <marv@pidgin.im>
parents: 9741
diff changeset
312 g_free(tmp);
6333
e06e04e44914 [gaim-migrate @ 6832]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
313 if (!strcmp(name, "topic")) {
13394
eb0ce960ff60 [gaim-migrate @ 15767]
Richard Laager <rlaager@wiktel.com>
parents: 13119
diff changeset
314 char *nick_esc;
6333
e06e04e44914 [gaim-migrate @ 6832]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
315 nick = irc_mask_nick(from);
13394
eb0ce960ff60 [gaim-migrate @ 15767]
Richard Laager <rlaager@wiktel.com>
parents: 13119
diff changeset
316 nick_esc = g_markup_escape_text(nick, -1);
9518
6c24a6f07256 [gaim-migrate @ 10345]
Luke Schierer <lschiere@pidgin.im>
parents: 9274
diff changeset
317 gaim_conv_chat_set_topic(GAIM_CONV_CHAT(convo), nick, topic);
13394
eb0ce960ff60 [gaim-migrate @ 15767]
Richard Laager <rlaager@wiktel.com>
parents: 13119
diff changeset
318 msg = g_strdup_printf(_("%s has changed the topic to: %s"), nick_esc, tmp2);
eb0ce960ff60 [gaim-migrate @ 15767]
Richard Laager <rlaager@wiktel.com>
parents: 13119
diff changeset
319 g_free(nick_esc);
6333
e06e04e44914 [gaim-migrate @ 6832]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
320 g_free(nick);
7118
bf630f7dfdcd [gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents: 7108
diff changeset
321 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
322 g_free(msg);
e06e04e44914 [gaim-migrate @ 6832]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
323 } else {
13394
eb0ce960ff60 [gaim-migrate @ 15767]
Richard Laager <rlaager@wiktel.com>
parents: 13119
diff changeset
324 char *chan_esc = g_markup_escape_text(chan, -1);
eb0ce960ff60 [gaim-migrate @ 15767]
Richard Laager <rlaager@wiktel.com>
parents: 13119
diff changeset
325 msg = g_strdup_printf(_("The topic for %s is: %s"), chan_esc, tmp2);
eb0ce960ff60 [gaim-migrate @ 15767]
Richard Laager <rlaager@wiktel.com>
parents: 13119
diff changeset
326 g_free(chan_esc);
9518
6c24a6f07256 [gaim-migrate @ 10345]
Luke Schierer <lschiere@pidgin.im>
parents: 9274
diff changeset
327 gaim_conv_chat_set_topic(GAIM_CONV_CHAT(convo), NULL, topic);
7118
bf630f7dfdcd [gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents: 7108
diff changeset
328 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
329 g_free(msg);
e06e04e44914 [gaim-migrate @ 6832]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
330 }
9762
3f97624e7753 [gaim-migrate @ 10630]
Tim Ringenbach <marv@pidgin.im>
parents: 9741
diff changeset
331 g_free(tmp2);
8529
2f505651ac03 [gaim-migrate @ 9268]
Ethan Blanton <elb@pidgin.im>
parents: 8504
diff changeset
332 g_free(topic);
6333
e06e04e44914 [gaim-migrate @ 6832]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
333 }
e06e04e44914 [gaim-migrate @ 6832]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
334
e06e04e44914 [gaim-migrate @ 6832]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
335 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
336 {
e06e04e44914 [gaim-migrate @ 6832]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
337 GaimConnection *gc = gaim_account_get_connection(irc->account);
e06e04e44914 [gaim-migrate @ 6832]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
338 char *buf;
e06e04e44914 [gaim-migrate @ 6832]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
339
e06e04e44914 [gaim-migrate @ 6832]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
340 if (!args || !args[1] || !gc)
e06e04e44914 [gaim-migrate @ 6832]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
341 return;
e06e04e44914 [gaim-migrate @ 6832]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
342
e06e04e44914 [gaim-migrate @ 6832]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
343 buf = g_strdup_printf(_("Unknown message '%s'"), args[1]);
e06e04e44914 [gaim-migrate @ 6832]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
344 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
345 g_free(buf);
e06e04e44914 [gaim-migrate @ 6832]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
346 }
e06e04e44914 [gaim-migrate @ 6832]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
347
e06e04e44914 [gaim-migrate @ 6832]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
348 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
349 {
e06e04e44914 [gaim-migrate @ 6832]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
350 char *names, *cur, *end, *tmp, *msg;
e06e04e44914 [gaim-migrate @ 6832]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
351 GaimConversation *convo;
e06e04e44914 [gaim-migrate @ 6832]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
352
e06e04e44914 [gaim-migrate @ 6832]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
353 if (!strcmp(name, "366")) {
11338
17142948653e [gaim-migrate @ 13551]
Mark Doliner <mark@kingant.net>
parents: 11026
diff changeset
354 convo = gaim_find_conversation_with_account(GAIM_CONV_TYPE_ANY, irc->nameconv ? irc->nameconv : args[1], irc->account);
6333
e06e04e44914 [gaim-migrate @ 6832]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
355 if (!convo) {
e06e04e44914 [gaim-migrate @ 6832]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
356 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
357 g_string_free(irc->names, TRUE);
e06e04e44914 [gaim-migrate @ 6832]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
358 irc->names = NULL;
e06e04e44914 [gaim-migrate @ 6832]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
359 g_free(irc->nameconv);
e06e04e44914 [gaim-migrate @ 6832]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
360 irc->nameconv = NULL;
e06e04e44914 [gaim-migrate @ 6832]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
361 return;
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
e06e04e44914 [gaim-migrate @ 6832]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
364 names = cur = g_string_free(irc->names, FALSE);
e06e04e44914 [gaim-migrate @ 6832]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
365 irc->names = NULL;
e06e04e44914 [gaim-migrate @ 6832]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
366 if (irc->nameconv) {
11026
a659e6bac294 [gaim-migrate @ 12901]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 10816
diff changeset
367 msg = g_strdup_printf(_("Users on %s: %s"), args[1], names ? names : "");
11338
17142948653e [gaim-migrate @ 13551]
Mark Doliner <mark@kingant.net>
parents: 11026
diff changeset
368 if (gaim_conversation_get_type(convo) == GAIM_CONV_TYPE_CHAT)
7118
bf630f7dfdcd [gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents: 7108
diff changeset
369 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
370 else
7118
bf630f7dfdcd [gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents: 7108
diff changeset
371 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
372 g_free(msg);
e06e04e44914 [gaim-migrate @ 6832]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
373 g_free(irc->nameconv);
e06e04e44914 [gaim-migrate @ 6832]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
374 irc->nameconv = NULL;
e06e04e44914 [gaim-migrate @ 6832]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
375 } else {
6407
ba0b99a72be2 [gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents: 6357
diff changeset
376 GList *users = NULL;
9554
8b2451878e26 [gaim-migrate @ 10387]
Luke Schierer <lschiere@pidgin.im>
parents: 9518
diff changeset
377 GList *flags = NULL;
6407
ba0b99a72be2 [gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents: 6357
diff changeset
378
6333
e06e04e44914 [gaim-migrate @ 6832]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
379 while (*cur) {
9554
8b2451878e26 [gaim-migrate @ 10387]
Luke Schierer <lschiere@pidgin.im>
parents: 9518
diff changeset
380 GaimConvChatBuddyFlags f = GAIM_CBFLAGS_NONE;
6333
e06e04e44914 [gaim-migrate @ 6832]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
381 end = strchr(cur, ' ');
e06e04e44914 [gaim-migrate @ 6832]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
382 if (!end)
e06e04e44914 [gaim-migrate @ 6832]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
383 end = cur + strlen(cur);
9554
8b2451878e26 [gaim-migrate @ 10387]
Luke Schierer <lschiere@pidgin.im>
parents: 9518
diff changeset
384 if (*cur == '@') {
8b2451878e26 [gaim-migrate @ 10387]
Luke Schierer <lschiere@pidgin.im>
parents: 9518
diff changeset
385 f = GAIM_CBFLAGS_OP;
6333
e06e04e44914 [gaim-migrate @ 6832]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
386 cur++;
9554
8b2451878e26 [gaim-migrate @ 10387]
Luke Schierer <lschiere@pidgin.im>
parents: 9518
diff changeset
387 } else if (*cur == '%') {
8b2451878e26 [gaim-migrate @ 10387]
Luke Schierer <lschiere@pidgin.im>
parents: 9518
diff changeset
388 f = GAIM_CBFLAGS_HALFOP;
8b2451878e26 [gaim-migrate @ 10387]
Luke Schierer <lschiere@pidgin.im>
parents: 9518
diff changeset
389 cur++;
8b2451878e26 [gaim-migrate @ 10387]
Luke Schierer <lschiere@pidgin.im>
parents: 9518
diff changeset
390 } else if(*cur == '+') {
8b2451878e26 [gaim-migrate @ 10387]
Luke Schierer <lschiere@pidgin.im>
parents: 9518
diff changeset
391 f = GAIM_CBFLAGS_VOICE;
8b2451878e26 [gaim-migrate @ 10387]
Luke Schierer <lschiere@pidgin.im>
parents: 9518
diff changeset
392 cur++;
8b2451878e26 [gaim-migrate @ 10387]
Luke Schierer <lschiere@pidgin.im>
parents: 9518
diff changeset
393 }
6333
e06e04e44914 [gaim-migrate @ 6832]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
394 tmp = g_strndup(cur, end - cur);
11869
3ba50c385299 [gaim-migrate @ 14160]
Stu Tomlinson <stu@nosnilmot.com>
parents: 11535
diff changeset
395 users = g_list_prepend(users, tmp);
3ba50c385299 [gaim-migrate @ 14160]
Stu Tomlinson <stu@nosnilmot.com>
parents: 11535
diff changeset
396 flags = g_list_prepend(flags, GINT_TO_POINTER(f));
6333
e06e04e44914 [gaim-migrate @ 6832]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
397 cur = end;
e06e04e44914 [gaim-migrate @ 6832]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
398 if (*cur)
e06e04e44914 [gaim-migrate @ 6832]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
399 cur++;
e06e04e44914 [gaim-migrate @ 6832]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
400 }
6407
ba0b99a72be2 [gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents: 6357
diff changeset
401
ba0b99a72be2 [gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents: 6357
diff changeset
402 if (users != NULL) {
ba0b99a72be2 [gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents: 6357
diff changeset
403 GList *l;
ba0b99a72be2 [gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents: 6357
diff changeset
404
11454
201617d49573 [gaim-migrate @ 13693]
Richard Laager <rlaager@wiktel.com>
parents: 11386
diff changeset
405 gaim_conv_chat_add_users(GAIM_CONV_CHAT(convo), users, NULL, flags, FALSE);
6407
ba0b99a72be2 [gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents: 6357
diff changeset
406
ba0b99a72be2 [gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents: 6357
diff changeset
407 for (l = users; l != NULL; l = l->next)
ba0b99a72be2 [gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents: 6357
diff changeset
408 g_free(l->data);
ba0b99a72be2 [gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents: 6357
diff changeset
409
ba0b99a72be2 [gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents: 6357
diff changeset
410 g_list_free(users);
9554
8b2451878e26 [gaim-migrate @ 10387]
Luke Schierer <lschiere@pidgin.im>
parents: 9518
diff changeset
411 g_list_free(flags);
6407
ba0b99a72be2 [gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents: 6357
diff changeset
412 }
6333
e06e04e44914 [gaim-migrate @ 6832]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
413 }
e06e04e44914 [gaim-migrate @ 6832]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
414 g_free(names);
e06e04e44914 [gaim-migrate @ 6832]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
415 } else {
e06e04e44914 [gaim-migrate @ 6832]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
416 if (!irc->names)
e06e04e44914 [gaim-migrate @ 6832]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
417 irc->names = g_string_new("");
e06e04e44914 [gaim-migrate @ 6832]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
418
e06e04e44914 [gaim-migrate @ 6832]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
419 irc->names = g_string_append(irc->names, args[3]);
e06e04e44914 [gaim-migrate @ 6832]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
420 }
e06e04e44914 [gaim-migrate @ 6832]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
421 }
e06e04e44914 [gaim-migrate @ 6832]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
422
e06e04e44914 [gaim-migrate @ 6832]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
423 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
424 {
e06e04e44914 [gaim-migrate @ 6832]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
425 GaimConnection *gc;
10774
d83f745c997b [gaim-migrate @ 12383]
Stu Tomlinson <stu@nosnilmot.com>
parents: 10751
diff changeset
426 char *escaped;
6333
e06e04e44914 [gaim-migrate @ 6832]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
427 if (!strcmp(name, "375")) {
e06e04e44914 [gaim-migrate @ 6832]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
428 gc = gaim_account_get_connection(irc->account);
e06e04e44914 [gaim-migrate @ 6832]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
429 if (gc)
e06e04e44914 [gaim-migrate @ 6832]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
430 gaim_connection_set_display_name(gc, args[0]);
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 if (!irc->motd)
e06e04e44914 [gaim-migrate @ 6832]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
434 irc->motd = g_string_new("");
e06e04e44914 [gaim-migrate @ 6832]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
435
10774
d83f745c997b [gaim-migrate @ 12383]
Stu Tomlinson <stu@nosnilmot.com>
parents: 10751
diff changeset
436 escaped = g_markup_escape_text(args[1], -1);
d83f745c997b [gaim-migrate @ 12383]
Stu Tomlinson <stu@nosnilmot.com>
parents: 10751
diff changeset
437 g_string_append_printf(irc->motd, "%s<br>", escaped);
d83f745c997b [gaim-migrate @ 12383]
Stu Tomlinson <stu@nosnilmot.com>
parents: 10751
diff changeset
438 g_free(escaped);
6333
e06e04e44914 [gaim-migrate @ 6832]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
439 }
e06e04e44914 [gaim-migrate @ 6832]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
440
e06e04e44914 [gaim-migrate @ 6832]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
441 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
442 {
e06e04e44914 [gaim-migrate @ 6832]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
443 GaimConnection *gc;
12001
8bcccf2988fa [gaim-migrate @ 14294]
Mark Doliner <mark@kingant.net>
parents: 11869
diff changeset
444 GaimStatus *status;
11489
63e339161d83 [gaim-migrate @ 13731]
Stu Tomlinson <stu@nosnilmot.com>
parents: 11454
diff changeset
445 GaimBlistNode *gnode, *cnode, *bnode;
6333
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 gc = gaim_account_get_connection(irc->account);
e06e04e44914 [gaim-migrate @ 6832]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
448 if (!gc)
e06e04e44914 [gaim-migrate @ 6832]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
449 return;
e06e04e44914 [gaim-migrate @ 6832]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
450
e06e04e44914 [gaim-migrate @ 6832]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
451 gaim_connection_set_state(gc, GAIM_CONNECTED);
e06e04e44914 [gaim-migrate @ 6832]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
452
12001
8bcccf2988fa [gaim-migrate @ 14294]
Mark Doliner <mark@kingant.net>
parents: 11869
diff changeset
453 /* If we're away then set our away message */
8bcccf2988fa [gaim-migrate @ 14294]
Mark Doliner <mark@kingant.net>
parents: 11869
diff changeset
454 status = gaim_account_get_active_status(irc->account);
8bcccf2988fa [gaim-migrate @ 14294]
Mark Doliner <mark@kingant.net>
parents: 11869
diff changeset
455 if (!gaim_status_get_type(status) != GAIM_STATUS_AVAILABLE)
8bcccf2988fa [gaim-migrate @ 14294]
Mark Doliner <mark@kingant.net>
parents: 11869
diff changeset
456 {
8bcccf2988fa [gaim-migrate @ 14294]
Mark Doliner <mark@kingant.net>
parents: 11869
diff changeset
457 GaimPluginProtocolInfo *prpl_info = GAIM_PLUGIN_PROTOCOL_INFO(gc->prpl);
8bcccf2988fa [gaim-migrate @ 14294]
Mark Doliner <mark@kingant.net>
parents: 11869
diff changeset
458 prpl_info->set_status(irc->account, status);
8bcccf2988fa [gaim-migrate @ 14294]
Mark Doliner <mark@kingant.net>
parents: 11869
diff changeset
459 }
8bcccf2988fa [gaim-migrate @ 14294]
Mark Doliner <mark@kingant.net>
parents: 11869
diff changeset
460
11489
63e339161d83 [gaim-migrate @ 13731]
Stu Tomlinson <stu@nosnilmot.com>
parents: 11454
diff changeset
461 /* this used to be in the core, but it's not now */
63e339161d83 [gaim-migrate @ 13731]
Stu Tomlinson <stu@nosnilmot.com>
parents: 11454
diff changeset
462 for (gnode = gaim_get_blist()->root; gnode; gnode = gnode->next) {
63e339161d83 [gaim-migrate @ 13731]
Stu Tomlinson <stu@nosnilmot.com>
parents: 11454
diff changeset
463 if(!GAIM_BLIST_NODE_IS_GROUP(gnode))
63e339161d83 [gaim-migrate @ 13731]
Stu Tomlinson <stu@nosnilmot.com>
parents: 11454
diff changeset
464 continue;
63e339161d83 [gaim-migrate @ 13731]
Stu Tomlinson <stu@nosnilmot.com>
parents: 11454
diff changeset
465 for(cnode = gnode->child; cnode; cnode = cnode->next) {
63e339161d83 [gaim-migrate @ 13731]
Stu Tomlinson <stu@nosnilmot.com>
parents: 11454
diff changeset
466 if(!GAIM_BLIST_NODE_IS_CONTACT(cnode))
63e339161d83 [gaim-migrate @ 13731]
Stu Tomlinson <stu@nosnilmot.com>
parents: 11454
diff changeset
467 continue;
63e339161d83 [gaim-migrate @ 13731]
Stu Tomlinson <stu@nosnilmot.com>
parents: 11454
diff changeset
468 for(bnode = cnode->child; bnode; bnode = bnode->next) {
63e339161d83 [gaim-migrate @ 13731]
Stu Tomlinson <stu@nosnilmot.com>
parents: 11454
diff changeset
469 GaimBuddy *b;
63e339161d83 [gaim-migrate @ 13731]
Stu Tomlinson <stu@nosnilmot.com>
parents: 11454
diff changeset
470 if(!GAIM_BLIST_NODE_IS_BUDDY(bnode))
63e339161d83 [gaim-migrate @ 13731]
Stu Tomlinson <stu@nosnilmot.com>
parents: 11454
diff changeset
471 continue;
63e339161d83 [gaim-migrate @ 13731]
Stu Tomlinson <stu@nosnilmot.com>
parents: 11454
diff changeset
472 b = (GaimBuddy *)bnode;
63e339161d83 [gaim-migrate @ 13731]
Stu Tomlinson <stu@nosnilmot.com>
parents: 11454
diff changeset
473 if(b->account == gc->account) {
63e339161d83 [gaim-migrate @ 13731]
Stu Tomlinson <stu@nosnilmot.com>
parents: 11454
diff changeset
474 struct irc_buddy *ib = g_new0(struct irc_buddy, 1);
63e339161d83 [gaim-migrate @ 13731]
Stu Tomlinson <stu@nosnilmot.com>
parents: 11454
diff changeset
475 ib->name = g_strdup(b->name);
63e339161d83 [gaim-migrate @ 13731]
Stu Tomlinson <stu@nosnilmot.com>
parents: 11454
diff changeset
476 g_hash_table_insert(irc->buddies, ib->name, ib);
63e339161d83 [gaim-migrate @ 13731]
Stu Tomlinson <stu@nosnilmot.com>
parents: 11454
diff changeset
477 }
63e339161d83 [gaim-migrate @ 13731]
Stu Tomlinson <stu@nosnilmot.com>
parents: 11454
diff changeset
478 }
63e339161d83 [gaim-migrate @ 13731]
Stu Tomlinson <stu@nosnilmot.com>
parents: 11454
diff changeset
479 }
63e339161d83 [gaim-migrate @ 13731]
Stu Tomlinson <stu@nosnilmot.com>
parents: 11454
diff changeset
480 }
63e339161d83 [gaim-migrate @ 13731]
Stu Tomlinson <stu@nosnilmot.com>
parents: 11454
diff changeset
481
6333
e06e04e44914 [gaim-migrate @ 6832]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
482 irc_blist_timeout(irc);
8872
07404dc25af8 [gaim-migrate @ 9640]
Ethan Blanton <elb@pidgin.im>
parents: 8529
diff changeset
483 if (!irc->timer)
07404dc25af8 [gaim-migrate @ 9640]
Ethan Blanton <elb@pidgin.im>
parents: 8529
diff changeset
484 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
485 }
e06e04e44914 [gaim-migrate @ 6832]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
486
10564
cdeb727d1de3 [gaim-migrate @ 11946]
Ethan Blanton <elb@pidgin.im>
parents: 10551
diff changeset
487 void irc_msg_time(struct irc_conn *irc, const char *name, const char *from, char **args)
cdeb727d1de3 [gaim-migrate @ 11946]
Ethan Blanton <elb@pidgin.im>
parents: 10551
diff changeset
488 {
cdeb727d1de3 [gaim-migrate @ 11946]
Ethan Blanton <elb@pidgin.im>
parents: 10551
diff changeset
489 GaimConnection *gc;
cdeb727d1de3 [gaim-migrate @ 11946]
Ethan Blanton <elb@pidgin.im>
parents: 10551
diff changeset
490
cdeb727d1de3 [gaim-migrate @ 11946]
Ethan Blanton <elb@pidgin.im>
parents: 10551
diff changeset
491 gc = gaim_account_get_connection(irc->account);
cdeb727d1de3 [gaim-migrate @ 11946]
Ethan Blanton <elb@pidgin.im>
parents: 10551
diff changeset
492 if (gc == NULL || args == NULL || args[2] == NULL)
cdeb727d1de3 [gaim-migrate @ 11946]
Ethan Blanton <elb@pidgin.im>
parents: 10551
diff changeset
493 return;
cdeb727d1de3 [gaim-migrate @ 11946]
Ethan Blanton <elb@pidgin.im>
parents: 10551
diff changeset
494
cdeb727d1de3 [gaim-migrate @ 11946]
Ethan Blanton <elb@pidgin.im>
parents: 10551
diff changeset
495 gaim_notify_message(gc, GAIM_NOTIFY_MSG_INFO, _("Time Response"),
cdeb727d1de3 [gaim-migrate @ 11946]
Ethan Blanton <elb@pidgin.im>
parents: 10551
diff changeset
496 _("The IRC server's local time is:"),
cdeb727d1de3 [gaim-migrate @ 11946]
Ethan Blanton <elb@pidgin.im>
parents: 10551
diff changeset
497 args[2], NULL, NULL);
cdeb727d1de3 [gaim-migrate @ 11946]
Ethan Blanton <elb@pidgin.im>
parents: 10551
diff changeset
498 }
cdeb727d1de3 [gaim-migrate @ 11946]
Ethan Blanton <elb@pidgin.im>
parents: 10551
diff changeset
499
7877
828856b7fe30 [gaim-migrate @ 8531]
Ethan Blanton <elb@pidgin.im>
parents: 7118
diff changeset
500 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
501 {
828856b7fe30 [gaim-migrate @ 8531]
Ethan Blanton <elb@pidgin.im>
parents: 7118
diff changeset
502 GaimConnection *gc = gaim_account_get_connection(irc->account);
828856b7fe30 [gaim-migrate @ 8531]
Ethan Blanton <elb@pidgin.im>
parents: 7118
diff changeset
503
828856b7fe30 [gaim-migrate @ 8531]
Ethan Blanton <elb@pidgin.im>
parents: 7118
diff changeset
504 if (gc == NULL || args == NULL || args[1] == NULL)
828856b7fe30 [gaim-migrate @ 8531]
Ethan Blanton <elb@pidgin.im>
parents: 7118
diff changeset
505 return;
828856b7fe30 [gaim-migrate @ 8531]
Ethan Blanton <elb@pidgin.im>
parents: 7118
diff changeset
506
828856b7fe30 [gaim-migrate @ 8531]
Ethan Blanton <elb@pidgin.im>
parents: 7118
diff changeset
507 gaim_notify_error(gc, NULL, _("No such channel"), args[1]);
828856b7fe30 [gaim-migrate @ 8531]
Ethan Blanton <elb@pidgin.im>
parents: 7118
diff changeset
508 }
828856b7fe30 [gaim-migrate @ 8531]
Ethan Blanton <elb@pidgin.im>
parents: 7118
diff changeset
509
6333
e06e04e44914 [gaim-migrate @ 6832]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
510 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
511 {
e06e04e44914 [gaim-migrate @ 6832]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
512 GaimConnection *gc;
e06e04e44914 [gaim-migrate @ 6832]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
513 GaimConversation *convo;
e06e04e44914 [gaim-migrate @ 6832]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
514
11338
17142948653e [gaim-migrate @ 13551]
Mark Doliner <mark@kingant.net>
parents: 11026
diff changeset
515 convo = gaim_find_conversation_with_account(GAIM_CONV_TYPE_ANY, args[1], irc->account);
6333
e06e04e44914 [gaim-migrate @ 6832]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
516 if (convo) {
11338
17142948653e [gaim-migrate @ 13551]
Mark Doliner <mark@kingant.net>
parents: 11026
diff changeset
517 if (gaim_conversation_get_type(convo) == GAIM_CONV_TYPE_CHAT) /* does this happen? */
7118
bf630f7dfdcd [gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents: 7108
diff changeset
518 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
519 GAIM_MESSAGE_SYSTEM|GAIM_MESSAGE_NO_LOG, time(NULL));
6333
e06e04e44914 [gaim-migrate @ 6832]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
520 else
7118
bf630f7dfdcd [gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents: 7108
diff changeset
521 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
522 GAIM_MESSAGE_SYSTEM|GAIM_MESSAGE_NO_LOG, time(NULL));
6333
e06e04e44914 [gaim-migrate @ 6832]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
523 } else {
e06e04e44914 [gaim-migrate @ 6832]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
524 if ((gc = gaim_account_get_connection(irc->account)) == NULL)
e06e04e44914 [gaim-migrate @ 6832]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
525 return;
10774
d83f745c997b [gaim-migrate @ 12383]
Stu Tomlinson <stu@nosnilmot.com>
parents: 10751
diff changeset
526 gaim_notify_error(gc, NULL, _("No such nick or channel"), args[1]);
6333
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
e06e04e44914 [gaim-migrate @ 6832]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
529 if (irc->whois.nick && !gaim_utf8_strcasecmp(irc->whois.nick, args[1])) {
e06e04e44914 [gaim-migrate @ 6832]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
530 g_free(irc->whois.nick);
e06e04e44914 [gaim-migrate @ 6832]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
531 irc->whois.nick = NULL;
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 }
e06e04e44914 [gaim-migrate @ 6832]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
534
e06e04e44914 [gaim-migrate @ 6832]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
535 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
536 {
e06e04e44914 [gaim-migrate @ 6832]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
537 GaimConnection *gc;
e06e04e44914 [gaim-migrate @ 6832]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
538 GaimConversation *convo;
e06e04e44914 [gaim-migrate @ 6832]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
539
11338
17142948653e [gaim-migrate @ 13551]
Mark Doliner <mark@kingant.net>
parents: 11026
diff changeset
540 convo = gaim_find_conversation_with_account(GAIM_CONV_TYPE_CHAT, args[1], irc->account);
6333
e06e04e44914 [gaim-migrate @ 6832]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
541 if (convo) {
7118
bf630f7dfdcd [gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents: 7108
diff changeset
542 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
543 } else {
e06e04e44914 [gaim-migrate @ 6832]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
544 if ((gc = gaim_account_get_connection(irc->account)) == NULL)
e06e04e44914 [gaim-migrate @ 6832]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
545 return;
e06e04e44914 [gaim-migrate @ 6832]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
546 gaim_notify_error(gc, NULL, _("Could not send"), args[2]);
e06e04e44914 [gaim-migrate @ 6832]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
547 }
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
e06e04e44914 [gaim-migrate @ 6832]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
550 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
551 {
11338
17142948653e [gaim-migrate @ 13551]
Mark Doliner <mark@kingant.net>
parents: 11026
diff changeset
552 GaimConversation *convo = gaim_find_conversation_with_account(GAIM_CONV_TYPE_CHAT, args[1], irc->account);
6333
e06e04e44914 [gaim-migrate @ 6832]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
553
e06e04e44914 [gaim-migrate @ 6832]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
554 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
555 if (convo) {
e06e04e44914 [gaim-migrate @ 6832]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
556 /*g_slist_remove(irc->gc->buddy_chats, convo);
e06e04e44914 [gaim-migrate @ 6832]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
557 gaim_conversation_set_account(convo, NULL);*/
7118
bf630f7dfdcd [gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents: 7108
diff changeset
558 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
559 }
e06e04e44914 [gaim-migrate @ 6832]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
560 }
e06e04e44914 [gaim-migrate @ 6832]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
561
e06e04e44914 [gaim-migrate @ 6832]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
562 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
563 {
e06e04e44914 [gaim-migrate @ 6832]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
564 GaimConversation *convo;
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 if (!args || !args[1] || !args[2])
e06e04e44914 [gaim-migrate @ 6832]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
567 return;
e06e04e44914 [gaim-migrate @ 6832]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
568
11338
17142948653e [gaim-migrate @ 13551]
Mark Doliner <mark@kingant.net>
parents: 11026
diff changeset
569 convo = gaim_find_conversation_with_account(GAIM_CONV_TYPE_CHAT, args[1], irc->account);
6333
e06e04e44914 [gaim-migrate @ 6832]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
570 if (!convo)
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
7118
bf630f7dfdcd [gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents: 7108
diff changeset
573 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
574 }
e06e04e44914 [gaim-migrate @ 6832]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
575
e06e04e44914 [gaim-migrate @ 6832]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
576 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
577 {
e06e04e44914 [gaim-migrate @ 6832]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
578 GaimConnection *gc = gaim_account_get_connection(irc->account);
e06e04e44914 [gaim-migrate @ 6832]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
579 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
580 char *nick = irc_mask_nick(from);
e06e04e44914 [gaim-migrate @ 6832]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
581
e06e04e44914 [gaim-migrate @ 6832]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
582 if (!args || !args[1] || !gc) {
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 g_hash_table_destroy(components);
e06e04e44914 [gaim-migrate @ 6832]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
585 return;
e06e04e44914 [gaim-migrate @ 6832]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
586 }
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 g_hash_table_insert(components, strdup("channel"), strdup(args[1]));
e06e04e44914 [gaim-migrate @ 6832]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
589
e06e04e44914 [gaim-migrate @ 6832]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
590 serv_got_chat_invite(gc, args[1], nick, NULL, components);
e06e04e44914 [gaim-migrate @ 6832]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
591 g_free(nick);
e06e04e44914 [gaim-migrate @ 6832]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
592 }
e06e04e44914 [gaim-migrate @ 6832]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
593
e06e04e44914 [gaim-migrate @ 6832]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
594 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
595 {
e06e04e44914 [gaim-migrate @ 6832]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
596 GaimConnection *gc = gaim_account_get_connection(irc->account);
e06e04e44914 [gaim-migrate @ 6832]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
597 char *buf;
e06e04e44914 [gaim-migrate @ 6832]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
598
e06e04e44914 [gaim-migrate @ 6832]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
599 if (!args || !args[1] || !gc)
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 buf = g_strdup_printf(_("Joining %s requires an invitation."), args[1]);
e06e04e44914 [gaim-migrate @ 6832]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
603 gaim_notify_error(gc, _("Invitation only"), _("Invitation only"), buf);
e06e04e44914 [gaim-migrate @ 6832]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
604 g_free(buf);
e06e04e44914 [gaim-migrate @ 6832]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
605 }
e06e04e44914 [gaim-migrate @ 6832]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
606
e06e04e44914 [gaim-migrate @ 6832]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
607 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
608 {
e06e04e44914 [gaim-migrate @ 6832]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
609 char **nicks;
e06e04e44914 [gaim-migrate @ 6832]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
610 struct irc_buddy *ib;
e06e04e44914 [gaim-migrate @ 6832]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
611 int i;
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 if (!args || !args[1])
e06e04e44914 [gaim-migrate @ 6832]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
614 return;
e06e04e44914 [gaim-migrate @ 6832]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
615
e06e04e44914 [gaim-migrate @ 6832]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
616 nicks = g_strsplit(args[1], " ", -1);
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 for (i = 0; nicks[i]; i++) {
e06e04e44914 [gaim-migrate @ 6832]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
619 if ((ib = g_hash_table_lookup(irc->buddies, (gconstpointer)nicks[i])) == NULL) {
e06e04e44914 [gaim-migrate @ 6832]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
620 continue;
e06e04e44914 [gaim-migrate @ 6832]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
621 }
e06e04e44914 [gaim-migrate @ 6832]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
622 ib->flag = TRUE;
e06e04e44914 [gaim-migrate @ 6832]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
623 }
e06e04e44914 [gaim-migrate @ 6832]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
624
6350
34c07f5f34a0 [gaim-migrate @ 6849]
Mark Doliner <mark@kingant.net>
parents: 6333
diff changeset
625 g_strfreev(nicks);
34c07f5f34a0 [gaim-migrate @ 6849]
Mark Doliner <mark@kingant.net>
parents: 6333
diff changeset
626
6333
e06e04e44914 [gaim-migrate @ 6832]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
627 g_hash_table_foreach(irc->buddies, (GHFunc)irc_buddy_status, (gpointer)irc);
e06e04e44914 [gaim-migrate @ 6832]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
628 }
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 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
631 {
e06e04e44914 [gaim-migrate @ 6832]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
632 GaimConnection *gc = gaim_account_get_connection(irc->account);
6695
0c5637b5462e [gaim-migrate @ 7221]
Nathan Walp <nwalp@pidgin.im>
parents: 6622
diff changeset
633 GaimBuddy *buddy = gaim_find_buddy(irc->account, name);
6333
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 if (!gc || !buddy)
e06e04e44914 [gaim-migrate @ 6832]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
636 return;
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 if (ib->online && !ib->flag) {
10242
c66da6503db8 [gaim-migrate @ 11381]
Tim Ringenbach <marv@pidgin.im>
parents: 9951
diff changeset
639 gaim_prpl_got_user_status(irc->account, name, "offline", NULL);
6333
e06e04e44914 [gaim-migrate @ 6832]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
640 ib->online = FALSE;
10242
c66da6503db8 [gaim-migrate @ 11381]
Tim Ringenbach <marv@pidgin.im>
parents: 9951
diff changeset
641 } else if (!ib->online && ib->flag) {
11535
bb98b2c09224 [gaim-migrate @ 13787]
Stu Tomlinson <stu@nosnilmot.com>
parents: 11533
diff changeset
642 gaim_prpl_got_user_status(irc->account, name, "available", NULL);
6333
e06e04e44914 [gaim-migrate @ 6832]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
643 ib->online = TRUE;
e06e04e44914 [gaim-migrate @ 6832]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
644 }
e06e04e44914 [gaim-migrate @ 6832]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
645 }
e06e04e44914 [gaim-migrate @ 6832]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
646
e06e04e44914 [gaim-migrate @ 6832]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
647 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
648 {
e06e04e44914 [gaim-migrate @ 6832]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
649 GaimConnection *gc = gaim_account_get_connection(irc->account);
e06e04e44914 [gaim-migrate @ 6832]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
650 GaimConversation *convo;
e06e04e44914 [gaim-migrate @ 6832]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
651 char *nick = irc_mask_nick(from), *userhost;
9238
f4f210e47b60 [gaim-migrate @ 10036]
Ethan Blanton <elb@pidgin.im>
parents: 9057
diff changeset
652 struct irc_buddy *ib;
6333
e06e04e44914 [gaim-migrate @ 6832]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
653 static int id = 1;
e06e04e44914 [gaim-migrate @ 6832]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
654
e06e04e44914 [gaim-migrate @ 6832]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
655 if (!gc) {
e06e04e44914 [gaim-migrate @ 6832]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
656 g_free(nick);
e06e04e44914 [gaim-migrate @ 6832]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
657 return;
e06e04e44914 [gaim-migrate @ 6832]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
658 }
e06e04e44914 [gaim-migrate @ 6832]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
659
e06e04e44914 [gaim-migrate @ 6832]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
660 if (!gaim_utf8_strcasecmp(nick, gaim_connection_get_display_name(gc))) {
e06e04e44914 [gaim-migrate @ 6832]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
661 /* We are joining a channel for the first time */
e06e04e44914 [gaim-migrate @ 6832]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
662 serv_got_joined_chat(gc, id++, args[0]);
e06e04e44914 [gaim-migrate @ 6832]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
663 g_free(nick);
e06e04e44914 [gaim-migrate @ 6832]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
664 return;
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
11338
17142948653e [gaim-migrate @ 13551]
Mark Doliner <mark@kingant.net>
parents: 11026
diff changeset
667 convo = gaim_find_conversation_with_account(GAIM_CONV_TYPE_CHAT, args[0], irc->account);
6333
e06e04e44914 [gaim-migrate @ 6832]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
668 if (convo == NULL) {
e06e04e44914 [gaim-migrate @ 6832]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
669 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
670 g_free(nick);
e06e04e44914 [gaim-migrate @ 6832]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
671 return;
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
e06e04e44914 [gaim-migrate @ 6832]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
674 userhost = irc_mask_userhost(from);
9846
c28d5b45624e [gaim-migrate @ 10724]
Mark Doliner <mark@kingant.net>
parents: 9797
diff changeset
675 gaim_conv_chat_add_user(GAIM_CONV_CHAT(convo), nick, userhost, GAIM_CBFLAGS_NONE, TRUE);
9238
f4f210e47b60 [gaim-migrate @ 10036]
Ethan Blanton <elb@pidgin.im>
parents: 9057
diff changeset
676
f4f210e47b60 [gaim-migrate @ 10036]
Ethan Blanton <elb@pidgin.im>
parents: 9057
diff changeset
677 if ((ib = g_hash_table_lookup(irc->buddies, nick)) != NULL) {
f4f210e47b60 [gaim-migrate @ 10036]
Ethan Blanton <elb@pidgin.im>
parents: 9057
diff changeset
678 ib->flag = TRUE;
f4f210e47b60 [gaim-migrate @ 10036]
Ethan Blanton <elb@pidgin.im>
parents: 9057
diff changeset
679 irc_buddy_status(nick, ib, irc);
f4f210e47b60 [gaim-migrate @ 10036]
Ethan Blanton <elb@pidgin.im>
parents: 9057
diff changeset
680 }
f4f210e47b60 [gaim-migrate @ 10036]
Ethan Blanton <elb@pidgin.im>
parents: 9057
diff changeset
681
6333
e06e04e44914 [gaim-migrate @ 6832]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
682 g_free(userhost);
e06e04e44914 [gaim-migrate @ 6832]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
683 g_free(nick);
e06e04e44914 [gaim-migrate @ 6832]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
684 }
e06e04e44914 [gaim-migrate @ 6832]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
685
e06e04e44914 [gaim-migrate @ 6832]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
686 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
687 {
e06e04e44914 [gaim-migrate @ 6832]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
688 GaimConnection *gc = gaim_account_get_connection(irc->account);
11338
17142948653e [gaim-migrate @ 13551]
Mark Doliner <mark@kingant.net>
parents: 11026
diff changeset
689 GaimConversation *convo = gaim_find_conversation_with_account(GAIM_CONV_TYPE_CHAT, args[0], irc->account);
12855
f9401180115a [gaim-migrate @ 15206]
Richard Laager <rlaager@wiktel.com>
parents: 12216
diff changeset
690 char *nick = irc_mask_nick(from), *buf;
6333
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 if (!gc) {
e06e04e44914 [gaim-migrate @ 6832]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
693 g_free(nick);
e06e04e44914 [gaim-migrate @ 6832]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
694 return;
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
e06e04e44914 [gaim-migrate @ 6832]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
697 if (!convo) {
e06e04e44914 [gaim-migrate @ 6832]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
698 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
699 g_free(nick);
e06e04e44914 [gaim-migrate @ 6832]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
700 return;
e06e04e44914 [gaim-migrate @ 6832]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
701 }
e06e04e44914 [gaim-migrate @ 6832]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
702
e06e04e44914 [gaim-migrate @ 6832]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
703 if (!gaim_utf8_strcasecmp(gaim_connection_get_display_name(gc), args[1])) {
12855
f9401180115a [gaim-migrate @ 15206]
Richard Laager <rlaager@wiktel.com>
parents: 12216
diff changeset
704 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
705 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
706 g_free(buf);
8256
1d86096ae0f4 [gaim-migrate @ 8979]
Christian Hammond <chipx86@chipx86.com>
parents: 8186
diff changeset
707 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
708 } else {
12855
f9401180115a [gaim-migrate @ 15206]
Richard Laager <rlaager@wiktel.com>
parents: 12216
diff changeset
709 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
710 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
711 g_free(buf);
e06e04e44914 [gaim-migrate @ 6832]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
712 }
e06e04e44914 [gaim-migrate @ 6832]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
713
e06e04e44914 [gaim-migrate @ 6832]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
714 g_free(nick);
e06e04e44914 [gaim-migrate @ 6832]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
715 return;
e06e04e44914 [gaim-migrate @ 6832]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
716 }
e06e04e44914 [gaim-migrate @ 6832]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
717
e06e04e44914 [gaim-migrate @ 6832]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
718 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
719 {
e06e04e44914 [gaim-migrate @ 6832]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
720 GaimConversation *convo;
e06e04e44914 [gaim-migrate @ 6832]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
721 char *nick = irc_mask_nick(from), *buf;
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 if (*args[0] == '#' || *args[0] == '&') { /* Channel */
10774
d83f745c997b [gaim-migrate @ 12383]
Stu Tomlinson <stu@nosnilmot.com>
parents: 10751
diff changeset
724 char *escaped;
11338
17142948653e [gaim-migrate @ 13551]
Mark Doliner <mark@kingant.net>
parents: 11026
diff changeset
725 convo = gaim_find_conversation_with_account(GAIM_CONV_TYPE_CHAT, args[0], irc->account);
6333
e06e04e44914 [gaim-migrate @ 6832]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
726 if (!convo) {
e06e04e44914 [gaim-migrate @ 6832]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
727 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
728 g_free(nick);
e06e04e44914 [gaim-migrate @ 6832]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
729 return;
e06e04e44914 [gaim-migrate @ 6832]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
730 }
10774
d83f745c997b [gaim-migrate @ 12383]
Stu Tomlinson <stu@nosnilmot.com>
parents: 10751
diff changeset
731 escaped = (args[2] != NULL) ? g_markup_escape_text(args[2], -1) : NULL;
d83f745c997b [gaim-migrate @ 12383]
Stu Tomlinson <stu@nosnilmot.com>
parents: 10751
diff changeset
732 buf = g_strdup_printf(_("mode (%s %s) by %s"), args[1], escaped ? escaped : "", nick);
12069
1019f1d510d6 [gaim-migrate @ 14364]
Richard Laager <rlaager@wiktel.com>
parents: 12001
diff changeset
733 gaim_conv_chat_write(GAIM_CONV_CHAT(convo), args[0], buf, GAIM_MESSAGE_SYSTEM, time(NULL));
10774
d83f745c997b [gaim-migrate @ 12383]
Stu Tomlinson <stu@nosnilmot.com>
parents: 10751
diff changeset
734 g_free(escaped);
6333
e06e04e44914 [gaim-migrate @ 6832]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
735 g_free(buf);
9554
8b2451878e26 [gaim-migrate @ 10387]
Luke Schierer <lschiere@pidgin.im>
parents: 9518
diff changeset
736 if(args[2]) {
8b2451878e26 [gaim-migrate @ 10387]
Luke Schierer <lschiere@pidgin.im>
parents: 9518
diff changeset
737 GaimConvChatBuddyFlags newflag, flags;
8b2451878e26 [gaim-migrate @ 10387]
Luke Schierer <lschiere@pidgin.im>
parents: 9518
diff changeset
738 char *mcur, *cur, *end, *user;
8b2451878e26 [gaim-migrate @ 10387]
Luke Schierer <lschiere@pidgin.im>
parents: 9518
diff changeset
739 gboolean add = FALSE;
8b2451878e26 [gaim-migrate @ 10387]
Luke Schierer <lschiere@pidgin.im>
parents: 9518
diff changeset
740 mcur = args[1];
8b2451878e26 [gaim-migrate @ 10387]
Luke Schierer <lschiere@pidgin.im>
parents: 9518
diff changeset
741 cur = args[2];
8b2451878e26 [gaim-migrate @ 10387]
Luke Schierer <lschiere@pidgin.im>
parents: 9518
diff changeset
742 while (*cur && *mcur) {
8b2451878e26 [gaim-migrate @ 10387]
Luke Schierer <lschiere@pidgin.im>
parents: 9518
diff changeset
743 if ((*mcur == '+') || (*mcur == '-')) {
8b2451878e26 [gaim-migrate @ 10387]
Luke Schierer <lschiere@pidgin.im>
parents: 9518
diff changeset
744 add = (*mcur == '+') ? TRUE : FALSE;
8b2451878e26 [gaim-migrate @ 10387]
Luke Schierer <lschiere@pidgin.im>
parents: 9518
diff changeset
745 mcur++;
8b2451878e26 [gaim-migrate @ 10387]
Luke Schierer <lschiere@pidgin.im>
parents: 9518
diff changeset
746 continue;
8b2451878e26 [gaim-migrate @ 10387]
Luke Schierer <lschiere@pidgin.im>
parents: 9518
diff changeset
747 }
8b2451878e26 [gaim-migrate @ 10387]
Luke Schierer <lschiere@pidgin.im>
parents: 9518
diff changeset
748 end = strchr(cur, ' ');
8b2451878e26 [gaim-migrate @ 10387]
Luke Schierer <lschiere@pidgin.im>
parents: 9518
diff changeset
749 if (!end)
8b2451878e26 [gaim-migrate @ 10387]
Luke Schierer <lschiere@pidgin.im>
parents: 9518
diff changeset
750 end = cur + strlen(cur);
8b2451878e26 [gaim-migrate @ 10387]
Luke Schierer <lschiere@pidgin.im>
parents: 9518
diff changeset
751 user = g_strndup(cur, end - cur);
8b2451878e26 [gaim-migrate @ 10387]
Luke Schierer <lschiere@pidgin.im>
parents: 9518
diff changeset
752 flags = gaim_conv_chat_user_get_flags(GAIM_CONV_CHAT(convo), user);
8b2451878e26 [gaim-migrate @ 10387]
Luke Schierer <lschiere@pidgin.im>
parents: 9518
diff changeset
753 newflag = GAIM_CBFLAGS_NONE;
8b2451878e26 [gaim-migrate @ 10387]
Luke Schierer <lschiere@pidgin.im>
parents: 9518
diff changeset
754 if (*mcur == 'o')
8b2451878e26 [gaim-migrate @ 10387]
Luke Schierer <lschiere@pidgin.im>
parents: 9518
diff changeset
755 newflag = GAIM_CBFLAGS_OP;
8b2451878e26 [gaim-migrate @ 10387]
Luke Schierer <lschiere@pidgin.im>
parents: 9518
diff changeset
756 else if (*mcur =='h')
8b2451878e26 [gaim-migrate @ 10387]
Luke Schierer <lschiere@pidgin.im>
parents: 9518
diff changeset
757 newflag = GAIM_CBFLAGS_HALFOP;
8b2451878e26 [gaim-migrate @ 10387]
Luke Schierer <lschiere@pidgin.im>
parents: 9518
diff changeset
758 else if (*mcur == 'v')
8b2451878e26 [gaim-migrate @ 10387]
Luke Schierer <lschiere@pidgin.im>
parents: 9518
diff changeset
759 newflag = GAIM_CBFLAGS_VOICE;
8b2451878e26 [gaim-migrate @ 10387]
Luke Schierer <lschiere@pidgin.im>
parents: 9518
diff changeset
760 if (newflag) {
8b2451878e26 [gaim-migrate @ 10387]
Luke Schierer <lschiere@pidgin.im>
parents: 9518
diff changeset
761 if (add)
8b2451878e26 [gaim-migrate @ 10387]
Luke Schierer <lschiere@pidgin.im>
parents: 9518
diff changeset
762 flags |= newflag;
8b2451878e26 [gaim-migrate @ 10387]
Luke Schierer <lschiere@pidgin.im>
parents: 9518
diff changeset
763 else
8b2451878e26 [gaim-migrate @ 10387]
Luke Schierer <lschiere@pidgin.im>
parents: 9518
diff changeset
764 flags &= ~newflag;
8b2451878e26 [gaim-migrate @ 10387]
Luke Schierer <lschiere@pidgin.im>
parents: 9518
diff changeset
765 gaim_conv_chat_user_set_flags(GAIM_CONV_CHAT(convo), user, flags);
8b2451878e26 [gaim-migrate @ 10387]
Luke Schierer <lschiere@pidgin.im>
parents: 9518
diff changeset
766 }
8b2451878e26 [gaim-migrate @ 10387]
Luke Schierer <lschiere@pidgin.im>
parents: 9518
diff changeset
767 g_free(user);
8b2451878e26 [gaim-migrate @ 10387]
Luke Schierer <lschiere@pidgin.im>
parents: 9518
diff changeset
768 cur = end;
8b2451878e26 [gaim-migrate @ 10387]
Luke Schierer <lschiere@pidgin.im>
parents: 9518
diff changeset
769 if (*cur)
8b2451878e26 [gaim-migrate @ 10387]
Luke Schierer <lschiere@pidgin.im>
parents: 9518
diff changeset
770 cur++;
8b2451878e26 [gaim-migrate @ 10387]
Luke Schierer <lschiere@pidgin.im>
parents: 9518
diff changeset
771 if (*mcur)
8b2451878e26 [gaim-migrate @ 10387]
Luke Schierer <lschiere@pidgin.im>
parents: 9518
diff changeset
772 mcur++;
8b2451878e26 [gaim-migrate @ 10387]
Luke Schierer <lschiere@pidgin.im>
parents: 9518
diff changeset
773 }
8b2451878e26 [gaim-migrate @ 10387]
Luke Schierer <lschiere@pidgin.im>
parents: 9518
diff changeset
774 }
6333
e06e04e44914 [gaim-migrate @ 6832]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
775 } else { /* User */
e06e04e44914 [gaim-migrate @ 6832]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
776 }
e06e04e44914 [gaim-migrate @ 6832]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
777 g_free(nick);
e06e04e44914 [gaim-migrate @ 6832]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
778 }
e06e04e44914 [gaim-migrate @ 6832]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
779
e06e04e44914 [gaim-migrate @ 6832]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
780 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
781 {
e06e04e44914 [gaim-migrate @ 6832]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
782 GaimConnection *gc = gaim_account_get_connection(irc->account);
10617
927de469483e [gaim-migrate @ 12081]
Ethan Blanton <elb@pidgin.im>
parents: 10564
diff changeset
783 GaimConversation *conv;
6333
e06e04e44914 [gaim-migrate @ 6832]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
784 GSList *chats;
e06e04e44914 [gaim-migrate @ 6832]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
785 char *nick = irc_mask_nick(from);
e06e04e44914 [gaim-migrate @ 6832]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
786
e06e04e44914 [gaim-migrate @ 6832]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
787 if (!gc) {
e06e04e44914 [gaim-migrate @ 6832]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
788 g_free(nick);
e06e04e44914 [gaim-migrate @ 6832]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
789 return;
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 chats = gc->buddy_chats;
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 if (!gaim_utf8_strcasecmp(nick, gaim_connection_get_display_name(gc))) {
e06e04e44914 [gaim-migrate @ 6832]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
794 gaim_connection_set_display_name(gc, args[0]);
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
e06e04e44914 [gaim-migrate @ 6832]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
797 while (chats) {
7118
bf630f7dfdcd [gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents: 7108
diff changeset
798 GaimConvChat *chat = GAIM_CONV_CHAT(chats->data);
9593
a64febebdd1e [gaim-migrate @ 10436]
Ethan Blanton <elb@pidgin.im>
parents: 9589
diff changeset
799 /* This is ugly ... */
a64febebdd1e [gaim-migrate @ 10436]
Ethan Blanton <elb@pidgin.im>
parents: 9589
diff changeset
800 if (gaim_conv_chat_find_user(chat, nick))
a64febebdd1e [gaim-migrate @ 10436]
Ethan Blanton <elb@pidgin.im>
parents: 9589
diff changeset
801 gaim_conv_chat_rename_user(chat, nick, args[0]);
6333
e06e04e44914 [gaim-migrate @ 6832]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
802 chats = chats->next;
e06e04e44914 [gaim-migrate @ 6832]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
803 }
10617
927de469483e [gaim-migrate @ 12081]
Ethan Blanton <elb@pidgin.im>
parents: 10564
diff changeset
804
11338
17142948653e [gaim-migrate @ 13551]
Mark Doliner <mark@kingant.net>
parents: 11026
diff changeset
805 conv = gaim_find_conversation_with_account(GAIM_CONV_TYPE_IM, nick,
10617
927de469483e [gaim-migrate @ 12081]
Ethan Blanton <elb@pidgin.im>
parents: 10564
diff changeset
806 irc->account);
927de469483e [gaim-migrate @ 12081]
Ethan Blanton <elb@pidgin.im>
parents: 10564
diff changeset
807 if (conv != NULL)
927de469483e [gaim-migrate @ 12081]
Ethan Blanton <elb@pidgin.im>
parents: 10564
diff changeset
808 gaim_conversation_set_name(conv, args[0]);
927de469483e [gaim-migrate @ 12081]
Ethan Blanton <elb@pidgin.im>
parents: 10564
diff changeset
809
6333
e06e04e44914 [gaim-migrate @ 6832]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
810 g_free(nick);
e06e04e44914 [gaim-migrate @ 6832]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
811 }
e06e04e44914 [gaim-migrate @ 6832]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
812
10633
eac0f2b244c2 [gaim-migrate @ 12113]
Ethan Blanton <elb@pidgin.im>
parents: 10617
diff changeset
813 void irc_msg_badnick(struct irc_conn *irc, const char *name, const char *from, char **args)
eac0f2b244c2 [gaim-migrate @ 12113]
Ethan Blanton <elb@pidgin.im>
parents: 10617
diff changeset
814 {
13057
5a9ff0c8593d [gaim-migrate @ 15419]
Ethan Blanton <elb@pidgin.im>
parents: 12855
diff changeset
815 GaimConnection *gc = gaim_account_get_connection(irc->account);
5a9ff0c8593d [gaim-migrate @ 15419]
Ethan Blanton <elb@pidgin.im>
parents: 12855
diff changeset
816 if (gaim_connection_get_state(gc) == GAIM_CONNECTED) {
5a9ff0c8593d [gaim-migrate @ 15419]
Ethan Blanton <elb@pidgin.im>
parents: 12855
diff changeset
817 gaim_notify_error(gc, _("Invalid nickname"),
5a9ff0c8593d [gaim-migrate @ 15419]
Ethan Blanton <elb@pidgin.im>
parents: 12855
diff changeset
818 _("Invalid nickname"),
5a9ff0c8593d [gaim-migrate @ 15419]
Ethan Blanton <elb@pidgin.im>
parents: 12855
diff changeset
819 _("Your selected nickname was rejected by the server. It probably contains invalid characters."));
5a9ff0c8593d [gaim-migrate @ 15419]
Ethan Blanton <elb@pidgin.im>
parents: 12855
diff changeset
820
5a9ff0c8593d [gaim-migrate @ 15419]
Ethan Blanton <elb@pidgin.im>
parents: 12855
diff changeset
821 } else {
5a9ff0c8593d [gaim-migrate @ 15419]
Ethan Blanton <elb@pidgin.im>
parents: 12855
diff changeset
822 gaim_connection_error(gaim_account_get_connection(irc->account),
5a9ff0c8593d [gaim-migrate @ 15419]
Ethan Blanton <elb@pidgin.im>
parents: 12855
diff changeset
823 _("Your selected account name was rejected by the server. It probably contains invalid characters."));
5a9ff0c8593d [gaim-migrate @ 15419]
Ethan Blanton <elb@pidgin.im>
parents: 12855
diff changeset
824 }
10633
eac0f2b244c2 [gaim-migrate @ 12113]
Ethan Blanton <elb@pidgin.im>
parents: 10617
diff changeset
825 }
eac0f2b244c2 [gaim-migrate @ 12113]
Ethan Blanton <elb@pidgin.im>
parents: 10617
diff changeset
826
6333
e06e04e44914 [gaim-migrate @ 6832]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
827 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
828 {
e06e04e44914 [gaim-migrate @ 6832]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
829 char *newnick, *buf, *end;
e06e04e44914 [gaim-migrate @ 6832]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
830
e06e04e44914 [gaim-migrate @ 6832]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
831 if (!args || !args[1])
e06e04e44914 [gaim-migrate @ 6832]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
832 return;
e06e04e44914 [gaim-migrate @ 6832]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
833
e06e04e44914 [gaim-migrate @ 6832]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
834 newnick = strdup(args[1]);
e06e04e44914 [gaim-migrate @ 6832]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
835 end = newnick + strlen(newnick) - 1;
11386
4eaa0f7eb3c9 [gaim-migrate @ 13614]
Thomas Butter <tbutter>
parents: 11338
diff changeset
836 /* try fallbacks */
4eaa0f7eb3c9 [gaim-migrate @ 13614]
Thomas Butter <tbutter>
parents: 11338
diff changeset
837 if((*end < '9') && (*end >= '1')) {
4eaa0f7eb3c9 [gaim-migrate @ 13614]
Thomas Butter <tbutter>
parents: 11338
diff changeset
838 *end = *end + 1;
4eaa0f7eb3c9 [gaim-migrate @ 13614]
Thomas Butter <tbutter>
parents: 11338
diff changeset
839 } else *end = '1';
6333
e06e04e44914 [gaim-migrate @ 6832]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
840
e06e04e44914 [gaim-migrate @ 6832]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
841 buf = irc_format(irc, "vn", "NICK", newnick);
e06e04e44914 [gaim-migrate @ 6832]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
842 irc_send(irc, buf);
e06e04e44914 [gaim-migrate @ 6832]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
843 g_free(buf);
10504
1a97d5e88d12 [gaim-migrate @ 11796]
Stu Tomlinson <stu@nosnilmot.com>
parents: 10246
diff changeset
844 g_free(newnick);
6333
e06e04e44914 [gaim-migrate @ 6832]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
845 }
e06e04e44914 [gaim-migrate @ 6832]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
846
e06e04e44914 [gaim-migrate @ 6832]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
847 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
848 {
13522
5ddae6fe983e [gaim-migrate @ 15898]
Richard Laager <rlaager@wiktel.com>
parents: 13394
diff changeset
849 char *newargs[3];
6333
e06e04e44914 [gaim-migrate @ 6832]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
850
e06e04e44914 [gaim-migrate @ 6832]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
851 newargs[0] = " notice "; /* The spaces are magic, leave 'em in! */
e06e04e44914 [gaim-migrate @ 6832]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
852 newargs[1] = args[1];
13522
5ddae6fe983e [gaim-migrate @ 15898]
Richard Laager <rlaager@wiktel.com>
parents: 13394
diff changeset
853 newargs[2] = args[0];
6333
e06e04e44914 [gaim-migrate @ 6832]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
854 irc_msg_privmsg(irc, name, from, newargs);
e06e04e44914 [gaim-migrate @ 6832]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
855 }
e06e04e44914 [gaim-migrate @ 6832]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
856
6718
37af5dea14d1 [gaim-migrate @ 7245]
Ethan Blanton <elb@pidgin.im>
parents: 6714
diff changeset
857 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
858 {
37af5dea14d1 [gaim-migrate @ 7245]
Ethan Blanton <elb@pidgin.im>
parents: 6714
diff changeset
859 GaimConnection *gc = gaim_account_get_connection(irc->account);
37af5dea14d1 [gaim-migrate @ 7245]
Ethan Blanton <elb@pidgin.im>
parents: 6714
diff changeset
860
6753
c3d8e8190d77 [gaim-migrate @ 7285]
Ethan Blanton <elb@pidgin.im>
parents: 6718
diff changeset
861 if (!args || !args[2] || !gc)
6718
37af5dea14d1 [gaim-migrate @ 7245]
Ethan Blanton <elb@pidgin.im>
parents: 6714
diff changeset
862 return;
37af5dea14d1 [gaim-migrate @ 7245]
Ethan Blanton <elb@pidgin.im>
parents: 6714
diff changeset
863
10774
d83f745c997b [gaim-migrate @ 12383]
Stu Tomlinson <stu@nosnilmot.com>
parents: 10751
diff changeset
864 gaim_notify_error(gc, _("Cannot change nick"), _("Could not change nick"), args[2]);
6718
37af5dea14d1 [gaim-migrate @ 7245]
Ethan Blanton <elb@pidgin.im>
parents: 6714
diff changeset
865 }
37af5dea14d1 [gaim-migrate @ 7245]
Ethan Blanton <elb@pidgin.im>
parents: 6714
diff changeset
866
6333
e06e04e44914 [gaim-migrate @ 6832]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
867 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
868 {
e06e04e44914 [gaim-migrate @ 6832]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
869 GaimConnection *gc = gaim_account_get_connection(irc->account);
e06e04e44914 [gaim-migrate @ 6832]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
870 GaimConversation *convo;
12855
f9401180115a [gaim-migrate @ 15206]
Richard Laager <rlaager@wiktel.com>
parents: 12216
diff changeset
871 char *nick, *msg;
6333
e06e04e44914 [gaim-migrate @ 6832]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
872
8186
8efff3aa4e39 [gaim-migrate @ 8907]
Ethan Blanton <elb@pidgin.im>
parents: 8163
diff changeset
873 if (!args || !args[0] || !gc)
6333
e06e04e44914 [gaim-migrate @ 6832]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
874 return;
e06e04e44914 [gaim-migrate @ 6832]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
875
11338
17142948653e [gaim-migrate @ 13551]
Mark Doliner <mark@kingant.net>
parents: 11026
diff changeset
876 convo = gaim_find_conversation_with_account(GAIM_CONV_TYPE_CHAT, args[0], irc->account);
6333
e06e04e44914 [gaim-migrate @ 6832]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
877 if (!convo) {
e06e04e44914 [gaim-migrate @ 6832]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
878 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
879 return;
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
e06e04e44914 [gaim-migrate @ 6832]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
882 nick = irc_mask_nick(from);
e06e04e44914 [gaim-migrate @ 6832]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
883 if (!gaim_utf8_strcasecmp(nick, gaim_connection_get_display_name(gc))) {
12855
f9401180115a [gaim-migrate @ 15206]
Richard Laager <rlaager@wiktel.com>
parents: 12216
diff changeset
884 char *escaped = g_markup_escape_text(args[1], -1);
8186
8efff3aa4e39 [gaim-migrate @ 8907]
Ethan Blanton <elb@pidgin.im>
parents: 8163
diff changeset
885 msg = g_strdup_printf(_("You have parted the channel%s%s"),
10551
6ef7be688140 [gaim-migrate @ 11926]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 10504
diff changeset
886 (args[1] && *args[1]) ? ": " : "",
10730
e84b1ef01905 [gaim-migrate @ 12331]
Stu Tomlinson <stu@nosnilmot.com>
parents: 10712
diff changeset
887 (escaped && *escaped) ? escaped : "");
12855
f9401180115a [gaim-migrate @ 15206]
Richard Laager <rlaager@wiktel.com>
parents: 12216
diff changeset
888 g_free(escaped);
7118
bf630f7dfdcd [gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents: 7108
diff changeset
889 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
890 g_free(msg);
8256
1d86096ae0f4 [gaim-migrate @ 8979]
Christian Hammond <chipx86@chipx86.com>
parents: 8186
diff changeset
891 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
892 } else {
12855
f9401180115a [gaim-migrate @ 15206]
Richard Laager <rlaager@wiktel.com>
parents: 12216
diff changeset
893 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
894 }
e06e04e44914 [gaim-migrate @ 6832]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
895 g_free(nick);
e06e04e44914 [gaim-migrate @ 6832]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
896 }
e06e04e44914 [gaim-migrate @ 6832]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
897
e06e04e44914 [gaim-migrate @ 6832]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
898 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
899 {
e06e04e44914 [gaim-migrate @ 6832]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
900 char *buf;
e06e04e44914 [gaim-migrate @ 6832]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
901 if (!args || !args[0])
e06e04e44914 [gaim-migrate @ 6832]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
902 return;
e06e04e44914 [gaim-migrate @ 6832]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
903
e06e04e44914 [gaim-migrate @ 6832]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
904 buf = irc_format(irc, "v:", "PONG", args[0]);
e06e04e44914 [gaim-migrate @ 6832]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
905 irc_send(irc, buf);
e06e04e44914 [gaim-migrate @ 6832]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
906 g_free(buf);
e06e04e44914 [gaim-migrate @ 6832]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
907 }
e06e04e44914 [gaim-migrate @ 6832]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
908
e06e04e44914 [gaim-migrate @ 6832]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
909 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
910 {
e06e04e44914 [gaim-migrate @ 6832]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
911 GaimConversation *convo;
e06e04e44914 [gaim-migrate @ 6832]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
912 GaimConnection *gc;
e06e04e44914 [gaim-migrate @ 6832]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
913 char **parts, *msg;
e06e04e44914 [gaim-migrate @ 6832]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
914 time_t oldstamp;
e06e04e44914 [gaim-migrate @ 6832]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
915
e06e04e44914 [gaim-migrate @ 6832]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
916 if (!args || !args[1])
e06e04e44914 [gaim-migrate @ 6832]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
917 return;
e06e04e44914 [gaim-migrate @ 6832]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
918
e06e04e44914 [gaim-migrate @ 6832]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
919 parts = g_strsplit(args[1], " ", 2);
e06e04e44914 [gaim-migrate @ 6832]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
920
e06e04e44914 [gaim-migrate @ 6832]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
921 if (!parts[0] || !parts[1]) {
e06e04e44914 [gaim-migrate @ 6832]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
922 g_strfreev(parts);
e06e04e44914 [gaim-migrate @ 6832]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
923 return;
e06e04e44914 [gaim-migrate @ 6832]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
924 }
e06e04e44914 [gaim-migrate @ 6832]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
925
e06e04e44914 [gaim-migrate @ 6832]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
926 if (sscanf(parts[1], "%lu", &oldstamp) != 1) {
e06e04e44914 [gaim-migrate @ 6832]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
927 msg = g_strdup(_("Error: invalid PONG from server"));
e06e04e44914 [gaim-migrate @ 6832]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
928 } else {
6350
34c07f5f34a0 [gaim-migrate @ 6849]
Mark Doliner <mark@kingant.net>
parents: 6333
diff changeset
929 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
930 }
e06e04e44914 [gaim-migrate @ 6832]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
931
11338
17142948653e [gaim-migrate @ 13551]
Mark Doliner <mark@kingant.net>
parents: 11026
diff changeset
932 convo = gaim_find_conversation_with_account(GAIM_CONV_TYPE_ANY, parts[0], irc->account);
6333
e06e04e44914 [gaim-migrate @ 6832]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
933 g_strfreev(parts);
e06e04e44914 [gaim-migrate @ 6832]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
934 if (convo) {
11338
17142948653e [gaim-migrate @ 13551]
Mark Doliner <mark@kingant.net>
parents: 11026
diff changeset
935 if (gaim_conversation_get_type (convo) == GAIM_CONV_TYPE_CHAT)
7118
bf630f7dfdcd [gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents: 7108
diff changeset
936 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
937 else
7118
bf630f7dfdcd [gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents: 7108
diff changeset
938 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
939 } else {
e06e04e44914 [gaim-migrate @ 6832]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
940 gc = gaim_account_get_connection(irc->account);
e06e04e44914 [gaim-migrate @ 6832]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
941 if (!gc) {
e06e04e44914 [gaim-migrate @ 6832]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
942 g_free(msg);
e06e04e44914 [gaim-migrate @ 6832]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
943 return;
e06e04e44914 [gaim-migrate @ 6832]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
944 }
e06e04e44914 [gaim-migrate @ 6832]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
945 gaim_notify_info(gc, NULL, "PONG", msg);
e06e04e44914 [gaim-migrate @ 6832]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
946 }
e06e04e44914 [gaim-migrate @ 6832]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
947 g_free(msg);
e06e04e44914 [gaim-migrate @ 6832]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
948 }
e06e04e44914 [gaim-migrate @ 6832]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
949
e06e04e44914 [gaim-migrate @ 6832]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
950 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
951 {
e06e04e44914 [gaim-migrate @ 6832]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
952 GaimConnection *gc = gaim_account_get_connection(irc->account);
e06e04e44914 [gaim-migrate @ 6832]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
953 GaimConversation *convo;
e06e04e44914 [gaim-migrate @ 6832]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
954 char *nick = irc_mask_nick(from), *tmp, *msg;
13522
5ddae6fe983e [gaim-migrate @ 15898]
Richard Laager <rlaager@wiktel.com>
parents: 13394
diff changeset
955 gboolean notice = FALSE;
6333
e06e04e44914 [gaim-migrate @ 6832]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
956
e06e04e44914 [gaim-migrate @ 6832]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
957 if (!args || !args[0] || !args[1] || !gc) {
e06e04e44914 [gaim-migrate @ 6832]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
958 g_free(nick);
e06e04e44914 [gaim-migrate @ 6832]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
959 return;
e06e04e44914 [gaim-migrate @ 6832]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
960 }
e06e04e44914 [gaim-migrate @ 6832]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
961
e06e04e44914 [gaim-migrate @ 6832]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
962 notice = !strcmp(args[0], " notice ");
13522
5ddae6fe983e [gaim-migrate @ 15898]
Richard Laager <rlaager@wiktel.com>
parents: 13394
diff changeset
963 if (notice) {
5ddae6fe983e [gaim-migrate @ 15898]
Richard Laager <rlaager@wiktel.com>
parents: 13394
diff changeset
964 args[0] = args[2];
5ddae6fe983e [gaim-migrate @ 15898]
Richard Laager <rlaager@wiktel.com>
parents: 13394
diff changeset
965 }
6333
e06e04e44914 [gaim-migrate @ 6832]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
966 tmp = irc_parse_ctcp(irc, nick, args[0], args[1], notice);
e06e04e44914 [gaim-migrate @ 6832]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
967 if (!tmp) {
e06e04e44914 [gaim-migrate @ 6832]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
968 g_free(nick);
e06e04e44914 [gaim-migrate @ 6832]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
969 return;
e06e04e44914 [gaim-migrate @ 6832]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
970 }
8163
da57fb60680a [gaim-migrate @ 8875]
Ethan Blanton <elb@pidgin.im>
parents: 8114
diff changeset
971
10732
c4cb90065e1d [gaim-migrate @ 12334]
Luke Schierer <lschiere@pidgin.im>
parents: 10730
diff changeset
972 msg = g_markup_escape_text(tmp, -1);
6333
e06e04e44914 [gaim-migrate @ 6832]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
973 g_free(tmp);
8163
da57fb60680a [gaim-migrate @ 8875]
Ethan Blanton <elb@pidgin.im>
parents: 8114
diff changeset
974
da57fb60680a [gaim-migrate @ 8875]
Ethan Blanton <elb@pidgin.im>
parents: 8114
diff changeset
975 tmp = irc_mirc2html(msg);
da57fb60680a [gaim-migrate @ 8875]
Ethan Blanton <elb@pidgin.im>
parents: 8114
diff changeset
976 g_free(msg);
da57fb60680a [gaim-migrate @ 8875]
Ethan Blanton <elb@pidgin.im>
parents: 8114
diff changeset
977 msg = tmp;
6333
e06e04e44914 [gaim-migrate @ 6832]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
978 if (notice) {
e06e04e44914 [gaim-migrate @ 6832]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
979 tmp = g_strdup_printf("(notice) %s", msg);
e06e04e44914 [gaim-migrate @ 6832]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
980 g_free(msg);
e06e04e44914 [gaim-migrate @ 6832]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
981 msg = tmp;
e06e04e44914 [gaim-migrate @ 6832]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
982 }
e06e04e44914 [gaim-migrate @ 6832]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
983
e06e04e44914 [gaim-migrate @ 6832]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
984 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
985 serv_got_im(gc, nick, msg, 0, time(NULL));
6333
e06e04e44914 [gaim-migrate @ 6832]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
986 } else {
11338
17142948653e [gaim-migrate @ 13551]
Mark Doliner <mark@kingant.net>
parents: 11026
diff changeset
987 convo = gaim_find_conversation_with_account(GAIM_CONV_TYPE_CHAT, args[0], irc->account);
6333
e06e04e44914 [gaim-migrate @ 6832]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
988 if (convo)
7118
bf630f7dfdcd [gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents: 7108
diff changeset
989 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
990 else
e06e04e44914 [gaim-migrate @ 6832]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
991 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
992 }
e06e04e44914 [gaim-migrate @ 6832]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
993 g_free(msg);
e06e04e44914 [gaim-migrate @ 6832]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
994 g_free(nick);
e06e04e44914 [gaim-migrate @ 6832]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
995 }
e06e04e44914 [gaim-migrate @ 6832]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
996
6714
0c260c4e753e [gaim-migrate @ 7240]
Ethan Blanton <elb@pidgin.im>
parents: 6695
diff changeset
997 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
998 {
0c260c4e753e [gaim-migrate @ 7240]
Ethan Blanton <elb@pidgin.im>
parents: 6695
diff changeset
999 GaimConnection *gc = gaim_account_get_connection(irc->account);
0c260c4e753e [gaim-migrate @ 7240]
Ethan Blanton <elb@pidgin.im>
parents: 6695
diff changeset
1000 char *msg;
0c260c4e753e [gaim-migrate @ 7240]
Ethan Blanton <elb@pidgin.im>
parents: 6695
diff changeset
1001
0c260c4e753e [gaim-migrate @ 7240]
Ethan Blanton <elb@pidgin.im>
parents: 6695
diff changeset
1002 if (!args || !args[1] || !args[2] || !gc)
0c260c4e753e [gaim-migrate @ 7240]
Ethan Blanton <elb@pidgin.im>
parents: 6695
diff changeset
1003 return;
0c260c4e753e [gaim-migrate @ 7240]
Ethan Blanton <elb@pidgin.im>
parents: 6695
diff changeset
1004
0c260c4e753e [gaim-migrate @ 7240]
Ethan Blanton <elb@pidgin.im>
parents: 6695
diff changeset
1005 msg = g_strdup_printf(_("Cannot join %s:"), args[1]);
0c260c4e753e [gaim-migrate @ 7240]
Ethan Blanton <elb@pidgin.im>
parents: 6695
diff changeset
1006 gaim_notify_error(gc, _("Cannot join channel"), msg, args[2]);
0c260c4e753e [gaim-migrate @ 7240]
Ethan Blanton <elb@pidgin.im>
parents: 6695
diff changeset
1007 g_free(msg);
0c260c4e753e [gaim-migrate @ 7240]
Ethan Blanton <elb@pidgin.im>
parents: 6695
diff changeset
1008 }
0c260c4e753e [gaim-migrate @ 7240]
Ethan Blanton <elb@pidgin.im>
parents: 6695
diff changeset
1009
6333
e06e04e44914 [gaim-migrate @ 6832]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
1010 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
1011 {
e06e04e44914 [gaim-migrate @ 6832]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
1012 GaimConnection *gc = gaim_account_get_connection(irc->account);
9238
f4f210e47b60 [gaim-migrate @ 10036]
Ethan Blanton <elb@pidgin.im>
parents: 9057
diff changeset
1013 struct irc_buddy *ib;
6333
e06e04e44914 [gaim-migrate @ 6832]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
1014 char *data[2];
e06e04e44914 [gaim-migrate @ 6832]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
1015
e06e04e44914 [gaim-migrate @ 6832]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
1016 if (!args || !args[0] || !gc)
e06e04e44914 [gaim-migrate @ 6832]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
1017 return;
e06e04e44914 [gaim-migrate @ 6832]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
1018
e06e04e44914 [gaim-migrate @ 6832]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
1019 data[0] = irc_mask_nick(from);
e06e04e44914 [gaim-migrate @ 6832]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
1020 data[1] = args[0];
e06e04e44914 [gaim-migrate @ 6832]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
1021 /* XXX this should have an API, I shouldn't grab this directly */
e06e04e44914 [gaim-migrate @ 6832]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
1022 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
1023
f4f210e47b60 [gaim-migrate @ 10036]
Ethan Blanton <elb@pidgin.im>
parents: 9057
diff changeset
1024 if ((ib = g_hash_table_lookup(irc->buddies, data[0])) != NULL) {
f4f210e47b60 [gaim-migrate @ 10036]
Ethan Blanton <elb@pidgin.im>
parents: 9057
diff changeset
1025 ib->flag = FALSE;
f4f210e47b60 [gaim-migrate @ 10036]
Ethan Blanton <elb@pidgin.im>
parents: 9057
diff changeset
1026 irc_buddy_status(data[0], ib, irc);
f4f210e47b60 [gaim-migrate @ 10036]
Ethan Blanton <elb@pidgin.im>
parents: 9057
diff changeset
1027 }
6333
e06e04e44914 [gaim-migrate @ 6832]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
1028 g_free(data[0]);
e06e04e44914 [gaim-migrate @ 6832]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
1029
e06e04e44914 [gaim-migrate @ 6832]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
1030 return;
e06e04e44914 [gaim-migrate @ 6832]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
1031 }
e06e04e44914 [gaim-migrate @ 6832]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
1032
10712
b41c48d890d8 [gaim-migrate @ 12306]
Mark Doliner <mark@kingant.net>
parents: 10659
diff changeset
1033 void irc_msg_unavailable(struct irc_conn *irc, const char *name, const char *from, char **args)
b41c48d890d8 [gaim-migrate @ 12306]
Mark Doliner <mark@kingant.net>
parents: 10659
diff changeset
1034 {
b41c48d890d8 [gaim-migrate @ 12306]
Mark Doliner <mark@kingant.net>
parents: 10659
diff changeset
1035 GaimConnection *gc = gaim_account_get_connection(irc->account);
b41c48d890d8 [gaim-migrate @ 12306]
Mark Doliner <mark@kingant.net>
parents: 10659
diff changeset
1036
b41c48d890d8 [gaim-migrate @ 12306]
Mark Doliner <mark@kingant.net>
parents: 10659
diff changeset
1037 if (!args || !args[1])
b41c48d890d8 [gaim-migrate @ 12306]
Mark Doliner <mark@kingant.net>
parents: 10659
diff changeset
1038 return;
b41c48d890d8 [gaim-migrate @ 12306]
Mark Doliner <mark@kingant.net>
parents: 10659
diff changeset
1039
b41c48d890d8 [gaim-migrate @ 12306]
Mark Doliner <mark@kingant.net>
parents: 10659
diff changeset
1040 gaim_notify_error(gc, NULL, _("Nick or channel is temporarily unavailable."), args[1]);
b41c48d890d8 [gaim-migrate @ 12306]
Mark Doliner <mark@kingant.net>
parents: 10659
diff changeset
1041 }
b41c48d890d8 [gaim-migrate @ 12306]
Mark Doliner <mark@kingant.net>
parents: 10659
diff changeset
1042
6333
e06e04e44914 [gaim-migrate @ 6832]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
1043 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
1044 {
e06e04e44914 [gaim-migrate @ 6832]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
1045 GaimConnection *gc = gaim_account_get_connection(irc->account);
10774
d83f745c997b [gaim-migrate @ 12383]
Stu Tomlinson <stu@nosnilmot.com>
parents: 10751
diff changeset
1046 char *nick, *msg;
6333
e06e04e44914 [gaim-migrate @ 6832]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
1047
e06e04e44914 [gaim-migrate @ 6832]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
1048 if (!args || !args[0] || !gc)
e06e04e44914 [gaim-migrate @ 6832]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
1049 return;
e06e04e44914 [gaim-migrate @ 6832]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
1050
e06e04e44914 [gaim-migrate @ 6832]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
1051 nick = irc_mask_nick(from);
e06e04e44914 [gaim-migrate @ 6832]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
1052 msg = g_strdup_printf (_("Wallops from %s"), nick);
e06e04e44914 [gaim-migrate @ 6832]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
1053 g_free(nick);
10774
d83f745c997b [gaim-migrate @ 12383]
Stu Tomlinson <stu@nosnilmot.com>
parents: 10751
diff changeset
1054 gaim_notify_info(gc, NULL, msg, args[0]);
6333
e06e04e44914 [gaim-migrate @ 6832]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
1055 g_free(msg);
e06e04e44914 [gaim-migrate @ 6832]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
1056 }
e06e04e44914 [gaim-migrate @ 6832]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
1057
e06e04e44914 [gaim-migrate @ 6832]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
1058 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
1059 {
e06e04e44914 [gaim-migrate @ 6832]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
1060 return;
e06e04e44914 [gaim-migrate @ 6832]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
1061 }