comparison libpurple/protocols/irc/cmds.c @ 23629:bd0c0cffb644

Correct some IRC comments for /ctcp
author Ethan Blanton <elb@pidgin.im>
date Mon, 21 Jul 2008 20:36:07 +0000
parents dc359ea9eb9a
children 4f46eb13b540
comparison
equal deleted inserted replaced
23628:dc359ea9eb9a 23629:bd0c0cffb644
77 /* check if we have args */ 77 /* check if we have args */
78 if (!args || !args[0] || !args[1]) 78 if (!args || !args[0] || !args[1])
79 return 0; 79 return 0;
80 80
81 /* TODO:strip newlines or send each line as separate ctcp or something 81 /* TODO:strip newlines or send each line as separate ctcp or something
82 * actually, this shouldn't be done here but somewhere else since irc should support escaping newlines 82 * actually, this shouldn't be done here but somewhere else since irc should support escaping newlines */
83 * utf8 could pose additional problems here since it allows some of weird chars (NULL) to be part of bigger chars */
84 83
85 string = g_string_new(args[1]); 84 string = g_string_new(args[1]);
86 g_string_prepend_c (string,'\001'); 85 g_string_prepend_c (string,'\001');
87 g_string_append_c (string,'\001'); 86 g_string_append_c (string,'\001');
88 buf = irc_format(irc, "vn:", "PRIVMSG", args[0], string->str); 87 buf = irc_format(irc, "vn:", "PRIVMSG", args[0], string->str);
89 g_string_free(string,TRUE); 88 g_string_free(string,TRUE);
90 89
91 /* check if line is small enough to send
92 * XXX: strlen will prolly not work for UTF-8 */
93 if (strlen(buf) >= 512)
94 return 0;
95
96 irc_send(irc, buf); 90 irc_send(irc, buf);
97 g_free(buf); 91 g_free(buf);
98 92
99
100 return 1; 93 return 1;
101
102 } 94 }
103 95
104 int irc_cmd_ctcp_action(struct irc_conn *irc, const char *cmd, const char *target, const char **args) 96 int irc_cmd_ctcp_action(struct irc_conn *irc, const char *cmd, const char *target, const char **args)
105 { 97 {
106 PurpleConnection *gc = purple_account_get_connection(irc->account); 98 PurpleConnection *gc = purple_account_get_connection(irc->account);