comparison libpurple/protocols/irc/irc.c @ 32827:4a34689eeb33 default tip

merged from im.pidgin.pidgin
author Yoshiki Yazawa <yaz@honeyplanet.jp>
date Sat, 19 Nov 2011 14:42:54 +0900
parents 0f94ec89f0bc a78523019e7a
children
comparison
equal deleted inserted replaced
32692:0f94ec89f0bc 32827:4a34689eeb33
354 struct irc_conn *irc; 354 struct irc_conn *irc;
355 char **userparts; 355 char **userparts;
356 const char *username = purple_account_get_username(account); 356 const char *username = purple_account_get_username(account);
357 357
358 gc = purple_account_get_connection(account); 358 gc = purple_account_get_connection(account);
359 gc->flags |= PURPLE_CONNECTION_NO_NEWLINES; 359 purple_connection_set_flags(gc, PURPLE_CONNECTION_NO_NEWLINES);
360 360
361 if (strpbrk(username, " \t\v\r\n") != NULL) { 361 if (strpbrk(username, " \t\v\r\n") != NULL) {
362 purple_connection_error (gc, 362 purple_connection_error (gc,
363 PURPLE_CONNECTION_ERROR_INVALID_SETTINGS, 363 PURPLE_CONNECTION_ERROR_INVALID_SETTINGS,
364 _("IRC nick and server may not contain whitespace")); 364 _("IRC nick and server may not contain whitespace"));
498 } 498 }
499 499
500 irc->fd = source; 500 irc->fd = source;
501 501
502 if (do_login(gc)) { 502 if (do_login(gc)) {
503 gc->inpa = purple_input_add(irc->fd, PURPLE_INPUT_READ, irc_input_cb, gc); 503 irc->inpa = purple_input_add(irc->fd, PURPLE_INPUT_READ, irc_input_cb, gc);
504 } 504 }
505 } 505 }
506 506
507 static void 507 static void
508 irc_ssl_connect_failure(PurpleSslConnection *gsc, PurpleSslErrorType error, 508 irc_ssl_connect_failure(PurpleSslConnection *gsc, PurpleSslErrorType error,
524 return; 524 return;
525 525
526 if (irc->gsc || (irc->fd >= 0)) 526 if (irc->gsc || (irc->fd >= 0))
527 irc_cmd_quit(irc, "quit", NULL, NULL); 527 irc_cmd_quit(irc, "quit", NULL, NULL);
528 528
529 if (gc->inpa) 529 if (irc->inpa) {
530 purple_input_remove(gc->inpa); 530 purple_input_remove(irc->inpa);
531 irc->inpa = 0;
532 }
531 533
532 g_free(irc->inbuf); 534 g_free(irc->inbuf);
533 if (irc->gsc) { 535 if (irc->gsc) {
534 purple_ssl_close(irc->gsc); 536 purple_ssl_close(irc->gsc);
535 } else if (irc->fd >= 0) { 537 } else if (irc->fd >= 0) {
643 } 645 }
644 } 646 }
645 647
646 static void read_input(struct irc_conn *irc, int len) 648 static void read_input(struct irc_conn *irc, int len)
647 { 649 {
650 PurpleConnection *connection = purple_account_get_connection(irc->account);
648 char *cur, *end; 651 char *cur, *end;
649 652
650 irc->account->gc->last_received = time(NULL); 653 purple_connection_update_last_received(connection);
651 irc->inbufused += len; 654 irc->inbufused += len;
652 irc->inbuf[irc->inbufused] = '\0'; 655 irc->inbuf[irc->inbufused] = '\0';
653 656
654 cur = irc->inbuf; 657 cur = irc->inbuf;
655 658
805 if (*what == '/') { 808 if (*what == '/') {
806 return irc_parse_cmd(irc, convo->name, what + 1); 809 return irc_parse_cmd(irc, convo->name, what + 1);
807 } 810 }
808 #endif 811 #endif
809 purple_markup_html_to_xhtml(what, NULL, &tmp); 812 purple_markup_html_to_xhtml(what, NULL, &tmp);
810 args[0] = convo->name; 813 args[0] = purple_conversation_get_name(convo);
811 args[1] = tmp; 814 args[1] = tmp;
812 815
813 irc_cmd_privmsg(irc, "msg", NULL, args); 816 irc_cmd_privmsg(irc, "msg", NULL, args);
814 817
815 serv_got_chat_in(gc, id, purple_connection_get_display_name(gc), flags, what, time(NULL)); 818 serv_got_chat_in(gc, id, purple_connection_get_display_name(gc), flags, what, time(NULL));