libpurple/protocols/irc/irc.c

branch
release-2.x.y
changeset 33404
bbd52f93184e
parent 32117
6d49fa9e996c
child 33600
7f43656ee445
child 35171
01b5caa9d79b
equal deleted inserted replaced
33403:a7dab773e3f6 33404:bbd52f93184e
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)
390 char *buf, *tmp = NULL; 391 char *buf, *tmp = NULL;
391 char *server; 392 char *server;
392 const char *username, *realname; 393 const char *username, *realname;
393 struct irc_conn *irc = gc->proto_data; 394 struct irc_conn *irc = gc->proto_data;
394 const char *pass = purple_connection_get_password(gc); 395 const char *pass = purple_connection_get_password(gc);
396 #ifdef HAVE_CYRUS_SASL
397 const gboolean use_sasl = purple_account_get_bool(irc->account, "sasl", FALSE);
398 #endif
395 399
396 if (pass && *pass) { 400 if (pass && *pass) {
397 buf = irc_format(irc, "v:", "PASS", pass); 401 #ifdef HAVE_CYRUS_SASL
402 if (use_sasl)
403 buf = irc_format(irc, "vv:", "CAP", "REQ", "sasl");
404 else /* intended to fall through */
405 #endif
406 buf = irc_format(irc, "v:", "PASS", pass);
398 if (irc_send(irc, buf) < 0) { 407 if (irc_send(irc, buf) < 0) {
399 g_free(buf); 408 g_free(buf);
400 return FALSE; 409 return FALSE;
401 } 410 }
402 g_free(buf); 411 g_free(buf);
523 532
524 purple_circ_buffer_destroy(irc->outbuf); 533 purple_circ_buffer_destroy(irc->outbuf);
525 534
526 g_free(irc->mode_chars); 535 g_free(irc->mode_chars);
527 g_free(irc->reqnick); 536 g_free(irc->reqnick);
537
538 #ifdef HAVE_CYRUS_SASL
539 if (irc->sasl_conn) {
540 sasl_dispose(&irc->sasl_conn);
541 irc->sasl_conn = NULL;
542 }
543 g_free(irc->sasl_cb);
544 if(irc->sasl_mechs)
545 g_string_free(irc->sasl_mechs, TRUE);
546 #endif
547
528 548
529 g_free(irc); 549 g_free(irc);
530 } 550 }
531 551
532 static int irc_im_send(PurpleConnection *gc, const char *who, const char *what, PurpleMessageFlags flags) 552 static int irc_im_send(PurpleConnection *gc, const char *who, const char *what, PurpleMessageFlags flags)
1043 */ 1063 */
1044 1064
1045 option = purple_account_option_bool_new(_("Use SSL"), "ssl", FALSE); 1065 option = purple_account_option_bool_new(_("Use SSL"), "ssl", FALSE);
1046 prpl_info.protocol_options = g_list_append(prpl_info.protocol_options, option); 1066 prpl_info.protocol_options = g_list_append(prpl_info.protocol_options, option);
1047 1067
1068 #ifdef HAVE_CYRUS_SASL
1069 option = purple_account_option_bool_new(_("Authenticate with SASL"), "sasl", FALSE);
1070 prpl_info.protocol_options = g_list_append(prpl_info.protocol_options, option);
1071
1072 option = purple_account_option_bool_new(
1073 _("Allow plaintext SASL auth over unencrypted connection"),
1074 "auth_plain_in_clear", FALSE);
1075 prpl_info.protocol_options = g_list_append(prpl_info.protocol_options, option);
1076 #endif
1077
1048 _irc_plugin = plugin; 1078 _irc_plugin = plugin;
1049 1079
1050 purple_prefs_remove("/plugins/prpl/irc/quitmsg"); 1080 purple_prefs_remove("/plugins/prpl/irc/quitmsg");
1051 purple_prefs_remove("/plugins/prpl/irc"); 1081 purple_prefs_remove("/plugins/prpl/irc");
1052 1082

mercurial