Mercurial > pidgin
annotate src/protocols/irc/irc.c @ 10343:ee4f477fc8cf
[gaim-migrate @ 11553]
Minor tweaks to the blist and status xml reading code. These functions
don't expect the filename to be called "blist.xml" and "status.xml"
anymore. Some guy wanted this because he wants to try to add some
sort of AIM buddy list importing, or something. I think.
committer: Tailor Script <tailor@pidgin.im>
| author | Mark Doliner <mark@kingant.net> |
|---|---|
| date | Fri, 10 Dec 2004 05:49:01 +0000 |
| parents | 357d4fa1bfbe |
| children | d2f999970f91 |
| rev | line source |
|---|---|
| 6333 | 1 /** |
| 2 * @file irc.c | |
|
6459
b52870734c21
[gaim-migrate @ 6968]
Christian Hammond <chipx86@chipx86.com>
parents:
6371
diff
changeset
|
3 * |
| 6333 | 4 * gaim |
| 2086 | 5 * |
| 8351 | 6 * Copyright (C) 2003, Robbert Haarman <gaim@inglorion.net> |
| 6333 | 7 * Copyright (C) 2003, Ethan Blanton <eblanton@cs.purdue.edu> |
| 8 * Copyright (C) 2000-2003, Rob Flynn <rob@tgflinux.com> | |
| 2086 | 9 * Copyright (C) 1998-1999, Mark Spencer <markster@marko.net> |
|
6459
b52870734c21
[gaim-migrate @ 6968]
Christian Hammond <chipx86@chipx86.com>
parents:
6371
diff
changeset
|
10 * |
| 2086 | 11 * This program is free software; you can redistribute it and/or modify |
| 12 * it under the terms of the GNU General Public License as published by | |
| 13 * the Free Software Foundation; either version 2 of the License, or | |
| 14 * (at your option) any later version. | |
| 15 * | |
| 16 * This program is distributed in the hope that it will be useful, | |
| 17 * but WITHOUT ANY WARRANTY; without even the implied warranty of | |
| 18 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
| 19 * GNU General Public License for more details. | |
| 20 * | |
| 21 * You should have received a copy of the GNU General Public License | |
| 22 * along with this program; if not, write to the Free Software | |
| 23 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | |
| 24 */ | |
| 6333 | 25 |
|
5872
059d95c67cda
[gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents:
5791
diff
changeset
|
26 #include "internal.h" |
|
059d95c67cda
[gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents:
5791
diff
changeset
|
27 |
|
059d95c67cda
[gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents:
5791
diff
changeset
|
28 #include "accountopt.h" |
| 9030 | 29 #include "blist.h" |
| 6333 | 30 #include "conversation.h" |
| 9030 | 31 #include "debug.h" |
| 7148 | 32 #include "notify.h" |
| 9030 | 33 #include "prpl.h" |
| 34 #include "plugin.h" | |
| 6350 | 35 #include "util.h" |
| 9943 | 36 #include "version.h" |
| 9030 | 37 |
| 6333 | 38 #include "irc.h" |
| 4422 | 39 |
| 6333 | 40 static void irc_buddy_append(char *name, struct irc_buddy *ib, GString *string); |
| 2086 | 41 |
| 6695 | 42 static const char *irc_blist_icon(GaimAccount *a, GaimBuddy *b); |
| 9953 | 43 static void irc_blist_emblems(GaimBuddy *b, const char **se, const char **sw, const char **nw, const char **ne); |
| 9951 | 44 static GList *irc_status_types(GaimAccount *account); |
| 9015 | 45 static GList *irc_actions(GaimPlugin *plugin, gpointer context); |
| 6333 | 46 /* static GList *irc_chat_info(GaimConnection *gc); */ |
| 47 static void irc_login(GaimAccount *account); | |
| 48 static void irc_login_cb(gpointer data, gint source, GaimInputCondition cond); | |
| 49 static void irc_close(GaimConnection *gc); | |
|
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
6982
diff
changeset
|
50 static int irc_im_send(GaimConnection *gc, const char *who, const char *what, GaimConvImFlags flags); |
| 6333 | 51 static int irc_chat_send(GaimConnection *gc, int id, const char *what); |
| 52 static void irc_chat_join (GaimConnection *gc, GHashTable *data); | |
| 53 static void irc_input_cb(gpointer data, gint source, GaimInputCondition cond); | |
| 3751 | 54 |
| 7711 | 55 static guint irc_nick_hash(const char *nick); |
| 56 static gboolean irc_nick_equal(const char *nick1, const char *nick2); | |
| 57 static void irc_buddy_free(struct irc_buddy *ib); | |
| 58 | |
| 59 static GaimPlugin *_irc_plugin = NULL; | |
| 60 | |
| 61 static const char *status_chars = "@+%&"; | |
| 62 | |
| 9015 | 63 static void irc_view_motd(GaimPluginAction *action) |
| 7148 | 64 { |
| 9015 | 65 GaimConnection *gc = (GaimConnection *) action->context; |
| 7148 | 66 struct irc_conn *irc; |
| 67 char *title; | |
| 68 | |
| 69 if (gc == NULL || gc->proto_data == NULL) { | |
| 70 gaim_debug(GAIM_DEBUG_ERROR, "irc", "got MOTD request for NULL gc\n"); | |
| 71 return; | |
| 72 } | |
| 73 irc = gc->proto_data; | |
| 74 if (irc->motd == NULL) { | |
| 75 gaim_notify_error(gc, _("Error displaying MOTD"), _("No MOTD available"), | |
| 76 _("There is no MOTD associated with this connection.")); | |
| 77 return; | |
| 78 } | |
| 79 title = g_strdup_printf(_("MOTD for %s"), irc->server); | |
| 80 gaim_notify_formatted(gc, title, title, NULL, irc->motd->str, NULL, NULL); | |
| 81 } | |
| 82 | |
| 6333 | 83 int irc_send(struct irc_conn *irc, const char *buf) |
| 3751 | 84 { |
| 9440 | 85 int ret; |
| 86 | |
| 6333 | 87 if (irc->fd < 0) |
| 88 return -1; | |
|
2205
cff4fbe01c7b
[gaim-migrate @ 2215]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2171
diff
changeset
|
89 |
| 6333 | 90 /* gaim_debug(GAIM_DEBUG_MISC, "irc", "sent: %s", buf); */ |
| 9440 | 91 if ((ret = write(irc->fd, buf, strlen(buf))) < 0) |
| 92 gaim_connection_error(gaim_account_get_connection(irc->account), | |
| 93 _("Server has disconnected")); | |
| 94 | |
| 95 return ret; | |
|
2205
cff4fbe01c7b
[gaim-migrate @ 2215]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2171
diff
changeset
|
96 } |
|
cff4fbe01c7b
[gaim-migrate @ 2215]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2171
diff
changeset
|
97 |
| 6333 | 98 /* XXX I don't like messing directly with these buddies */ |
| 99 gboolean irc_blist_timeout(struct irc_conn *irc) | |
| 2086 | 100 { |
| 6333 | 101 GString *string = g_string_sized_new(512); |
| 102 char *list, *buf; | |
|
2289
38e156136896
[gaim-migrate @ 2299]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2273
diff
changeset
|
103 |
| 6333 | 104 g_hash_table_foreach(irc->buddies, (GHFunc)irc_buddy_append, (gpointer)string); |
|
4359
5fb47ec9bfe4
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4349
diff
changeset
|
105 |
| 6333 | 106 list = g_string_free(string, FALSE); |
| 107 if (!list || !strlen(list)) { | |
| 108 g_free(list); | |
|
2137
18722ae5b882
[gaim-migrate @ 2147]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2131
diff
changeset
|
109 return TRUE; |
| 2086 | 110 } |
|
4416
8e62cee6d738
[gaim-migrate @ 4689]
Christian Hammond <chipx86@chipx86.com>
parents:
4373
diff
changeset
|
111 |
| 8038 | 112 buf = irc_format(irc, "vn", "ISON", list); |
| 6333 | 113 g_free(list); |
| 114 irc_send(irc, buf); | |
| 115 g_free(buf); | |
|
4416
8e62cee6d738
[gaim-migrate @ 4689]
Christian Hammond <chipx86@chipx86.com>
parents:
4373
diff
changeset
|
116 |
|
2131
acc11216ec5d
[gaim-migrate @ 2141]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2123
diff
changeset
|
117 return TRUE; |
| 2086 | 118 } |
| 119 | |
| 6333 | 120 static void irc_buddy_append(char *name, struct irc_buddy *ib, GString *string) |
|
2289
38e156136896
[gaim-migrate @ 2299]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2273
diff
changeset
|
121 { |
| 6333 | 122 ib->flag = FALSE; |
| 123 g_string_append_printf(string, "%s ", name); | |
| 3511 | 124 } |
| 125 | |
| 9553 | 126 static void irc_ison_one(struct irc_conn *irc, struct irc_buddy *ib) |
| 127 { | |
| 128 char *buf; | |
| 129 | |
| 130 ib->flag = FALSE; | |
| 131 buf = irc_format(irc, "vn", "ISON", ib->name); | |
| 132 irc_send(irc, buf); | |
| 133 g_free(buf); | |
| 134 } | |
| 135 | |
| 136 | |
| 6695 | 137 static const char *irc_blist_icon(GaimAccount *a, GaimBuddy *b) |
| 3029 | 138 { |
| 6333 | 139 return "irc"; |
|
2339
9bda60d2d2e6
[gaim-migrate @ 2352]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2331
diff
changeset
|
140 } |
|
9bda60d2d2e6
[gaim-migrate @ 2352]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2331
diff
changeset
|
141 |
| 9953 | 142 static void irc_blist_emblems(GaimBuddy *b, const char **se, const char **sw, const char **nw, const char **ne) |
| 3751 | 143 { |
| 10244 | 144 GaimPresence *presence = gaim_buddy_get_presence(b); |
| 145 | |
| 146 if (gaim_presence_is_online(presence) == FALSE) { | |
| 6333 | 147 *se = "offline"; |
| 10244 | 148 } |
| 2086 | 149 } |
| 150 | |
| 9944 | 151 static GList *irc_status_types(GaimAccount *account) |
| 2086 | 152 { |
| 9944 | 153 GaimStatusType *type; |
| 154 GList *types = NULL; | |
| 155 | |
| 156 type = gaim_status_type_new(GAIM_STATUS_OFFLINE, "offline", | |
| 157 _("Offline"), FALSE); | |
| 158 types = g_list_append(types, type); | |
| 159 | |
| 160 type = gaim_status_type_new(GAIM_STATUS_ONLINE, "online", | |
| 161 _("Online"), FALSE); | |
| 162 types = g_list_append(types, type); | |
| 163 | |
| 164 type = gaim_status_type_new(GAIM_STATUS_AVAILABLE, "available", | |
| 165 _("Available"), TRUE); | |
| 166 types = g_list_append(types, type); | |
| 167 | |
| 168 type = gaim_status_type_new_with_attrs( | |
| 169 GAIM_STATUS_AWAY, "away", _("Away"), TRUE, TRUE, FALSE, | |
| 10009 | 170 "message", _("Message"), gaim_value_new(GAIM_TYPE_STRING), NULL); |
| 9944 | 171 types = g_list_append(types, type); |
| 172 | |
| 173 return types; | |
| 3452 | 174 } |
| 175 | |
| 9015 | 176 static GList *irc_actions(GaimPlugin *plugin, gpointer context) |
| 7148 | 177 { |
| 178 GList *list = NULL; | |
| 9015 | 179 GaimPluginAction *act = NULL; |
| 7148 | 180 |
| 9015 | 181 act = gaim_plugin_action_new(_("View MOTD"), irc_view_motd); |
| 182 list = g_list_append(list, act); | |
| 7148 | 183 |
| 184 return list; | |
| 185 } | |
| 186 | |
| 6333 | 187 static GList *irc_chat_join_info(GaimConnection *gc) |
| 2086 | 188 { |
|
2170
c24595d3c364
[gaim-migrate @ 2180]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2167
diff
changeset
|
189 GList *m = NULL; |
|
2289
38e156136896
[gaim-migrate @ 2299]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2273
diff
changeset
|
190 struct proto_chat_entry *pce; |
|
2170
c24595d3c364
[gaim-migrate @ 2180]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2167
diff
changeset
|
191 |
|
2289
38e156136896
[gaim-migrate @ 2299]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2273
diff
changeset
|
192 pce = g_new0(struct proto_chat_entry, 1); |
| 7841 | 193 pce->label = _("_Channel:"); |
| 5234 | 194 pce->identifier = "channel"; |
|
2289
38e156136896
[gaim-migrate @ 2299]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2273
diff
changeset
|
195 m = g_list_append(m, pce); |
|
2170
c24595d3c364
[gaim-migrate @ 2180]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2167
diff
changeset
|
196 |
|
2289
38e156136896
[gaim-migrate @ 2299]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2273
diff
changeset
|
197 pce = g_new0(struct proto_chat_entry, 1); |
| 7841 | 198 pce->label = _("_Password:"); |
| 5234 | 199 pce->identifier = "password"; |
| 6499 | 200 pce->secret = TRUE; |
|
2289
38e156136896
[gaim-migrate @ 2299]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2273
diff
changeset
|
201 m = g_list_append(m, pce); |
|
2170
c24595d3c364
[gaim-migrate @ 2180]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2167
diff
changeset
|
202 |
|
c24595d3c364
[gaim-migrate @ 2180]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2167
diff
changeset
|
203 return m; |
| 2086 | 204 } |
| 205 | |
| 9754 | 206 GHashTable *irc_chat_info_defaults(GaimConnection *gc, const char *chat_name) |
| 207 { | |
| 208 GHashTable *defaults; | |
| 209 | |
| 210 defaults = g_hash_table_new_full(g_str_hash, g_str_equal, NULL, g_free); | |
| 211 | |
| 212 if (chat_name != NULL) | |
| 213 g_hash_table_insert(defaults, "channel", g_strdup(chat_name)); | |
| 214 | |
| 215 return defaults; | |
| 216 } | |
| 217 | |
| 6333 | 218 static void irc_login(GaimAccount *account) |
|
2289
38e156136896
[gaim-migrate @ 2299]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2273
diff
changeset
|
219 { |
| 6333 | 220 GaimConnection *gc; |
| 221 struct irc_conn *irc; | |
| 222 char *buf, **userparts; | |
| 223 const char *username = gaim_account_get_username(account); | |
| 224 int err; | |
| 225 | |
| 226 gc = gaim_account_get_connection(account); | |
| 8677 | 227 gc->flags |= GAIM_CONNECTION_NO_NEWLINES; |
| 6333 | 228 |
| 6752 | 229 if (strpbrk(username, " \t\v\r\n") != NULL) { |
| 230 gaim_connection_error(gc, _("IRC nicks may not contain whitespace")); | |
| 231 return; | |
| 232 } | |
| 233 | |
| 6333 | 234 gc->proto_data = irc = g_new0(struct irc_conn, 1); |
| 235 irc->account = account; | |
| 236 | |
| 237 userparts = g_strsplit(username, "@", 2); | |
| 238 gaim_connection_set_display_name(gc, userparts[0]); | |
| 239 irc->server = g_strdup(userparts[1]); | |
| 240 g_strfreev(userparts); | |
|
2289
38e156136896
[gaim-migrate @ 2299]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2273
diff
changeset
|
241 |
| 10159 | 242 irc->buddies = g_hash_table_new_full((GHashFunc)irc_nick_hash, (GEqualFunc)irc_nick_equal, |
| 6333 | 243 NULL, (GDestroyNotify)irc_buddy_free); |
| 244 irc->cmds = g_hash_table_new(g_str_hash, g_str_equal); | |
| 245 irc_cmd_table_build(irc); | |
| 246 irc->msgs = g_hash_table_new(g_str_hash, g_str_equal); | |
| 247 irc_msg_table_build(irc); | |
| 248 | |
| 10159 | 249 buf = g_strdup_printf(_("Logging in: %s"), username); |
| 6333 | 250 gaim_connection_update_progress(gc, buf, 1, 2); |
| 251 g_free(buf); | |
| 252 | |
| 10159 | 253 err = gaim_proxy_connect(account, irc->server, |
| 6333 | 254 gaim_account_get_int(account, "port", IRC_DEFAULT_PORT), |
| 255 irc_login_cb, gc); | |
| 256 | |
| 257 if (err || !account->gc) { | |
| 258 gaim_connection_error(gc, _("Couldn't create socket")); | |
|
2289
38e156136896
[gaim-migrate @ 2299]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2273
diff
changeset
|
259 return; |
| 6333 | 260 } |
|
2289
38e156136896
[gaim-migrate @ 2299]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2273
diff
changeset
|
261 } |
|
38e156136896
[gaim-migrate @ 2299]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2273
diff
changeset
|
262 |
| 6333 | 263 static void irc_login_cb(gpointer data, gint source, GaimInputCondition cond) |
|
2289
38e156136896
[gaim-migrate @ 2299]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2273
diff
changeset
|
264 { |
| 6333 | 265 GaimConnection *gc = data; |
| 266 struct irc_conn *irc = gc->proto_data; | |
| 267 char hostname[256]; | |
| 268 char *buf; | |
| 10002 | 269 const char *username, *realname; |
| 6333 | 270 GList *connections = gaim_connections_get_all(); |
| 271 | |
| 8778 | 272 if (source < 0) { |
| 273 gaim_connection_error(gc, _("Couldn't connect to host")); | |
| 6333 | 274 return; |
| 8778 | 275 } |
| 6333 | 276 |
| 277 if (!g_list_find(connections, gc)) { | |
| 278 close(source); | |
| 279 return; | |
| 280 } | |
| 281 | |
| 282 irc->fd = source; | |
|
2289
38e156136896
[gaim-migrate @ 2299]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2273
diff
changeset
|
283 |
| 6333 | 284 if (gc->account->password && *gc->account->password) { |
| 285 buf = irc_format(irc, "vv", "PASS", gc->account->password); | |
| 286 if (irc_send(irc, buf) < 0) { | |
| 287 gaim_connection_error(gc, "Error sending password"); | |
| 288 return; | |
| 289 } | |
| 290 g_free(buf); | |
| 291 } | |
|
2289
38e156136896
[gaim-migrate @ 2299]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2273
diff
changeset
|
292 |
| 6333 | 293 gethostname(hostname, sizeof(hostname)); |
| 294 hostname[sizeof(hostname) - 1] = '\0'; | |
| 7323 | 295 username = gaim_account_get_string(irc->account, "username", ""); |
| 10002 | 296 realname = gaim_account_get_string(irc->account, "realname", ""); |
| 7323 | 297 buf = irc_format(irc, "vvvv:", "USER", strlen(username) ? username : g_get_user_name(), hostname, irc->server, |
| 10002 | 298 strlen(realname) ? realname : IRC_DEFAULT_ALIAS); |
| 6333 | 299 if (irc_send(irc, buf) < 0) { |
| 300 gaim_connection_error(gc, "Error registering with server"); | |
| 301 return; | |
| 302 } | |
| 303 g_free(buf); | |
| 304 buf = irc_format(irc, "vn", "NICK", gaim_connection_get_display_name(gc)); | |
| 305 if (irc_send(irc, buf) < 0) { | |
| 306 gaim_connection_error(gc, "Error sending nickname"); | |
| 307 return; | |
| 308 } | |
| 309 g_free(buf); | |
| 310 | |
| 311 gc->inpa = gaim_input_add(irc->fd, GAIM_INPUT_READ, irc_input_cb, gc); | |
|
2289
38e156136896
[gaim-migrate @ 2299]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2273
diff
changeset
|
312 } |
|
38e156136896
[gaim-migrate @ 2299]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2273
diff
changeset
|
313 |
| 6333 | 314 static void irc_close(GaimConnection *gc) |
|
2289
38e156136896
[gaim-migrate @ 2299]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2273
diff
changeset
|
315 { |
| 6333 | 316 struct irc_conn *irc = gc->proto_data; |
| 317 | |
| 6752 | 318 if (irc == NULL) |
| 319 return; | |
| 320 | |
| 6333 | 321 irc_cmd_quit(irc, "quit", NULL, NULL); |
| 322 | |
| 323 if (gc->inpa) | |
| 9441 | 324 gaim_input_remove(gc->inpa); |
| 6333 | 325 |
| 326 g_free(irc->inbuf); | |
| 327 close(irc->fd); | |
| 328 if (irc->timer) | |
|
8287
ef881489396e
[gaim-migrate @ 9011]
Christian Hammond <chipx86@chipx86.com>
parents:
8170
diff
changeset
|
329 gaim_timeout_remove(irc->timer); |
| 6333 | 330 g_hash_table_destroy(irc->cmds); |
| 331 g_hash_table_destroy(irc->msgs); | |
| 332 if (irc->motd) | |
| 333 g_string_free(irc->motd, TRUE); | |
| 334 g_free(irc->server); | |
| 335 g_free(irc); | |
|
2289
38e156136896
[gaim-migrate @ 2299]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2273
diff
changeset
|
336 } |
|
38e156136896
[gaim-migrate @ 2299]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2273
diff
changeset
|
337 |
|
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
6982
diff
changeset
|
338 static int irc_im_send(GaimConnection *gc, const char *who, const char *what, GaimConvImFlags flags) |
|
2289
38e156136896
[gaim-migrate @ 2299]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2273
diff
changeset
|
339 { |
| 6333 | 340 struct irc_conn *irc = gc->proto_data; |
| 341 const char *args[2]; | |
| 342 | |
| 7711 | 343 if (strchr(status_chars, *who) != NULL) |
| 6333 | 344 args[0] = who + 1; |
| 345 else | |
| 346 args[0] = who; | |
| 347 args[1] = what; | |
| 9442 | 348 |
| 6333 | 349 irc_cmd_privmsg(irc, "msg", NULL, args); |
| 350 return 1; | |
|
2289
38e156136896
[gaim-migrate @ 2299]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2273
diff
changeset
|
351 } |
| 2086 | 352 |
| 6333 | 353 static void irc_get_info(GaimConnection *gc, const char *who) |
| 2086 | 354 { |
| 6333 | 355 struct irc_conn *irc = gc->proto_data; |
| 356 const char *args[1]; | |
| 357 args[0] = who; | |
| 358 irc_cmd_whois(irc, "whois", NULL, args); | |
| 359 } | |
| 360 | |
| 9944 | 361 static void irc_set_status(GaimAccount *account, GaimStatus *status) |
| 6333 | 362 { |
| 9944 | 363 GaimConnection *gc = gaim_account_get_connection(account); |
| 6333 | 364 struct irc_conn *irc = gc->proto_data; |
| 365 const char *args[1]; | |
| 9944 | 366 const char *status_id = gaim_status_get_id(status); |
| 2086 | 367 |
| 9944 | 368 if (!strcmp(status_id, "away")) |
| 369 args[0] = gaim_status_get_attr_string(status, "message"); | |
| 370 else if (!strcmp(status_id, "available")) | |
| 371 args[0] = NULL; | |
|
2393
a7ecfd3f7714
[gaim-migrate @ 2406]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2382
diff
changeset
|
372 |
| 6333 | 373 irc_cmd_away(irc, "away", NULL, args); |
| 4916 | 374 } |
| 375 | |
| 9285 | 376 static void irc_add_buddy(GaimConnection *gc, GaimBuddy *buddy, GaimGroup *group) |
| 3029 | 377 { |
| 6333 | 378 struct irc_conn *irc = (struct irc_conn *)gc->proto_data; |
| 379 struct irc_buddy *ib = g_new0(struct irc_buddy, 1); | |
| 9285 | 380 ib->name = g_strdup(buddy->name); |
| 6333 | 381 g_hash_table_insert(irc->buddies, ib->name, ib); |
| 9238 | 382 |
| 9553 | 383 /* if the timer isn't set, this is during signon, so we don't want to flood |
| 384 * ourself off with ISON's, so we don't, but after that we want to know when | |
| 385 * someone's online asap */ | |
| 386 if (irc->timer) | |
| 387 irc_ison_one(irc, ib); | |
| 3029 | 388 } |
| 3622 | 389 |
| 9285 | 390 static void irc_remove_buddy(GaimConnection *gc, GaimBuddy *buddy, GaimGroup *group) |
| 6333 | 391 { |
| 392 struct irc_conn *irc = (struct irc_conn *)gc->proto_data; | |
| 9285 | 393 g_hash_table_remove(irc->buddies, buddy->name); |
| 3616 | 394 } |
|
4514
7521e29658bc
[gaim-migrate @ 4792]
Christian Hammond <chipx86@chipx86.com>
parents:
4509
diff
changeset
|
395 |
| 6333 | 396 static void irc_input_cb(gpointer data, gint source, GaimInputCondition cond) |
| 397 { | |
| 398 GaimConnection *gc = data; | |
| 399 struct irc_conn *irc = gc->proto_data; | |
| 400 char *cur, *end; | |
| 401 int len; | |
| 402 | |
| 403 if (irc->inbuflen < irc->inbufused + IRC_INITIAL_BUFSIZE) { | |
| 404 irc->inbuflen += IRC_INITIAL_BUFSIZE; | |
| 405 irc->inbuf = g_realloc(irc->inbuf, irc->inbuflen); | |
| 3708 | 406 } |
| 3616 | 407 |
| 6333 | 408 if ((len = read(irc->fd, irc->inbuf + irc->inbufused, IRC_INITIAL_BUFSIZE - 1)) < 0) { |
| 7653 | 409 gaim_connection_error(gc, _("Read error")); |
| 6333 | 410 return; |
| 6369 | 411 } else if (len == 0) { |
| 9440 | 412 gaim_connection_error(gc, _("Server has disconnected")); |
| 6369 | 413 return; |
| 6333 | 414 } |
| 6369 | 415 |
| 6333 | 416 irc->inbufused += len; |
| 417 irc->inbuf[irc->inbufused] = '\0'; | |
| 3616 | 418 |
| 8156 | 419 cur = irc->inbuf; |
| 420 while (cur < irc->inbuf + irc->inbufused && | |
| 421 ((end = strstr(cur, "\r\n")) || (end = strstr(cur, "\n")))) { | |
| 422 int step = (*end == '\r' ? 2 : 1); | |
| 6333 | 423 *end = '\0'; |
| 424 irc_parse_msg(irc, cur); | |
| 8156 | 425 cur = end + step; |
| 6333 | 426 } |
| 427 if (cur != irc->inbuf + irc->inbufused) { /* leftover */ | |
| 428 irc->inbufused -= (cur - irc->inbuf); | |
| 429 memmove(irc->inbuf, cur, irc->inbufused); | |
| 430 } else { | |
| 431 irc->inbufused = 0; | |
| 432 } | |
| 3616 | 433 } |
| 434 | |
| 6333 | 435 static void irc_chat_join (GaimConnection *gc, GHashTable *data) |
| 436 { | |
| 437 struct irc_conn *irc = gc->proto_data; | |
| 438 const char *args[2]; | |
| 3616 | 439 |
| 6333 | 440 args[0] = g_hash_table_lookup(data, "channel"); |
| 441 args[1] = g_hash_table_lookup(data, "password"); | |
| 442 irc_cmd_join(irc, "join", NULL, args); | |
| 3622 | 443 } |
| 444 | |
| 9917 | 445 static char *irc_get_chat_name(GHashTable *data) { |
| 446 return g_strdup(g_hash_table_lookup(data, "channel")); | |
| 447 } | |
| 448 | |
| 6333 | 449 static void irc_chat_invite(GaimConnection *gc, int id, const char *message, const char *name) |
| 3751 | 450 { |
| 6333 | 451 struct irc_conn *irc = gc->proto_data; |
| 452 GaimConversation *convo = gaim_find_chat(gc, id); | |
| 453 const char *args[2]; | |
| 3751 | 454 |
| 6333 | 455 if (!convo) { |
| 456 gaim_debug(GAIM_DEBUG_ERROR, "irc", "Got chat invite request for bogus chat\n"); | |
| 457 return; | |
| 458 } | |
| 459 args[0] = name; | |
| 460 args[1] = gaim_conversation_get_name(convo); | |
| 461 irc_cmd_invite(irc, "invite", gaim_conversation_get_name(convo), args); | |
| 3707 | 462 } |
| 463 | |
| 6333 | 464 |
| 465 static void irc_chat_leave (GaimConnection *gc, int id) | |
| 3707 | 466 { |
| 6333 | 467 struct irc_conn *irc = gc->proto_data; |
| 468 GaimConversation *convo = gaim_find_chat(gc, id); | |
| 469 const char *args[2]; | |
| 5298 | 470 |
| 6333 | 471 if (!convo) |
| 472 return; | |
| 3735 | 473 |
| 6333 | 474 args[0] = gaim_conversation_get_name(convo); |
| 475 args[1] = NULL; | |
| 476 irc_cmd_part(irc, "part", gaim_conversation_get_name(convo), args); | |
| 477 serv_got_chat_left(gc, id); | |
| 3735 | 478 } |
| 479 | |
| 6333 | 480 static int irc_chat_send(GaimConnection *gc, int id, const char *what) |
| 3735 | 481 { |
| 6333 | 482 struct irc_conn *irc = gc->proto_data; |
| 483 GaimConversation *convo = gaim_find_chat(gc, id); | |
| 484 const char *args[2]; | |
| 8163 | 485 char *tmp; |
| 6333 | 486 |
| 487 if (!convo) { | |
| 488 gaim_debug(GAIM_DEBUG_ERROR, "irc", "chat send on nonexistent chat\n"); | |
| 489 return -EINVAL; | |
| 490 } | |
| 9130 | 491 #if 0 |
| 6333 | 492 if (*what == '/') { |
| 493 return irc_parse_cmd(irc, convo->name, what + 1); | |
| 494 } | |
| 9130 | 495 #endif |
| 6333 | 496 args[0] = convo->name; |
| 497 args[1] = what; | |
| 498 | |
| 499 irc_cmd_privmsg(irc, "msg", NULL, args); | |
| 8163 | 500 |
| 501 tmp = gaim_escape_html(what); | |
| 502 serv_got_chat_in(gc, id, gaim_connection_get_display_name(gc), 0, tmp, time(NULL)); | |
| 503 g_free(tmp); | |
| 6333 | 504 return 0; |
| 3707 | 505 } |
| 506 | |
| 6333 | 507 static guint irc_nick_hash(const char *nick) |
| 508 { | |
| 509 char *lc; | |
| 510 guint bucket; | |
|
6270
1bf6fd117797
[gaim-migrate @ 6767]
Christian Hammond <chipx86@chipx86.com>
parents:
6240
diff
changeset
|
511 |
| 6333 | 512 lc = g_utf8_strdown(nick, -1); |
| 513 bucket = g_str_hash(lc); | |
| 514 g_free(lc); | |
|
6270
1bf6fd117797
[gaim-migrate @ 6767]
Christian Hammond <chipx86@chipx86.com>
parents:
6240
diff
changeset
|
515 |
| 6333 | 516 return bucket; |
| 3029 | 517 } |
| 518 | |
| 6333 | 519 static gboolean irc_nick_equal(const char *nick1, const char *nick2) |
|
2619
536198196dc6
[gaim-migrate @ 2632]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2617
diff
changeset
|
520 { |
| 6333 | 521 return (gaim_utf8_strcasecmp(nick1, nick2) == 0); |
|
2619
536198196dc6
[gaim-migrate @ 2632]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2617
diff
changeset
|
522 } |
|
536198196dc6
[gaim-migrate @ 2632]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2617
diff
changeset
|
523 |
| 6333 | 524 static void irc_buddy_free(struct irc_buddy *ib) |
|
2619
536198196dc6
[gaim-migrate @ 2632]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2617
diff
changeset
|
525 { |
| 6333 | 526 g_free(ib->name); |
| 527 g_free(ib); | |
|
2619
536198196dc6
[gaim-migrate @ 2632]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2617
diff
changeset
|
528 } |
|
536198196dc6
[gaim-migrate @ 2632]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2617
diff
changeset
|
529 |
| 9154 | 530 static void irc_chat_set_topic(GaimConnection *gc, int id, const char *topic) |
| 531 { | |
| 532 char *buf; | |
| 533 const char *name = NULL; | |
| 534 struct irc_conn *irc; | |
| 535 | |
| 536 irc = gc->proto_data; | |
| 537 name = gaim_conversation_get_name(gaim_find_chat(gc, id)); | |
| 538 | |
| 539 if (name == NULL) | |
| 540 return; | |
| 541 | |
| 542 buf = irc_format(irc, "vt:", "TOPIC", name, topic); | |
| 543 irc_send(irc, buf); | |
| 544 g_free(buf); | |
| 545 } | |
| 546 | |
| 8114 | 547 static GaimRoomlist *irc_roomlist_get_list(GaimConnection *gc) |
| 548 { | |
| 549 struct irc_conn *irc; | |
| 550 GList *fields = NULL; | |
| 551 GaimRoomlistField *f; | |
| 8352 | 552 char *buf; |
| 8114 | 553 |
| 554 irc = gc->proto_data; | |
| 555 | |
| 556 if (irc->roomlist) | |
| 557 gaim_roomlist_unref(irc->roomlist); | |
| 558 | |
| 559 irc->roomlist = gaim_roomlist_new(gaim_connection_get_account(gc)); | |
| 560 | |
| 561 f = gaim_roomlist_field_new(GAIM_ROOMLIST_FIELD_STRING, "", "channel", TRUE); | |
| 562 fields = g_list_append(fields, f); | |
| 563 | |
| 564 f = gaim_roomlist_field_new(GAIM_ROOMLIST_FIELD_INT, _("Users"), "users", FALSE); | |
| 565 fields = g_list_append(fields, f); | |
| 566 | |
| 567 f = gaim_roomlist_field_new(GAIM_ROOMLIST_FIELD_STRING, _("Topic"), "topic", FALSE); | |
| 568 fields = g_list_append(fields, f); | |
| 569 | |
| 570 gaim_roomlist_set_fields(irc->roomlist, fields); | |
| 571 | |
| 8352 | 572 buf = irc_format(irc, "v", "LIST"); |
| 573 irc_send(irc, buf); | |
| 574 g_free(buf); | |
| 8114 | 575 |
| 576 return irc->roomlist; | |
| 577 } | |
| 578 | |
| 579 static void irc_roomlist_cancel(GaimRoomlist *list) | |
| 580 { | |
| 581 GaimConnection *gc = gaim_account_get_connection(list->account); | |
| 582 struct irc_conn *irc; | |
| 583 | |
| 584 if (gc == NULL) | |
| 585 return; | |
| 586 | |
| 587 irc = gc->proto_data; | |
| 588 | |
| 589 gaim_roomlist_set_in_progress(list, FALSE); | |
| 590 | |
| 591 if (irc->roomlist == list) { | |
| 592 irc->roomlist = NULL; | |
| 593 gaim_roomlist_unref(list); | |
| 594 } | |
| 595 } | |
| 596 | |
|
5205
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5150
diff
changeset
|
597 static GaimPluginProtocolInfo prpl_info = |
| 2086 | 598 { |
|
5205
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5150
diff
changeset
|
599 OPT_PROTO_CHAT_TOPIC | OPT_PROTO_PASSWORD_OPTIONAL, |
| 9475 | 600 NULL, /* user_splits */ |
| 601 NULL, /* protocol_options */ | |
| 9951 | 602 NO_BUDDY_ICONS, /* icon_spec */ |
| 603 irc_blist_icon, /* list_icon */ | |
| 604 irc_blist_emblems, /* list_emblems */ | |
| 9475 | 605 NULL, /* status_text */ |
| 606 NULL, /* tooltip_text */ | |
| 9951 | 607 irc_status_types, /* away_states */ |
| 9475 | 608 NULL, /* blist_node_menu */ |
| 9951 | 609 irc_chat_join_info, /* chat_info */ |
| 9754 | 610 irc_chat_info_defaults, /* chat_info_defaults */ |
| 9951 | 611 irc_login, /* login */ |
| 612 irc_close, /* close */ | |
| 613 irc_im_send, /* send_im */ | |
| 9475 | 614 NULL, /* set_info */ |
| 615 NULL, /* send_typing */ | |
| 9951 | 616 irc_get_info, /* get_info */ |
| 617 irc_set_status, /* set_status */ | |
| 9475 | 618 NULL, /* set_idle */ |
| 619 NULL, /* change_passwd */ | |
| 9951 | 620 irc_add_buddy, /* add_buddy */ |
| 9475 | 621 NULL, /* add_buddies */ |
| 9951 | 622 irc_remove_buddy, /* remove_buddy */ |
| 9475 | 623 NULL, /* remove_buddies */ |
| 9741 | 624 NULL, /* add_permit */ |
| 625 NULL, /* add_deny */ | |
| 626 NULL, /* rem_permit */ | |
| 627 NULL, /* rem_deny */ | |
| 628 NULL, /* set_permit_deny */ | |
| 9475 | 629 NULL, /* warn */ |
| 9951 | 630 irc_chat_join, /* join_chat */ |
| 9475 | 631 NULL, /* reject_chat */ |
| 9951 | 632 irc_get_chat_name, /* get_chat_name */ |
| 633 irc_chat_invite, /* chat_invite */ | |
| 634 irc_chat_leave, /* chat_leave */ | |
| 9475 | 635 NULL, /* chat_whisper */ |
| 9951 | 636 irc_chat_send, /* chat_send */ |
| 9475 | 637 NULL, /* keepalive */ |
| 638 NULL, /* register_user */ | |
| 639 NULL, /* get_cb_info */ | |
| 640 NULL, /* get_cb_away */ | |
| 641 NULL, /* alias_buddy */ | |
| 642 NULL, /* group_buddy */ | |
| 643 NULL, /* rename_group */ | |
| 644 NULL, /* buddy_free */ | |
| 645 NULL, /* convo_closed */ | |
| 646 NULL, /* normalize */ | |
| 647 NULL, /* set_buddy_icon */ | |
| 648 NULL, /* remove_group */ | |
| 649 NULL, /* get_cb_real_name */ | |
| 9951 | 650 irc_chat_set_topic, /* set_chat_topic */ |
| 9475 | 651 NULL, /* find_blist_chat */ |
| 652 irc_roomlist_get_list, /* roomlist_get_list */ | |
| 653 irc_roomlist_cancel, /* roomlist_cancel */ | |
| 654 NULL, /* roomlist_expand_category */ | |
| 655 NULL, /* can_receive_file */ | |
| 656 irc_dccsend_send_file /* send_file */ | |
|
5205
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5150
diff
changeset
|
657 }; |
|
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5150
diff
changeset
|
658 |
| 8114 | 659 |
|
5205
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5150
diff
changeset
|
660 static GaimPluginInfo info = |
|
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5150
diff
changeset
|
661 { |
| 9943 | 662 GAIM_PLUGIN_MAGIC, |
| 663 GAIM_MAJOR_VERSION, | |
| 664 GAIM_MINOR_VERSION, | |
|
5205
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5150
diff
changeset
|
665 GAIM_PLUGIN_PROTOCOL, /**< type */ |
|
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5150
diff
changeset
|
666 NULL, /**< ui_requirement */ |
|
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5150
diff
changeset
|
667 0, /**< flags */ |
|
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5150
diff
changeset
|
668 NULL, /**< dependencies */ |
|
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5150
diff
changeset
|
669 GAIM_PRIORITY_DEFAULT, /**< priority */ |
|
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5150
diff
changeset
|
670 |
|
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5150
diff
changeset
|
671 "prpl-irc", /**< id */ |
|
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5150
diff
changeset
|
672 "IRC", /**< name */ |
|
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5150
diff
changeset
|
673 VERSION, /**< version */ |
| 6333 | 674 N_("IRC Protocol Plugin"), /** summary */ |
| 675 N_("The IRC Protocol Plugin that Sucks Less"), /** description */ | |
|
5205
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5150
diff
changeset
|
676 NULL, /**< author */ |
|
6371
8f94cce8faa5
[gaim-migrate @ 6876]
Christian Hammond <chipx86@chipx86.com>
parents:
6369
diff
changeset
|
677 GAIM_WEBSITE, /**< homepage */ |
|
5205
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5150
diff
changeset
|
678 |
|
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5150
diff
changeset
|
679 NULL, /**< load */ |
|
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5150
diff
changeset
|
680 NULL, /**< unload */ |
|
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5150
diff
changeset
|
681 NULL, /**< destroy */ |
|
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5150
diff
changeset
|
682 |
|
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5150
diff
changeset
|
683 NULL, /**< ui_info */ |
| 8993 | 684 &prpl_info, /**< extra_info */ |
| 685 NULL, | |
| 9015 | 686 irc_actions |
|
5205
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5150
diff
changeset
|
687 }; |
|
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5150
diff
changeset
|
688 |
| 6333 | 689 static void _init_plugin(GaimPlugin *plugin) |
|
5205
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5150
diff
changeset
|
690 { |
|
5638
0bdfa28c678e
[gaim-migrate @ 6047]
Christian Hammond <chipx86@chipx86.com>
parents:
5618
diff
changeset
|
691 GaimAccountUserSplit *split; |
|
0bdfa28c678e
[gaim-migrate @ 6047]
Christian Hammond <chipx86@chipx86.com>
parents:
5618
diff
changeset
|
692 GaimAccountOption *option; |
|
0bdfa28c678e
[gaim-migrate @ 6047]
Christian Hammond <chipx86@chipx86.com>
parents:
5618
diff
changeset
|
693 |
| 6333 | 694 split = gaim_account_user_split_new(_("Server"), IRC_DEFAULT_SERVER, '@'); |
|
5638
0bdfa28c678e
[gaim-migrate @ 6047]
Christian Hammond <chipx86@chipx86.com>
parents:
5618
diff
changeset
|
695 prpl_info.user_splits = g_list_append(prpl_info.user_splits, split); |
|
0bdfa28c678e
[gaim-migrate @ 6047]
Christian Hammond <chipx86@chipx86.com>
parents:
5618
diff
changeset
|
696 |
|
6459
b52870734c21
[gaim-migrate @ 6968]
Christian Hammond <chipx86@chipx86.com>
parents:
6371
diff
changeset
|
697 option = gaim_account_option_int_new(_("Port"), "port", IRC_DEFAULT_PORT); |
| 6333 | 698 prpl_info.protocol_options = g_list_append(prpl_info.protocol_options, option); |
|
5638
0bdfa28c678e
[gaim-migrate @ 6047]
Christian Hammond <chipx86@chipx86.com>
parents:
5618
diff
changeset
|
699 |
| 10258 | 700 option = gaim_account_option_string_new(_("Encodings"), "encoding", IRC_DEFAULT_CHARSET); |
| 6333 | 701 prpl_info.protocol_options = g_list_append(prpl_info.protocol_options, option); |
|
5205
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5150
diff
changeset
|
702 |
| 7323 | 703 option = gaim_account_option_string_new(_("Username"), "username", ""); |
| 704 prpl_info.protocol_options = g_list_append(prpl_info.protocol_options, option); | |
| 705 | |
| 10002 | 706 option = gaim_account_option_string_new(_("Real name"), "realname", ""); |
| 707 prpl_info.protocol_options = g_list_append(prpl_info.protocol_options, option); | |
| 708 | |
| 6333 | 709 _irc_plugin = plugin; |
| 9130 | 710 |
| 711 irc_register_commands(); | |
| 2086 | 712 } |
| 713 | |
| 6333 | 714 GAIM_INIT_PLUGIN(irc, _init_plugin, info); |
