libpurple/protocols/irc/irc.c

changeset 33600
7f43656ee445
parent 32987
cdf1e8c4203c
parent 33404
bbd52f93184e
child 34312
4461d5c1e61c
child 34529
68cf25486001
equal deleted inserted replaced
33599:97dc0963df2d 33600:7f43656ee445
153 { 153 {
154 int ret; 154 int ret;
155 char *tosend= g_strdup(buf); 155 char *tosend= g_strdup(buf);
156 156
157 purple_signal_emit(_irc_plugin, "irc-sending-text", purple_account_get_connection(irc->account), &tosend); 157 purple_signal_emit(_irc_plugin, "irc-sending-text", purple_account_get_connection(irc->account), &tosend);
158
158 if (tosend == NULL) 159 if (tosend == NULL)
159 return 0; 160 return 0;
160 161
161 /* If we're not buffering writes, try to send immediately */ 162 /* If we're not buffering writes, try to send immediately */
162 if (!irc->writeh) 163 if (!irc->writeh)
391 char *buf, *tmp = NULL; 392 char *buf, *tmp = NULL;
392 char *server; 393 char *server;
393 const char *username, *realname; 394 const char *username, *realname;
394 struct irc_conn *irc = purple_connection_get_protocol_data(gc); 395 struct irc_conn *irc = purple_connection_get_protocol_data(gc);
395 const char *pass = purple_connection_get_password(gc); 396 const char *pass = purple_connection_get_password(gc);
397 #ifdef HAVE_CYRUS_SASL
398 const gboolean use_sasl = purple_account_get_bool(irc->account, "sasl", FALSE);
399 #endif
396 400
397 if (pass && *pass) { 401 if (pass && *pass) {
398 buf = irc_format(irc, "v:", "PASS", pass); 402 #ifdef HAVE_CYRUS_SASL
403 if (use_sasl)
404 buf = irc_format(irc, "vv:", "CAP", "REQ", "sasl");
405 else /* intended to fall through */
406 #endif
407 buf = irc_format(irc, "v:", "PASS", pass);
399 if (irc_send(irc, buf) < 0) { 408 if (irc_send(irc, buf) < 0) {
400 g_free(buf); 409 g_free(buf);
401 return FALSE; 410 return FALSE;
402 } 411 }
403 g_free(buf); 412 g_free(buf);
526 535
527 purple_circ_buffer_destroy(irc->outbuf); 536 purple_circ_buffer_destroy(irc->outbuf);
528 537
529 g_free(irc->mode_chars); 538 g_free(irc->mode_chars);
530 g_free(irc->reqnick); 539 g_free(irc->reqnick);
540
541 #ifdef HAVE_CYRUS_SASL
542 if (irc->sasl_conn) {
543 sasl_dispose(&irc->sasl_conn);
544 irc->sasl_conn = NULL;
545 }
546 g_free(irc->sasl_cb);
547 if(irc->sasl_mechs)
548 g_string_free(irc->sasl_mechs, TRUE);
549 #endif
550
531 551
532 g_free(irc); 552 g_free(irc);
533 } 553 }
534 554
535 static int irc_im_send(PurpleConnection *gc, const char *who, const char *what, PurpleMessageFlags flags) 555 static int irc_im_send(PurpleConnection *gc, const char *who, const char *what, PurpleMessageFlags flags)
1045 */ 1065 */
1046 1066
1047 option = purple_account_option_bool_new(_("Use SSL"), "ssl", FALSE); 1067 option = purple_account_option_bool_new(_("Use SSL"), "ssl", FALSE);
1048 prpl_info.protocol_options = g_list_append(prpl_info.protocol_options, option); 1068 prpl_info.protocol_options = g_list_append(prpl_info.protocol_options, option);
1049 1069
1070 #ifdef HAVE_CYRUS_SASL
1071 option = purple_account_option_bool_new(_("Authenticate with SASL"), "sasl", FALSE);
1072 prpl_info.protocol_options = g_list_append(prpl_info.protocol_options, option);
1073
1074 option = purple_account_option_bool_new(
1075 _("Allow plaintext SASL auth over unencrypted connection"),
1076 "auth_plain_in_clear", FALSE);
1077 prpl_info.protocol_options = g_list_append(prpl_info.protocol_options, option);
1078 #endif
1079
1050 _irc_plugin = plugin; 1080 _irc_plugin = plugin;
1051 1081
1052 purple_prefs_remove("/plugins/prpl/irc/quitmsg"); 1082 purple_prefs_remove("/plugins/prpl/irc/quitmsg");
1053 purple_prefs_remove("/plugins/prpl/irc"); 1083 purple_prefs_remove("/plugins/prpl/irc");
1054 1084

mercurial