Mercurial > pidgin
annotate src/protocols/irc/irc.c @ 9234:f18eb3f22733
[gaim-migrate @ 10030]
This appears to be somewhat hacky, but due to the lack of a timer in
blist.c, we need a core place to emit buddy-idle-updated. server.c now
maintains a list of idle buddies and emits the signal when appropriate. We
really need a better way to do this, which I'll attempt to incorporate into
the status rewrite, but perhaps the best way would involve the blist update
timer being in blist.c. Anyhow, this works for now.
committer: Tailor Script <tailor@pidgin.im>
| author | Christian Hammond <chipx86@chipx86.com> |
|---|---|
| date | Tue, 08 Jun 2004 02:02:25 +0000 |
| parents | dcb290a0c970 |
| children | f4f210e47b60 |
| 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" |
| 32 #include "multi.h" | |
| 7148 | 33 #include "notify.h" |
| 9030 | 34 #include "prpl.h" |
| 35 #include "plugin.h" | |
| 6350 | 36 #include "util.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); |
| 43 static void irc_blist_emblems(GaimBuddy *b, char **se, char **sw, char **nw, char **ne); | |
| 6333 | 44 static GList *irc_away_states(GaimConnection *gc); |
| 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 { |
| 6333 | 85 if (irc->fd < 0) |
| 86 return -1; | |
|
2205
cff4fbe01c7b
[gaim-migrate @ 2215]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2171
diff
changeset
|
87 |
| 6333 | 88 /* gaim_debug(GAIM_DEBUG_MISC, "irc", "sent: %s", buf); */ |
| 89 return write(irc->fd, buf, strlen(buf)); | |
|
2205
cff4fbe01c7b
[gaim-migrate @ 2215]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2171
diff
changeset
|
90 } |
|
cff4fbe01c7b
[gaim-migrate @ 2215]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2171
diff
changeset
|
91 |
| 6333 | 92 /* XXX I don't like messing directly with these buddies */ |
| 93 gboolean irc_blist_timeout(struct irc_conn *irc) | |
| 2086 | 94 { |
| 6333 | 95 GString *string = g_string_sized_new(512); |
| 96 char *list, *buf; | |
|
2289
38e156136896
[gaim-migrate @ 2299]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2273
diff
changeset
|
97 |
| 6333 | 98 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
|
99 |
| 6333 | 100 list = g_string_free(string, FALSE); |
| 101 if (!list || !strlen(list)) { | |
| 102 g_free(list); | |
|
2137
18722ae5b882
[gaim-migrate @ 2147]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2131
diff
changeset
|
103 return TRUE; |
| 2086 | 104 } |
|
4416
8e62cee6d738
[gaim-migrate @ 4689]
Christian Hammond <chipx86@chipx86.com>
parents:
4373
diff
changeset
|
105 |
| 8038 | 106 buf = irc_format(irc, "vn", "ISON", list); |
| 6333 | 107 g_free(list); |
| 108 irc_send(irc, buf); | |
| 109 g_free(buf); | |
|
4416
8e62cee6d738
[gaim-migrate @ 4689]
Christian Hammond <chipx86@chipx86.com>
parents:
4373
diff
changeset
|
110 |
|
2131
acc11216ec5d
[gaim-migrate @ 2141]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2123
diff
changeset
|
111 return TRUE; |
| 2086 | 112 } |
| 113 | |
| 6333 | 114 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
|
115 { |
| 6333 | 116 ib->flag = FALSE; |
| 117 g_string_append_printf(string, "%s ", name); | |
| 3511 | 118 } |
| 119 | |
| 6695 | 120 static const char *irc_blist_icon(GaimAccount *a, GaimBuddy *b) |
| 3029 | 121 { |
| 6333 | 122 return "irc"; |
|
2339
9bda60d2d2e6
[gaim-migrate @ 2352]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2331
diff
changeset
|
123 } |
|
9bda60d2d2e6
[gaim-migrate @ 2352]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2331
diff
changeset
|
124 |
| 6695 | 125 static void irc_blist_emblems(GaimBuddy *b, char **se, char **sw, char **nw, char **ne) |
| 3751 | 126 { |
| 6333 | 127 if (b->present == GAIM_BUDDY_OFFLINE) |
| 128 *se = "offline"; | |
| 2086 | 129 } |
| 130 | |
| 6333 | 131 static GList *irc_away_states(GaimConnection *gc) |
| 2086 | 132 { |
| 6333 | 133 return g_list_append(NULL, (gpointer)GAIM_AWAY_CUSTOM); |
| 3452 | 134 } |
| 135 | |
| 9015 | 136 static GList *irc_actions(GaimPlugin *plugin, gpointer context) |
| 7148 | 137 { |
| 138 GList *list = NULL; | |
| 9015 | 139 GaimPluginAction *act = NULL; |
| 7148 | 140 |
| 9015 | 141 act = gaim_plugin_action_new(_("View MOTD"), irc_view_motd); |
| 142 list = g_list_append(list, act); | |
| 7148 | 143 |
| 144 return list; | |
| 145 } | |
| 146 | |
| 9030 | 147 |
| 148 static void irc_dccsend_send_ask_menu(GaimBlistNode *node, gpointer data) | |
| 149 { | |
| 150 GaimBuddy *buddy; | |
| 151 GaimConnection *gc; | |
| 152 | |
| 153 g_return_if_fail(GAIM_BLIST_NODE_IS_BUDDY(node)); | |
| 154 | |
| 155 buddy = (GaimBuddy *) node; | |
| 156 gc =gaim_account_get_connection(buddy->account); | |
| 157 | |
| 158 irc_dccsend_send_ask(gc, buddy->name); | |
| 159 } | |
| 160 | |
| 161 | |
| 162 static GList *irc_blist_node_menu(GaimBlistNode *node) | |
| 2086 | 163 { |
| 8351 | 164 GList *m = NULL; |
| 9030 | 165 GaimBlistNodeAction *act; |
| 166 | |
| 167 if(GAIM_BLIST_NODE_IS_BUDDY(node)) { | |
| 168 act = gaim_blist_node_action_new(_("Send File"), | |
| 169 irc_dccsend_send_ask_menu, NULL); | |
| 170 m = g_list_append(m, act); | |
| 171 } | |
| 8351 | 172 |
| 173 return m; | |
| 2086 | 174 } |
| 175 | |
| 6333 | 176 static GList *irc_chat_join_info(GaimConnection *gc) |
| 2086 | 177 { |
|
2170
c24595d3c364
[gaim-migrate @ 2180]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2167
diff
changeset
|
178 GList *m = NULL; |
|
2289
38e156136896
[gaim-migrate @ 2299]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2273
diff
changeset
|
179 struct proto_chat_entry *pce; |
|
2170
c24595d3c364
[gaim-migrate @ 2180]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2167
diff
changeset
|
180 |
|
2289
38e156136896
[gaim-migrate @ 2299]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2273
diff
changeset
|
181 pce = g_new0(struct proto_chat_entry, 1); |
| 7841 | 182 pce->label = _("_Channel:"); |
| 5234 | 183 pce->identifier = "channel"; |
|
2289
38e156136896
[gaim-migrate @ 2299]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2273
diff
changeset
|
184 m = g_list_append(m, pce); |
|
2170
c24595d3c364
[gaim-migrate @ 2180]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2167
diff
changeset
|
185 |
|
2289
38e156136896
[gaim-migrate @ 2299]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2273
diff
changeset
|
186 pce = g_new0(struct proto_chat_entry, 1); |
| 7841 | 187 pce->label = _("_Password:"); |
| 5234 | 188 pce->identifier = "password"; |
| 6499 | 189 pce->secret = TRUE; |
|
2289
38e156136896
[gaim-migrate @ 2299]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2273
diff
changeset
|
190 m = g_list_append(m, pce); |
|
2170
c24595d3c364
[gaim-migrate @ 2180]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2167
diff
changeset
|
191 |
|
c24595d3c364
[gaim-migrate @ 2180]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2167
diff
changeset
|
192 return m; |
| 2086 | 193 } |
| 194 | |
| 6333 | 195 static void irc_login(GaimAccount *account) |
|
2289
38e156136896
[gaim-migrate @ 2299]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2273
diff
changeset
|
196 { |
| 6333 | 197 GaimConnection *gc; |
| 198 struct irc_conn *irc; | |
| 199 char *buf, **userparts; | |
| 200 const char *username = gaim_account_get_username(account); | |
| 201 int err; | |
| 202 | |
| 203 gc = gaim_account_get_connection(account); | |
| 8677 | 204 gc->flags |= GAIM_CONNECTION_NO_NEWLINES; |
| 6333 | 205 |
| 6752 | 206 if (strpbrk(username, " \t\v\r\n") != NULL) { |
| 207 gaim_connection_error(gc, _("IRC nicks may not contain whitespace")); | |
| 208 return; | |
| 209 } | |
| 210 | |
| 6333 | 211 gc->proto_data = irc = g_new0(struct irc_conn, 1); |
| 212 irc->account = account; | |
| 213 | |
| 214 userparts = g_strsplit(username, "@", 2); | |
| 215 gaim_connection_set_display_name(gc, userparts[0]); | |
| 216 irc->server = g_strdup(userparts[1]); | |
| 217 g_strfreev(userparts); | |
|
2289
38e156136896
[gaim-migrate @ 2299]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2273
diff
changeset
|
218 |
| 6333 | 219 irc->buddies = g_hash_table_new_full((GHashFunc)irc_nick_hash, (GEqualFunc)irc_nick_equal, |
| 220 NULL, (GDestroyNotify)irc_buddy_free); | |
| 221 irc->cmds = g_hash_table_new(g_str_hash, g_str_equal); | |
| 222 irc_cmd_table_build(irc); | |
| 223 irc->msgs = g_hash_table_new(g_str_hash, g_str_equal); | |
| 224 irc_msg_table_build(irc); | |
| 225 | |
| 226 buf = g_strdup_printf(_("Signon: %s"), username); | |
| 227 gaim_connection_update_progress(gc, buf, 1, 2); | |
| 228 g_free(buf); | |
| 229 | |
| 230 err = gaim_proxy_connect(account, irc->server, | |
| 231 gaim_account_get_int(account, "port", IRC_DEFAULT_PORT), | |
| 232 irc_login_cb, gc); | |
| 233 | |
| 234 if (err || !account->gc) { | |
| 235 gaim_connection_error(gc, _("Couldn't create socket")); | |
|
2289
38e156136896
[gaim-migrate @ 2299]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2273
diff
changeset
|
236 return; |
| 6333 | 237 } |
|
2289
38e156136896
[gaim-migrate @ 2299]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2273
diff
changeset
|
238 } |
|
38e156136896
[gaim-migrate @ 2299]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2273
diff
changeset
|
239 |
| 6333 | 240 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
|
241 { |
| 6333 | 242 GaimConnection *gc = data; |
| 243 struct irc_conn *irc = gc->proto_data; | |
| 244 char hostname[256]; | |
| 245 char *buf; | |
| 7323 | 246 const char *username; |
| 6333 | 247 GList *connections = gaim_connections_get_all(); |
| 248 | |
| 8778 | 249 if (source < 0) { |
| 250 gaim_connection_error(gc, _("Couldn't connect to host")); | |
| 6333 | 251 return; |
| 8778 | 252 } |
| 6333 | 253 |
| 254 if (!g_list_find(connections, gc)) { | |
| 255 close(source); | |
| 256 return; | |
| 257 } | |
| 258 | |
| 259 irc->fd = source; | |
|
2289
38e156136896
[gaim-migrate @ 2299]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2273
diff
changeset
|
260 |
| 6333 | 261 if (gc->account->password && *gc->account->password) { |
| 262 buf = irc_format(irc, "vv", "PASS", gc->account->password); | |
| 263 if (irc_send(irc, buf) < 0) { | |
| 264 gaim_connection_error(gc, "Error sending password"); | |
| 265 return; | |
| 266 } | |
| 267 g_free(buf); | |
| 268 } | |
|
2289
38e156136896
[gaim-migrate @ 2299]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2273
diff
changeset
|
269 |
| 6333 | 270 gethostname(hostname, sizeof(hostname)); |
| 271 hostname[sizeof(hostname) - 1] = '\0'; | |
| 7323 | 272 username = gaim_account_get_string(irc->account, "username", ""); |
| 273 buf = irc_format(irc, "vvvv:", "USER", strlen(username) ? username : g_get_user_name(), hostname, irc->server, | |
| 6333 | 274 gc->account->alias && *gc->account->alias ? gc->account->alias : IRC_DEFAULT_ALIAS); |
| 275 if (irc_send(irc, buf) < 0) { | |
| 276 gaim_connection_error(gc, "Error registering with server"); | |
| 277 return; | |
| 278 } | |
| 279 g_free(buf); | |
| 280 buf = irc_format(irc, "vn", "NICK", gaim_connection_get_display_name(gc)); | |
| 281 if (irc_send(irc, buf) < 0) { | |
| 282 gaim_connection_error(gc, "Error sending nickname"); | |
| 283 return; | |
| 284 } | |
| 285 g_free(buf); | |
| 286 | |
| 287 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
|
288 } |
|
38e156136896
[gaim-migrate @ 2299]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2273
diff
changeset
|
289 |
| 6333 | 290 static void irc_close(GaimConnection *gc) |
|
2289
38e156136896
[gaim-migrate @ 2299]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2273
diff
changeset
|
291 { |
| 6333 | 292 struct irc_conn *irc = gc->proto_data; |
| 293 | |
| 6752 | 294 if (irc == NULL) |
| 295 return; | |
| 296 | |
| 6333 | 297 irc_cmd_quit(irc, "quit", NULL, NULL); |
| 298 | |
| 299 if (gc->inpa) | |
|
8287
ef881489396e
[gaim-migrate @ 9011]
Christian Hammond <chipx86@chipx86.com>
parents:
8170
diff
changeset
|
300 gaim_timeout_remove(gc->inpa); |
| 6333 | 301 |
| 302 g_free(irc->inbuf); | |
| 303 close(irc->fd); | |
| 304 if (irc->timer) | |
|
8287
ef881489396e
[gaim-migrate @ 9011]
Christian Hammond <chipx86@chipx86.com>
parents:
8170
diff
changeset
|
305 gaim_timeout_remove(irc->timer); |
| 6333 | 306 g_hash_table_destroy(irc->cmds); |
| 307 g_hash_table_destroy(irc->msgs); | |
| 308 if (irc->motd) | |
| 309 g_string_free(irc->motd, TRUE); | |
| 310 g_free(irc->server); | |
| 311 g_free(irc); | |
|
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 |
|
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
6982
diff
changeset
|
314 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
|
315 { |
| 6333 | 316 struct irc_conn *irc = gc->proto_data; |
| 317 const char *args[2]; | |
| 318 | |
| 7711 | 319 if (strchr(status_chars, *who) != NULL) |
| 6333 | 320 args[0] = who + 1; |
| 321 else | |
| 322 args[0] = who; | |
| 323 args[1] = what; | |
| 9130 | 324 #if 0 |
| 6333 | 325 if (*what == '/') { |
| 326 return irc_parse_cmd(irc, who, what + 1); | |
| 327 } | |
| 9130 | 328 #endif |
| 6333 | 329 irc_cmd_privmsg(irc, "msg", NULL, args); |
| 330 return 1; | |
|
2289
38e156136896
[gaim-migrate @ 2299]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2273
diff
changeset
|
331 } |
| 2086 | 332 |
| 6333 | 333 static void irc_get_info(GaimConnection *gc, const char *who) |
| 2086 | 334 { |
| 6333 | 335 struct irc_conn *irc = gc->proto_data; |
| 336 const char *args[1]; | |
| 337 args[0] = who; | |
| 338 irc_cmd_whois(irc, "whois", NULL, args); | |
| 339 } | |
| 340 | |
| 341 static void irc_set_away(GaimConnection *gc, const char *state, const char *msg) | |
| 342 { | |
| 343 struct irc_conn *irc = gc->proto_data; | |
| 344 const char *args[1]; | |
| 2086 | 345 |
|
4111
ee884f1d7ae3
[gaim-migrate @ 4326]
Christian Hammond <chipx86@chipx86.com>
parents:
4067
diff
changeset
|
346 if (gc->away) { |
|
ee884f1d7ae3
[gaim-migrate @ 4326]
Christian Hammond <chipx86@chipx86.com>
parents:
4067
diff
changeset
|
347 g_free(gc->away); |
|
2394
579f8d4347ad
[gaim-migrate @ 2407]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2393
diff
changeset
|
348 gc->away = NULL; |
|
4111
ee884f1d7ae3
[gaim-migrate @ 4326]
Christian Hammond <chipx86@chipx86.com>
parents:
4067
diff
changeset
|
349 } |
|
2393
a7ecfd3f7714
[gaim-migrate @ 2406]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2382
diff
changeset
|
350 |
| 6333 | 351 if (msg) |
|
4111
ee884f1d7ae3
[gaim-migrate @ 4326]
Christian Hammond <chipx86@chipx86.com>
parents:
4067
diff
changeset
|
352 gc->away = g_strdup(msg); |
| 2086 | 353 |
| 6333 | 354 args[0] = msg; |
| 355 irc_cmd_away(irc, "away", NULL, args); | |
| 4916 | 356 } |
| 357 | |
|
6787
faa491042c66
[gaim-migrate @ 7326]
Christian Hammond <chipx86@chipx86.com>
parents:
6752
diff
changeset
|
358 static void irc_add_buddy(GaimConnection *gc, const char *who, GaimGroup *group) |
| 3029 | 359 { |
| 6333 | 360 struct irc_conn *irc = (struct irc_conn *)gc->proto_data; |
| 361 struct irc_buddy *ib = g_new0(struct irc_buddy, 1); | |
| 362 ib->name = g_strdup(who); | |
| 363 g_hash_table_insert(irc->buddies, ib->name, ib); | |
| 3029 | 364 } |
| 3622 | 365 |
| 6333 | 366 static void irc_remove_buddy(GaimConnection *gc, const char *who, const char *group) |
| 367 { | |
| 368 struct irc_conn *irc = (struct irc_conn *)gc->proto_data; | |
| 369 g_hash_table_remove(irc->buddies, who); | |
| 3616 | 370 } |
|
4514
7521e29658bc
[gaim-migrate @ 4792]
Christian Hammond <chipx86@chipx86.com>
parents:
4509
diff
changeset
|
371 |
| 3616 | 372 |
| 6333 | 373 static void irc_input_cb(gpointer data, gint source, GaimInputCondition cond) |
| 374 { | |
| 375 GaimConnection *gc = data; | |
| 376 struct irc_conn *irc = gc->proto_data; | |
| 377 char *cur, *end; | |
| 378 int len; | |
| 379 | |
| 380 if (irc->inbuflen < irc->inbufused + IRC_INITIAL_BUFSIZE) { | |
| 381 irc->inbuflen += IRC_INITIAL_BUFSIZE; | |
| 382 irc->inbuf = g_realloc(irc->inbuf, irc->inbuflen); | |
| 3708 | 383 } |
| 3616 | 384 |
| 6333 | 385 if ((len = read(irc->fd, irc->inbuf + irc->inbufused, IRC_INITIAL_BUFSIZE - 1)) < 0) { |
| 7653 | 386 gaim_connection_error(gc, _("Read error")); |
| 6333 | 387 return; |
| 6369 | 388 } else if (len == 0) { |
| 389 /* Remote closed the connection, probably */ | |
| 390 return; | |
| 6333 | 391 } |
| 6369 | 392 |
| 6333 | 393 irc->inbufused += len; |
| 394 irc->inbuf[irc->inbufused] = '\0'; | |
| 3616 | 395 |
| 8156 | 396 cur = irc->inbuf; |
| 397 while (cur < irc->inbuf + irc->inbufused && | |
| 398 ((end = strstr(cur, "\r\n")) || (end = strstr(cur, "\n")))) { | |
| 399 int step = (*end == '\r' ? 2 : 1); | |
| 6333 | 400 *end = '\0'; |
| 401 irc_parse_msg(irc, cur); | |
| 8156 | 402 cur = end + step; |
| 6333 | 403 } |
| 404 if (cur != irc->inbuf + irc->inbufused) { /* leftover */ | |
| 405 irc->inbufused -= (cur - irc->inbuf); | |
| 406 memmove(irc->inbuf, cur, irc->inbufused); | |
| 407 } else { | |
| 408 irc->inbufused = 0; | |
| 409 } | |
| 3616 | 410 } |
| 411 | |
| 6333 | 412 static void irc_chat_join (GaimConnection *gc, GHashTable *data) |
| 413 { | |
| 414 struct irc_conn *irc = gc->proto_data; | |
| 415 const char *args[2]; | |
| 3616 | 416 |
| 6333 | 417 args[0] = g_hash_table_lookup(data, "channel"); |
| 418 args[1] = g_hash_table_lookup(data, "password"); | |
| 419 irc_cmd_join(irc, "join", NULL, args); | |
| 3622 | 420 } |
| 421 | |
| 6333 | 422 static void irc_chat_invite(GaimConnection *gc, int id, const char *message, const char *name) |
| 3751 | 423 { |
| 6333 | 424 struct irc_conn *irc = gc->proto_data; |
| 425 GaimConversation *convo = gaim_find_chat(gc, id); | |
| 426 const char *args[2]; | |
| 3751 | 427 |
| 6333 | 428 if (!convo) { |
| 429 gaim_debug(GAIM_DEBUG_ERROR, "irc", "Got chat invite request for bogus chat\n"); | |
| 430 return; | |
| 431 } | |
| 432 args[0] = name; | |
| 433 args[1] = gaim_conversation_get_name(convo); | |
| 434 irc_cmd_invite(irc, "invite", gaim_conversation_get_name(convo), args); | |
| 3707 | 435 } |
| 436 | |
| 6333 | 437 |
| 438 static void irc_chat_leave (GaimConnection *gc, int id) | |
| 3707 | 439 { |
| 6333 | 440 struct irc_conn *irc = gc->proto_data; |
| 441 GaimConversation *convo = gaim_find_chat(gc, id); | |
| 442 const char *args[2]; | |
| 5298 | 443 |
| 6333 | 444 if (!convo) |
| 445 return; | |
| 3735 | 446 |
| 6333 | 447 args[0] = gaim_conversation_get_name(convo); |
| 448 args[1] = NULL; | |
| 449 irc_cmd_part(irc, "part", gaim_conversation_get_name(convo), args); | |
| 450 serv_got_chat_left(gc, id); | |
| 3735 | 451 } |
| 452 | |
| 6333 | 453 static int irc_chat_send(GaimConnection *gc, int id, const char *what) |
| 3735 | 454 { |
| 6333 | 455 struct irc_conn *irc = gc->proto_data; |
| 456 GaimConversation *convo = gaim_find_chat(gc, id); | |
| 457 const char *args[2]; | |
| 8163 | 458 char *tmp; |
| 6333 | 459 |
| 460 if (!convo) { | |
| 461 gaim_debug(GAIM_DEBUG_ERROR, "irc", "chat send on nonexistent chat\n"); | |
| 462 return -EINVAL; | |
| 463 } | |
| 9130 | 464 #if 0 |
| 6333 | 465 if (*what == '/') { |
| 466 return irc_parse_cmd(irc, convo->name, what + 1); | |
| 467 } | |
| 9130 | 468 #endif |
| 6333 | 469 args[0] = convo->name; |
| 470 args[1] = what; | |
| 471 | |
| 472 irc_cmd_privmsg(irc, "msg", NULL, args); | |
| 8163 | 473 |
| 474 tmp = gaim_escape_html(what); | |
| 475 serv_got_chat_in(gc, id, gaim_connection_get_display_name(gc), 0, tmp, time(NULL)); | |
| 476 g_free(tmp); | |
| 6333 | 477 return 0; |
| 3707 | 478 } |
| 479 | |
| 6333 | 480 static guint irc_nick_hash(const char *nick) |
| 481 { | |
| 482 char *lc; | |
| 483 guint bucket; | |
|
6270
1bf6fd117797
[gaim-migrate @ 6767]
Christian Hammond <chipx86@chipx86.com>
parents:
6240
diff
changeset
|
484 |
| 6333 | 485 lc = g_utf8_strdown(nick, -1); |
| 486 bucket = g_str_hash(lc); | |
| 487 g_free(lc); | |
|
6270
1bf6fd117797
[gaim-migrate @ 6767]
Christian Hammond <chipx86@chipx86.com>
parents:
6240
diff
changeset
|
488 |
| 6333 | 489 return bucket; |
| 3029 | 490 } |
| 491 | |
| 6333 | 492 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
|
493 { |
| 6333 | 494 return (gaim_utf8_strcasecmp(nick1, nick2) == 0); |
|
2619
536198196dc6
[gaim-migrate @ 2632]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2617
diff
changeset
|
495 } |
|
536198196dc6
[gaim-migrate @ 2632]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2617
diff
changeset
|
496 |
| 6333 | 497 static void irc_buddy_free(struct irc_buddy *ib) |
|
2619
536198196dc6
[gaim-migrate @ 2632]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2617
diff
changeset
|
498 { |
| 6333 | 499 g_free(ib->name); |
| 500 g_free(ib); | |
|
2619
536198196dc6
[gaim-migrate @ 2632]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2617
diff
changeset
|
501 } |
|
536198196dc6
[gaim-migrate @ 2632]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2617
diff
changeset
|
502 |
| 9154 | 503 static void irc_chat_set_topic(GaimConnection *gc, int id, const char *topic) |
| 504 { | |
| 505 char *buf; | |
| 506 const char *name = NULL; | |
| 507 struct irc_conn *irc; | |
| 508 | |
| 509 irc = gc->proto_data; | |
| 510 name = gaim_conversation_get_name(gaim_find_chat(gc, id)); | |
| 511 | |
| 512 if (name == NULL) | |
| 513 return; | |
| 514 | |
| 515 buf = irc_format(irc, "vt:", "TOPIC", name, topic); | |
| 516 irc_send(irc, buf); | |
| 517 g_free(buf); | |
| 518 } | |
| 519 | |
| 8114 | 520 static GaimRoomlist *irc_roomlist_get_list(GaimConnection *gc) |
| 521 { | |
| 522 struct irc_conn *irc; | |
| 523 GList *fields = NULL; | |
| 524 GaimRoomlistField *f; | |
| 8352 | 525 char *buf; |
| 8114 | 526 |
| 527 irc = gc->proto_data; | |
| 528 | |
| 529 if (irc->roomlist) | |
| 530 gaim_roomlist_unref(irc->roomlist); | |
| 531 | |
| 532 irc->roomlist = gaim_roomlist_new(gaim_connection_get_account(gc)); | |
| 533 | |
| 534 f = gaim_roomlist_field_new(GAIM_ROOMLIST_FIELD_STRING, "", "channel", TRUE); | |
| 535 fields = g_list_append(fields, f); | |
| 536 | |
| 537 f = gaim_roomlist_field_new(GAIM_ROOMLIST_FIELD_INT, _("Users"), "users", FALSE); | |
| 538 fields = g_list_append(fields, f); | |
| 539 | |
| 540 f = gaim_roomlist_field_new(GAIM_ROOMLIST_FIELD_STRING, _("Topic"), "topic", FALSE); | |
| 541 fields = g_list_append(fields, f); | |
| 542 | |
| 543 gaim_roomlist_set_fields(irc->roomlist, fields); | |
| 544 | |
| 8352 | 545 buf = irc_format(irc, "v", "LIST"); |
| 546 irc_send(irc, buf); | |
| 547 g_free(buf); | |
| 8114 | 548 |
| 549 return irc->roomlist; | |
| 550 } | |
| 551 | |
| 552 static void irc_roomlist_cancel(GaimRoomlist *list) | |
| 553 { | |
| 554 GaimConnection *gc = gaim_account_get_connection(list->account); | |
| 555 struct irc_conn *irc; | |
| 556 | |
| 557 if (gc == NULL) | |
| 558 return; | |
| 559 | |
| 560 irc = gc->proto_data; | |
| 561 | |
| 562 gaim_roomlist_set_in_progress(list, FALSE); | |
| 563 | |
| 564 if (irc->roomlist == list) { | |
| 565 irc->roomlist = NULL; | |
| 566 gaim_roomlist_unref(list); | |
| 567 } | |
| 568 } | |
| 569 | |
|
5205
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5150
diff
changeset
|
570 static GaimPluginProtocolInfo prpl_info = |
| 2086 | 571 { |
|
8749
d7b8eb1f0a18
[gaim-migrate @ 9504]
Christian Hammond <chipx86@chipx86.com>
parents:
8713
diff
changeset
|
572 GAIM_PRPL_API_VERSION, |
|
5205
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5150
diff
changeset
|
573 OPT_PROTO_CHAT_TOPIC | OPT_PROTO_PASSWORD_OPTIONAL, |
|
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5150
diff
changeset
|
574 NULL, |
|
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5150
diff
changeset
|
575 NULL, |
| 6333 | 576 irc_blist_icon, |
| 577 irc_blist_emblems, | |
|
5205
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5150
diff
changeset
|
578 NULL, |
|
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5150
diff
changeset
|
579 NULL, |
|
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5150
diff
changeset
|
580 irc_away_states, |
| 9030 | 581 irc_blist_node_menu, |
| 6333 | 582 irc_chat_join_info, |
|
5205
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5150
diff
changeset
|
583 irc_login, |
|
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5150
diff
changeset
|
584 irc_close, |
| 6333 | 585 irc_im_send, |
|
5205
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5150
diff
changeset
|
586 NULL, |
|
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5150
diff
changeset
|
587 NULL, |
|
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5150
diff
changeset
|
588 irc_get_info, |
|
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5150
diff
changeset
|
589 irc_set_away, |
|
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5150
diff
changeset
|
590 NULL, |
|
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5150
diff
changeset
|
591 NULL, |
|
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5150
diff
changeset
|
592 irc_add_buddy, |
|
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5150
diff
changeset
|
593 NULL, |
|
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5150
diff
changeset
|
594 irc_remove_buddy, |
|
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5150
diff
changeset
|
595 NULL, |
|
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5150
diff
changeset
|
596 NULL, |
|
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5150
diff
changeset
|
597 NULL, |
|
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5150
diff
changeset
|
598 NULL, |
|
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5150
diff
changeset
|
599 NULL, |
|
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5150
diff
changeset
|
600 NULL, |
|
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5150
diff
changeset
|
601 NULL, |
| 6333 | 602 irc_chat_join, |
| 8562 | 603 NULL, /* reject chat invite */ |
|
5205
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5150
diff
changeset
|
604 irc_chat_invite, |
|
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5150
diff
changeset
|
605 irc_chat_leave, |
|
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5150
diff
changeset
|
606 NULL, |
|
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5150
diff
changeset
|
607 irc_chat_send, |
|
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5150
diff
changeset
|
608 NULL, |
|
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5150
diff
changeset
|
609 NULL, |
|
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5150
diff
changeset
|
610 NULL, |
|
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5150
diff
changeset
|
611 NULL, |
|
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5150
diff
changeset
|
612 NULL, |
|
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5150
diff
changeset
|
613 NULL, |
|
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5150
diff
changeset
|
614 NULL, |
|
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5150
diff
changeset
|
615 NULL, |
| 6333 | 616 NULL, /*irc_convo_closed,*/ |
| 8114 | 617 NULL, /* normalize */ |
| 618 NULL, /* set buddy icon */ | |
| 619 NULL, /* remove group */ | |
| 620 NULL, /* get_cb_real_name */ | |
| 9154 | 621 irc_chat_set_topic, |
| 8114 | 622 NULL, |
| 623 irc_roomlist_get_list, | |
| 624 irc_roomlist_cancel, | |
| 8589 | 625 NULL |
|
5205
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5150
diff
changeset
|
626 }; |
|
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5150
diff
changeset
|
627 |
| 8114 | 628 |
|
5205
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5150
diff
changeset
|
629 static GaimPluginInfo info = |
|
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5150
diff
changeset
|
630 { |
|
8749
d7b8eb1f0a18
[gaim-migrate @ 9504]
Christian Hammond <chipx86@chipx86.com>
parents:
8713
diff
changeset
|
631 GAIM_PLUGIN_API_VERSION, /**< api_version */ |
|
5205
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5150
diff
changeset
|
632 GAIM_PLUGIN_PROTOCOL, /**< type */ |
|
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5150
diff
changeset
|
633 NULL, /**< ui_requirement */ |
|
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5150
diff
changeset
|
634 0, /**< flags */ |
|
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5150
diff
changeset
|
635 NULL, /**< dependencies */ |
|
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5150
diff
changeset
|
636 GAIM_PRIORITY_DEFAULT, /**< priority */ |
|
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5150
diff
changeset
|
637 |
|
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5150
diff
changeset
|
638 "prpl-irc", /**< id */ |
|
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5150
diff
changeset
|
639 "IRC", /**< name */ |
|
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5150
diff
changeset
|
640 VERSION, /**< version */ |
| 6333 | 641 N_("IRC Protocol Plugin"), /** summary */ |
| 642 N_("The IRC Protocol Plugin that Sucks Less"), /** description */ | |
|
5205
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5150
diff
changeset
|
643 NULL, /**< author */ |
|
6371
8f94cce8faa5
[gaim-migrate @ 6876]
Christian Hammond <chipx86@chipx86.com>
parents:
6369
diff
changeset
|
644 GAIM_WEBSITE, /**< homepage */ |
|
5205
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5150
diff
changeset
|
645 |
|
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5150
diff
changeset
|
646 NULL, /**< load */ |
|
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5150
diff
changeset
|
647 NULL, /**< unload */ |
|
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5150
diff
changeset
|
648 NULL, /**< destroy */ |
|
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5150
diff
changeset
|
649 |
|
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5150
diff
changeset
|
650 NULL, /**< ui_info */ |
| 8993 | 651 &prpl_info, /**< extra_info */ |
| 652 NULL, | |
| 9015 | 653 irc_actions |
|
5205
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5150
diff
changeset
|
654 }; |
|
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5150
diff
changeset
|
655 |
| 6333 | 656 static void _init_plugin(GaimPlugin *plugin) |
|
5205
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5150
diff
changeset
|
657 { |
|
5638
0bdfa28c678e
[gaim-migrate @ 6047]
Christian Hammond <chipx86@chipx86.com>
parents:
5618
diff
changeset
|
658 GaimAccountUserSplit *split; |
|
0bdfa28c678e
[gaim-migrate @ 6047]
Christian Hammond <chipx86@chipx86.com>
parents:
5618
diff
changeset
|
659 GaimAccountOption *option; |
|
0bdfa28c678e
[gaim-migrate @ 6047]
Christian Hammond <chipx86@chipx86.com>
parents:
5618
diff
changeset
|
660 |
| 6333 | 661 split = gaim_account_user_split_new(_("Server"), IRC_DEFAULT_SERVER, '@'); |
|
5638
0bdfa28c678e
[gaim-migrate @ 6047]
Christian Hammond <chipx86@chipx86.com>
parents:
5618
diff
changeset
|
662 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
|
663 |
|
6459
b52870734c21
[gaim-migrate @ 6968]
Christian Hammond <chipx86@chipx86.com>
parents:
6371
diff
changeset
|
664 option = gaim_account_option_int_new(_("Port"), "port", IRC_DEFAULT_PORT); |
| 6333 | 665 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
|
666 |
| 6333 | 667 option = gaim_account_option_string_new(_("Encoding"), "encoding", IRC_DEFAULT_CHARSET); |
| 668 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
|
669 |
| 7323 | 670 option = gaim_account_option_string_new(_("Username"), "username", ""); |
| 671 prpl_info.protocol_options = g_list_append(prpl_info.protocol_options, option); | |
| 672 | |
| 6333 | 673 _irc_plugin = plugin; |
| 9130 | 674 |
| 675 irc_register_commands(); | |
| 2086 | 676 } |
| 677 | |
| 6333 | 678 GAIM_INIT_PLUGIN(irc, _init_plugin, info); |
