| 258 PurpleConnection *gc = purple_account_get_connection(irc->account); |
258 PurpleConnection *gc = purple_account_get_connection(irc->account); |
| 259 |
259 |
| 260 if (!args || !args[1] || !gc) |
260 if (!args || !args[1] || !gc) |
| 261 return; |
261 return; |
| 262 |
262 |
| 263 purple_notify_error(gc, NULL, _("Bad mode"), args[1]); |
263 purple_notify_error(gc, NULL, _("Bad mode"), args[1], |
| |
264 purple_request_cpar_from_connection(gc)); |
| 264 } |
265 } |
| 265 |
266 |
| 266 void irc_msg_ban(struct irc_conn *irc, const char *name, const char *from, char **args) |
267 void irc_msg_ban(struct irc_conn *irc, const char *name, const char *from, char **args) |
| 267 { |
268 { |
| 268 PurpleChatConversation *chat; |
269 PurpleChatConversation *chat; |
| 314 |
315 |
| 315 if (!args || !args[1] || !gc) |
316 if (!args || !args[1] || !gc) |
| 316 return; |
317 return; |
| 317 |
318 |
| 318 buf = g_strdup_printf(_("You are banned from %s."), args[1]); |
319 buf = g_strdup_printf(_("You are banned from %s."), args[1]); |
| 319 purple_notify_error(gc, _("Banned"), _("Banned"), buf); |
320 purple_notify_error(gc, _("Banned"), _("Banned"), buf, |
| |
321 purple_request_cpar_from_connection(gc)); |
| 320 g_free(buf); |
322 g_free(buf); |
| 321 } |
323 } |
| 322 |
324 |
| 323 void irc_msg_banfull(struct irc_conn *irc, const char *name, const char *from, char **args) |
325 void irc_msg_banfull(struct irc_conn *irc, const char *name, const char *from, char **args) |
| 324 { |
326 { |
| 666 |
668 |
| 667 if (!args || !args[1] || !gc) |
669 if (!args || !args[1] || !gc) |
| 668 return; |
670 return; |
| 669 |
671 |
| 670 buf = g_strdup_printf(_("Unknown message '%s'"), args[1]); |
672 buf = g_strdup_printf(_("Unknown message '%s'"), args[1]); |
| 671 purple_notify_error(gc, _("Unknown message"), buf, _("The IRC server received a message it did not understand.")); |
673 purple_notify_error(gc, _("Unknown message"), buf, _("The IRC server " |
| |
674 "received a message it did not understand."), |
| |
675 purple_request_cpar_from_connection(gc)); |
| 672 g_free(buf); |
676 g_free(buf); |
| 673 } |
677 } |
| 674 |
678 |
| 675 void irc_msg_names(struct irc_conn *irc, const char *name, const char *from, char **args) |
679 void irc_msg_names(struct irc_conn *irc, const char *name, const char *from, char **args) |
| 676 { |
680 { |
| 798 gc = purple_account_get_connection(irc->account); |
802 gc = purple_account_get_connection(irc->account); |
| 799 if (gc == NULL || args == NULL || args[2] == NULL) |
803 if (gc == NULL || args == NULL || args[2] == NULL) |
| 800 return; |
804 return; |
| 801 |
805 |
| 802 purple_notify_message(gc, PURPLE_NOTIFY_MSG_INFO, _("Time Response"), |
806 purple_notify_message(gc, PURPLE_NOTIFY_MSG_INFO, _("Time Response"), |
| 803 _("The IRC server's local time is:"), |
807 _("The IRC server's local time is:"), args[2], NULL, NULL, |
| 804 args[2], NULL, NULL); |
808 purple_request_cpar_from_connection(gc)); |
| 805 } |
809 } |
| 806 |
810 |
| 807 void irc_msg_nochan(struct irc_conn *irc, const char *name, const char *from, char **args) |
811 void irc_msg_nochan(struct irc_conn *irc, const char *name, const char *from, char **args) |
| 808 { |
812 { |
| 809 PurpleConnection *gc = purple_account_get_connection(irc->account); |
813 PurpleConnection *gc = purple_account_get_connection(irc->account); |
| 810 |
814 |
| 811 if (gc == NULL || args == NULL || args[1] == NULL) |
815 if (gc == NULL || args == NULL || args[1] == NULL) |
| 812 return; |
816 return; |
| 813 |
817 |
| 814 purple_notify_error(gc, NULL, _("No such channel"), args[1]); |
818 purple_notify_error(gc, NULL, _("No such channel"), args[1], |
| |
819 purple_request_cpar_from_connection(gc)); |
| 815 } |
820 } |
| 816 |
821 |
| 817 void irc_msg_nonick(struct irc_conn *irc, const char *name, const char *from, char **args) |
822 void irc_msg_nonick(struct irc_conn *irc, const char *name, const char *from, char **args) |
| 818 { |
823 { |
| 819 PurpleConnection *gc; |
824 PurpleConnection *gc; |
| 826 PURPLE_MESSAGE_SYSTEM|PURPLE_MESSAGE_NO_LOG, time(NULL)); |
831 PURPLE_MESSAGE_SYSTEM|PURPLE_MESSAGE_NO_LOG, time(NULL)); |
| 827 |
832 |
| 828 } else { |
833 } else { |
| 829 if ((gc = purple_account_get_connection(irc->account)) == NULL) |
834 if ((gc = purple_account_get_connection(irc->account)) == NULL) |
| 830 return; |
835 return; |
| 831 purple_notify_error(gc, NULL, _("No such nick or channel"), args[1]); |
836 purple_notify_error(gc, NULL, _("No such nick or channel"), |
| |
837 args[1], purple_request_cpar_from_connection(gc)); |
| 832 } |
838 } |
| 833 |
839 |
| 834 if (irc->whois.nick && !purple_utf8_strcasecmp(irc->whois.nick, args[1])) { |
840 if (irc->whois.nick && !purple_utf8_strcasecmp(irc->whois.nick, args[1])) { |
| 835 g_free(irc->whois.nick); |
841 g_free(irc->whois.nick); |
| 836 irc->whois.nick = NULL; |
842 irc->whois.nick = NULL; |
| 847 purple_conversation_write_message(PURPLE_CONVERSATION(chat), args[1], args[2], |
853 purple_conversation_write_message(PURPLE_CONVERSATION(chat), args[1], args[2], |
| 848 PURPLE_MESSAGE_SYSTEM|PURPLE_MESSAGE_NO_LOG, time(NULL)); |
854 PURPLE_MESSAGE_SYSTEM|PURPLE_MESSAGE_NO_LOG, time(NULL)); |
| 849 } else { |
855 } else { |
| 850 if ((gc = purple_account_get_connection(irc->account)) == NULL) |
856 if ((gc = purple_account_get_connection(irc->account)) == NULL) |
| 851 return; |
857 return; |
| 852 purple_notify_error(gc, NULL, _("Could not send"), args[2]); |
858 purple_notify_error(gc, NULL, _("Could not send"), args[2], |
| |
859 purple_request_cpar_from_connection(gc)); |
| 853 } |
860 } |
| 854 } |
861 } |
| 855 |
862 |
| 856 void irc_msg_notinchan(struct irc_conn *irc, const char *name, const char *from, char **args) |
863 void irc_msg_notinchan(struct irc_conn *irc, const char *name, const char *from, char **args) |
| 857 { |
864 { |
| 905 |
912 |
| 906 if (!args || !args[1] || !gc) |
913 if (!args || !args[1] || !gc) |
| 907 return; |
914 return; |
| 908 |
915 |
| 909 buf = g_strdup_printf(_("Joining %s requires an invitation."), args[1]); |
916 buf = g_strdup_printf(_("Joining %s requires an invitation."), args[1]); |
| 910 purple_notify_error(gc, _("Invitation only"), _("Invitation only"), buf); |
917 purple_notify_error(gc, _("Invitation only"), _("Invitation only"), buf, |
| |
918 purple_request_cpar_from_connection(gc)); |
| 911 g_free(buf); |
919 g_free(buf); |
| 912 } |
920 } |
| 913 |
921 |
| 914 void irc_msg_ison(struct irc_conn *irc, const char *name, const char *from, char **args) |
922 void irc_msg_ison(struct irc_conn *irc, const char *name, const char *from, char **args) |
| 915 { |
923 { |
| 1154 |
1162 |
| 1155 void irc_msg_badnick(struct irc_conn *irc, const char *name, const char *from, char **args) |
1163 void irc_msg_badnick(struct irc_conn *irc, const char *name, const char *from, char **args) |
| 1156 { |
1164 { |
| 1157 PurpleConnection *gc = purple_account_get_connection(irc->account); |
1165 PurpleConnection *gc = purple_account_get_connection(irc->account); |
| 1158 if (purple_connection_get_state(gc) == PURPLE_CONNECTION_CONNECTED) { |
1166 if (purple_connection_get_state(gc) == PURPLE_CONNECTION_CONNECTED) { |
| 1159 purple_notify_error(gc, _("Invalid nickname"), |
1167 purple_notify_error(gc, _("Invalid nickname"), _("Invalid " |
| 1160 _("Invalid nickname"), |
1168 "nickname"), _("Your selected nickname was rejected by " |
| 1161 _("Your selected nickname was rejected by the server. It probably contains invalid characters.")); |
1169 "the server. It probably contains invalid characters."), |
| |
1170 purple_request_cpar_from_connection(gc)); |
| 1162 |
1171 |
| 1163 } else { |
1172 } else { |
| 1164 purple_connection_error (gc, |
1173 purple_connection_error (gc, |
| 1165 PURPLE_CONNECTION_ERROR_INVALID_SETTINGS, |
1174 PURPLE_CONNECTION_ERROR_INVALID_SETTINGS, |
| 1166 _("Your selected account name was rejected by the server. It probably contains invalid characters.")); |
1175 _("Your selected account name was rejected by the server. It probably contains invalid characters.")); |
| 1179 /* We only want to do the following dance if the connection |
1188 /* We only want to do the following dance if the connection |
| 1180 has not been successfully completed. If it has, just |
1189 has not been successfully completed. If it has, just |
| 1181 notify the user that their /nick command didn't go. */ |
1190 notify the user that their /nick command didn't go. */ |
| 1182 buf = g_strdup_printf(_("The nickname \"%s\" is already being used."), |
1191 buf = g_strdup_printf(_("The nickname \"%s\" is already being used."), |
| 1183 irc->reqnick); |
1192 irc->reqnick); |
| 1184 purple_notify_error(gc, _("Nickname in use"), |
1193 purple_notify_error(gc, _("Nickname in use"), _("Nickname in " |
| 1185 _("Nickname in use"), buf); |
1194 "use"), buf, purple_request_cpar_from_connection(gc)); |
| 1186 g_free(buf); |
1195 g_free(buf); |
| 1187 g_free(irc->reqnick); |
1196 g_free(irc->reqnick); |
| 1188 irc->reqnick = NULL; |
1197 irc->reqnick = NULL; |
| 1189 return; |
1198 return; |
| 1190 } |
1199 } |
| 1224 PurpleConnection *gc = purple_account_get_connection(irc->account); |
1233 PurpleConnection *gc = purple_account_get_connection(irc->account); |
| 1225 |
1234 |
| 1226 if (!args || !args[2] || !gc) |
1235 if (!args || !args[2] || !gc) |
| 1227 return; |
1236 return; |
| 1228 |
1237 |
| 1229 purple_notify_error(gc, _("Cannot change nick"), _("Could not change nick"), args[2]); |
1238 purple_notify_error(gc, _("Cannot change nick"), |
| |
1239 _("Could not change nick"), args[2], |
| |
1240 purple_request_cpar_from_connection(gc)); |
| 1230 } |
1241 } |
| 1231 |
1242 |
| 1232 void irc_msg_part(struct irc_conn *irc, const char *name, const char *from, char **args) |
1243 void irc_msg_part(struct irc_conn *irc, const char *name, const char *from, char **args) |
| 1233 { |
1244 { |
| 1234 PurpleConnection *gc = purple_account_get_connection(irc->account); |
1245 PurpleConnection *gc = purple_account_get_connection(irc->account); |
| 1308 gc = purple_account_get_connection(irc->account); |
1319 gc = purple_account_get_connection(irc->account); |
| 1309 if (!gc) { |
1320 if (!gc) { |
| 1310 g_free(msg); |
1321 g_free(msg); |
| 1311 return; |
1322 return; |
| 1312 } |
1323 } |
| 1313 purple_notify_info(gc, NULL, "PONG", msg); |
1324 purple_notify_info(gc, NULL, "PONG", msg, |
| |
1325 purple_request_cpar_from_connection(gc)); |
| 1314 } |
1326 } |
| 1315 g_free(msg); |
1327 g_free(msg); |
| 1316 } |
1328 } |
| 1317 |
1329 |
| 1318 void irc_msg_privmsg(struct irc_conn *irc, const char *name, const char *from, char **args) |
1330 void irc_msg_privmsg(struct irc_conn *irc, const char *name, const char *from, char **args) |
| 1382 * succeeded. Suppress that. */ |
1394 * succeeded. Suppress that. */ |
| 1383 return; |
1395 return; |
| 1384 } |
1396 } |
| 1385 |
1397 |
| 1386 msg = g_strdup_printf(_("Cannot join %s: Registration is required."), args[1]); |
1398 msg = g_strdup_printf(_("Cannot join %s: Registration is required."), args[1]); |
| 1387 purple_notify_error(gc, _("Cannot join channel"), msg, args[2]); |
1399 purple_notify_error(gc, _("Cannot join channel"), msg, args[2], |
| |
1400 purple_request_cpar_from_connection(gc)); |
| 1388 g_free(msg); |
1401 g_free(msg); |
| 1389 } |
1402 } |
| 1390 |
1403 |
| 1391 void irc_msg_quit(struct irc_conn *irc, const char *name, const char *from, char **args) |
1404 void irc_msg_quit(struct irc_conn *irc, const char *name, const char *from, char **args) |
| 1392 { |
1405 { |
| 1417 PurpleConnection *gc = purple_account_get_connection(irc->account); |
1430 PurpleConnection *gc = purple_account_get_connection(irc->account); |
| 1418 |
1431 |
| 1419 if (!args || !args[1]) |
1432 if (!args || !args[1]) |
| 1420 return; |
1433 return; |
| 1421 |
1434 |
| 1422 purple_notify_error(gc, NULL, _("Nick or channel is temporarily unavailable."), args[1]); |
1435 purple_notify_error(gc, NULL, _("Nick or channel is temporarily " |
| |
1436 "unavailable."), args[1], |
| |
1437 purple_request_cpar_from_connection(gc)); |
| 1423 } |
1438 } |
| 1424 |
1439 |
| 1425 void irc_msg_wallops(struct irc_conn *irc, const char *name, const char *from, char **args) |
1440 void irc_msg_wallops(struct irc_conn *irc, const char *name, const char *from, char **args) |
| 1426 { |
1441 { |
| 1427 PurpleConnection *gc = purple_account_get_connection(irc->account); |
1442 PurpleConnection *gc = purple_account_get_connection(irc->account); |
| 1431 return; |
1446 return; |
| 1432 |
1447 |
| 1433 nick = irc_mask_nick(from); |
1448 nick = irc_mask_nick(from); |
| 1434 msg = g_strdup_printf (_("Wallops from %s"), nick); |
1449 msg = g_strdup_printf (_("Wallops from %s"), nick); |
| 1435 g_free(nick); |
1450 g_free(nick); |
| 1436 purple_notify_info(gc, NULL, msg, args[0]); |
1451 purple_notify_info(gc, NULL, msg, args[0], |
| |
1452 purple_request_cpar_from_connection(gc)); |
| 1437 g_free(msg); |
1453 g_free(msg); |
| 1438 } |
1454 } |
| 1439 |
1455 |
| 1440 #ifdef HAVE_CYRUS_SASL |
1456 #ifdef HAVE_CYRUS_SASL |
| 1441 static int |
1457 static int |