Mercurial > pidgin
comparison plugins/irc.c @ 1676:a3d857c8984e
[gaim-migrate @ 1686]
IRC got away message support.
committer: Tailor Script <tailor@pidgin.im>
| author | Rob Flynn <gaim@robflynn.com> |
|---|---|
| date | Sat, 31 Mar 2001 22:46:54 +0000 |
| parents | 3232467ae220 |
| children | 1573a65fd0cd |
comparison
equal
deleted
inserted
replaced
| 1675:3232467ae220 | 1676:a3d857c8984e |
|---|---|
| 448 } | 448 } |
| 449 | 449 |
| 450 g_strfreev(res); | 450 g_strfreev(res); |
| 451 } | 451 } |
| 452 | 452 |
| 453 /* Autoresponse to an away message */ | |
| 454 if (((strstr(buf, " 301 ")) && (!strstr(buf, "PRIVMSG")) && (!strstr(buf, "NOTICE")))) { | |
| 455 char **res; | |
| 456 | |
| 457 res = g_strsplit(buf, " ", 5); | |
| 458 | |
| 459 if (!strcmp(res[1], "301")) | |
| 460 serv_got_im(gc, res[3], res[4] + 1, 1); | |
| 461 | |
| 462 g_strfreev(res); | |
| 463 } | |
| 464 | |
| 453 /* Parse the list of names that we receive when we first sign on to | 465 /* Parse the list of names that we receive when we first sign on to |
| 454 * a channel */ | 466 * a channel */ |
| 455 | 467 |
| 456 if (((strstr(buf, " 353 ")) && (!strstr(buf, "PRIVMSG")) && (!strstr(buf, "NOTICE")))) { | 468 if (((strstr(buf, " 353 ")) && (!strstr(buf, "PRIVMSG")) && (!strstr(buf, "NOTICE")))) { |
| 457 gchar u_host[255]; | 469 gchar u_host[255]; |
| 1251 gtk_object_set_user_data(GTK_OBJECT(button), gc); | 1263 gtk_object_set_user_data(GTK_OBJECT(button), gc); |
| 1252 gtk_menu_append(GTK_MENU(menu), button); | 1264 gtk_menu_append(GTK_MENU(menu), button); |
| 1253 gtk_widget_show(button); | 1265 gtk_widget_show(button); |
| 1254 } | 1266 } |
| 1255 | 1267 |
| 1268 | |
| 1269 static void irc_set_away(struct gaim_connection *gc, char *state, char *msg) | |
| 1270 { | |
| 1271 struct irc_data *idata = (struct irc_data *)gc->proto_data; | |
| 1272 char buf[BUF_LEN]; | |
| 1273 | |
| 1274 if (msg) | |
| 1275 g_snprintf(buf, BUF_LEN, "AWAY :%s\n", msg); | |
| 1276 else | |
| 1277 g_snprintf(buf, BUF_LEN, "AWAY\n"); | |
| 1278 | |
| 1279 write(idata->fd, buf, strlen(buf)); | |
| 1280 } | |
| 1256 | 1281 |
| 1257 static struct prpl *my_protocol = NULL; | 1282 static struct prpl *my_protocol = NULL; |
| 1258 | 1283 |
| 1259 static void irc_init(struct prpl *ret) | 1284 static void irc_init(struct prpl *ret) |
| 1260 { | 1285 { |
| 1268 ret->send_im = irc_send_im; | 1293 ret->send_im = irc_send_im; |
| 1269 ret->join_chat = irc_join_chat; | 1294 ret->join_chat = irc_join_chat; |
| 1270 ret->chat_leave = irc_chat_leave; | 1295 ret->chat_leave = irc_chat_leave; |
| 1271 ret->chat_send = irc_chat_send; | 1296 ret->chat_send = irc_chat_send; |
| 1272 ret->get_info = irc_get_info; | 1297 ret->get_info = irc_get_info; |
| 1298 ret->set_away = irc_set_away; | |
| 1273 | 1299 |
| 1274 my_protocol = ret; | 1300 my_protocol = ret; |
| 1275 } | 1301 } |
| 1276 | 1302 |
| 1277 char *gaim_plugin_init(GModule * handle) | 1303 char *gaim_plugin_init(GModule * handle) |
