summaryrefslogtreecommitdiff
path: root/src/plugins
diff options
context:
space:
mode:
Diffstat (limited to 'src/plugins')
-rw-r--r--src/plugins/irc/CMakeLists.txt1
-rw-r--r--src/plugins/irc/Makefile.am2
-rw-r--r--src/plugins/irc/irc-buffer.c52
-rw-r--r--src/plugins/irc/irc-buffer.h6
-rw-r--r--src/plugins/irc/irc-command.c14
-rw-r--r--src/plugins/irc/irc-config.c7
-rw-r--r--src/plugins/irc/irc-config.h1
-rw-r--r--src/plugins/irc/irc-debug.c108
-rw-r--r--src/plugins/irc/irc-debug.h11
-rw-r--r--src/plugins/irc/irc-raw.c267
-rw-r--r--src/plugins/irc/irc-raw.h47
-rw-r--r--src/plugins/irc/irc-server.c26
12 files changed, 385 insertions, 157 deletions
diff --git a/src/plugins/irc/CMakeLists.txt b/src/plugins/irc/CMakeLists.txt
index 16cf55528..a56c5e815 100644
--- a/src/plugins/irc/CMakeLists.txt
+++ b/src/plugins/irc/CMakeLists.txt
@@ -31,6 +31,7 @@ irc-input.c irc-input.h
irc-mode.c irc-mode.h
irc-nick.c irc-nick.h
irc-protocol.c irc-protocol.h
+irc-raw.c irc-raw.h
irc-server.c irc-server.h
irc-upgrade.c irc-upgrade.h)
SET_TARGET_PROPERTIES(irc PROPERTIES PREFIX "")
diff --git a/src/plugins/irc/Makefile.am b/src/plugins/irc/Makefile.am
index dfff9d1b6..9333de1fe 100644
--- a/src/plugins/irc/Makefile.am
+++ b/src/plugins/irc/Makefile.am
@@ -52,6 +52,8 @@ irc_la_SOURCES = irc.c \
irc-nick.h \
irc-protocol.c \
irc-protocol.h \
+ irc-raw.c \
+ irc-raw.h \
irc-server.c \
irc-server.h \
irc-upgrade.c \
diff --git a/src/plugins/irc/irc-buffer.c b/src/plugins/irc/irc-buffer.c
index 7792a8845..36fc16896 100644
--- a/src/plugins/irc/irc-buffer.c
+++ b/src/plugins/irc/irc-buffer.c
@@ -29,6 +29,7 @@
#include "irc-channel.h"
#include "irc-command.h"
#include "irc-config.h"
+#include "irc-raw.h"
#include "irc-server.h"
@@ -285,37 +286,44 @@ irc_buffer_close_cb (void *data, struct t_gui_buffer *buffer)
/* make C compiler happy */
(void) data;
- if (ptr_channel)
+ if (buffer == irc_raw_buffer)
{
- /* send PART for channel if its buffer is closed */
- if ((ptr_channel->type == IRC_CHANNEL_TYPE_CHANNEL)
- && (ptr_channel->nicks))
- {
- irc_command_part_channel (ptr_server, ptr_channel->name, NULL);
- }
- irc_channel_free (ptr_server, ptr_channel);
+ irc_raw_buffer = NULL;
}
else
{
- if (ptr_server)
+ if (ptr_channel)
+ {
+ /* send PART for channel if its buffer is closed */
+ if ((ptr_channel->type == IRC_CHANNEL_TYPE_CHANNEL)
+ && (ptr_channel->nicks))
+ {
+ irc_command_part_channel (ptr_server, ptr_channel->name, NULL);
+ }
+ irc_channel_free (ptr_server, ptr_channel);
+ }
+ else
{
- /* send PART on all channels for server, then disconnect from server */
- ptr_channel = ptr_server->channels;
- while (ptr_channel)
+ if (ptr_server)
{
- next_channel = ptr_channel->next_channel;
- weechat_buffer_close (ptr_channel->buffer);
- ptr_channel = next_channel;
+ /* send PART on all channels for server, then disconnect from server */
+ ptr_channel = ptr_server->channels;
+ while (ptr_channel)
+ {
+ next_channel = ptr_channel->next_channel;
+ weechat_buffer_close (ptr_channel->buffer);
+ ptr_channel = next_channel;
+ }
+ irc_server_disconnect (ptr_server, 0);
+ ptr_server->buffer = NULL;
}
- irc_server_disconnect (ptr_server, 0);
- ptr_server->buffer = NULL;
}
+
+ if (irc_buffer_servers == buffer)
+ irc_buffer_servers = NULL;
+ if (ptr_server && (irc_current_server == ptr_server))
+ irc_current_server = NULL;
}
-
- if (irc_buffer_servers == buffer)
- irc_buffer_servers = NULL;
- if (ptr_server && (irc_current_server == ptr_server))
- irc_current_server = NULL;
return WEECHAT_RC_OK;
}
diff --git a/src/plugins/irc/irc-buffer.h b/src/plugins/irc/irc-buffer.h
index ae2cc2e9b..74d97ed2b 100644
--- a/src/plugins/irc/irc-buffer.h
+++ b/src/plugins/irc/irc-buffer.h
@@ -22,6 +22,12 @@
#define IRC_BUFFER_ALL_SERVERS_NAME "servers"
+#define IRC_BUFFER_RAW_NAME "irc_raw"
+#define IRC_BUFFER_RAW_PREFIX_RECV "-->"
+#define IRC_BUFFER_RAW_PREFIX_RECV_MOD "==>"
+#define IRC_BUFFER_RAW_PREFIX_SEND "<--"
+#define IRC_BUFFER_RAW_PREFIX_SEND_MOD "<=="
+
struct t_gui_buffer;
struct t_irc_server;
struct t_irc_channel;
diff --git a/src/plugins/irc/irc-command.c b/src/plugins/irc/irc-command.c
index 520aff92c..e852ef4a0 100644
--- a/src/plugins/irc/irc-command.c
+++ b/src/plugins/irc/irc-command.c
@@ -41,6 +41,7 @@
#include "irc-nick.h"
#include "irc-display.h"
#include "irc-ignore.h"
+#include "irc-raw.h"
/*
@@ -3106,6 +3107,12 @@ irc_command_server (void *data, struct t_gui_buffer *buffer, int argc,
IRC_PLUGIN_NAME);
return WEECHAT_RC_OK;
}
+
+ if (weechat_strcasecmp (argv[1], "raw") == 0)
+ {
+ irc_raw_open (1);
+ return WEECHAT_RC_OK;
+ }
if (weechat_strcasecmp (argv[1], "switch") == 0)
{
@@ -4058,7 +4065,7 @@ irc_command_init ()
"[copy servername newservername] | "
"[rename servername newservername] | "
"[keep servername] | [del servername] | "
- "[deloutq] | [switch]"),
+ "[deloutq] | [raw] | [switch]"),
N_(" list: list servers (no parameter implies "
"this list)\n"
" listfull: list servers with detailed info for "
@@ -4082,6 +4089,7 @@ irc_command_init ()
" deloutq: delete messages out queue for all "
"servers (all messages WeeChat is currently "
"sending)\n"
+ " raw: open buffer with raw IRC data\n"
" switch: switch active server (when one "
"buffer is used for all servers, default key: "
"alt-s on server buffer)\n\n"
@@ -4096,8 +4104,8 @@ irc_command_init ()
" /server del freenode\n"
" /server deloutq\n"
" /server switch"),
- "add|copy|rename|keep|del|deloutq|list|listfull|switch "
- "%(irc_servers) %(irc_servers)",
+ "add|copy|rename|keep|del|deloutq|list|listfull|"
+ "raw|switch %(irc_servers) %(irc_servers)",
&irc_command_server, NULL);
weechat_hook_command ("servlist",
N_("list services currently connected to the "
diff --git a/src/plugins/irc/irc-config.c b/src/plugins/irc/irc-config.c
index af3d21c36..f7bb28ffa 100644
--- a/src/plugins/irc/irc-config.c
+++ b/src/plugins/irc/irc-config.c
@@ -55,6 +55,7 @@ struct t_config_option *irc_config_look_display_old_topic;
struct t_config_option *irc_config_look_hide_nickserv_pwd;
struct t_config_option *irc_config_look_highlight_tags;
struct t_config_option *irc_config_look_notice_as_pv;
+struct t_config_option *irc_config_look_raw_messages;
struct t_config_option *irc_config_look_show_away_once;
struct t_config_option *irc_config_look_smart_filter;
struct t_config_option *irc_config_look_smart_filter_delay;
@@ -1098,6 +1099,12 @@ irc_config_init ()
"messages,..)"),
NULL, 0, 0, "irc_privmsg,irc_notice", NULL, 0, NULL, NULL,
&irc_config_change_look_highlight_tags, NULL, NULL, NULL);
+ irc_config_look_raw_messages = weechat_config_new_option (
+ irc_config_file, ptr_section,
+ "raw_messages", "integer",
+ N_("number of IRC raw messages to save in memory when raw data buffer "
+ "is closed (messages will be displayed when opening raw data buffer)"),
+ NULL, 0, 65535, "256", NULL, 0, NULL, NULL, NULL, NULL, NULL, NULL);
irc_config_look_show_away_once = weechat_config_new_option (
irc_config_file, ptr_section,
"show_away_once", "boolean",
diff --git a/src/plugins/irc/irc-config.h b/src/plugins/irc/irc-config.h
index 6e735e0c5..0a09e6b8a 100644
--- a/src/plugins/irc/irc-config.h
+++ b/src/plugins/irc/irc-config.h
@@ -44,6 +44,7 @@ extern struct t_config_option *irc_config_look_display_old_topic;
extern struct t_config_option *irc_config_look_hide_nickserv_pwd;
extern struct t_config_option *irc_config_look_highlight_tags;
extern struct t_config_option *irc_config_look_notice_as_pv;
+extern struct t_config_option *irc_config_look_raw_messages;
extern struct t_config_option *irc_config_look_show_away_once;
extern struct t_config_option *irc_config_look_smart_filter;
extern struct t_config_option *irc_config_look_smart_filter_delay;
diff --git a/src/plugins/irc/irc-debug.c b/src/plugins/irc/irc-debug.c
index ed0954785..ff8dc7000 100644
--- a/src/plugins/irc/irc-debug.c
+++ b/src/plugins/irc/irc-debug.c
@@ -28,114 +28,6 @@
#include "irc-server.h"
-struct t_gui_buffer *irc_debug_buffer = NULL;
-
-
-/*
- * irc_debug_buffer_close_cb: callback called when IRC debug buffer is closed
- */
-
-int
-irc_debug_buffer_close_cb (void *data, struct t_gui_buffer *buffer)
-{
- /* make C compiler happy */
- (void) data;
- (void) buffer;
-
- irc_debug_buffer = NULL;
-
- return WEECHAT_RC_OK;
-}
-
-/*
- * irc_debug_printf: print a message on IRC debug buffer
- */
-
-void
-irc_debug_printf (struct t_irc_server *server, int send, int modified,
- const char *message)
-{
- char *buf, *buf2;
- const unsigned char *ptr_buf;
- const char *hexa = "0123456789ABCDEF";
- int pos_buf, pos_buf2, char_size, i;
-
- if (!weechat_irc_plugin->debug || !message)
- return;
-
- if (!irc_debug_buffer)
- {
- irc_debug_buffer = weechat_buffer_search ("irc", IRC_DEBUG_BUFFER_NAME);
- if (!irc_debug_buffer)
- {
- irc_debug_buffer = weechat_buffer_new (IRC_DEBUG_BUFFER_NAME,
- NULL, NULL,
- &irc_debug_buffer_close_cb, NULL);
-
- /* failed to create buffer ? then return */
- if (!irc_debug_buffer)
- return;
-
- weechat_buffer_set (irc_debug_buffer,
- "title", _("IRC debug messages"));
-
- weechat_buffer_set (irc_debug_buffer, "short_name", IRC_DEBUG_BUFFER_NAME);
- weechat_buffer_set (irc_debug_buffer, "localvar_set_type", "debug");
- weechat_buffer_set (irc_debug_buffer, "localvar_set_server", IRC_DEBUG_BUFFER_NAME);
- weechat_buffer_set (irc_debug_buffer, "localvar_set_channel", IRC_DEBUG_BUFFER_NAME);
- weechat_buffer_set (irc_debug_buffer, "localvar_set_no_log", "1");
-
- /* disabled all highlights on this debug buffer */
- weechat_buffer_set (irc_debug_buffer, "highlight_words", "-");
- }
- }
-
- buf = weechat_iconv_to_internal (NULL, message);
- buf2 = malloc ((strlen (buf) * 3) + 1);
- if (buf2)
- {
- ptr_buf = (buf) ? (unsigned char *)buf : (unsigned char *)message;
- pos_buf = 0;
- pos_buf2 = 0;
- while (ptr_buf[pos_buf])
- {
- if (ptr_buf[pos_buf] < 32)
- {
- buf2[pos_buf2++] = '\\';
- buf2[pos_buf2++] = hexa[ptr_buf[pos_buf] / 16];
- buf2[pos_buf2++] = hexa[ptr_buf[pos_buf] % 16];
- pos_buf++;
- }
- else
- {
- char_size = weechat_utf8_char_size ((const char *)(ptr_buf + pos_buf));
- for (i = 0; i < char_size; i++)
- {
- buf2[pos_buf2++] = ptr_buf[pos_buf++];
- }
- }
- }
- buf2[pos_buf2] = '\0';
- }
-
- weechat_printf (irc_debug_buffer,
- "%s%s%s%s%s\t%s",
- (server) ? weechat_color ("chat_server") : "",
- (server) ? server->name : "",
- (server) ? " " : "",
- (send) ?
- weechat_color ("chat_prefix_quit") :
- weechat_color ("chat_prefix_join"),
- (send) ?
- ((modified) ? IRC_DEBUG_PREFIX_SEND_MOD : IRC_DEBUG_PREFIX_SEND) :
- ((modified) ? IRC_DEBUG_PREFIX_RECV_MOD : IRC_DEBUG_PREFIX_RECV),
- (buf2) ? buf2 : ((buf) ? buf : message));
- if (buf)
- free (buf);
- if (buf2)
- free (buf2);
-}
-
/*
* irc_debug_signal_debug_dump_cb: dump IRC data in WeeChat log file
*/
diff --git a/src/plugins/irc/irc-debug.h b/src/plugins/irc/irc-debug.h
index 09e0123da..40fef4c5f 100644
--- a/src/plugins/irc/irc-debug.h
+++ b/src/plugins/irc/irc-debug.h
@@ -20,17 +20,6 @@
#ifndef __WEECHAT_IRC_DEBUG_H
#define __WEECHAT_IRC_DEBUG_H 1
-#define IRC_DEBUG_BUFFER_NAME "irc_debug"
-
-#define IRC_DEBUG_PREFIX_RECV "-->"
-#define IRC_DEBUG_PREFIX_RECV_MOD "==>"
-#define IRC_DEBUG_PREFIX_SEND "<--"
-#define IRC_DEBUG_PREFIX_SEND_MOD "<=="
-
-struct t_irc_server;
-
-extern void irc_debug_printf (struct t_irc_server *server, int send,
- int modified, const char *message);
extern void irc_debug_init ();
#endif /* irc-debug.h */
diff --git a/src/plugins/irc/irc-raw.c b/src/plugins/irc/irc-raw.c
new file mode 100644
index 000000000..562cc6088
--- /dev/null
+++ b/src/plugins/irc/irc-raw.c
@@ -0,0 +1,267 @@
+/*
+ * Copyright (c) 2003-2009 by FlashCode <flashcode@flashtux.org>
+ * See README for License detail, AUTHORS for developers list.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+
+/* irc-raw.c: functions for IRC raw data messages */
+
+
+#include <stdlib.h>
+#include <stdio.h>
+#include <string.h>
+
+#include "../weechat-plugin.h"
+#include "irc.h"
+#include "irc-raw.h"
+#include "irc-buffer.h"
+#include "irc-config.h"
+#include "irc-server.h"
+
+
+struct t_gui_buffer *irc_raw_buffer = NULL;
+
+int irc_raw_messages_count = 0;
+struct t_irc_raw_message *irc_raw_messages = NULL;
+struct t_irc_raw_message *last_irc_raw_message = NULL;
+
+
+/*
+ * irc_raw_message_print: print an irc raw message
+ */
+
+void
+irc_raw_message_print (struct t_irc_raw_message *raw_message)
+{
+ if (irc_raw_buffer && raw_message)
+ {
+ weechat_printf_date_tags (irc_raw_buffer,
+ raw_message->date, NULL,
+ "%s\t%s",
+ raw_message->prefix,
+ raw_message->message);
+ }
+}
+
+/*
+ * irc_raw_open: open IRC raw buffer
+ */
+
+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", IRC_RAW_BUFFER_NAME);
+ if (!irc_raw_buffer)
+ {
+ irc_raw_buffer = weechat_buffer_new (IRC_RAW_BUFFER_NAME,
+ NULL, 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"));
+
+ weechat_buffer_set (irc_raw_buffer, "short_name", IRC_RAW_BUFFER_NAME);
+ weechat_buffer_set (irc_raw_buffer, "localvar_set_type", "debug");
+ 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");
+
+ /* disabled all highlights on this debug buffer */
+ weechat_buffer_set (irc_raw_buffer, "highlight_words", "-");
+
+ if (switch_to_buffer)
+ weechat_buffer_set (irc_raw_buffer, "display", "1");
+
+ /* print messages in list */
+ for (ptr_raw_message = irc_raw_messages; ptr_raw_message;
+ ptr_raw_message = ptr_raw_message->next_message)
+ {
+ irc_raw_message_print (ptr_raw_message);
+ }
+ }
+ }
+}
+
+/*
+ * irc_raw_message_free: free a raw message and remove it from list
+ */
+
+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;
+ if (raw_message->prev_message)
+ {
+ (raw_message->prev_message)->next_message = raw_message->next_message;
+ new_raw_messages = irc_raw_messages;
+ }
+ 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--;
+}
+
+/*
+ * irc_raw_message_free_all: free all raw messages
+ */
+
+void
+irc_raw_message_free_all ()
+{
+ while (irc_raw_messages)
+ {
+ irc_raw_message_free (irc_raw_messages);
+ }
+}
+
+/*
+ * irc_raw_message_add: add new message to list
+ */
+
+void
+irc_raw_message_add (struct t_irc_server *server, int send, int modified,
+ const char *message)
+{
+ char *buf, *buf2, prefix[256];
+ const unsigned char *ptr_buf;
+ const char *hexa = "0123456789ABCDEF";
+ int pos_buf, pos_buf2, char_size, i, max_messages;
+ struct t_irc_raw_message *new_raw_message;
+
+ max_messages = weechat_config_integer (irc_config_look_raw_messages);
+
+ buf = weechat_iconv_to_internal (NULL, message);
+ buf2 = malloc ((strlen (buf) * 3) + 1);
+ if (buf2)
+ {
+ ptr_buf = (buf) ? (unsigned char *)buf : (unsigned char *)message;
+ pos_buf = 0;
+ pos_buf2 = 0;
+ while (ptr_buf[pos_buf])
+ {
+ if (ptr_buf[pos_buf] < 32)
+ {
+ buf2[pos_buf2++] = '\\';
+ buf2[pos_buf2++] = hexa[ptr_buf[pos_buf] / 16];
+ buf2[pos_buf2++] = hexa[ptr_buf[pos_buf] % 16];
+ pos_buf++;
+ }
+ else
+ {
+ char_size = weechat_utf8_char_size ((const char *)(ptr_buf + pos_buf));
+ for (i = 0; i < char_size; i++)
+ {
+ buf2[pos_buf2++] = ptr_buf[pos_buf++];
+ }
+ }
+ }
+ buf2[pos_buf2] = '\0';
+ }
+
+ new_raw_message = malloc (sizeof (*new_raw_message));
+ if (new_raw_message)
+ {
+ new_raw_message->date = time (NULL);
+ snprintf (prefix, sizeof (prefix), "%s%s%s%s%s",
+ (server) ? weechat_color ("chat_server") : "",
+ (server) ? server->name : "",
+ (server) ? " " : "",
+ (send) ?
+ weechat_color ("chat_prefix_quit") :
+ weechat_color ("chat_prefix_join"),
+ (send) ?
+ ((modified) ? IRC_RAW_PREFIX_SEND_MOD : IRC_RAW_PREFIX_SEND) :
+ ((modified) ? IRC_RAW_PREFIX_RECV_MOD : IRC_RAW_PREFIX_RECV));
+ new_raw_message->prefix = strdup (prefix);
+ new_raw_message->message = strdup ((buf2) ? buf2 : ((buf) ? buf : message));
+ new_raw_message->prev_message = NULL;
+ new_raw_message->next_message = NULL;
+
+ while (irc_raw_messages_count >= max_messages)
+ {
+ irc_raw_message_free (irc_raw_messages);
+ }
+
+ if (max_messages > 0)
+ {
+ new_raw_message->prev_message = last_irc_raw_message;
+ new_raw_message->next_message = NULL;
+ if (irc_raw_messages)
+ last_irc_raw_message->next_message = new_raw_message;
+ else
+ irc_raw_messages = new_raw_message;
+ last_irc_raw_message = new_raw_message;
+
+ irc_raw_messages_count++;
+
+ if (irc_raw_buffer)
+ irc_raw_message_print (new_raw_message);
+ }
+ else
+ {
+ /* don't store message, just print it if raw buffer is opened */
+ if (irc_raw_buffer)
+ irc_raw_message_print (new_raw_message);
+ irc_raw_message_free (new_raw_message);
+ }
+ }
+
+ if (buf)
+ free (buf);
+ if (buf2)
+ free (buf2);
+}
+
+/*
+ * irc_raw_print: print a message on IRC debug buffer
+ */
+
+void
+irc_raw_print (struct t_irc_server *server, int send, int modified,
+ const char *message)
+{
+ if (!message)
+ return;
+
+ if (!irc_raw_buffer && (weechat_irc_plugin->debug >= 1))
+ irc_raw_open (0);
+
+ irc_raw_message_add (server, send, modified, message);
+}
diff --git a/src/plugins/irc/irc-raw.h b/src/plugins/irc/irc-raw.h
new file mode 100644
index 000000000..d0b6038d1
--- /dev/null
+++ b/src/plugins/irc/irc-raw.h
@@ -0,0 +1,47 @@
+/*
+ * Copyright (c) 2003-2009 by FlashCode <flashcode@flashtux.org>
+ * See README for License detail, AUTHORS for developers list.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+
+
+#ifndef __WEECHAT_IRC_RAW_H
+#define __WEECHAT_IRC_RAW_H 1
+
+#define IRC_RAW_BUFFER_NAME "irc_raw"
+#define IRC_RAW_PREFIX_RECV "-->"
+#define IRC_RAW_PREFIX_RECV_MOD "==>"
+#define IRC_RAW_PREFIX_SEND "<--"
+#define IRC_RAW_PREFIX_SEND_MOD "<=="
+
+struct t_irc_raw_message
+{
+ time_t date; /* date/time of message */
+ char *prefix; /* prefix */
+ char *message; /* message */
+ struct t_irc_raw_message *prev_message; /* pointer to previous message */
+ struct t_irc_raw_message *next_message; /* pointer to next message */
+};
+
+struct t_irc_server;
+
+extern struct t_gui_buffer *irc_raw_buffer;
+
+extern void irc_raw_open (int switch_to_buffer);
+extern void irc_raw_max_messages (int number);
+extern void irc_raw_print (struct t_irc_server *server, int send,
+ int modified, const char *message);
+
+#endif /* irc-raw.h */
diff --git a/src/plugins/irc/irc-server.c b/src/plugins/irc/irc-server.c
index 429f048f2..b7746b1d0 100644
--- a/src/plugins/irc/irc-server.c
+++ b/src/plugins/irc/irc-server.c
@@ -44,10 +44,10 @@
#include "irc-channel.h"
#include "irc-command.h"
#include "irc-config.h"
-#include "irc-debug.h"
#include "irc-input.h"
#include "irc-nick.h"
#include "irc-protocol.h"
+#include "irc-raw.h"
struct t_irc_server *irc_servers = NULL;
@@ -959,8 +959,8 @@ irc_server_outqueue_send (struct t_irc_server *server)
pos = strchr (server->outqueue->message_before_mod, '\r');
if (pos)
pos[0] = '\0';
- irc_debug_printf (server, 1, 0,
- server->outqueue->message_before_mod);
+ irc_raw_print (server, 1, 0,
+ server->outqueue->message_before_mod);
if (pos)
pos[0] = '\r';
}
@@ -969,8 +969,8 @@ irc_server_outqueue_send (struct t_irc_server *server)
pos = strchr (server->outqueue->message_after_mod, '\r');
if (pos)
pos[0] = '\0';
- irc_debug_printf (server, 1, server->outqueue->modified,
- server->outqueue->message_after_mod);
+ irc_raw_print (server, 1, server->outqueue->modified,
+ server->outqueue->message_after_mod);
if (pos)
pos[0] = '\r';
@@ -1204,9 +1204,9 @@ irc_server_send_one_msg (struct t_irc_server *server, const char *message)
else
{
if (first_message)
- irc_debug_printf (server, 1, 0, message);
+ irc_raw_print (server, 1, 0, message);
if (new_msg)
- irc_debug_printf (server, 1, 1, ptr_msg);
+ irc_raw_print (server, 1, 1, ptr_msg);
/* send signal with command that will be sent to server */
irc_server_send_signal (server, "irc_out",
@@ -1235,7 +1235,7 @@ irc_server_send_one_msg (struct t_irc_server *server, const char *message)
free (msg_encoded);
}
else
- irc_debug_printf (server, 1, 1, _("(message dropped)"));
+ irc_raw_print (server, 1, 1, _("(message dropped)"));
if (nick)
free (nick);
@@ -1437,7 +1437,7 @@ irc_server_msgq_flush ()
if (ptr_data[0])
{
- irc_debug_printf (irc_recv_msgq->server, 0, 0, ptr_data);
+ irc_raw_print (irc_recv_msgq->server, 0, 0, ptr_data);
irc_server_parse_message (ptr_data, NULL, NULL, &command,
NULL, NULL);
@@ -1470,8 +1470,8 @@ irc_server_msgq_flush ()
pos[0] = '\0';
if (new_msg)
- irc_debug_printf (irc_recv_msgq->server, 0, 1,
- ptr_msg);
+ irc_raw_print (irc_recv_msgq->server, 0, 1,
+ ptr_msg);
irc_server_parse_message (ptr_msg, &nick, &host,
&command, &channel,
@@ -1530,8 +1530,8 @@ irc_server_msgq_flush ()
}
else
{
- irc_debug_printf (irc_recv_msgq->server, 0, 1,
- _("(message dropped)"));
+ irc_raw_print (irc_recv_msgq->server, 0, 1,
+ _("(message dropped)"));
}
if (new_msg)
free (new_msg);