diff options
Diffstat (limited to 'src/plugins/irc/irc-raw.c')
-rw-r--r-- | src/plugins/irc/irc-raw.c | 60 |
1 files changed, 30 insertions, 30 deletions
diff --git a/src/plugins/irc/irc-raw.c b/src/plugins/irc/irc-raw.c index 051c85667..a5f5a5117 100644 --- a/src/plugins/irc/irc-raw.c +++ b/src/plugins/irc/irc-raw.c @@ -67,7 +67,7 @@ void irc_raw_open (int switch_to_buffer) { struct t_irc_raw_message *ptr_raw_message; - + if (!irc_raw_buffer) { irc_raw_buffer = weechat_buffer_search (IRC_PLUGIN_NAME, @@ -77,14 +77,14 @@ irc_raw_open (int switch_to_buffer) irc_raw_buffer = weechat_buffer_new (IRC_RAW_BUFFER_NAME, &irc_input_data_cb, NULL, &irc_buffer_close_cb, NULL); - + /* failed to create buffer ? then return */ if (!irc_raw_buffer) return; - + weechat_buffer_set (irc_raw_buffer, "title", _("IRC raw messages")); - + if (!weechat_buffer_get_integer (irc_raw_buffer, "short_name_is_set")) { weechat_buffer_set (irc_raw_buffer, "short_name", @@ -94,7 +94,7 @@ irc_raw_open (int switch_to_buffer) weechat_buffer_set (irc_raw_buffer, "localvar_set_server", IRC_RAW_BUFFER_NAME); weechat_buffer_set (irc_raw_buffer, "localvar_set_channel", IRC_RAW_BUFFER_NAME); weechat_buffer_set (irc_raw_buffer, "localvar_set_no_log", "1"); - + /* disable all highlights on this buffer */ weechat_buffer_set (irc_raw_buffer, "highlight_words", "-"); @@ -106,7 +106,7 @@ irc_raw_open (int switch_to_buffer) } } } - + if (irc_raw_buffer && switch_to_buffer) weechat_buffer_set (irc_raw_buffer, "display", "1"); } @@ -119,7 +119,7 @@ void irc_raw_message_free (struct t_irc_raw_message *raw_message) { struct t_irc_raw_message *new_raw_messages; - + /* remove message from raw messages list */ if (last_irc_raw_message == raw_message) last_irc_raw_message = raw_message->prev_message; @@ -130,20 +130,20 @@ irc_raw_message_free (struct t_irc_raw_message *raw_message) } else new_raw_messages = raw_message->next_message; - + if (raw_message->next_message) (raw_message->next_message)->prev_message = raw_message->prev_message; - + /* free data */ if (raw_message->prefix) free (raw_message->prefix); if (raw_message->message) free (raw_message->message); - + free (raw_message); - + irc_raw_messages = new_raw_messages; - + irc_raw_messages_count--; } @@ -168,7 +168,7 @@ void irc_raw_message_remove_old () { int max_messages; - + max_messages = weechat_config_integer (irc_config_look_raw_messages); while (irc_raw_messages && (irc_raw_messages_count >= max_messages)) { @@ -185,19 +185,19 @@ irc_raw_message_add_to_list (time_t date, const char *prefix, const char *message) { struct t_irc_raw_message *new_raw_message; - + if (!prefix || !message) return NULL; - + irc_raw_message_remove_old (); - + new_raw_message = malloc (sizeof (*new_raw_message)); if (new_raw_message) { new_raw_message->date = date; new_raw_message->prefix = strdup (prefix); new_raw_message->message = strdup (message); - + /* add message to list */ new_raw_message->prev_message = last_irc_raw_message; new_raw_message->next_message = NULL; @@ -206,10 +206,10 @@ irc_raw_message_add_to_list (time_t date, const char *prefix, else irc_raw_messages = new_raw_message; last_irc_raw_message = new_raw_message; - + irc_raw_messages_count++; } - + return new_raw_message; } @@ -226,7 +226,7 @@ irc_raw_message_add (struct t_irc_server *server, int flags, const char *hexa = "0123456789ABCDEF"; int pos_buf, pos_buf2, char_size, i; struct t_irc_raw_message *new_raw_message; - + buf = weechat_iconv_to_internal (NULL, message); buf2 = malloc ((strlen (buf) * 3) + 1); if (buf2) @@ -282,7 +282,7 @@ irc_raw_message_add (struct t_irc_server *server, int flags, strcpy (prefix_arrow, IRC_RAW_PREFIX_SEND); break; } - + snprintf (prefix, sizeof (prefix), "%s%s%s%s%s", (server) ? weechat_color ("chat_server") : "", (server) ? server->name : "", @@ -291,16 +291,16 @@ irc_raw_message_add (struct t_irc_server *server, int flags, weechat_color ("chat_prefix_quit") : weechat_color ("chat_prefix_join"), prefix_arrow); - + new_raw_message = irc_raw_message_add_to_list (time (NULL), prefix, (buf2) ? buf2 : ((buf) ? buf : message)); - + if (buf) free (buf); if (buf2) free (buf2); - + return new_raw_message; } @@ -313,14 +313,14 @@ irc_raw_print (struct t_irc_server *server, int flags, const char *message) { struct t_irc_raw_message *new_raw_message; - + if (!message) return; /* auto-open IRC raw buffer if debug for irc plugin is >= 1 */ if (!irc_raw_buffer && (weechat_irc_plugin->debug >= 1)) irc_raw_open (0); - + new_raw_message = irc_raw_message_add (server, flags, message); if (new_raw_message) { @@ -341,20 +341,20 @@ irc_raw_add_to_infolist (struct t_infolist *infolist, struct t_irc_raw_message *raw_message) { struct t_infolist_item *ptr_item; - + if (!infolist || !raw_message) return 0; - + ptr_item = weechat_infolist_new_item (infolist); if (!ptr_item) return 0; - + if (!weechat_infolist_new_var_time (ptr_item, "date", raw_message->date)) return 0; if (!weechat_infolist_new_var_string (ptr_item, "prefix", raw_message->prefix)) return 0; if (!weechat_infolist_new_var_string (ptr_item, "message", raw_message->message)) return 0; - + return 1; } |