Mercurial > pidgin
comparison src/protocols/irc/irc.c @ 2847:e49bd1479edd
[gaim-migrate @ 2860]
apathy by seanegan.
i mean. apache by seanegan.
i'm so lame.
a patch by seanegan.
committer: Tailor Script <tailor@pidgin.im>
| author | Eric Warmenhoven <eric@warmenhoven.org> |
|---|---|
| date | Wed, 05 Dec 2001 10:15:18 +0000 |
| parents | cf50045c0167 |
| children | b1e300a85678 |
comparison
equal
deleted
inserted
replaced
| 2846:4b3f17ca66bf | 2847:e49bd1479edd |
|---|---|
| 864 nick[sizeof(nick)-1] = 0; | 864 nick[sizeof(nick)-1] = 0; |
| 865 if ((ex - pdibuf) < sizeof (nick)) | 865 if ((ex - pdibuf) < sizeof (nick)) |
| 866 nick[ex - pdibuf] = 0; /* cut the buffer at the '!' */ | 866 nick[ex - pdibuf] = 0; /* cut the buffer at the '!' */ |
| 867 } | 867 } |
| 868 | 868 |
| 869 if (!strcmp(cmd, "INVITE")) { /* */ | 869 if (!strcmp(cmd, "INVITE")) { |
| 870 char *chan = g_strdup(word[4]); | |
| 871 serv_got_chat_invite(gc, chan + 1, nick, NULL, g_list_append(NULL, chan)); | |
| 870 } else if (!strcmp(cmd, "JOIN")) { | 872 } else if (!strcmp(cmd, "JOIN")) { |
| 871 char *chan = *word[3] == ':' ? word[3] + 1 : word[3]; | 873 char *chan = *word[3] == ':' ? word[3] + 1 : word[3]; |
| 872 if (!g_strcasecmp(gc->displayname, nick)) { | 874 if (!g_strcasecmp(gc->displayname, nick)) { |
| 873 static int id = 1; | 875 static int id = 1; |
| 874 serv_got_joined_chat(gc, id++, chan); | 876 serv_got_joined_chat(gc, id++, chan); |
| 1280 | 1282 |
| 1281 if (!g_strcasecmp(pdibuf, "ME")) { | 1283 if (!g_strcasecmp(pdibuf, "ME")) { |
| 1282 g_snprintf(buf, sizeof(buf), "PRIVMSG %s :\001ACTION %s\001\r\n", who, word_eol[2]); | 1284 g_snprintf(buf, sizeof(buf), "PRIVMSG %s :\001ACTION %s\001\r\n", who, word_eol[2]); |
| 1283 irc_write(id->fd, buf, strlen(buf)); | 1285 irc_write(id->fd, buf, strlen(buf)); |
| 1284 return 1; | 1286 return 1; |
| 1287 } else if (!g_strcasecmp(pdibuf, "INVITE")) { | |
| 1288 char buf[IRC_BUF_LEN]; | |
| 1289 g_snprintf(buf, sizeof(buf), "INVITE %s\r\n", word_eol[2]); | |
| 1290 irc_write(id->fd, buf, strlen(buf)); | |
| 1285 } else if (!g_strcasecmp(pdibuf, "TOPIC")) { | 1291 } else if (!g_strcasecmp(pdibuf, "TOPIC")) { |
| 1286 if (!*word_eol[2]) | 1292 if (!*word_eol[2]) |
| 1287 return -EINVAL; | 1293 return -EINVAL; |
| 1288 g_snprintf(buf, sizeof(buf), "TOPIC %s :%s\r\n", who, word_eol[2]); | 1294 g_snprintf(buf, sizeof(buf), "TOPIC %s :%s\r\n", who, word_eol[2]); |
| 1289 irc_write(id->fd, buf, strlen(buf)); | 1295 irc_write(id->fd, buf, strlen(buf)); |
| 1365 c = find_conversation(who); | 1371 c = find_conversation(who); |
| 1366 } | 1372 } |
| 1367 if (!c) | 1373 if (!c) |
| 1368 return -EINVAL; | 1374 return -EINVAL; |
| 1369 write_to_conv(c, "<B>Currently supported commands:<BR>" | 1375 write_to_conv(c, "<B>Currently supported commands:<BR>" |
| 1370 "JOIN PART LIST TOPIC WHOIS<BR>" | 1376 "WHOIS INVITE NICK LIST<BR>" |
| 1371 "OP DEOP VOICE DEVOICE KICK<BR>" | 1377 "JOIN PART TOPIC KICK<BR>" |
| 1372 "NICK ME MSG QUOTE SAY</B>", | 1378 "OP DEOP VOICE DEVOICE<BR>" |
| 1379 "ME MSG QUOTE SAY</B>", | |
| 1373 WFLAG_NOLOG, NULL, time(NULL)); | 1380 WFLAG_NOLOG, NULL, time(NULL)); |
| 1374 } else { | 1381 } else { |
| 1375 struct conversation *c = NULL; | 1382 struct conversation *c = NULL; |
| 1376 if (is_channel(gc, who)) { | 1383 if (is_channel(gc, who)) { |
| 1377 c = irc_find_chat(gc, who); | 1384 c = irc_find_chat(gc, who); |
| 1404 cr = strchr(what, '\n'); | 1411 cr = strchr(what, '\n'); |
| 1405 } | 1412 } |
| 1406 return ret; | 1413 return ret; |
| 1407 } else | 1414 } else |
| 1408 return handle_command(gc, who, what); | 1415 return handle_command(gc, who, what); |
| 1416 } | |
| 1417 | |
| 1418 static void irc_chat_invite(struct gaim_connection *gc, int idn, char *message, char *name) { | |
| 1419 char buf[IRC_BUF_LEN]; | |
| 1420 struct irc_data *id = gc->proto_data; | |
| 1421 struct conversation *c = irc_find_chat_by_id(gc, idn); | |
| 1422 g_snprintf(buf, sizeof(buf), "INVITE %s %s\r\n", name, c->name); | |
| 1423 irc_write(id->fd, buf, strlen(buf)); | |
| 1409 } | 1424 } |
| 1410 | 1425 |
| 1411 static int irc_send_im(struct gaim_connection *gc, char *who, char *what, int flags) | 1426 static int irc_send_im(struct gaim_connection *gc, char *who, char *what, int flags) |
| 1412 { | 1427 { |
| 1413 if (*who == '@' || *who == '+') | 1428 if (*who == '@' || *who == '+') |
| 1548 ret->chat_send = irc_chat_send; | 1563 ret->chat_send = irc_chat_send; |
| 1549 ret->away_states = irc_away_states; | 1564 ret->away_states = irc_away_states; |
| 1550 ret->set_away = irc_set_away; | 1565 ret->set_away = irc_set_away; |
| 1551 ret->get_info = irc_get_info; | 1566 ret->get_info = irc_get_info; |
| 1552 ret->buddy_menu = irc_buddy_menu; | 1567 ret->buddy_menu = irc_buddy_menu; |
| 1568 ret->chat_invite = irc_chat_invite; | |
| 1553 my_protocol = ret; | 1569 my_protocol = ret; |
| 1554 } | 1570 } |
| 1555 | 1571 |
| 1556 #ifndef STATIC | 1572 #ifndef STATIC |
| 1557 | 1573 |
