summaryrefslogtreecommitdiff
path: root/src/plugins/irc/irc-input.c
diff options
context:
space:
mode:
authorSebastien Helleu <flashcode@flashtux.org>2008-06-03 10:56:51 +0200
committerSebastien Helleu <flashcode@flashtux.org>2008-06-03 10:56:51 +0200
commit3a53257032a0df8aa5f3b31f14a8e6f4e1f07595 (patch)
tree23d16979c6ee884220afbe148b32981338f7f690 /src/plugins/irc/irc-input.c
parent2b1d7df86c745367cfdf4de13629790197b523b3 (diff)
downloadweechat-3a53257032a0df8aa5f3b31f14a8e6f4e1f07595.zip
Add "const" keyword for some "char *" function arguments (core and plugins API)
Diffstat (limited to 'src/plugins/irc/irc-input.c')
-rw-r--r--src/plugins/irc/irc-input.c21
1 files changed, 14 insertions, 7 deletions
diff --git a/src/plugins/irc/irc-input.c b/src/plugins/irc/irc-input.c
index 47c22f3f7..1e76901e5 100644
--- a/src/plugins/irc/irc-input.c
+++ b/src/plugins/irc/irc-input.c
@@ -36,7 +36,7 @@
*/
void
-irc_input_user_message_display (struct t_gui_buffer *buffer, char *text)
+irc_input_user_message_display (struct t_gui_buffer *buffer, const char *text)
{
struct t_irc_nick *ptr_nick;
char *text_decoded;
@@ -84,13 +84,15 @@ irc_input_user_message_display (struct t_gui_buffer *buffer, char *text)
/*
* irc_input_send_user_message: send a PRIVMSG message, and split it
* if > 512 bytes
+ * warning: this function makes temporarirly
+ * changes in "text"
*/
void
irc_input_send_user_message (struct t_gui_buffer *buffer, char *text)
{
int max_length;
- char *pos, *pos_next, *pos_max, *next, saved_char, *last_space;
+ char *pos, *pos_max, *last_space, *pos_next, *next, saved_char;
IRC_GET_SERVER_CHANNEL(buffer);
@@ -151,9 +153,10 @@ irc_input_send_user_message (struct t_gui_buffer *buffer, char *text)
*/
int
-irc_input_data_cb (void *data, struct t_gui_buffer *buffer, char *input_data)
+irc_input_data_cb (void *data, struct t_gui_buffer *buffer,
+ const char *input_data)
{
- char *data_with_colors;
+ char *data_with_colors, *msg;
/* make C compiler happy */
(void) data;
@@ -164,9 +167,13 @@ irc_input_data_cb (void *data, struct t_gui_buffer *buffer, char *input_data)
{
data_with_colors = irc_color_encode (input_data,
weechat_config_boolean (irc_config_network_colors_send));
-
- irc_input_send_user_message (buffer,
- (data_with_colors) ? data_with_colors : input_data);
+
+ msg = strdup ((data_with_colors) ? data_with_colors : input_data);
+ if (msg)
+ {
+ irc_input_send_user_message (buffer, msg);
+ free (msg);
+ }
if (data_with_colors)
free (data_with_colors);