Thu, 21 May 2020 21:21:54 -0500
Make sure we're not including the gettext macros in header files and deal with the repercussions of that.
| 6333 | 1 | /** |
| 15884 | 2 | * purple |
| 6333 | 3 | * |
| 4 | * Copyright (C) 2003, Ethan Blanton <eblanton@cs.purdue.edu> | |
| 8351 | 5 | * |
| 6333 | 6 | * This program is free software; you can redistribute it and/or modify |
| 7 | * it under the terms of the GNU General Public License as published by | |
| 8 | * the Free Software Foundation; either version 2 of the License, or | |
| 9 | * (at your option) any later version. | |
| 10 | * | |
| 11 | * This program is distributed in the hope that it will be useful, | |
| 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | |
| 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
| 14 | * GNU General Public License for more details. | |
| 15 | * | |
| 16 | * You should have received a copy of the GNU General Public License | |
| 17 | * along with this program; if not, write to the Free Software | |
|
19859
71d37b57eff2
The FSF changed its address a while ago; our files were out of date.
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
17409
diff
changeset
|
18 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA |
| 6333 | 19 | */ |
| 20 | ||
|
40441
f23c7e772667
Make sure we're not including the gettext macros in header files and deal with the repercussions of that.
Gary Kramlich <grim@reaperworld.com>
parents:
40439
diff
changeset
|
21 | #include <glib/gi18n-lib.h> |
|
f23c7e772667
Make sure we're not including the gettext macros in header files and deal with the repercussions of that.
Gary Kramlich <grim@reaperworld.com>
parents:
40439
diff
changeset
|
22 | |
|
39961
d508d5b5dd22
Update the irc prpl to only use purple.h
Gary Kramlich <grim@reaperworld.com>
parents:
39589
diff
changeset
|
23 | #include <purple.h> |
| 6333 | 24 | |
| 25 | #include "irc.h" | |
| 26 | ||
| 27 | #include <stdio.h> | |
| 28 | #include <stdlib.h> | |
| 29 | #include <ctype.h> | |
| 30 | ||
|
36663
c61b6dbc1f03
Make protocols unregister their commands when being removed
Ankit Vani <a@nevitus.org>
parents:
36637
diff
changeset
|
31 | static GSList *cmds = NULL; |
|
c61b6dbc1f03
Make protocols unregister their commands when being removed
Ankit Vani <a@nevitus.org>
parents:
36637
diff
changeset
|
32 | |
| 6333 | 33 | static char *irc_send_convert(struct irc_conn *irc, const char *string); |
| 34 | static char *irc_recv_convert(struct irc_conn *irc, const char *string); | |
| 35 | ||
| 36 | static void irc_parse_error_cb(struct irc_conn *irc, char *input); | |
| 37 | ||
| 38 | static char *irc_mirc_colors[16] = { | |
| 39 | "white", "black", "blue", "dark green", "red", "brown", "purple", | |
| 40 | "orange", "yellow", "green", "teal", "cyan", "light blue", | |
| 41 | "pink", "grey", "light grey" }; | |
| 42 | ||
|
36544
1bf8b6ef5aea
Renamed PurplePluginProtocolInfo to PurpleProtocol
Ankit Vani <a@nevitus.org>
parents:
36520
diff
changeset
|
43 | extern PurpleProtocol *_irc_protocol; |
| 14683 | 44 | |
| 6333 | 45 | /*typedef void (*IRCMsgCallback)(struct irc_conn *irc, char *from, char *name, char **args);*/ |
| 46 | static struct _irc_msg { | |
| 47 | char *name; | |
| 48 | char *format; | |
|
35253
4d9be297d399
Fill in req_cnt for irc_msg_kick and irc_msg_nick.
Mark Doliner <mark@kingant.net>
parents:
35250
diff
changeset
|
49 | |
|
4d9be297d399
Fill in req_cnt for irc_msg_kick and irc_msg_nick.
Mark Doliner <mark@kingant.net>
parents:
35250
diff
changeset
|
50 | /** The required parameter count, based on values we use, not protocol |
|
4d9be297d399
Fill in req_cnt for irc_msg_kick and irc_msg_nick.
Mark Doliner <mark@kingant.net>
parents:
35250
diff
changeset
|
51 | * specification. */ |
|
4d9be297d399
Fill in req_cnt for irc_msg_kick and irc_msg_nick.
Mark Doliner <mark@kingant.net>
parents:
35250
diff
changeset
|
52 | int req_cnt; |
|
4d9be297d399
Fill in req_cnt for irc_msg_kick and irc_msg_nick.
Mark Doliner <mark@kingant.net>
parents:
35250
diff
changeset
|
53 | |
| 6333 | 54 | void (*cb)(struct irc_conn *irc, const char *name, const char *from, char **args); |
| 55 | } _irc_msgs[] = { | |
|
35250
6b0e0566af20
IRC: fill required command parameter counts (part 3)
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35249
diff
changeset
|
56 | { "005", "n*", 2, irc_msg_features }, /* Feature list */ |
|
6b0e0566af20
IRC: fill required command parameter counts (part 3)
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35249
diff
changeset
|
57 | { "251", "n:", 1, irc_msg_luser }, /* Client & Server count */ |
|
6b0e0566af20
IRC: fill required command parameter counts (part 3)
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35249
diff
changeset
|
58 | { "255", "n:", 1, irc_msg_luser }, /* Client & Server count Mk. II */ |
|
6b0e0566af20
IRC: fill required command parameter counts (part 3)
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35249
diff
changeset
|
59 | { "301", "nn:", 3, irc_msg_away }, /* User is away */ |
|
6b0e0566af20
IRC: fill required command parameter counts (part 3)
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35249
diff
changeset
|
60 | { "303", "n:", 2, irc_msg_ison }, /* ISON reply */ |
|
6b0e0566af20
IRC: fill required command parameter counts (part 3)
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35249
diff
changeset
|
61 | { "311", "nnvvv:", 6, irc_msg_whois }, /* Whois user */ |
|
6b0e0566af20
IRC: fill required command parameter counts (part 3)
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35249
diff
changeset
|
62 | { "312", "nnv:", 4, irc_msg_whois }, /* Whois server */ |
|
6b0e0566af20
IRC: fill required command parameter counts (part 3)
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35249
diff
changeset
|
63 | { "313", "nn:", 2, irc_msg_whois }, /* Whois ircop */ |
| 39589 | 64 | { "314", "nnnvv:", 6, irc_msg_whois }, /* Whowas user */ |
| 65 | { "315", "nt:", 0, irc_msg_who }, /* end of WHO channel */ | |
|
35272
d33c29cda7bb
I think 317 actually only requires 3 args. I think the fourth is optional.
Mark Doliner <mark@kingant.net>
parents:
35253
diff
changeset
|
66 | { "317", "nnvv", 3, irc_msg_whois }, /* Whois idle */ |
|
35250
6b0e0566af20
IRC: fill required command parameter counts (part 3)
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35249
diff
changeset
|
67 | { "318", "nt:", 2, irc_msg_endwhois }, /* End of WHOIS */ |
|
6b0e0566af20
IRC: fill required command parameter counts (part 3)
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35249
diff
changeset
|
68 | { "319", "nn:", 3, irc_msg_whois }, /* Whois channels */ |
|
6b0e0566af20
IRC: fill required command parameter counts (part 3)
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35249
diff
changeset
|
69 | { "320", "nn:", 2, irc_msg_whois }, /* Whois (fn ident) */ |
|
6b0e0566af20
IRC: fill required command parameter counts (part 3)
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35249
diff
changeset
|
70 | { "321", "*", 0, irc_msg_list }, /* Start of list */ |
|
6b0e0566af20
IRC: fill required command parameter counts (part 3)
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35249
diff
changeset
|
71 | { "322", "ncv:", 4, irc_msg_list }, /* List. */ |
|
6b0e0566af20
IRC: fill required command parameter counts (part 3)
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35249
diff
changeset
|
72 | { "323", ":", 0, irc_msg_list }, /* End of list. */ |
|
6b0e0566af20
IRC: fill required command parameter counts (part 3)
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35249
diff
changeset
|
73 | { "324", "ncv:", 3, irc_msg_chanmode }, /* Channel modes */ |
| 39589 | 74 | { "330", "nnv:", 4, irc_msg_whois }, /* Whois (fn login) */ |
|
35248
9f132a6855cd
IRC: fill required command parameter counts (part 1)
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35245
diff
changeset
|
75 | { "331", "nc:", 3, irc_msg_topic }, /* No channel topic */ |
|
9f132a6855cd
IRC: fill required command parameter counts (part 1)
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35245
diff
changeset
|
76 | { "332", "nc:", 3, irc_msg_topic }, /* Channel topic */ |
|
35250
6b0e0566af20
IRC: fill required command parameter counts (part 3)
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35249
diff
changeset
|
77 | { "333", "ncvv", 4, irc_msg_topicinfo }, /* Topic setter stuff */ |
|
6b0e0566af20
IRC: fill required command parameter counts (part 3)
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35249
diff
changeset
|
78 | { "352", "ncvvvnv:", 8, irc_msg_who }, /* Channel WHO */ |
|
6b0e0566af20
IRC: fill required command parameter counts (part 3)
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35249
diff
changeset
|
79 | { "353", "nvc:", 4, irc_msg_names }, /* Names list */ |
|
6b0e0566af20
IRC: fill required command parameter counts (part 3)
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35249
diff
changeset
|
80 | { "366", "nc:", 2, irc_msg_names }, /* End of names */ |
|
6b0e0566af20
IRC: fill required command parameter counts (part 3)
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35249
diff
changeset
|
81 | { "367", "ncnnv", 3, irc_msg_ban }, /* Ban list */ |
|
6b0e0566af20
IRC: fill required command parameter counts (part 3)
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35249
diff
changeset
|
82 | { "368", "nc:", 2, irc_msg_ban }, /* End of ban list */ |
| 39589 | 83 | { "369", "nt:", 2, irc_msg_endwhois }, /* End of WHOWAS */ |
|
35249
5845d9fa7084
IRC: fill required command parameter counts (part 2)
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35248
diff
changeset
|
84 | { "372", "n:", 1, irc_msg_motd }, /* MOTD */ |
|
5845d9fa7084
IRC: fill required command parameter counts (part 2)
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35248
diff
changeset
|
85 | { "375", "n:", 1, irc_msg_motd }, /* Start MOTD */ |
|
5845d9fa7084
IRC: fill required command parameter counts (part 2)
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35248
diff
changeset
|
86 | { "376", "n:", 1, irc_msg_motd }, /* End of MOTD */ |
|
5845d9fa7084
IRC: fill required command parameter counts (part 2)
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35248
diff
changeset
|
87 | { "391", "nv:", 3, irc_msg_time }, /* Time reply */ |
|
5845d9fa7084
IRC: fill required command parameter counts (part 2)
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35248
diff
changeset
|
88 | { "401", "nt:", 2, irc_msg_nonick }, /* No such nick/chan */ |
|
5845d9fa7084
IRC: fill required command parameter counts (part 2)
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35248
diff
changeset
|
89 | { "403", "nc:", 2, irc_msg_nochan }, /* No such channel */ |
|
5845d9fa7084
IRC: fill required command parameter counts (part 2)
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35248
diff
changeset
|
90 | { "404", "nt:", 3, irc_msg_nosend }, /* Cannot send to chan */ |
| 39589 | 91 | { "406", "nt:", 2, irc_msg_nonick }, /* No such nick for WHOWAS */ |
|
35249
5845d9fa7084
IRC: fill required command parameter counts (part 2)
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35248
diff
changeset
|
92 | { "421", "nv:", 2, irc_msg_unknown }, /* Unknown command */ |
|
5845d9fa7084
IRC: fill required command parameter counts (part 2)
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35248
diff
changeset
|
93 | { "422", "n:", 1, irc_msg_motd }, /* MOTD file missing */ |
|
5845d9fa7084
IRC: fill required command parameter counts (part 2)
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35248
diff
changeset
|
94 | { "432", "vn:", 0, irc_msg_badnick }, /* Erroneous nickname */ |
|
5845d9fa7084
IRC: fill required command parameter counts (part 2)
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35248
diff
changeset
|
95 | { "433", "vn:", 2, irc_msg_nickused }, /* Nickname already in use */ |
|
5845d9fa7084
IRC: fill required command parameter counts (part 2)
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35248
diff
changeset
|
96 | { "437", "nc:", 2, irc_msg_unavailable }, /* Nick/channel is unavailable */ |
|
5845d9fa7084
IRC: fill required command parameter counts (part 2)
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35248
diff
changeset
|
97 | { "438", "nn:", 3, irc_msg_nochangenick }, /* Nick may not change */ |
|
5845d9fa7084
IRC: fill required command parameter counts (part 2)
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35248
diff
changeset
|
98 | { "442", "nc:", 3, irc_msg_notinchan }, /* Not in channel */ |
|
5845d9fa7084
IRC: fill required command parameter counts (part 2)
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35248
diff
changeset
|
99 | { "473", "nc:", 2, irc_msg_inviteonly }, /* Tried to join invite-only */ |
|
5845d9fa7084
IRC: fill required command parameter counts (part 2)
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35248
diff
changeset
|
100 | { "474", "nc:", 2, irc_msg_banned }, /* Banned from channel */ |
|
5845d9fa7084
IRC: fill required command parameter counts (part 2)
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35248
diff
changeset
|
101 | { "477", "nc:", 3, irc_msg_regonly }, /* Registration Required */ |
|
5845d9fa7084
IRC: fill required command parameter counts (part 2)
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35248
diff
changeset
|
102 | { "478", "nct:", 3, irc_msg_banfull }, /* Banlist is full */ |
|
5845d9fa7084
IRC: fill required command parameter counts (part 2)
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35248
diff
changeset
|
103 | { "482", "nc:", 3, irc_msg_notop }, /* Need to be op to do that */ |
|
5845d9fa7084
IRC: fill required command parameter counts (part 2)
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35248
diff
changeset
|
104 | { "501", "n:", 2, irc_msg_badmode }, /* Unknown mode flag */ |
|
5845d9fa7084
IRC: fill required command parameter counts (part 2)
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35248
diff
changeset
|
105 | { "506", "nc:", 3, irc_msg_nosend }, /* Must identify to send */ |
|
5845d9fa7084
IRC: fill required command parameter counts (part 2)
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35248
diff
changeset
|
106 | { "515", "nc:", 3, irc_msg_regonly }, /* Registration required */ |
|
33404
bbd52f93184e
Implement SASL support for IRC, using Cyrus.
Thijs Alkemade <thijsalkemade@gmail.com>
parents:
32057
diff
changeset
|
107 | #ifdef HAVE_CYRUS_SASL |
|
35248
9f132a6855cd
IRC: fill required command parameter counts (part 1)
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35245
diff
changeset
|
108 | { "903", "*", 0, irc_msg_authok}, /* SASL auth successful */ |
|
9f132a6855cd
IRC: fill required command parameter counts (part 1)
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35245
diff
changeset
|
109 | { "904", "*", 0, irc_msg_authtryagain }, /* SASL auth failed, can recover*/ |
|
9f132a6855cd
IRC: fill required command parameter counts (part 1)
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35245
diff
changeset
|
110 | { "905", "*", 0, irc_msg_authfail }, /* SASL auth failed */ |
|
9f132a6855cd
IRC: fill required command parameter counts (part 1)
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35245
diff
changeset
|
111 | { "906", "*", 0, irc_msg_authfail }, /* SASL auth failed */ |
|
9f132a6855cd
IRC: fill required command parameter counts (part 1)
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35245
diff
changeset
|
112 | { "907", "*", 0, irc_msg_authfail }, /* SASL auth failed */ |
|
9f132a6855cd
IRC: fill required command parameter counts (part 1)
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35245
diff
changeset
|
113 | { "cap", "vv:", 3, irc_msg_cap }, /* SASL capable */ |
|
38908
86e7c9ca0bcd
irc: handle AUTHENTICATE as a normal command with server prefix
dx <dx@dxzone.com.ar>
parents:
38907
diff
changeset
|
114 | { "authenticate", ":", 1, irc_msg_authenticate }, /* SASL authenticate */ |
|
33404
bbd52f93184e
Implement SASL support for IRC, using Cyrus.
Thijs Alkemade <thijsalkemade@gmail.com>
parents:
32057
diff
changeset
|
115 | #endif |
|
35248
9f132a6855cd
IRC: fill required command parameter counts (part 1)
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35245
diff
changeset
|
116 | { "invite", "n:", 2, irc_msg_invite }, /* Invited */ |
|
9f132a6855cd
IRC: fill required command parameter counts (part 1)
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35245
diff
changeset
|
117 | { "join", ":", 1, irc_msg_join }, /* Joined a channel */ |
|
35253
4d9be297d399
Fill in req_cnt for irc_msg_kick and irc_msg_nick.
Mark Doliner <mark@kingant.net>
parents:
35250
diff
changeset
|
118 | { "kick", "cn:", 3, irc_msg_kick }, /* KICK */ |
|
35248
9f132a6855cd
IRC: fill required command parameter counts (part 1)
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35245
diff
changeset
|
119 | { "mode", "tv:", 2, irc_msg_mode }, /* MODE for channel */ |
|
35253
4d9be297d399
Fill in req_cnt for irc_msg_kick and irc_msg_nick.
Mark Doliner <mark@kingant.net>
parents:
35250
diff
changeset
|
120 | { "nick", ":", 1, irc_msg_nick }, /* Nick change */ |
|
35248
9f132a6855cd
IRC: fill required command parameter counts (part 1)
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35245
diff
changeset
|
121 | { "notice", "t:", 2, irc_msg_notice }, /* NOTICE recv */ |
|
9f132a6855cd
IRC: fill required command parameter counts (part 1)
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35245
diff
changeset
|
122 | { "part", "c:", 1, irc_msg_part }, /* Parted a channel */ |
|
9f132a6855cd
IRC: fill required command parameter counts (part 1)
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35245
diff
changeset
|
123 | { "ping", ":", 1, irc_msg_ping }, /* Received PING from server */ |
|
9f132a6855cd
IRC: fill required command parameter counts (part 1)
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35245
diff
changeset
|
124 | { "pong", "v:", 2, irc_msg_pong }, /* Received PONG from server */ |
|
9f132a6855cd
IRC: fill required command parameter counts (part 1)
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35245
diff
changeset
|
125 | { "privmsg", "t:", 2, irc_msg_privmsg }, /* Received private message */ |
|
9f132a6855cd
IRC: fill required command parameter counts (part 1)
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35245
diff
changeset
|
126 | { "topic", "c:", 2, irc_msg_topic }, /* TOPIC command */ |
|
9f132a6855cd
IRC: fill required command parameter counts (part 1)
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35245
diff
changeset
|
127 | { "quit", ":", 1, irc_msg_quit }, /* QUIT notice */ |
|
9f132a6855cd
IRC: fill required command parameter counts (part 1)
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35245
diff
changeset
|
128 | { "wallops", ":", 1, irc_msg_wallops }, /* WALLOPS command */ |
|
35245
a167504359e5
IRC: implement support for required args checking in message parser
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
33809
diff
changeset
|
129 | { NULL, NULL, 0, NULL } |
| 6333 | 130 | }; |
| 131 | ||
| 132 | static struct _irc_user_cmd { | |
| 133 | char *name; | |
| 134 | char *format; | |
| 135 | IRCCmdCallback cb; | |
| 9255 | 136 | char *help; |
| 6333 | 137 | } _irc_cmds[] = { |
| 9255 | 138 | { "action", ":", irc_cmd_ctcp_action, N_("action <action to perform>: Perform an action.") }, |
|
31651
24e136c4c399
Add authserv support to IRC. Need a name to credit tomos with. Fixes #13337.
Tomos Lelong <lelongt@gmail.com>
parents:
31565
diff
changeset
|
139 | { "authserv", ":", irc_cmd_service, N_("authserv: Send a command to authserv") }, |
| 9255 | 140 | { "away", ":", irc_cmd_away, N_("away [message]: Set an away message, or use no message to return from being away.") }, |
|
23895
4d883627111f
/ctcp command for IRC
Vladislav Guberinic <neosisani@gmail.com>
parents:
23532
diff
changeset
|
141 | { "ctcp", "t:", irc_cmd_ctcp, N_("ctcp <nick> <msg>: sends ctcp msg to nick.") }, |
| 12013 | 142 | { "chanserv", ":", irc_cmd_service, N_("chanserv: Send a command to chanserv") }, |
| 9258 | 143 | { "deop", ":", irc_cmd_op, N_("deop <nick1> [nick2] ...: Remove channel operator status from someone. You must be a channel operator to do this.") }, |
| 144 | { "devoice", ":", irc_cmd_op, N_("devoice <nick1> [nick2] ...: Remove channel voice status from someone, preventing them from speaking if the channel is moderated (+m). You must be a channel operator to do this.") }, | |
| 145 | { "invite", ":", irc_cmd_invite, N_("invite <nick> [room]: Invite someone to join you in the specified channel, or the current channel.") }, | |
| 9266 | 146 | { "j", "cv", irc_cmd_join, N_("j <room1>[,room2][,...] [key1[,key2][,...]]: Enter one or more channels, optionally providing a channel key for each if needed.") }, |
| 147 | { "join", "cv", irc_cmd_join, N_("join <room1>[,room2][,...] [key1[,key2][,...]]: Enter one or more channels, optionally providing a channel key for each if needed.") }, | |
| 9258 | 148 | { "kick", "n:", irc_cmd_kick, N_("kick <nick> [message]: Remove someone from a channel. You must be a channel operator to do this.") }, |
| 149 | { "list", ":", irc_cmd_list, N_("list: Display a list of chat rooms on the network. <i>Warning, some servers may disconnect you upon doing this.</i>") }, | |
| 9255 | 150 | { "me", ":", irc_cmd_ctcp_action, N_("me <action to perform>: Perform an action.") }, |
| 12013 | 151 | { "memoserv", ":", irc_cmd_service, N_("memoserv: Send a command to memoserv") }, |
|
10609
170a5af61448
[gaim-migrate @ 12055]
Richard Laager <rlaager@pidgin.im>
parents:
10564
diff
changeset
|
152 | { "mode", ":", irc_cmd_mode, N_("mode <+|-><A-Za-z> <nick|channel>: Set or unset a channel or user mode.") }, |
| 9258 | 153 | { "msg", "t:", irc_cmd_privmsg, N_("msg <nick> <message>: Send a private message to a user (as opposed to a channel).") }, |
| 154 | { "names", "c", irc_cmd_names, N_("names [channel]: List the users currently in a channel.") }, | |
| 9274 | 155 | { "nick", "n", irc_cmd_nick, N_("nick <new nickname>: Change your nickname.") }, |
| 12013 | 156 | { "nickserv", ":", irc_cmd_service, N_("nickserv: Send a command to nickserv") }, |
|
22092
52c00ca73f6f
Added /notice support for IRC. If I didn't do this properly, feel free
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
21720
diff
changeset
|
157 | { "notice", "t:", irc_cmd_privmsg, N_("notice <target<: Send a notice to a user or channel.") }, |
| 9258 | 158 | { "op", ":", irc_cmd_op, N_("op <nick1> [nick2] ...: Grant channel operator status to someone. You must be a channel operator to do this.") }, |
| 9255 | 159 | { "operwall", ":", irc_cmd_wallops, N_("operwall <message>: If you don't know what this is, you probably can't use it.") }, |
| 12013 | 160 | { "operserv", ":", irc_cmd_service, N_("operserv: Send a command to operserv") }, |
| 9258 | 161 | { "part", "c:", irc_cmd_part, N_("part [room] [message]: Leave the current channel, or a specified channel, with an optional message.") }, |
| 9255 | 162 | { "ping", "n", irc_cmd_ping, N_("ping [nick]: Asks how much lag a user (or the server if no user specified) has.") }, |
| 9258 | 163 | { "query", "n:", irc_cmd_query, N_("query <nick> <message>: Send a private message to a user (as opposed to a channel).") }, |
| 9255 | 164 | { "quit", ":", irc_cmd_quit, N_("quit [message]: Disconnect from the server, with an optional message.") }, |
| 165 | { "quote", "*", irc_cmd_quote, N_("quote [...]: Send a raw command to the server.") }, | |
| 166 | { "remove", "n:", irc_cmd_remove, N_("remove <nick> [message]: Remove someone from a room. You must be a channel operator to do this.") }, | |
| 10564 | 167 | { "time", "", irc_cmd_time, N_("time: Displays the current local time at the IRC server.") }, |
| 9255 | 168 | { "topic", ":", irc_cmd_topic, N_("topic [new topic]: View or change the channel topic.") }, |
| 169 | { "umode", ":", irc_cmd_mode, N_("umode <+|-><A-Za-z>: Set or unset a user mode.") }, | |
| 13943 | 170 | { "version", ":", irc_cmd_ctcp_version, N_("version [nick]: send CTCP VERSION request to a user") }, |
| 9258 | 171 | { "voice", ":", irc_cmd_op, N_("voice <nick1> [nick2] ...: Grant channel voice status to someone. You must be a channel operator to do this.") }, |
| 9255 | 172 | { "wallops", ":", irc_cmd_wallops, N_("wallops <message>: If you don't know what this is, you probably can't use it.") }, |
|
10609
170a5af61448
[gaim-migrate @ 12055]
Richard Laager <rlaager@pidgin.im>
parents:
10564
diff
changeset
|
173 | { "whois", "tt", irc_cmd_whois, N_("whois [server] <nick>: Get information on a user.") }, |
|
16474
bc8580a69dba
/whowas for IRC. Thanks, achris.
Ethan Blanton <elb@pidgin.im>
parents:
15884
diff
changeset
|
174 | { "whowas", "t", irc_cmd_whowas, N_("whowas <nick>: Get information on a user that has logged off.") }, |
|
11318
13fa1d5134f3
[gaim-migrate @ 13521]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
11136
diff
changeset
|
175 | { NULL, NULL, NULL, NULL } |
| 6333 | 176 | }; |
| 177 | ||
| 15884 | 178 | static PurpleCmdRet irc_parse_purple_cmd(PurpleConversation *conv, const gchar *cmd, |
| 9597 | 179 | gchar **args, gchar **error, void *data) |
| 9130 | 180 | { |
| 15884 | 181 | PurpleConnection *gc; |
| 9130 | 182 | struct irc_conn *irc; |
| 183 | struct _irc_user_cmd *cmdent; | |
| 184 | ||
|
32698
154e4a2a6287
Our API really shouldn't have a 'gc' in it anymore.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32635
diff
changeset
|
185 | gc = purple_conversation_get_connection(conv); |
| 9130 | 186 | if (!gc) |
| 15884 | 187 | return PURPLE_CMD_RET_FAILED; |
| 9130 | 188 | |
|
32276
abc0b7c0cb86
Convert irc prpl to use accessor functions purple_connection_get_protocol_data() and purple_connection_set_protocol_data().
Andrew Victor <andrew.victor@mxit.com>
parents:
32157
diff
changeset
|
189 | irc = purple_connection_get_protocol_data(gc); |
| 9130 | 190 | |
| 191 | if ((cmdent = g_hash_table_lookup(irc->cmds, cmd)) == NULL) | |
| 15884 | 192 | return PURPLE_CMD_RET_FAILED; |
| 9130 | 193 | |
| 15884 | 194 | (cmdent->cb)(irc, cmd, purple_conversation_get_name(conv), (const char **)args); |
| 9130 | 195 | |
| 15884 | 196 | return PURPLE_CMD_RET_OK; |
| 9130 | 197 | } |
| 198 | ||
| 199 | static void irc_register_command(struct _irc_user_cmd *c) | |
| 200 | { | |
|
36663
c61b6dbc1f03
Make protocols unregister their commands when being removed
Ankit Vani <a@nevitus.org>
parents:
36637
diff
changeset
|
201 | PurpleCmdId id; |
| 15884 | 202 | PurpleCmdFlag f; |
| 9130 | 203 | char args[10]; |
| 204 | char *format; | |
|
12316
b4e5d5ea15fd
[gaim-migrate @ 14620]
Richard Laager <rlaager@pidgin.im>
parents:
12282
diff
changeset
|
205 | size_t i; |
| 9130 | 206 | |
|
36545
23b59a16c808
Replaced some _prpl_ stuff with _protocol_
Ankit Vani <a@nevitus.org>
parents:
36544
diff
changeset
|
207 | f = PURPLE_CMD_FLAG_CHAT | PURPLE_CMD_FLAG_IM | PURPLE_CMD_FLAG_PROTOCOL_ONLY |
| 15884 | 208 | | PURPLE_CMD_FLAG_ALLOW_WRONG_ARGS; |
| 9130 | 209 | |
| 210 | format = c->format; | |
| 211 | ||
| 212 | for (i = 0; (i < (sizeof(args) - 1)) && *format; i++, format++) | |
| 213 | switch (*format) { | |
| 214 | case 'v': | |
| 215 | case 'n': | |
| 216 | case 'c': | |
| 217 | case 't': | |
| 218 | args[i] = 'w'; | |
| 219 | break; | |
| 220 | case ':': | |
| 221 | case '*': | |
| 222 | args[i] = 's'; | |
| 223 | break; | |
| 224 | } | |
| 225 | ||
| 226 | args[i] = '\0'; | |
| 227 | ||
|
37005
702a601fc2ca
Update protocol IDs in codebase
Ankit Vani <a@nevitus.org>
parents:
36910
diff
changeset
|
228 | id = purple_cmd_register(c->name, args, PURPLE_CMD_P_PROTOCOL, f, "prpl-irc", |
| 15884 | 229 | irc_parse_purple_cmd, _(c->help), NULL); |
|
36663
c61b6dbc1f03
Make protocols unregister their commands when being removed
Ankit Vani <a@nevitus.org>
parents:
36637
diff
changeset
|
230 | cmds = g_slist_prepend(cmds, GUINT_TO_POINTER(id)); |
| 9130 | 231 | } |
| 232 | ||
| 233 | void irc_register_commands(void) | |
| 234 | { | |
| 235 | struct _irc_user_cmd *c; | |
| 236 | ||
| 237 | for (c = _irc_cmds; c && c->name; c++) | |
| 238 | irc_register_command(c); | |
| 239 | } | |
| 240 | ||
|
36663
c61b6dbc1f03
Make protocols unregister their commands when being removed
Ankit Vani <a@nevitus.org>
parents:
36637
diff
changeset
|
241 | void irc_unregister_commands(void) |
|
c61b6dbc1f03
Make protocols unregister their commands when being removed
Ankit Vani <a@nevitus.org>
parents:
36637
diff
changeset
|
242 | { |
|
40052
cc03b5af25ea
Use GSList functions instead of manual iterations
qarkai <qarkai@gmail.com>
parents:
40001
diff
changeset
|
243 | g_slist_free_full(cmds, (GDestroyNotify)purple_cmd_unregister); |
|
36663
c61b6dbc1f03
Make protocols unregister their commands when being removed
Ankit Vani <a@nevitus.org>
parents:
36637
diff
changeset
|
244 | } |
|
c61b6dbc1f03
Make protocols unregister their commands when being removed
Ankit Vani <a@nevitus.org>
parents:
36637
diff
changeset
|
245 | |
| 6333 | 246 | static char *irc_send_convert(struct irc_conn *irc, const char *string) |
| 247 | { | |
| 248 | char *utf8; | |
| 249 | GError *err = NULL; | |
| 10258 | 250 | gchar **encodings; |
| 251 | const gchar *enclist; | |
|
9644
a9a0dedb52c7
[gaim-migrate @ 10492]
Mark Doliner <markdoliner@pidgin.im>
parents:
9597
diff
changeset
|
252 | |
| 15884 | 253 | enclist = purple_account_get_string(irc->account, "encoding", IRC_DEFAULT_CHARSET); |
| 10258 | 254 | encodings = g_strsplit(enclist, ",", 2); |
| 255 | ||
|
17138
d666ace4a8ac
strcasecmp is post-C89, so use the glib equivalent
Ethan Blanton <elb@pidgin.im>
parents:
16993
diff
changeset
|
256 | if (encodings[0] == NULL || !g_ascii_strcasecmp("UTF-8", encodings[0])) { |
| 10278 | 257 | g_strfreev(encodings); |
|
23392
9268a4fc4786
Remove an unnecessary strdup when sending messages over IRC.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
22798
diff
changeset
|
258 | return NULL; |
| 10278 | 259 | } |
|
9644
a9a0dedb52c7
[gaim-migrate @ 10492]
Mark Doliner <markdoliner@pidgin.im>
parents:
9597
diff
changeset
|
260 | |
| 10258 | 261 | utf8 = g_convert(string, strlen(string), encodings[0], "UTF-8", NULL, NULL, &err); |
| 6333 | 262 | if (err) { |
| 15884 | 263 | purple_debug(PURPLE_DEBUG_ERROR, "irc", "Send conversion error: %s\n", err->message); |
| 264 | purple_debug(PURPLE_DEBUG_ERROR, "irc", "Sending as UTF-8 instead of %s\n", encodings[0]); | |
| 6333 | 265 | utf8 = g_strdup(string); |
| 8954 | 266 | g_error_free(err); |
| 6333 | 267 | } |
| 10258 | 268 | g_strfreev(encodings); |
| 269 | ||
| 6333 | 270 | return utf8; |
| 271 | } | |
| 272 | ||
| 273 | static char *irc_recv_convert(struct irc_conn *irc, const char *string) | |
| 274 | { | |
|
9644
a9a0dedb52c7
[gaim-migrate @ 10492]
Mark Doliner <markdoliner@pidgin.im>
parents:
9597
diff
changeset
|
275 | char *utf8 = NULL; |
| 10258 | 276 | const gchar *charset, *enclist; |
| 277 | gchar **encodings; | |
|
23906
6962e96ddd38
This adds an "auto-detect UTF-8" option to IRC which, when enabled,
Ethan Blanton <elb@pidgin.im>
parents:
23895
diff
changeset
|
278 | gboolean autodetect; |
| 10258 | 279 | int i; |
|
9644
a9a0dedb52c7
[gaim-migrate @ 10492]
Mark Doliner <markdoliner@pidgin.im>
parents:
9597
diff
changeset
|
280 | |
|
32057
e0abdcaf6fd9
Fix a leak in IRC when accepting a UTF-8 message with a non-UTF-8 encoding.
Ethan Blanton <elb@pidgin.im>
parents:
32047
diff
changeset
|
281 | autodetect = purple_account_get_bool(irc->account, "autodetect_utf8", IRC_DEFAULT_AUTODETECT); |
|
e0abdcaf6fd9
Fix a leak in IRC when accepting a UTF-8 message with a non-UTF-8 encoding.
Ethan Blanton <elb@pidgin.im>
parents:
32047
diff
changeset
|
282 | |
|
e0abdcaf6fd9
Fix a leak in IRC when accepting a UTF-8 message with a non-UTF-8 encoding.
Ethan Blanton <elb@pidgin.im>
parents:
32047
diff
changeset
|
283 | if (autodetect && g_utf8_validate(string, -1, NULL)) { |
|
e0abdcaf6fd9
Fix a leak in IRC when accepting a UTF-8 message with a non-UTF-8 encoding.
Ethan Blanton <elb@pidgin.im>
parents:
32047
diff
changeset
|
284 | return g_strdup(string); |
|
e0abdcaf6fd9
Fix a leak in IRC when accepting a UTF-8 message with a non-UTF-8 encoding.
Ethan Blanton <elb@pidgin.im>
parents:
32047
diff
changeset
|
285 | } |
|
e0abdcaf6fd9
Fix a leak in IRC when accepting a UTF-8 message with a non-UTF-8 encoding.
Ethan Blanton <elb@pidgin.im>
parents:
32047
diff
changeset
|
286 | |
| 15884 | 287 | enclist = purple_account_get_string(irc->account, "encoding", IRC_DEFAULT_CHARSET); |
| 10258 | 288 | encodings = g_strsplit(enclist, ",", -1); |
| 289 | ||
|
10504
eae130eefbfe
[gaim-migrate @ 11796]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
10278
diff
changeset
|
290 | if (encodings[0] == NULL) { |
|
eae130eefbfe
[gaim-migrate @ 11796]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
10278
diff
changeset
|
291 | g_strfreev(encodings); |
| 15884 | 292 | return purple_utf8_salvage(string); |
|
10504
eae130eefbfe
[gaim-migrate @ 11796]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
10278
diff
changeset
|
293 | } |
|
9644
a9a0dedb52c7
[gaim-migrate @ 10492]
Mark Doliner <markdoliner@pidgin.im>
parents:
9597
diff
changeset
|
294 | |
| 10258 | 295 | for (i = 0; encodings[i] != NULL; i++) { |
| 296 | charset = encodings[i]; | |
| 297 | while (*charset == ' ') | |
| 298 | charset++; | |
| 299 | ||
|
17156
6d4cc0f310d1
More strcasecmp() replacements.
Richard Laager <rlaager@pidgin.im>
parents:
17138
diff
changeset
|
300 | if (!g_ascii_strcasecmp("UTF-8", charset)) { |
|
11726
6f319ff4cea5
[gaim-migrate @ 14017]
Richard Laager <rlaager@pidgin.im>
parents:
11318
diff
changeset
|
301 | if (g_utf8_validate(string, -1, NULL)) |
| 10258 | 302 | utf8 = g_strdup(string); |
| 303 | } else { | |
|
11726
6f319ff4cea5
[gaim-migrate @ 14017]
Richard Laager <rlaager@pidgin.im>
parents:
11318
diff
changeset
|
304 | utf8 = g_convert(string, -1, "UTF-8", charset, NULL, NULL, NULL); |
| 10258 | 305 | } |
| 306 | ||
| 307 | if (utf8) { | |
| 308 | g_strfreev(encodings); | |
| 309 | return utf8; | |
| 310 | } | |
|
9644
a9a0dedb52c7
[gaim-migrate @ 10492]
Mark Doliner <markdoliner@pidgin.im>
parents:
9597
diff
changeset
|
311 | } |
|
10504
eae130eefbfe
[gaim-migrate @ 11796]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
10278
diff
changeset
|
312 | g_strfreev(encodings); |
|
9644
a9a0dedb52c7
[gaim-migrate @ 10492]
Mark Doliner <markdoliner@pidgin.im>
parents:
9597
diff
changeset
|
313 | |
| 15884 | 314 | return purple_utf8_salvage(string); |
| 6333 | 315 | } |
| 316 | ||
|
20217
9249f67ef61e
applied changes from 6c08c628ee64e16c824829c25befc0ca09338f9d
Luke Schierer <lschiere@pidgin.im>
parents:
19859
diff
changeset
|
317 | /* This function is shamelessly stolen from glib--it is an old version of the |
|
9249f67ef61e
applied changes from 6c08c628ee64e16c824829c25befc0ca09338f9d
Luke Schierer <lschiere@pidgin.im>
parents:
19859
diff
changeset
|
318 | * private function append_escaped_text, used by g_markup_escape_text, whose |
|
9249f67ef61e
applied changes from 6c08c628ee64e16c824829c25befc0ca09338f9d
Luke Schierer <lschiere@pidgin.im>
parents:
19859
diff
changeset
|
319 | * behavior changed in glib 2.12. */ |
|
9249f67ef61e
applied changes from 6c08c628ee64e16c824829c25befc0ca09338f9d
Luke Schierer <lschiere@pidgin.im>
parents:
19859
diff
changeset
|
320 | static void irc_append_escaped_text(GString *str, const char *text, gssize length) |
|
9249f67ef61e
applied changes from 6c08c628ee64e16c824829c25befc0ca09338f9d
Luke Schierer <lschiere@pidgin.im>
parents:
19859
diff
changeset
|
321 | { |
|
9249f67ef61e
applied changes from 6c08c628ee64e16c824829c25befc0ca09338f9d
Luke Schierer <lschiere@pidgin.im>
parents:
19859
diff
changeset
|
322 | const char *p = text; |
|
9249f67ef61e
applied changes from 6c08c628ee64e16c824829c25befc0ca09338f9d
Luke Schierer <lschiere@pidgin.im>
parents:
19859
diff
changeset
|
323 | const char *end = text + length; |
|
9249f67ef61e
applied changes from 6c08c628ee64e16c824829c25befc0ca09338f9d
Luke Schierer <lschiere@pidgin.im>
parents:
19859
diff
changeset
|
324 | const char *next = NULL; |
|
9249f67ef61e
applied changes from 6c08c628ee64e16c824829c25befc0ca09338f9d
Luke Schierer <lschiere@pidgin.im>
parents:
19859
diff
changeset
|
325 | |
|
9249f67ef61e
applied changes from 6c08c628ee64e16c824829c25befc0ca09338f9d
Luke Schierer <lschiere@pidgin.im>
parents:
19859
diff
changeset
|
326 | while(p != end) { |
|
9249f67ef61e
applied changes from 6c08c628ee64e16c824829c25befc0ca09338f9d
Luke Schierer <lschiere@pidgin.im>
parents:
19859
diff
changeset
|
327 | next = g_utf8_next_char(p); |
|
9249f67ef61e
applied changes from 6c08c628ee64e16c824829c25befc0ca09338f9d
Luke Schierer <lschiere@pidgin.im>
parents:
19859
diff
changeset
|
328 | |
|
9249f67ef61e
applied changes from 6c08c628ee64e16c824829c25befc0ca09338f9d
Luke Schierer <lschiere@pidgin.im>
parents:
19859
diff
changeset
|
329 | switch(*p) { |
|
9249f67ef61e
applied changes from 6c08c628ee64e16c824829c25befc0ca09338f9d
Luke Schierer <lschiere@pidgin.im>
parents:
19859
diff
changeset
|
330 | case '&': |
|
9249f67ef61e
applied changes from 6c08c628ee64e16c824829c25befc0ca09338f9d
Luke Schierer <lschiere@pidgin.im>
parents:
19859
diff
changeset
|
331 | g_string_append(str, "&"); |
|
9249f67ef61e
applied changes from 6c08c628ee64e16c824829c25befc0ca09338f9d
Luke Schierer <lschiere@pidgin.im>
parents:
19859
diff
changeset
|
332 | break; |
|
9249f67ef61e
applied changes from 6c08c628ee64e16c824829c25befc0ca09338f9d
Luke Schierer <lschiere@pidgin.im>
parents:
19859
diff
changeset
|
333 | case '<': |
|
9249f67ef61e
applied changes from 6c08c628ee64e16c824829c25befc0ca09338f9d
Luke Schierer <lschiere@pidgin.im>
parents:
19859
diff
changeset
|
334 | g_string_append(str, "<"); |
|
9249f67ef61e
applied changes from 6c08c628ee64e16c824829c25befc0ca09338f9d
Luke Schierer <lschiere@pidgin.im>
parents:
19859
diff
changeset
|
335 | break; |
|
9249f67ef61e
applied changes from 6c08c628ee64e16c824829c25befc0ca09338f9d
Luke Schierer <lschiere@pidgin.im>
parents:
19859
diff
changeset
|
336 | case '>': |
|
9249f67ef61e
applied changes from 6c08c628ee64e16c824829c25befc0ca09338f9d
Luke Schierer <lschiere@pidgin.im>
parents:
19859
diff
changeset
|
337 | g_string_append(str, ">"); |
|
9249f67ef61e
applied changes from 6c08c628ee64e16c824829c25befc0ca09338f9d
Luke Schierer <lschiere@pidgin.im>
parents:
19859
diff
changeset
|
338 | break; |
|
9249f67ef61e
applied changes from 6c08c628ee64e16c824829c25befc0ca09338f9d
Luke Schierer <lschiere@pidgin.im>
parents:
19859
diff
changeset
|
339 | case '\'': |
|
9249f67ef61e
applied changes from 6c08c628ee64e16c824829c25befc0ca09338f9d
Luke Schierer <lschiere@pidgin.im>
parents:
19859
diff
changeset
|
340 | g_string_append(str, "'"); |
|
9249f67ef61e
applied changes from 6c08c628ee64e16c824829c25befc0ca09338f9d
Luke Schierer <lschiere@pidgin.im>
parents:
19859
diff
changeset
|
341 | break; |
|
9249f67ef61e
applied changes from 6c08c628ee64e16c824829c25befc0ca09338f9d
Luke Schierer <lschiere@pidgin.im>
parents:
19859
diff
changeset
|
342 | case '"': |
|
9249f67ef61e
applied changes from 6c08c628ee64e16c824829c25befc0ca09338f9d
Luke Schierer <lschiere@pidgin.im>
parents:
19859
diff
changeset
|
343 | g_string_append(str, """); |
|
9249f67ef61e
applied changes from 6c08c628ee64e16c824829c25befc0ca09338f9d
Luke Schierer <lschiere@pidgin.im>
parents:
19859
diff
changeset
|
344 | break; |
|
9249f67ef61e
applied changes from 6c08c628ee64e16c824829c25befc0ca09338f9d
Luke Schierer <lschiere@pidgin.im>
parents:
19859
diff
changeset
|
345 | default: |
|
9249f67ef61e
applied changes from 6c08c628ee64e16c824829c25befc0ca09338f9d
Luke Schierer <lschiere@pidgin.im>
parents:
19859
diff
changeset
|
346 | g_string_append_len(str, p, next - p); |
|
9249f67ef61e
applied changes from 6c08c628ee64e16c824829c25befc0ca09338f9d
Luke Schierer <lschiere@pidgin.im>
parents:
19859
diff
changeset
|
347 | break; |
|
9249f67ef61e
applied changes from 6c08c628ee64e16c824829c25befc0ca09338f9d
Luke Schierer <lschiere@pidgin.im>
parents:
19859
diff
changeset
|
348 | } |
|
9249f67ef61e
applied changes from 6c08c628ee64e16c824829c25befc0ca09338f9d
Luke Schierer <lschiere@pidgin.im>
parents:
19859
diff
changeset
|
349 | |
|
9249f67ef61e
applied changes from 6c08c628ee64e16c824829c25befc0ca09338f9d
Luke Schierer <lschiere@pidgin.im>
parents:
19859
diff
changeset
|
350 | p = next; |
|
9249f67ef61e
applied changes from 6c08c628ee64e16c824829c25befc0ca09338f9d
Luke Schierer <lschiere@pidgin.im>
parents:
19859
diff
changeset
|
351 | } |
|
9249f67ef61e
applied changes from 6c08c628ee64e16c824829c25befc0ca09338f9d
Luke Schierer <lschiere@pidgin.im>
parents:
19859
diff
changeset
|
352 | } |
|
9249f67ef61e
applied changes from 6c08c628ee64e16c824829c25befc0ca09338f9d
Luke Schierer <lschiere@pidgin.im>
parents:
19859
diff
changeset
|
353 | |
|
9249f67ef61e
applied changes from 6c08c628ee64e16c824829c25befc0ca09338f9d
Luke Schierer <lschiere@pidgin.im>
parents:
19859
diff
changeset
|
354 | /* This function is shamelessly stolen from glib--it is an old version of the |
|
9249f67ef61e
applied changes from 6c08c628ee64e16c824829c25befc0ca09338f9d
Luke Schierer <lschiere@pidgin.im>
parents:
19859
diff
changeset
|
355 | * function g_markup_escape_text, whose behavior changed in glib 2.12. */ |
|
9249f67ef61e
applied changes from 6c08c628ee64e16c824829c25befc0ca09338f9d
Luke Schierer <lschiere@pidgin.im>
parents:
19859
diff
changeset
|
356 | char *irc_escape_privmsg(const char *text, gssize length) |
|
9249f67ef61e
applied changes from 6c08c628ee64e16c824829c25befc0ca09338f9d
Luke Schierer <lschiere@pidgin.im>
parents:
19859
diff
changeset
|
357 | { |
|
9249f67ef61e
applied changes from 6c08c628ee64e16c824829c25befc0ca09338f9d
Luke Schierer <lschiere@pidgin.im>
parents:
19859
diff
changeset
|
358 | GString *str; |
|
9249f67ef61e
applied changes from 6c08c628ee64e16c824829c25befc0ca09338f9d
Luke Schierer <lschiere@pidgin.im>
parents:
19859
diff
changeset
|
359 | |
|
9249f67ef61e
applied changes from 6c08c628ee64e16c824829c25befc0ca09338f9d
Luke Schierer <lschiere@pidgin.im>
parents:
19859
diff
changeset
|
360 | g_return_val_if_fail(text != NULL, NULL); |
|
9249f67ef61e
applied changes from 6c08c628ee64e16c824829c25befc0ca09338f9d
Luke Schierer <lschiere@pidgin.im>
parents:
19859
diff
changeset
|
361 | |
|
9249f67ef61e
applied changes from 6c08c628ee64e16c824829c25befc0ca09338f9d
Luke Schierer <lschiere@pidgin.im>
parents:
19859
diff
changeset
|
362 | if(length < 0) |
|
9249f67ef61e
applied changes from 6c08c628ee64e16c824829c25befc0ca09338f9d
Luke Schierer <lschiere@pidgin.im>
parents:
19859
diff
changeset
|
363 | length = strlen(text); |
|
9249f67ef61e
applied changes from 6c08c628ee64e16c824829c25befc0ca09338f9d
Luke Schierer <lschiere@pidgin.im>
parents:
19859
diff
changeset
|
364 | |
|
9249f67ef61e
applied changes from 6c08c628ee64e16c824829c25befc0ca09338f9d
Luke Schierer <lschiere@pidgin.im>
parents:
19859
diff
changeset
|
365 | str = g_string_sized_new(length); |
|
9249f67ef61e
applied changes from 6c08c628ee64e16c824829c25befc0ca09338f9d
Luke Schierer <lschiere@pidgin.im>
parents:
19859
diff
changeset
|
366 | |
|
9249f67ef61e
applied changes from 6c08c628ee64e16c824829c25befc0ca09338f9d
Luke Schierer <lschiere@pidgin.im>
parents:
19859
diff
changeset
|
367 | irc_append_escaped_text(str, text, length); |
|
9249f67ef61e
applied changes from 6c08c628ee64e16c824829c25befc0ca09338f9d
Luke Schierer <lschiere@pidgin.im>
parents:
19859
diff
changeset
|
368 | |
|
9249f67ef61e
applied changes from 6c08c628ee64e16c824829c25befc0ca09338f9d
Luke Schierer <lschiere@pidgin.im>
parents:
19859
diff
changeset
|
369 | return g_string_free(str, FALSE); |
|
9249f67ef61e
applied changes from 6c08c628ee64e16c824829c25befc0ca09338f9d
Luke Schierer <lschiere@pidgin.im>
parents:
19859
diff
changeset
|
370 | } |
|
9249f67ef61e
applied changes from 6c08c628ee64e16c824829c25befc0ca09338f9d
Luke Schierer <lschiere@pidgin.im>
parents:
19859
diff
changeset
|
371 | |
| 6333 | 372 | /* XXX tag closings are not necessarily correctly nested here! If we |
| 373 | * get a ^O or reach the end of the string and there are open | |
| 374 | * tags, they are closed in a fixed order ... this means, for | |
| 375 | * example, you might see <FONT COLOR="blue">some text <B>with | |
| 376 | * various attributes</FONT></B> (notice that B and FONT overlap | |
| 377 | * and are not cleanly nested). This is imminently fixable but | |
| 378 | * I am not fixing it right now. | |
| 379 | */ | |
| 380 | char *irc_mirc2html(const char *string) | |
| 381 | { | |
| 382 | const char *cur, *end; | |
| 383 | char fg[3] = "\0\0", bg[3] = "\0\0"; | |
| 384 | int fgnum, bgnum; | |
|
12158
02fcec741f07
[gaim-migrate @ 14459]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
12013
diff
changeset
|
385 | int font = 0, bold = 0, underline = 0, italic = 0; |
|
28468
aa8975185a48
Head irc_mirc2* bugs off at the pass with a NULL check
Ethan Blanton <elb@pidgin.im>
parents:
24763
diff
changeset
|
386 | GString *decoded; |
|
aa8975185a48
Head irc_mirc2* bugs off at the pass with a NULL check
Ethan Blanton <elb@pidgin.im>
parents:
24763
diff
changeset
|
387 | |
|
aa8975185a48
Head irc_mirc2* bugs off at the pass with a NULL check
Ethan Blanton <elb@pidgin.im>
parents:
24763
diff
changeset
|
388 | if (string == NULL) |
|
aa8975185a48
Head irc_mirc2* bugs off at the pass with a NULL check
Ethan Blanton <elb@pidgin.im>
parents:
24763
diff
changeset
|
389 | return NULL; |
|
aa8975185a48
Head irc_mirc2* bugs off at the pass with a NULL check
Ethan Blanton <elb@pidgin.im>
parents:
24763
diff
changeset
|
390 | |
|
aa8975185a48
Head irc_mirc2* bugs off at the pass with a NULL check
Ethan Blanton <elb@pidgin.im>
parents:
24763
diff
changeset
|
391 | decoded = g_string_sized_new(strlen(string)); |
| 6333 | 392 | |
| 393 | cur = string; | |
| 394 | do { | |
| 6754 | 395 | end = strpbrk(cur, "\002\003\007\017\026\037"); |
| 6333 | 396 | |
|
36256
a437550a9308
Remove -Wno-sign-compare and backport fixes from default.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
35282
diff
changeset
|
397 | decoded = g_string_append_len(decoded, cur, (end ? (gssize)(end - cur) : (gssize)strlen(cur))); |
| 6333 | 398 | cur = end ? end : cur + strlen(cur); |
| 399 | ||
| 400 | switch (*cur) { | |
| 401 | case '\002': | |
| 402 | cur++; | |
| 403 | if (!bold) { | |
| 404 | decoded = g_string_append(decoded, "<B>"); | |
| 405 | bold = TRUE; | |
| 406 | } else { | |
| 407 | decoded = g_string_append(decoded, "</B>"); | |
| 408 | bold = FALSE; | |
| 409 | } | |
| 410 | break; | |
| 411 | case '\003': | |
| 412 | cur++; | |
| 413 | fg[0] = fg[1] = bg[0] = bg[1] = '\0'; | |
| 414 | if (isdigit(*cur)) | |
| 415 | fg[0] = *cur++; | |
| 416 | if (isdigit(*cur)) | |
| 417 | fg[1] = *cur++; | |
| 418 | if (*cur == ',') { | |
| 419 | cur++; | |
| 420 | if (isdigit(*cur)) | |
| 421 | bg[0] = *cur++; | |
| 422 | if (isdigit(*cur)) | |
| 423 | bg[1] = *cur++; | |
| 424 | } | |
| 425 | if (font) { | |
| 426 | decoded = g_string_append(decoded, "</FONT>"); | |
| 427 | font = FALSE; | |
| 428 | } | |
| 429 | ||
| 430 | if (fg[0]) { | |
| 431 | fgnum = atoi(fg); | |
| 432 | if (fgnum < 0 || fgnum > 15) | |
| 433 | continue; | |
| 434 | font = TRUE; | |
| 435 | g_string_append_printf(decoded, "<FONT COLOR=\"%s\"", irc_mirc_colors[fgnum]); | |
| 436 | if (bg[0]) { | |
| 437 | bgnum = atoi(bg); | |
| 438 | if (bgnum >= 0 && bgnum < 16) | |
| 439 | g_string_append_printf(decoded, " BACK=\"%s\"", irc_mirc_colors[bgnum]); | |
| 440 | } | |
| 441 | decoded = g_string_append_c(decoded, '>'); | |
| 442 | } | |
| 443 | break; | |
|
12158
02fcec741f07
[gaim-migrate @ 14459]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
12013
diff
changeset
|
444 | case '\011': |
|
02fcec741f07
[gaim-migrate @ 14459]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
12013
diff
changeset
|
445 | cur++; |
|
02fcec741f07
[gaim-migrate @ 14459]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
12013
diff
changeset
|
446 | if (!italic) { |
|
02fcec741f07
[gaim-migrate @ 14459]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
12013
diff
changeset
|
447 | decoded = g_string_append(decoded, "<I>"); |
|
02fcec741f07
[gaim-migrate @ 14459]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
12013
diff
changeset
|
448 | italic = TRUE; |
|
02fcec741f07
[gaim-migrate @ 14459]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
12013
diff
changeset
|
449 | } else { |
|
02fcec741f07
[gaim-migrate @ 14459]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
12013
diff
changeset
|
450 | decoded = g_string_append(decoded, "</I>"); |
|
02fcec741f07
[gaim-migrate @ 14459]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
12013
diff
changeset
|
451 | italic = FALSE; |
|
02fcec741f07
[gaim-migrate @ 14459]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
12013
diff
changeset
|
452 | } |
|
02fcec741f07
[gaim-migrate @ 14459]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
12013
diff
changeset
|
453 | break; |
| 6754 | 454 | case '\037': |
| 455 | cur++; | |
| 456 | if (!underline) { | |
| 457 | decoded = g_string_append(decoded, "<U>"); | |
| 458 | underline = TRUE; | |
| 459 | } else { | |
| 460 | decoded = g_string_append(decoded, "</U>"); | |
| 12282 | 461 | underline = FALSE; |
| 6754 | 462 | } |
| 463 | break; | |
| 6333 | 464 | case '\007': |
| 465 | case '\026': | |
| 466 | cur++; | |
| 467 | break; | |
| 468 | case '\017': | |
| 469 | cur++; | |
| 470 | /* fallthrough */ | |
| 471 | case '\000': | |
| 472 | if (bold) | |
| 6754 | 473 | decoded = g_string_append(decoded, "</B>"); |
|
12158
02fcec741f07
[gaim-migrate @ 14459]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
12013
diff
changeset
|
474 | if (italic) |
|
02fcec741f07
[gaim-migrate @ 14459]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
12013
diff
changeset
|
475 | decoded = g_string_append(decoded, "</I>"); |
| 6754 | 476 | if (underline) |
| 477 | decoded = g_string_append(decoded, "</U>"); | |
| 6333 | 478 | if (font) |
| 479 | decoded = g_string_append(decoded, "</FONT>"); | |
|
31974
28ac37064cd4
Fix the handling of IRC formatting following mIRC ^O.
Ethan Blanton <elb@pidgin.im>
parents:
31651
diff
changeset
|
480 | bold = italic = underline = font = FALSE; |
| 6333 | 481 | break; |
| 482 | default: | |
| 15884 | 483 | purple_debug(PURPLE_DEBUG_ERROR, "irc", "Unexpected mIRC formatting character %d\n", *cur); |
| 6333 | 484 | } |
| 485 | } while (*cur); | |
| 486 | ||
| 487 | return g_string_free(decoded, FALSE); | |
| 488 | } | |
| 489 | ||
| 8529 | 490 | char *irc_mirc2txt (const char *string) |
| 491 | { | |
|
28468
aa8975185a48
Head irc_mirc2* bugs off at the pass with a NULL check
Ethan Blanton <elb@pidgin.im>
parents:
24763
diff
changeset
|
492 | char *result; |
| 8529 | 493 | int i, j; |
| 494 | ||
|
28468
aa8975185a48
Head irc_mirc2* bugs off at the pass with a NULL check
Ethan Blanton <elb@pidgin.im>
parents:
24763
diff
changeset
|
495 | if (string == NULL) |
|
aa8975185a48
Head irc_mirc2* bugs off at the pass with a NULL check
Ethan Blanton <elb@pidgin.im>
parents:
24763
diff
changeset
|
496 | return NULL; |
|
aa8975185a48
Head irc_mirc2* bugs off at the pass with a NULL check
Ethan Blanton <elb@pidgin.im>
parents:
24763
diff
changeset
|
497 | |
|
aa8975185a48
Head irc_mirc2* bugs off at the pass with a NULL check
Ethan Blanton <elb@pidgin.im>
parents:
24763
diff
changeset
|
498 | result = g_strdup (string); |
|
aa8975185a48
Head irc_mirc2* bugs off at the pass with a NULL check
Ethan Blanton <elb@pidgin.im>
parents:
24763
diff
changeset
|
499 | |
| 8529 | 500 | for (i = 0, j = 0; result[i]; i++) { |
| 501 | switch (result[i]) { | |
| 502 | case '\002': | |
| 503 | case '\003': | |
|
17409
1205b4f7bb82
This performs mIRC formatting code stripping for the room list, as
Ethan Blanton <elb@pidgin.im>
parents:
17156
diff
changeset
|
504 | /* Foreground color */ |
|
1205b4f7bb82
This performs mIRC formatting code stripping for the room list, as
Ethan Blanton <elb@pidgin.im>
parents:
17156
diff
changeset
|
505 | if (isdigit(result[i + 1])) |
|
1205b4f7bb82
This performs mIRC formatting code stripping for the room list, as
Ethan Blanton <elb@pidgin.im>
parents:
17156
diff
changeset
|
506 | i++; |
|
1205b4f7bb82
This performs mIRC formatting code stripping for the room list, as
Ethan Blanton <elb@pidgin.im>
parents:
17156
diff
changeset
|
507 | if (isdigit(result[i + 1])) |
|
1205b4f7bb82
This performs mIRC formatting code stripping for the room list, as
Ethan Blanton <elb@pidgin.im>
parents:
17156
diff
changeset
|
508 | i++; |
|
1205b4f7bb82
This performs mIRC formatting code stripping for the room list, as
Ethan Blanton <elb@pidgin.im>
parents:
17156
diff
changeset
|
509 | /* Optional comma and background color */ |
|
1205b4f7bb82
This performs mIRC formatting code stripping for the room list, as
Ethan Blanton <elb@pidgin.im>
parents:
17156
diff
changeset
|
510 | if (result[i + 1] == ',') { |
|
1205b4f7bb82
This performs mIRC formatting code stripping for the room list, as
Ethan Blanton <elb@pidgin.im>
parents:
17156
diff
changeset
|
511 | i++; |
|
1205b4f7bb82
This performs mIRC formatting code stripping for the room list, as
Ethan Blanton <elb@pidgin.im>
parents:
17156
diff
changeset
|
512 | if (isdigit(result[i + 1])) |
|
1205b4f7bb82
This performs mIRC formatting code stripping for the room list, as
Ethan Blanton <elb@pidgin.im>
parents:
17156
diff
changeset
|
513 | i++; |
|
1205b4f7bb82
This performs mIRC formatting code stripping for the room list, as
Ethan Blanton <elb@pidgin.im>
parents:
17156
diff
changeset
|
514 | if (isdigit(result[i + 1])) |
|
1205b4f7bb82
This performs mIRC formatting code stripping for the room list, as
Ethan Blanton <elb@pidgin.im>
parents:
17156
diff
changeset
|
515 | i++; |
|
1205b4f7bb82
This performs mIRC formatting code stripping for the room list, as
Ethan Blanton <elb@pidgin.im>
parents:
17156
diff
changeset
|
516 | } |
|
1205b4f7bb82
This performs mIRC formatting code stripping for the room list, as
Ethan Blanton <elb@pidgin.im>
parents:
17156
diff
changeset
|
517 | /* Note that i still points to the last character |
|
1205b4f7bb82
This performs mIRC formatting code stripping for the room list, as
Ethan Blanton <elb@pidgin.im>
parents:
17156
diff
changeset
|
518 | * of the color selection string. */ |
|
1205b4f7bb82
This performs mIRC formatting code stripping for the room list, as
Ethan Blanton <elb@pidgin.im>
parents:
17156
diff
changeset
|
519 | continue; |
| 8529 | 520 | case '\007': |
| 521 | case '\017': | |
| 522 | case '\026': | |
| 523 | case '\037': | |
| 524 | continue; | |
| 525 | default: | |
| 526 | result[j++] = result[i]; | |
| 527 | } | |
| 528 | } | |
| 11136 | 529 | result[j] = '\0'; |
|
24763
67d9d4c975c0
Replace spaces wth tabs in indentation and tabs with spaces in line continuations.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
24574
diff
changeset
|
530 | return result; |
| 8529 | 531 | } |
| 532 | ||
|
24574
4ee71b4f335f
Strip multiple leading mode characters from incoming nicknames.
Marcos García Ochoa <magao@bigfoot.com>
parents:
23906
diff
changeset
|
533 | const char *irc_nick_skip_mode(struct irc_conn *irc, const char *nick) |
|
4ee71b4f335f
Strip multiple leading mode characters from incoming nicknames.
Marcos García Ochoa <magao@bigfoot.com>
parents:
23906
diff
changeset
|
534 | { |
|
4ee71b4f335f
Strip multiple leading mode characters from incoming nicknames.
Marcos García Ochoa <magao@bigfoot.com>
parents:
23906
diff
changeset
|
535 | static const char *default_modes = "@+%&"; |
|
4ee71b4f335f
Strip multiple leading mode characters from incoming nicknames.
Marcos García Ochoa <magao@bigfoot.com>
parents:
23906
diff
changeset
|
536 | const char *mode_chars; |
|
4ee71b4f335f
Strip multiple leading mode characters from incoming nicknames.
Marcos García Ochoa <magao@bigfoot.com>
parents:
23906
diff
changeset
|
537 | |
|
4ee71b4f335f
Strip multiple leading mode characters from incoming nicknames.
Marcos García Ochoa <magao@bigfoot.com>
parents:
23906
diff
changeset
|
538 | mode_chars = irc->mode_chars ? irc->mode_chars : default_modes; |
|
4ee71b4f335f
Strip multiple leading mode characters from incoming nicknames.
Marcos García Ochoa <magao@bigfoot.com>
parents:
23906
diff
changeset
|
539 | |
|
38918
bb3906c14782
irc: fix read out of bounds in irc_nick_skip_mode
dx <dx@dxzone.com.ar>
parents:
36256
diff
changeset
|
540 | while (*nick && strchr(mode_chars, *nick) != NULL) |
|
24574
4ee71b4f335f
Strip multiple leading mode characters from incoming nicknames.
Marcos García Ochoa <magao@bigfoot.com>
parents:
23906
diff
changeset
|
541 | nick++; |
|
4ee71b4f335f
Strip multiple leading mode characters from incoming nicknames.
Marcos García Ochoa <magao@bigfoot.com>
parents:
23906
diff
changeset
|
542 | |
|
4ee71b4f335f
Strip multiple leading mode characters from incoming nicknames.
Marcos García Ochoa <magao@bigfoot.com>
parents:
23906
diff
changeset
|
543 | return nick; |
|
4ee71b4f335f
Strip multiple leading mode characters from incoming nicknames.
Marcos García Ochoa <magao@bigfoot.com>
parents:
23906
diff
changeset
|
544 | } |
|
4ee71b4f335f
Strip multiple leading mode characters from incoming nicknames.
Marcos García Ochoa <magao@bigfoot.com>
parents:
23906
diff
changeset
|
545 | |
| 10208 | 546 | gboolean irc_ischannel(const char *string) |
| 547 | { | |
| 548 | return (string[0] == '#' || string[0] == '&'); | |
| 549 | } | |
| 550 | ||
| 6333 | 551 | char *irc_parse_ctcp(struct irc_conn *irc, const char *from, const char *to, const char *msg, int notice) |
| 552 | { | |
| 15884 | 553 | PurpleConnection *gc; |
| 6333 | 554 | const char *cur = msg + 1; |
| 555 | char *buf, *ctcp; | |
| 556 | ||
| 6754 | 557 | /* Note that this is NOT correct w.r.t. multiple CTCPs in one |
| 558 | * message and low-level quoting ... but if you want that crap, | |
| 559 | * use a real IRC client. */ | |
| 560 | ||
|
38920
306b7ae2c8a4
irc: Fix write of a single \0 before the start of a buffer in irc_parse_ctcp
dx <dx@dxzone.com.ar>
parents:
36256
diff
changeset
|
561 | if (msg[0] != '\001' || msg[1] == '\0' || msg[strlen(msg) - 1] != '\001') |
| 6333 | 562 | return g_strdup(msg); |
| 563 | ||
| 564 | if (!strncmp(cur, "ACTION ", 7)) { | |
| 565 | cur += 7; | |
| 566 | buf = g_strdup_printf("/me %s", cur); | |
| 567 | buf[strlen(buf) - 1] = '\0'; | |
| 568 | return buf; | |
| 569 | } else if (!strncmp(cur, "PING ", 5)) { | |
| 570 | if (notice) { /* reply */ | |
|
40000
0eeff970bcdd
Use monotonic time for IRC ping messages.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
39589
diff
changeset
|
571 | gint64 timestamp; |
| 15884 | 572 | gc = purple_account_get_connection(irc->account); |
| 6333 | 573 | if (!gc) |
| 574 | return NULL; | |
|
40000
0eeff970bcdd
Use monotonic time for IRC ping messages.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
39589
diff
changeset
|
575 | if (sscanf(cur, "PING %" G_GINT64_FORMAT, ×tamp) == 1) { |
|
0eeff970bcdd
Use monotonic time for IRC ping messages.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
39589
diff
changeset
|
576 | buf = g_strdup_printf(_("Reply time from %s: %f seconds"), from, |
|
0eeff970bcdd
Use monotonic time for IRC ping messages.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
39589
diff
changeset
|
577 | (g_get_monotonic_time() - timestamp) / |
|
0eeff970bcdd
Use monotonic time for IRC ping messages.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
39589
diff
changeset
|
578 | (gdouble)G_USEC_PER_SEC); |
|
34449
bbcb198650b7
Notify API: extend purple_notify_message with PurpleRequestCommonParameters
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
34304
diff
changeset
|
579 | purple_notify_info(gc, _("PONG"), |
|
bbcb198650b7
Notify API: extend purple_notify_message with PurpleRequestCommonParameters
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
34304
diff
changeset
|
580 | _("CTCP PING reply"), buf, |
|
bbcb198650b7
Notify API: extend purple_notify_message with PurpleRequestCommonParameters
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
34304
diff
changeset
|
581 | purple_request_cpar_from_connection(gc)); |
|
33809
d5e9c888ccd7
Add some error checking for sscanf usage (there are more places that could use this)
Daniel Atallah <datallah@pidgin.im>
parents:
33544
diff
changeset
|
582 | g_free(buf); |
|
d5e9c888ccd7
Add some error checking for sscanf usage (there are more places that could use this)
Daniel Atallah <datallah@pidgin.im>
parents:
33544
diff
changeset
|
583 | } else |
|
d5e9c888ccd7
Add some error checking for sscanf usage (there are more places that could use this)
Daniel Atallah <datallah@pidgin.im>
parents:
33544
diff
changeset
|
584 | purple_debug(PURPLE_DEBUG_ERROR, "irc", "Unable to parse PING timestamp"); |
| 6333 | 585 | return NULL; |
| 586 | } else { | |
| 587 | buf = irc_format(irc, "vt:", "NOTICE", from, msg); | |
| 588 | irc_send(irc, buf); | |
| 589 | g_free(buf); | |
| 590 | } | |
| 591 | } else if (!strncmp(cur, "VERSION", 7) && !notice) { | |
| 15884 | 592 | buf = irc_format(irc, "vt:", "NOTICE", from, "\001VERSION Purple IRC\001"); |
| 6333 | 593 | irc_send(irc, buf); |
| 594 | g_free(buf); | |
| 8351 | 595 | } else if (!strncmp(cur, "DCC SEND ", 9)) { |
| 596 | irc_dccsend_recv(irc, from, msg + 10); | |
| 597 | return NULL; | |
| 6333 | 598 | } |
| 599 | ||
| 600 | ctcp = g_strdup(msg + 1); | |
| 601 | ctcp[strlen(ctcp) - 1] = '\0'; | |
| 602 | buf = g_strdup_printf("Received CTCP '%s' (to %s) from %s", ctcp, to, from); | |
| 603 | g_free(ctcp); | |
| 604 | return buf; | |
| 605 | } | |
| 606 | ||
| 607 | void irc_msg_table_build(struct irc_conn *irc) | |
| 608 | { | |
| 609 | int i; | |
| 610 | ||
| 611 | if (!irc || !irc->msgs) { | |
| 15884 | 612 | purple_debug(PURPLE_DEBUG_ERROR, "irc", "Attempt to build a message table on a bogus structure\n"); |
| 6333 | 613 | return; |
| 614 | } | |
| 615 | ||
| 616 | for (i = 0; _irc_msgs[i].name; i++) { | |
| 617 | g_hash_table_insert(irc->msgs, (gpointer)_irc_msgs[i].name, (gpointer)&_irc_msgs[i]); | |
| 618 | } | |
| 619 | } | |
| 620 | ||
| 621 | void irc_cmd_table_build(struct irc_conn *irc) | |
| 622 | { | |
| 623 | int i; | |
| 624 | ||
| 625 | if (!irc || !irc->cmds) { | |
| 15884 | 626 | purple_debug(PURPLE_DEBUG_ERROR, "irc", "Attempt to build a command table on a bogus structure\n"); |
| 6333 | 627 | return; |
| 628 | } | |
| 629 | ||
| 630 | for (i = 0; _irc_cmds[i].name ; i++) { | |
| 631 | g_hash_table_insert(irc->cmds, (gpointer)_irc_cmds[i].name, (gpointer)&_irc_cmds[i]); | |
| 632 | } | |
| 633 | } | |
| 634 | ||
| 635 | char *irc_format(struct irc_conn *irc, const char *format, ...) | |
| 636 | { | |
| 637 | GString *string = g_string_new(""); | |
| 638 | char *tok, *tmp; | |
| 639 | const char *cur; | |
| 640 | va_list ap; | |
| 641 | ||
| 642 | va_start(ap, format); | |
| 643 | for (cur = format; *cur; cur++) { | |
| 644 | if (cur != format) | |
| 645 | g_string_append_c(string, ' '); | |
| 646 | ||
| 647 | tok = va_arg(ap, char *); | |
| 648 | switch (*cur) { | |
| 649 | case 'v': | |
| 650 | g_string_append(string, tok); | |
| 651 | break; | |
| 652 | case ':': | |
| 653 | g_string_append_c(string, ':'); | |
| 654 | /* no break! */ | |
| 655 | case 't': | |
| 656 | case 'n': | |
| 657 | case 'c': | |
| 658 | tmp = irc_send_convert(irc, tok); | |
|
23392
9268a4fc4786
Remove an unnecessary strdup when sending messages over IRC.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
22798
diff
changeset
|
659 | g_string_append(string, tmp ? tmp : tok); |
| 6333 | 660 | g_free(tmp); |
| 661 | break; | |
| 662 | default: | |
| 15884 | 663 | purple_debug(PURPLE_DEBUG_ERROR, "irc", "Invalid format character '%c'\n", *cur); |
| 6333 | 664 | break; |
| 665 | } | |
| 666 | } | |
| 667 | va_end(ap); | |
| 668 | g_string_append(string, "\r\n"); | |
| 669 | return (g_string_free(string, FALSE)); | |
| 670 | } | |
| 671 | ||
| 672 | void irc_parse_msg(struct irc_conn *irc, char *input) | |
| 673 | { | |
| 674 | struct _irc_msg *msgent; | |
| 675 | char *cur, *end, *tmp, *from, *msgname, *fmt, **args, *msg; | |
| 7631 | 676 | guint i; |
|
20440
42e5e5445a2f
Move prpl-irc to purple_connection_error_reason.
Will Thompson <resiak@pidgin.im>
parents:
19859
diff
changeset
|
677 | PurpleConnection *gc = purple_account_get_connection(irc->account); |
|
35245
a167504359e5
IRC: implement support for required args checking in message parser
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
33809
diff
changeset
|
678 | gboolean fmt_valid; |
|
a167504359e5
IRC: implement support for required args checking in message parser
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
33809
diff
changeset
|
679 | int args_cnt; |
| 6333 | 680 | |
|
14544
847944da3ca0
[gaim-migrate @ 17201]
Daniel Atallah <datallah@pidgin.im>
parents:
14254
diff
changeset
|
681 | irc->recv_time = time(NULL); |
|
14984
aa56a88dc792
[gaim-migrate @ 17694]
Mark Doliner <markdoliner@pidgin.im>
parents:
14683
diff
changeset
|
682 | |
|
aa56a88dc792
[gaim-migrate @ 17694]
Mark Doliner <markdoliner@pidgin.im>
parents:
14683
diff
changeset
|
683 | /* |
|
14996
291304176e0b
[gaim-migrate @ 17706]
Mark Doliner <markdoliner@pidgin.im>
parents:
14995
diff
changeset
|
684 | * The data passed to irc-receiving-text is the raw protocol data. |
|
14995
fc9f51b8f6d5
[gaim-migrate @ 17705]
Mark Doliner <markdoliner@pidgin.im>
parents:
14984
diff
changeset
|
685 | * TODO: It should be passed as an array of bytes and a length |
|
fc9f51b8f6d5
[gaim-migrate @ 17705]
Mark Doliner <markdoliner@pidgin.im>
parents:
14984
diff
changeset
|
686 | * instead of a null terminated string. |
|
14984
aa56a88dc792
[gaim-migrate @ 17694]
Mark Doliner <markdoliner@pidgin.im>
parents:
14683
diff
changeset
|
687 | */ |
|
36520
42a876472506
Refactored irc to use the new plugin API
Ankit Vani <a@nevitus.org>
parents:
33811
diff
changeset
|
688 | purple_signal_emit(_irc_protocol, "irc-receiving-text", gc, &input); |
|
31294
73607ab89c6f
Remove trailing whitespace
Richard Laager <rlaager@pidgin.im>
parents:
31229
diff
changeset
|
689 | |
|
38907
d184ca7f413e
irc: show protocol debug if PURPLE_VERBOSE_DEBUG=1
dx <dx@dxzone.com.ar>
parents:
36256
diff
changeset
|
690 | if (purple_debug_is_verbose()) { |
|
d184ca7f413e
irc: show protocol debug if PURPLE_VERBOSE_DEBUG=1
dx <dx@dxzone.com.ar>
parents:
36256
diff
changeset
|
691 | char *clean = purple_utf8_salvage(input); |
|
d184ca7f413e
irc: show protocol debug if PURPLE_VERBOSE_DEBUG=1
dx <dx@dxzone.com.ar>
parents:
36256
diff
changeset
|
692 | clean = g_strstrip(clean); |
|
d184ca7f413e
irc: show protocol debug if PURPLE_VERBOSE_DEBUG=1
dx <dx@dxzone.com.ar>
parents:
36256
diff
changeset
|
693 | purple_debug_misc("irc", ">> %s\n", clean); |
|
d184ca7f413e
irc: show protocol debug if PURPLE_VERBOSE_DEBUG=1
dx <dx@dxzone.com.ar>
parents:
36256
diff
changeset
|
694 | g_free(clean); |
|
d184ca7f413e
irc: show protocol debug if PURPLE_VERBOSE_DEBUG=1
dx <dx@dxzone.com.ar>
parents:
36256
diff
changeset
|
695 | } |
|
d184ca7f413e
irc: show protocol debug if PURPLE_VERBOSE_DEBUG=1
dx <dx@dxzone.com.ar>
parents:
36256
diff
changeset
|
696 | |
| 6333 | 697 | if (!strncmp(input, "PING ", 5)) { |
| 698 | msg = irc_format(irc, "vv", "PONG", input + 5); | |
| 699 | irc_send(irc, msg); | |
| 700 | g_free(msg); | |
| 701 | return; | |
| 702 | } else if (!strncmp(input, "ERROR ", 6)) { | |
| 10154 | 703 | if (g_utf8_validate(input, -1, NULL)) { |
|
37966
956640da6944
irc: Pass PurpleConnection errors as GErrors
Mike Ruprecht <cmaiku@gmail.com>
parents:
37158
diff
changeset
|
704 | purple_connection_take_error(gc, g_error_new( |
|
956640da6944
irc: Pass PurpleConnection errors as GErrors
Mike Ruprecht <cmaiku@gmail.com>
parents:
37158
diff
changeset
|
705 | PURPLE_CONNECTION_ERROR, |
|
956640da6944
irc: Pass PurpleConnection errors as GErrors
Mike Ruprecht <cmaiku@gmail.com>
parents:
37158
diff
changeset
|
706 | PURPLE_CONNECTION_ERROR_NETWORK_ERROR, |
|
956640da6944
irc: Pass PurpleConnection errors as GErrors
Mike Ruprecht <cmaiku@gmail.com>
parents:
37158
diff
changeset
|
707 | "%s\n%s", _("Disconnected."), input)); |
| 10154 | 708 | } else |
|
37966
956640da6944
irc: Pass PurpleConnection errors as GErrors
Mike Ruprecht <cmaiku@gmail.com>
parents:
37158
diff
changeset
|
709 | purple_connection_take_error(gc, g_error_new_literal( |
|
956640da6944
irc: Pass PurpleConnection errors as GErrors
Mike Ruprecht <cmaiku@gmail.com>
parents:
37158
diff
changeset
|
710 | PURPLE_CONNECTION_ERROR, |
| 21279 | 711 | PURPLE_CONNECTION_ERROR_NETWORK_ERROR, |
|
37966
956640da6944
irc: Pass PurpleConnection errors as GErrors
Mike Ruprecht <cmaiku@gmail.com>
parents:
37158
diff
changeset
|
712 | _("Disconnected."))); |
| 6333 | 713 | return; |
|
33404
bbd52f93184e
Implement SASL support for IRC, using Cyrus.
Thijs Alkemade <thijsalkemade@gmail.com>
parents:
32057
diff
changeset
|
714 | #ifdef HAVE_CYRUS_SASL |
|
bbd52f93184e
Implement SASL support for IRC, using Cyrus.
Thijs Alkemade <thijsalkemade@gmail.com>
parents:
32057
diff
changeset
|
715 | } else if (!strncmp(input, "AUTHENTICATE ", 13)) { |
|
bbd52f93184e
Implement SASL support for IRC, using Cyrus.
Thijs Alkemade <thijsalkemade@gmail.com>
parents:
32057
diff
changeset
|
716 | irc_msg_auth(irc, input + 13); |
|
bbd52f93184e
Implement SASL support for IRC, using Cyrus.
Thijs Alkemade <thijsalkemade@gmail.com>
parents:
32057
diff
changeset
|
717 | return; |
|
bbd52f93184e
Implement SASL support for IRC, using Cyrus.
Thijs Alkemade <thijsalkemade@gmail.com>
parents:
32057
diff
changeset
|
718 | #endif |
| 6333 | 719 | } |
| 720 | ||
| 721 | if (input[0] != ':' || (cur = strchr(input, ' ')) == NULL) { | |
| 722 | irc_parse_error_cb(irc, input); | |
| 723 | return; | |
| 724 | } | |
| 725 | ||
| 726 | from = g_strndup(&input[1], cur - &input[1]); | |
| 727 | cur++; | |
| 728 | end = strchr(cur, ' '); | |
| 729 | if (!end) | |
| 730 | end = cur + strlen(cur); | |
| 731 | ||
| 732 | tmp = g_strndup(cur, end - cur); | |
| 733 | msgname = g_ascii_strdown(tmp, -1); | |
| 734 | g_free(tmp); | |
| 735 | ||
| 736 | if ((msgent = g_hash_table_lookup(irc->msgs, msgname)) == NULL) { | |
| 737 | irc_msg_default(irc, "", from, &input); | |
| 738 | g_free(msgname); | |
| 739 | g_free(from); | |
| 740 | return; | |
| 741 | } | |
| 742 | g_free(msgname); | |
| 743 | ||
|
35245
a167504359e5
IRC: implement support for required args checking in message parser
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
33809
diff
changeset
|
744 | fmt_valid = TRUE; |
| 6333 | 745 | args = g_new0(char *, strlen(msgent->format)); |
|
35245
a167504359e5
IRC: implement support for required args checking in message parser
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
33809
diff
changeset
|
746 | args_cnt = 0; |
| 6333 | 747 | for (cur = end, fmt = msgent->format, i = 0; fmt[i] && *cur++; i++) { |
| 748 | switch (fmt[i]) { | |
| 749 | case 'v': | |
| 750 | if (!(end = strchr(cur, ' '))) end = cur + strlen(cur); | |
|
32047
42d2acf32425
UTF-8 salvage unknown strings in IRC
Ethan Blanton <elb@pidgin.im>
parents:
32037
diff
changeset
|
751 | /* This is a string of unknown encoding which we do not |
|
42d2acf32425
UTF-8 salvage unknown strings in IRC
Ethan Blanton <elb@pidgin.im>
parents:
32037
diff
changeset
|
752 | * want to transcode, but it may or may not be valid |
|
42d2acf32425
UTF-8 salvage unknown strings in IRC
Ethan Blanton <elb@pidgin.im>
parents:
32037
diff
changeset
|
753 | * UTF-8, so we'll salvage it. If a nick/channel/target |
|
42d2acf32425
UTF-8 salvage unknown strings in IRC
Ethan Blanton <elb@pidgin.im>
parents:
32037
diff
changeset
|
754 | * field has inadvertently been marked verbatim, this |
|
42d2acf32425
UTF-8 salvage unknown strings in IRC
Ethan Blanton <elb@pidgin.im>
parents:
32037
diff
changeset
|
755 | * could cause weirdness. */ |
|
42d2acf32425
UTF-8 salvage unknown strings in IRC
Ethan Blanton <elb@pidgin.im>
parents:
32037
diff
changeset
|
756 | tmp = g_strndup(cur, end - cur); |
|
42d2acf32425
UTF-8 salvage unknown strings in IRC
Ethan Blanton <elb@pidgin.im>
parents:
32037
diff
changeset
|
757 | args[i] = purple_utf8_salvage(tmp); |
|
42d2acf32425
UTF-8 salvage unknown strings in IRC
Ethan Blanton <elb@pidgin.im>
parents:
32037
diff
changeset
|
758 | g_free(tmp); |
| 6333 | 759 | cur += end - cur; |
| 760 | break; | |
| 761 | case 't': | |
| 762 | case 'n': | |
| 763 | case 'c': | |
| 764 | if (!(end = strchr(cur, ' '))) end = cur + strlen(cur); | |
| 765 | tmp = g_strndup(cur, end - cur); | |
| 766 | args[i] = irc_recv_convert(irc, tmp); | |
| 767 | g_free(tmp); | |
| 768 | cur += end - cur; | |
| 769 | break; | |
| 770 | case ':': | |
| 771 | if (*cur == ':') cur++; | |
| 772 | args[i] = irc_recv_convert(irc, cur); | |
| 773 | cur = cur + strlen(cur); | |
| 774 | break; | |
| 775 | case '*': | |
|
32047
42d2acf32425
UTF-8 salvage unknown strings in IRC
Ethan Blanton <elb@pidgin.im>
parents:
32037
diff
changeset
|
776 | /* Ditto 'v' above; we're going to salvage this in case |
|
36637
9b0109ae118d
Renamed some prpl stuff to protocol stuff.
Ankit Vani <a@nevitus.org>
parents:
36574
diff
changeset
|
777 | * it leaks past the IRC protocol */ |
|
32047
42d2acf32425
UTF-8 salvage unknown strings in IRC
Ethan Blanton <elb@pidgin.im>
parents:
32037
diff
changeset
|
778 | args[i] = purple_utf8_salvage(cur); |
| 6333 | 779 | cur = cur + strlen(cur); |
| 780 | break; | |
| 781 | default: | |
| 15884 | 782 | purple_debug(PURPLE_DEBUG_ERROR, "irc", "invalid message format character '%c'\n", fmt[i]); |
|
35245
a167504359e5
IRC: implement support for required args checking in message parser
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
33809
diff
changeset
|
783 | fmt_valid = FALSE; |
| 6333 | 784 | break; |
| 785 | } | |
|
35245
a167504359e5
IRC: implement support for required args checking in message parser
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
33809
diff
changeset
|
786 | if (fmt_valid) |
|
a167504359e5
IRC: implement support for required args checking in message parser
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
33809
diff
changeset
|
787 | args_cnt = i + 1; |
| 6333 | 788 | } |
|
35245
a167504359e5
IRC: implement support for required args checking in message parser
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
33809
diff
changeset
|
789 | if (G_UNLIKELY(!fmt_valid)) { |
|
a167504359e5
IRC: implement support for required args checking in message parser
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
33809
diff
changeset
|
790 | purple_debug_error("irc", "message format was invalid"); |
|
a167504359e5
IRC: implement support for required args checking in message parser
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
33809
diff
changeset
|
791 | } else if (G_LIKELY(args_cnt >= msgent->req_cnt)) { |
|
a167504359e5
IRC: implement support for required args checking in message parser
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
33809
diff
changeset
|
792 | tmp = irc_recv_convert(irc, from); |
|
a167504359e5
IRC: implement support for required args checking in message parser
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
33809
diff
changeset
|
793 | (msgent->cb)(irc, msgent->name, tmp, args); |
|
a167504359e5
IRC: implement support for required args checking in message parser
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
33809
diff
changeset
|
794 | g_free(tmp); |
|
a167504359e5
IRC: implement support for required args checking in message parser
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
33809
diff
changeset
|
795 | } else { |
|
a167504359e5
IRC: implement support for required args checking in message parser
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
33809
diff
changeset
|
796 | purple_debug_error("irc", "args count (%d) doesn't reach " |
|
a167504359e5
IRC: implement support for required args checking in message parser
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
33809
diff
changeset
|
797 | "expected value of %d for the '%s' command", |
|
a167504359e5
IRC: implement support for required args checking in message parser
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
33809
diff
changeset
|
798 | args_cnt, msgent->req_cnt, msgent->name); |
|
a167504359e5
IRC: implement support for required args checking in message parser
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
33809
diff
changeset
|
799 | } |
| 6333 | 800 | for (i = 0; i < strlen(msgent->format); i++) { |
| 801 | g_free(args[i]); | |
| 802 | } | |
| 803 | g_free(args); | |
| 804 | g_free(from); | |
| 805 | } | |
| 806 | ||
| 807 | static void irc_parse_error_cb(struct irc_conn *irc, char *input) | |
| 808 | { | |
|
23433
0094a64519cb
Make the IRC "unknown message" debugging messages UTF-8 safe.
Ethan Blanton <elb@pidgin.im>
parents:
23392
diff
changeset
|
809 | char *clean; |
|
24763
67d9d4c975c0
Replace spaces wth tabs in indentation and tabs with spaces in line continuations.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
24574
diff
changeset
|
810 | /* This really should be escaped somehow that you can tell what |
|
67d9d4c975c0
Replace spaces wth tabs in indentation and tabs with spaces in line continuations.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
24574
diff
changeset
|
811 | * the junk was -- but as it is, it can crash glib. */ |
|
67d9d4c975c0
Replace spaces wth tabs in indentation and tabs with spaces in line continuations.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
24574
diff
changeset
|
812 | clean = purple_utf8_salvage(input); |
|
23433
0094a64519cb
Make the IRC "unknown message" debugging messages UTF-8 safe.
Ethan Blanton <elb@pidgin.im>
parents:
23392
diff
changeset
|
813 | purple_debug(PURPLE_DEBUG_WARNING, "irc", "Unrecognized string: %s\n", clean); |
|
24763
67d9d4c975c0
Replace spaces wth tabs in indentation and tabs with spaces in line continuations.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
24574
diff
changeset
|
814 | g_free(clean); |
| 6333 | 815 | } |