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