summaryrefslogtreecommitdiff
path: root/src/plugins/irc
diff options
context:
space:
mode:
Diffstat (limited to 'src/plugins/irc')
-rw-r--r--src/plugins/irc/CMakeLists.txt11
-rw-r--r--src/plugins/irc/Makefile.am36
-rw-r--r--src/plugins/irc/irc-buffer.h7
-rw-r--r--src/plugins/irc/irc-channel.c250
-rw-r--r--src/plugins/irc/irc-channel.h22
-rw-r--r--src/plugins/irc/irc-color.h4
-rw-r--r--src/plugins/irc/irc-command.c1071
-rw-r--r--src/plugins/irc/irc-command.h66
-rw-r--r--src/plugins/irc/irc-config.c1219
-rw-r--r--src/plugins/irc/irc-config.h100
-rw-r--r--src/plugins/irc/irc-dcc.c174
-rw-r--r--src/plugins/irc/irc-dcc.h21
-rw-r--r--src/plugins/irc/irc-display.h31
-rw-r--r--src/plugins/irc/irc-mode.h28
-rw-r--r--src/plugins/irc/irc-nick.c83
-rw-r--r--src/plugins/irc/irc-nick.h17
-rw-r--r--src/plugins/irc/irc-protocol.c220
-rw-r--r--src/plugins/irc/irc-protocol.h69
-rw-r--r--src/plugins/irc/irc-server.c933
-rw-r--r--src/plugins/irc/irc-server.h47
-rw-r--r--src/plugins/irc/irc.c98
-rw-r--r--src/plugins/irc/irc.h295
22 files changed, 2602 insertions, 2200 deletions
diff --git a/src/plugins/irc/CMakeLists.txt b/src/plugins/irc/CMakeLists.txt
index 8292edcc6..5a676dec7 100644
--- a/src/plugins/irc/CMakeLists.txt
+++ b/src/plugins/irc/CMakeLists.txt
@@ -14,10 +14,13 @@
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
-SET(LIB_PROTOCOL_IRC_SRC irc.c irc.h irc-buffer.c irc-buffer.h irc-channel.c
-irc-channel.h irc-command.c irc-command.h irc-color.c irc-color.h irc-config.c
-irc-config.h irc-dcc.c irc-dcc.h irc-display.c irc-input.c irc-log.c irc-mode.c
-irc-nick.c irc-nick.h irc-protocol.c irc-protocol.h irc-server.c irc-server.h)
+SET(LIB_PROTOCOL_IRC_SRC irc.c irc.h irc-channel.c irc-channel.h irc-config.c
+irc-config.h irc-server.c irc-server.h)
+
+#SET(LIB_PROTOCOL_IRC_SRC irc.c irc.h irc-buffer.c irc-buffer.h irc-channel.c
+#irc-channel.h irc-command.c irc-command.h irc-color.c irc-color.h irc-config.c
+#irc-config.h irc-dcc.c irc-dcc.h irc-display.c irc-input.c irc-log.c irc-mode.c
+#irc-nick.c irc-nick.h irc-protocol.c irc-protocol.h irc-server.c irc-server.h)
CHECK_INCLUDE_FILES("regex.h" HAVE_REGEX_H)
CHECK_FUNCTION_EXISTS(regexec HAVE_REGEXEC)
diff --git a/src/plugins/irc/Makefile.am b/src/plugins/irc/Makefile.am
index 0f6864e2f..0e5a1a4e4 100644
--- a/src/plugins/irc/Makefile.am
+++ b/src/plugins/irc/Makefile.am
@@ -22,27 +22,31 @@ lib_LTLIBRARIES = irc.la
irc_la_SOURCES = irc.c \
irc.h \
- irc-buffer.c \
- irc-buffer.h \
irc-channel.c \
irc-channel.h \
- irc-command.c \
- irc-command.h \
- irc-color.c \
- irc-color.h \
irc-config.c \
irc-config.h \
- irc-dcc.c \
- irc-dcc.h \
- irc-display.c \
- irc-input.c \
- irc-log.c \
- irc-mode.c \
- irc-nick.c \
- irc-nick.h \
- irc-protocol.c \
- irc-protocol.h \
irc-server.c \
irc-server.h
+
+# irc.c \
+# irc.h \
+# irc-buffer.c \
+# irc-buffer.h \
+# irc-command.c \
+# irc-command.h \
+# irc-color.c \
+# irc-color.h \
+# irc-dcc.c \
+# irc-dcc.h \
+# irc-display.c \
+# irc-input.c \
+# irc-log.c \
+# irc-mode.c \
+# irc-nick.c \
+# irc-nick.h \
+# irc-protocol.c \
+# irc-protocol.h
+
irc_la_LDFLAGS = -module
irc_la_LIBADD = $(GNUTLS_LFLAGS)
diff --git a/src/plugins/irc/irc-buffer.h b/src/plugins/irc/irc-buffer.h
index 6b527005c..88bd8eafa 100644
--- a/src/plugins/irc/irc-buffer.h
+++ b/src/plugins/irc/irc-buffer.h
@@ -35,8 +35,6 @@
t_irc_server *ptr_server = IRC_BUFFER_SERVER(buffer); \
t_irc_channel *ptr_channel = IRC_BUFFER_CHANNEL(buffer)
-/* protocol data for GUI buffers */
-
struct t_irc_buffer_data
{
struct t_irc_server *server;
@@ -44,4 +42,9 @@ struct t_irc_buffer_data
int all_servers;
};
+extern struct t_irc_buffer_data *irc_buffer_data_create (struct t_irc_server *);
+extern void irc_buffer_data_free (struct t_gui_buffer *);
+extern void irc_buffer_merge_servers (struct t_gui_window *);
+extern void irc_buffer_split_server (struct t_gui_window *);
+
#endif /* irc-buffer.h */
diff --git a/src/plugins/irc/irc-channel.c b/src/plugins/irc/irc-channel.c
index 262ccd6f3..c57fac6d4 100644
--- a/src/plugins/irc/irc-channel.c
+++ b/src/plugins/irc/irc-channel.c
@@ -27,13 +27,12 @@
#include <unistd.h>
#include <string.h>
-#include "../../core/weechat.h"
#include "irc.h"
-#include "../../core/log.h"
-#include "../../core/utf8.h"
-#include "../../core/util.h"
-#include "../../core/weechat-config.h"
-#include "../../gui/gui.h"
+#include "irc-channel.h"
+#include "irc-config.h"
+#include "irc-dcc.h"
+#include "irc-nick.h"
+#include "irc-server.h"
/*
@@ -41,55 +40,31 @@
* list
*/
-t_irc_channel *
-irc_channel_new (t_irc_server *server, int channel_type, char *channel_name,
- int switch_to_channel)
+struct t_irc_channel *
+irc_channel_new (struct t_irc_server *server, int channel_type,
+ char *channel_name, int switch_to_channel)
{
- t_irc_channel *new_channel;
- t_gui_buffer *new_buffer;
- int attribs, log_buffer;
- char *log_filename;
+ struct t_irc_channel *new_channel;
+ struct t_gui_buffer *new_buffer;
/* alloc memory for new channel */
- if ((new_channel = (t_irc_channel *) malloc (sizeof (t_irc_channel))) == NULL)
+ if ((new_channel = (struct t_irc_channel *) malloc (sizeof (struct t_irc_channel))) == NULL)
{
- fprintf (stderr, _("%s cannot allocate new channel"), WEECHAT_ERROR);
+ weechat_printf (NULL,
+ _("%sIrc: cannot allocate new channel"),
+ weechat_prefix ("error"));
return NULL;
}
-
- log_buffer = 0;
- attribs = GUI_BUFFER_ATTRIB_TEXT | GUI_BUFFER_ATTRIB_INPUT |
- GUI_BUFFER_ATTRIB_NICKS;
- switch (channel_type)
- {
- case IRC_CHANNEL_TYPE_CHANNEL:
- if (irc_cfg_log_auto_channel)
- log_buffer = 1;
- attribs |= GUI_BUFFER_ATTRIB_NICKLIST;
- break;
- case IRC_CHANNEL_TYPE_PRIVATE:
- case IRC_CHANNEL_TYPE_DCC_CHAT:
- if (irc_cfg_log_auto_private)
- log_buffer = 1;
- break;
- }
- log_filename = irc_log_get_filename (server->name, channel_name,
- (channel_type == IRC_CHANNEL_TYPE_DCC_CHAT));
- new_buffer = gui_buffer_new (gui_current_window, 0,
- server->name, channel_name,
- attribs,
- irc_protocol,
- irc_buffer_data_create (server),
- &irc_buffer_data_free,
- GUI_NOTIFY_LEVEL_DEFAULT,
- channel_name, server->nick,
- log_buffer, log_filename,
- switch_to_channel);
- if (log_filename)
- free (log_filename);
+ /* create buffer for channel */
+ new_buffer = weechat_buffer_new (server->name, channel_name, NULL);
if (!new_buffer)
+ {
+ free (new_channel);
return NULL;
+ }
+ if (channel_type == IRC_CHANNEL_TYPE_CHANNEL)
+ weechat_buffer_set (new_buffer, "nicklist", "1");
/* initialize new channel */
new_channel->type = channel_type;
@@ -110,20 +85,20 @@ irc_channel_new (t_irc_server *server, int channel_type, char *channel_name,
new_channel->last_nick = NULL;
new_channel->buffer = new_buffer;
new_channel->nicks_speaking = NULL;
- new_channel->last_nick_speaking = NULL;
-
- IRC_BUFFER_CHANNEL(new_buffer) = new_channel;
- new_buffer->notify_level = irc_channel_get_notify_level (server, new_channel);
+ //new_buffer->notify_level = irc_channel_get_notify_level (server, new_channel);
/* add new channel to channels list */
- new_channel->prev_channel = server->last_channel;
+ new_channel->prev_channel = ((struct t_irc_server *)server)->last_channel;
new_channel->next_channel = NULL;
if (server->channels)
- server->last_channel->next_channel = new_channel;
+ (server->last_channel)->next_channel = new_channel;
else
server->channels = new_channel;
server->last_channel = new_channel;
+ if (switch_to_channel)
+ weechat_buffer_set (new_buffer, "display", "1");
+
/* all is ok, return address of new channel */
return new_channel;
}
@@ -133,9 +108,9 @@ irc_channel_new (t_irc_server *server, int channel_type, char *channel_name,
*/
void
-irc_channel_free (t_irc_server *server, t_irc_channel *channel)
+irc_channel_free (struct t_irc_server *server, struct t_irc_channel *channel)
{
- t_irc_channel *new_channels;
+ struct t_irc_channel *new_channels;
if (!server || !channel)
return;
@@ -143,12 +118,13 @@ irc_channel_free (t_irc_server *server, t_irc_channel *channel)
/* close DCC CHAT */
if (channel->dcc_chat)
{
- ((t_irc_dcc *)(channel->dcc_chat))->channel = NULL;
- if (!IRC_DCC_ENDED(((t_irc_dcc *)(channel->dcc_chat))->status))
+ channel->dcc_chat->channel = NULL;
+ /*if (!IRC_DCC_ENDED(channel->dcc_chat->status))
{
- irc_dcc_close ((t_irc_dcc *)(channel->dcc_chat), IRC_DCC_ABORTED);
+ irc_dcc_close (channel->dcc_chat, IRC_DCC_ABORTED);
irc_dcc_redraw (1);
}
+ */
}
/* remove channel from channels list */
@@ -174,12 +150,11 @@ irc_channel_free (t_irc_server *server, t_irc_channel *channel)
free (channel->modes);
if (channel->key)
free (channel->key);
- irc_nick_free_all (channel);
+ //irc_nick_free_all (channel);
if (channel->away_message)
free (channel->away_message);
if (channel->nicks_speaking)
- weelist_remove_all (&(channel->nicks_speaking),
- &(channel->last_nick_speaking));
+ weechat_list_free (channel->nicks_speaking);
free (channel);
server->channels = new_channels;
}
@@ -189,7 +164,7 @@ irc_channel_free (t_irc_server *server, t_irc_channel *channel)
*/
void
-irc_channel_free_all (t_irc_server *server)
+irc_channel_free_all (struct t_irc_server *server)
{
/* remove all channels for the server */
while (server->channels)
@@ -201,10 +176,10 @@ irc_channel_free_all (t_irc_server *server)
* WARNING: DCC chat channels are not returned by this function
*/
-t_irc_channel *
-irc_channel_search (t_irc_server *server, char *channel_name)
+struct t_irc_channel *
+irc_channel_search (struct t_irc_server *server, char *channel_name)
{
- t_irc_channel *ptr_channel;
+ struct t_irc_channel *ptr_channel;
if (!server || !channel_name)
return NULL;
@@ -223,10 +198,10 @@ irc_channel_search (t_irc_server *server, char *channel_name)
* irc_channel_search_any: returns pointer on a channel with name
*/
-t_irc_channel *
-irc_channel_search_any (t_irc_server *server, char *channel_name)
+struct t_irc_channel *
+irc_channel_search_any (struct t_irc_server *server, char *channel_name)
{
- t_irc_channel *ptr_channel;
+ struct t_irc_channel *ptr_channel;
if (!server || !channel_name)
return NULL;
@@ -245,10 +220,11 @@ irc_channel_search_any (t_irc_server *server, char *channel_name)
* looks only for channels without buffer
*/
-t_irc_channel *
-irc_channel_search_any_without_buffer (t_irc_server *server, char *channel_name)
+struct t_irc_channel *
+irc_channel_search_any_without_buffer (struct t_irc_server *server,
+ char *channel_name)
{
- t_irc_channel *ptr_channel;
+ struct t_irc_channel *ptr_channel;
if (!server || !channel_name)
return NULL;
@@ -267,10 +243,10 @@ irc_channel_search_any_without_buffer (t_irc_server *server, char *channel_name)
* irc_channel_search_dcc: returns pointer on a DCC chat channel with name
*/
-t_irc_channel *
-irc_channel_search_dcc (t_irc_server *server, char *channel_name)
+struct t_irc_channel *
+irc_channel_search_dcc (struct t_irc_server *server, char *channel_name)
{
- t_irc_channel *ptr_channel;
+ struct t_irc_channel *ptr_channel;
if (!server || !channel_name)
return NULL;
@@ -307,9 +283,9 @@ irc_channel_is_channel (char *string)
*/
void
-irc_channel_remove_away (t_irc_channel *channel)
+irc_channel_remove_away (struct t_irc_channel *channel)
{
- t_irc_nick *ptr_nick;
+ struct t_irc_nick *ptr_nick;
if (channel->type == IRC_CHANNEL_TYPE_CHANNEL)
{
@@ -317,7 +293,7 @@ irc_channel_remove_away (t_irc_channel *channel)
{
IRC_NICK_SET_FLAG(ptr_nick, 0, IRC_NICK_AWAY);
}
- gui_nicklist_draw (channel->buffer, 0, 0);
+ //gui_nicklist_draw (channel->buffer, 0, 0);
}
}
@@ -326,12 +302,14 @@ irc_channel_remove_away (t_irc_channel *channel)
*/
void
-irc_channel_check_away (t_irc_server *server, t_irc_channel *channel, int force)
+irc_channel_check_away (struct t_irc_server *server,
+ struct t_irc_channel *channel, int force)
{
if (channel->type == IRC_CHANNEL_TYPE_CHANNEL)
{
- if (force || (irc_cfg_irc_away_check_max_nicks == 0) ||
- (channel->nicks_count <= irc_cfg_irc_away_check_max_nicks))
+ if (force
+ || (weechat_config_integer (irc_config_irc_away_check_max_nicks) == 0)
+ || (channel->nicks_count <= weechat_config_integer (irc_config_irc_away_check_max_nicks)))
{
channel->checking_away++;
irc_server_sendf (server, "WHO %s", channel->name);
@@ -346,9 +324,13 @@ irc_channel_check_away (t_irc_server *server, t_irc_channel *channel, int force)
*/
void
-irc_channel_set_away (t_irc_channel *channel, char *nick, int is_away)
+irc_channel_set_away (struct t_irc_channel *channel, char *nick, int is_away)
{
- t_irc_nick *ptr_nick;
+ (void) channel;
+ (void) nick;
+ (void) is_away;
+
+ /*struct t_irc_nick *ptr_nick;
if (channel->type == IRC_CHANNEL_TYPE_CHANNEL)
{
@@ -356,6 +338,7 @@ irc_channel_set_away (t_irc_channel *channel, char *nick, int is_away)
if (ptr_nick)
irc_nick_set_away (channel, ptr_nick, is_away);
}
+ */
}
/*
@@ -363,27 +346,28 @@ irc_channel_set_away (t_irc_channel *channel, char *nick, int is_away)
*/
int
-irc_channel_create_dcc (t_irc_dcc *ptr_dcc)
+irc_channel_create_dcc (void *dcc)
{
- t_irc_channel *ptr_channel;
+ struct t_irc_channel *ptr_channel;
- ptr_channel = irc_channel_search_dcc (ptr_dcc->server, ptr_dcc->nick);
+ ptr_channel = irc_channel_search_dcc (((struct t_irc_dcc *)dcc)->server,
+ ((struct t_irc_dcc *)dcc)->nick);
if (!ptr_channel)
{
- ptr_channel = irc_channel_new (ptr_dcc->server,
+ ptr_channel = irc_channel_new (((struct t_irc_dcc *)dcc)->server,
IRC_CHANNEL_TYPE_DCC_CHAT,
- ptr_dcc->nick, 0);
+ ((struct t_irc_dcc *)dcc)->nick, 0);
if (!ptr_channel)
return 0;
}
if (ptr_channel->dcc_chat &&
- (!IRC_DCC_ENDED(((t_irc_dcc *)(ptr_channel->dcc_chat))->status)))
+ (!IRC_DCC_ENDED(ptr_channel->dcc_chat->status)))
return 0;
- ptr_channel->dcc_chat = ptr_dcc;
- ptr_dcc->channel = ptr_channel;
- gui_window_redraw_buffer (ptr_channel->buffer);
+ ptr_channel->dcc_chat = dcc;
+ ((struct t_irc_dcc *)dcc)->channel = ptr_channel;
+ //gui_window_redraw_buffer (ptr_channel->buffer);
return 1;
}
@@ -392,9 +376,12 @@ irc_channel_create_dcc (t_irc_dcc *ptr_dcc)
*/
int
-irc_channel_get_notify_level (t_irc_server *server, t_irc_channel *channel)
+irc_channel_get_notify_level (struct t_irc_server *server,
+ struct t_irc_channel *channel)
{
- char *name, *pos, *pos2;
+ (void) server;
+ (void) channel;
+ /*char *name, *pos, *pos2;
int server_default_notify, notify;
if ((!server) || (!channel))
@@ -428,6 +415,8 @@ irc_channel_get_notify_level (t_irc_server *server, t_irc_channel *channel)
return notify;
return server_default_notify;
+ */
+ return 0;
}
/*
@@ -435,10 +424,14 @@ irc_channel_get_notify_level (t_irc_server *server, t_irc_channel *channel)
*/
void
-irc_channel_set_notify_level (t_irc_server *server, t_irc_channel *channel,
- int notify)
+irc_channel_set_notify_level (struct t_irc_server *server,
+ struct t_irc_channel *channel, int notify)
{
- char level_string[2];
+ (void) server;
+ (void) channel;
+ (void) notify;
+
+ /*char level_string[2];
if ((!server) || (!channel))
return;
@@ -446,6 +439,7 @@ irc_channel_set_notify_level (t_irc_server *server, t_irc_channel *channel,
level_string[0] = notify + '0';
level_string[1] = '\0';
config_option_list_set (&(server->notify_levels), channel->name, level_string);
+ */
}
/*
@@ -453,22 +447,20 @@ irc_channel_set_notify_level (t_irc_server *server, t_irc_channel *channel,
*/
void
-irc_channel_add_nick_speaking (t_irc_channel *channel, char *nick)
+irc_channel_add_nick_speaking (struct t_irc_channel *channel, char *nick)
{
int size, to_remove, i;
- weelist_add (&(channel->nicks_speaking), &(channel->last_nick_speaking),
- nick, WEELIST_POS_END);
+ weechat_list_add (channel->nicks_speaking, nick, "end");
- size = weelist_get_size (channel->nicks_speaking);
+ size = weechat_list_size (channel->nicks_speaking);
if (size > IRC_CHANNEL_NICKS_SPEAKING_LIMIT)
{
to_remove = size - IRC_CHANNEL_NICKS_SPEAKING_LIMIT;
for (i = 0; i < to_remove; i++)
{
- weelist_remove (&(channel->nicks_speaking),
- &(channel->last_nick_speaking),
- channel->nicks_speaking);
+ weechat_list_remove (channel->nicks_speaking,
+ weechat_list_get (channel->nicks_speaking, 0));
}
}
}
@@ -478,31 +470,39 @@ irc_channel_add_nick_speaking (t_irc_channel *channel, char *nick)
*/
void
-irc_channel_print_log (t_irc_channel *channel)
+irc_channel_print_log (struct t_irc_channel *channel)
{
- weechat_log_printf ("=> channel %s (addr:0x%X)]\n", channel->name, channel);
- weechat_log_printf (" type . . . . . . . . : %d\n", channel->type);
- weechat_log_printf (" dcc_chat . . . . . . : 0x%X\n", channel->dcc_chat);
- weechat_log_printf (" topic. . . . . . . . : '%s'\n", channel->topic);
- weechat_log_printf (" modes. . . . . . . . : '%s'\n", channel->modes);
- weechat_log_printf (" limit. . . . . . . . : %d\n", channel->limit);
- weechat_log_printf (" key. . . . . . . . . : '%s'\n", channel->key);
- weechat_log_printf (" checking_away. . . . : %d\n", channel->checking_away);
- weechat_log_printf (" away_message . . . . : '%s'\n", channel->away_message);
- weechat_log_printf (" cycle. . . . . . . . : %d\n", channel->cycle);
- weechat_log_printf (" close. . . . . . . . : %d\n", channel->close);
- weechat_log_printf (" display_creation_date: %d\n", channel->display_creation_date);
- weechat_log_printf (" nicks. . . . . . . . : 0x%X\n", channel->nicks);
- weechat_log_printf (" last_nick. . . . . . : 0x%X\n", channel->last_nick);
- weechat_log_printf (" buffer . . . . . . . : 0x%X\n", channel->buffer);
- weechat_log_printf (" nicks_speaking . . . : 0x%X\n", channel->nicks_speaking);
- weechat_log_printf (" last_nick_speaking . : 0x%X\n", channel->last_nick_speaking);
- weechat_log_printf (" prev_channel . . . . : 0x%X\n", channel->prev_channel);
- weechat_log_printf (" next_channel . . . . : 0x%X\n", channel->next_channel);
+ struct t_weelist_item *ptr_item;
+ int i;
+
+ weechat_log_printf ("=> channel %s (addr:0x%X)]", channel->name, channel);
+ weechat_log_printf (" type . . . . . . . . : %d", channel->type);
+ weechat_log_printf (" dcc_chat . . . . . . : 0x%X", channel->dcc_chat);
+ weechat_log_printf (" topic. . . . . . . . : '%s'", channel->topic);
+ weechat_log_printf (" modes. . . . . . . . : '%s'", channel->modes);
+ weechat_log_printf (" limit. . . . . . . . : %d", channel->limit);
+ weechat_log_printf (" key. . . . . . . . . : '%s'", channel->key);
+ weechat_log_printf (" checking_away. . . . : %d", channel->checking_away);
+ weechat_log_printf (" away_message . . . . : '%s'", channel->away_message);
+ weechat_log_printf (" cycle. . . . . . . . : %d", channel->cycle);
+ weechat_log_printf (" close. . . . . . . . : %d", channel->close);
+ weechat_log_printf (" display_creation_date: %d", channel->display_creation_date);
+ weechat_log_printf (" nicks. . . . . . . . : 0x%X", channel->nicks);
+ weechat_log_printf (" last_nick. . . . . . : 0x%X", channel->last_nick);
+ weechat_log_printf (" buffer . . . . . . . : 0x%X", channel->buffer);
+ weechat_log_printf (" nicks_speaking . . . : 0x%X", channel->nicks_speaking);
+ weechat_log_printf (" prev_channel . . . . : 0x%X", channel->prev_channel);
+ weechat_log_printf (" next_channel . . . . : 0x%X", channel->next_channel);
if (channel->nicks_speaking)
{
- weechat_log_printf ("\n");
- weelist_print_log (channel->nicks_speaking,
- "channel nick speaking element");
+ weechat_log_printf ("");
+ i = 0;
+ for (ptr_item = weechat_list_get (channel->nicks_speaking, 0);
+ ptr_item; ptr_item = weechat_list_next (ptr_item))
+ {
+ weechat_log_printf (" nick speaking %d: '%s'",
+ i, weechat_list_string (ptr_item));
+ i++;
+ }
}
}
diff --git a/src/plugins/irc/irc-channel.h b/src/plugins/irc/irc-channel.h
index 673a60379..eecce10c6 100644
--- a/src/plugins/irc/irc-channel.h
+++ b/src/plugins/irc/irc-channel.h
@@ -20,6 +20,8 @@
#ifndef __WEECHAT_IRC_CHANNEL_H
#define __WEECHAT_IRC_CHANNEL_H 1
+#include "irc-server.h"
+
#define IRC_CHANNEL_PREFIX "#&+!"
/* channel types */
@@ -33,7 +35,7 @@
struct t_irc_channel
{
int type; /* channel type */
- void *dcc_chat; /* DCC CHAT pointer (NULL if not DCC) */
+ struct t_irc_dcc *dcc_chat; /* DCC CHAT pointer (NULL if not DCC) */
char *name; /* name of channel (exemple: "#abc") */
char *topic; /* topic of channel (host for private) */
char *modes; /* channel modes */
@@ -50,10 +52,26 @@ struct t_irc_channel
struct t_irc_nick *nicks; /* nicks on the channel */
struct t_irc_nick *last_nick; /* last nick on the channel */
struct t_weelist *nicks_speaking; /* for smart completion */
- struct t_weelist *last_nick_speaking; /* last nick speaking */
struct t_gui_buffer *buffer; /* buffer allocated for channel */
struct t_irc_channel *prev_channel; /* link to previous channel */
struct t_irc_channel *next_channel; /* link to next channel */
};
+extern struct t_irc_channel *irc_channel_new (struct t_irc_server *, int, char *, int);
+extern void irc_channel_free (struct t_irc_server *, struct t_irc_channel *);
+extern void irc_channel_free_all (struct t_irc_server *);
+extern struct t_irc_channel *irc_channel_search (struct t_irc_server *, char *);
+extern struct t_irc_channel *irc_channel_search_any (struct t_irc_server *, char *);
+extern struct t_irc_channel *irc_channel_search_any_without_buffer (struct t_irc_server *, char *);
+extern struct t_irc_channel *irc_channel_search_dcc (struct t_irc_server *, char *);
+extern int irc_channel_is_channel (char *);
+extern void irc_channel_remove_away (struct t_irc_channel *);
+extern void irc_channel_check_away (struct t_irc_server *, struct t_irc_channel *, int);
+extern void irc_channel_set_away (struct t_irc_channel *, char *, int);
+extern int irc_channel_create_dcc (void *);
+extern int irc_channel_get_notify_level (struct t_irc_server *, struct t_irc_channel *);
+extern void irc_channel_set_notify_level (struct t_irc_server *, struct t_irc_channel *, int);
+extern void irc_channel_add_nick_speaking (struct t_irc_channel *, char *);
+extern void irc_channel_print_log (struct t_irc_channel *);
+
#endif /* irc-channel.h */
diff --git a/src/plugins/irc/irc-color.h b/src/plugins/irc/irc-color.h
index 7b153595c..bee7f1426 100644
--- a/src/plugins/irc/irc-color.h
+++ b/src/plugins/irc/irc-color.h
@@ -51,4 +51,8 @@
#define IRC_COLOR_UNDERLINE_CHAR '\x1F'
#define IRC_COLOR_UNDERLINE_STR "\x1F"
+extern unsigned char *irc_color_decode (unsigned char *, int, int);
+extern unsigned char *irc_color_decode_for_user_entry (unsigned char *);
+extern unsigned char *irc_color_encode (unsigned char *, int);
+
#endif /* irc-color.h */
diff --git a/src/plugins/irc/irc-command.c b/src/plugins/irc/irc-command.c
index 528bdda31..5d91a0d00 100644
--- a/src/plugins/irc/irc-command.c
+++ b/src/plugins/irc/irc-command.c
@@ -39,26 +39,26 @@ t_weechat_command irc_commands[] =
{ { "admin", N_("find information about the administrator of the server"),
N_("[target]"),
N_("target: server"),
- NULL, 0, 1, 0, irc_cmd_admin },
+ NULL, 0, 1, 0, irc_command_admin },
{ "ame", N_("send a CTCP action to all channels of all connected servers"),
N_("message"),
N_("message: message to send"),
- "", 1, MAX_ARGS, 1, irc_cmd_ame },
+ "", 1, MAX_ARGS, 1, irc_command_ame },
{ "amsg", N_("send message to all channels of all connected servers"),
N_("text"),
N_("text: text to send"),
- "", 1, MAX_ARGS, 1, irc_cmd_amsg },
+ "", 1, MAX_ARGS, 1, irc_command_amsg },
{ "away", N_("toggle away status"),
N_("[-all] [message]"),
N_(" -all: toggle away status on all connected servers\n"
"message: message for away (if no message is given, away status is "
"removed)"),
- "-all", 0, MAX_ARGS, 1, irc_cmd_away },
+ "-all", 0, MAX_ARGS, 1, irc_command_away },
{ "ban", N_("bans nicks or hosts"),
N_("[channel] [nickname [nickname ...]]"),
N_(" channel: channel for ban\n"
"nickname: user or host to ban"),
- "%N", 0, MAX_ARGS, 0, irc_cmd_ban },
+ "%N", 0, MAX_ARGS, 0, irc_command_ban },
{ "connect", N_("connect to server(s)"),
N_("[-all [-nojoin] | servername [servername ...] [-nojoin] | hostname "
"[-port port] [-ipv6] [-ssl]]"),
@@ -70,98 +70,98 @@ t_weechat_command irc_commands[] =
" port: port for server (integer, default is 6667)\n"
" ipv6: use IPv6 protocol\n"
" ssl: use SSL protocol"),
- "%S|-all|-nojoin|%*", 0, MAX_ARGS, 0, irc_cmd_connect },
+ "%S|-all|-nojoin|%*", 0, MAX_ARGS, 0, irc_command_connect },
{ "ctcp", N_("send a CTCP message (Client-To-Client Protocol)"),
N_("receiver type [arguments]"),
N_(" receiver: nick or channel to send CTCP to\n"
" type: CTCP type (examples: \"version\", \"ping\", ..)\n"
"arguments: arguments for CTCP"),
- "%c|%n action|ping|version", 2, MAX_ARGS, 1, irc_cmd_ctcp },
+ "%c|%n action|ping|version", 2, MAX_ARGS, 1, irc_command_ctcp },
{ "cycle", N_("leave and rejoin a channel"),
N_("[channel[,channel]] [part_message]"),
N_(" channel: channel name for cycle\n"
"part_message: part message (displayed to other users)"),
- "%p", 0, MAX_ARGS, 0, irc_cmd_cycle },
+ "%p", 0, MAX_ARGS, 0, irc_command_cycle },
{ "dcc", N_("starts DCC (file or chat) or close chat"),
N_("action [nickname [file]]"),
N_(" action: 'send' (file) or 'chat' or 'close' (chat)\n"
"nickname: nickname to send file or chat\n"
" file: filename (on local host)"),
- "chat|send|close %n %f", 1, MAX_ARGS, 0, irc_cmd_dcc },
+ "chat|send|close %n %f", 1, MAX_ARGS, 0, irc_command_dcc },
{ "dehalfop", N_("removes half channel operator status from nickname(s)"),
N_("[nickname [nickname]]"), "",
- "", 0, MAX_ARGS, 0, irc_cmd_dehalfop },
+ "", 0, MAX_ARGS, 0, irc_command_dehalfop },
{ "deop", N_("removes channel operator status from nickname(s)"),
N_("[nickname [nickname]]"), "",
- "", 0, MAX_ARGS, 0, irc_cmd_deop },
+ "", 0, MAX_ARGS, 0, irc_command_deop },
{ "devoice", N_("removes voice from nickname(s)"),
N_("[nickname [nickname]]"), "",
- "", 0, MAX_ARGS, 0, irc_cmd_devoice },
+ "", 0, MAX_ARGS, 0, irc_command_devoice },
{ "die", N_("shutdown the server"), "", "",
- NULL, 0, 0, 0, irc_cmd_die },
+ NULL, 0, 0, 0, irc_command_die },
{ "disconnect", N_("disconnect from server(s)"),
N_("[-all | servername [servername ...]]"),
N_(" -all: disconnect from all servers\n"
"servername: server name to disconnect"),
- "%S|-all", 0, MAX_ARGS, 0, irc_cmd_disconnect },
+ "%S|-all", 0, MAX_ARGS, 0, irc_command_disconnect },
{ "halfop", N_("gives half channel operator status to nickname(s)"),
N_("[nickname [nickname]]"), "",
- "", 0, MAX_ARGS, 0, irc_cmd_halfop },
+ "", 0, MAX_ARGS, 0, irc_command_halfop },
{ "info", N_("get information describing the server"),
N_("[target]"),
N_("target: server name"),
- NULL, 0, 1, 0, irc_cmd_info },
+ NULL, 0, 1, 0, irc_command_info },
{ "invite", N_("invite a nick on a channel"),
N_("nickname channel"),
N_("nickname: nick to invite\n"
" channel: channel to invite"),
- "%n %c", 1, 2, 0, irc_cmd_invite },
+ "%n %c", 1, 2, 0, irc_command_invite },
{ "ison", N_("check if a nickname is currently on IRC"),
N_("nickname [nickname ...]"),
N_("nickname: nickname"),
- "", 1, MAX_ARGS, 0, irc_cmd_ison },
+ "", 1, MAX_ARGS, 0, irc_command_ison },
{ "join", N_("join a channel"),
N_("channel[,channel] [key[,key]]"),
N_("channel: channel name to join\n"
" key: key to join the channel"),
- "%C", 1, MAX_ARGS, 0, irc_cmd_join },
+ "%C", 1, MAX_ARGS, 0, irc_command_join },
{ "kick", N_("forcibly remove a user from a channel"),
N_("[channel] nickname [comment]"),
N_(" channel: channel where user is\n"
"nickname: nickname to kick\n"
" comment: comment for kick"),
- "%n %-", 1, MAX_ARGS, 0, irc_cmd_kick },
+ "%n %-", 1, MAX_ARGS, 0, irc_command_kick },
{ "kickban", N_("kicks and bans a nick from a channel"),
N_("[channel] nickname [comment]"),
N_(" channel: channel where user is\n"
"nickname: nickname to kick and ban\n"
" comment: comment for kick"),
- "%n %-", 1, MAX_ARGS, 0, irc_cmd_kickban },
+ "%n %-", 1, MAX_ARGS, 0, irc_command_kickban },
{ "kill", N_("close client-server connection"),
N_("nickname comment"),
N_("nickname: nickname\n"
" comment: comment for kill"),
- "%n %-", 2, MAX_ARGS, 0, irc_cmd_kill },
+ "%n %-", 2, MAX_ARGS, 0, irc_command_kill },
{ "links",
N_("list all servernames which are known by the server answering "
"the query"),
N_("[[server] server_mask]"),
N_(" server: this server should answer the query\n"
"server_mask: list of servers must match this mask"),
- NULL, 0, 2, 0, irc_cmd_links },
+ NULL, 0, 2, 0, irc_command_links },
{ "list", N_("list channels and their topic"),
N_("[channel[,channel] [server]]"),
N_("channel: channel to list (a regexp is allowed)\nserver: server name"),
- NULL, 0, MAX_ARGS, 0, irc_cmd_list },
+ NULL, 0, MAX_ARGS, 0, irc_command_list },
{ "lusers", N_("get statistics about the size of the IRC network"),
N_("[mask [target]]"),
N_(" mask: servers matching the mask only\n"
"target: server for forwarding request"),
- NULL, 0, 2, 0, irc_cmd_lusers },
+ NULL, 0, 2, 0, irc_command_lusers },
{ "me", N_("send a CTCP action to the current channel"),
N_("message"),
N_("message: message to send"),
- "", 0, MAX_ARGS, 1, irc_cmd_me },
+ "", 0, MAX_ARGS, 1, irc_command_me },
{ "mode", N_("change channel or user mode"),
N_("{ channel {[+|-]|o|p|s|i|t|n|b|v} [limit] [user] [ban mask] } | "
"{ nickname {[+|-]|i|w|s|o} }"),
@@ -185,80 +185,80 @@ t_weechat_command irc_commands[] =
" s: mark a user for receive server notices\n"
" w: user receives wallops\n"
" o: operator flag"),
- "%c|%m", 1, MAX_ARGS, 0, irc_cmd_mode },
+ "%c|%m", 1, MAX_ARGS, 0, irc_command_mode },
{ "motd", N_("get the \"Message Of The Day\""),
N_("[target]"),
N_("target: server name"),
- NULL, 0, 1, 0, irc_cmd_motd },
+ NULL, 0, 1, 0, irc_command_motd },
{ "msg", N_("send message to a nick or channel"),
N_("receiver[,receiver] text"),
N_("receiver: nick or channel (may be mask, '*' = current channel)\n"
"text: text to send"),
- "", 2, MAX_ARGS, 1, irc_cmd_msg },
+ "", 2, MAX_ARGS, 1, irc_command_msg },
{ "names", N_("list nicknames on channels"),
N_("[channel[,channel]]"),
N_("channel: channel name"),
- NULL, 0, 1, 0, irc_cmd_names },
+ NULL, 0, 1, 0, irc_command_names },
{ "nick", N_("change current nickname"),
N_("[-all] nickname"),
N_(" -all: set new nickname for all connected servers\n"
"nickname: new nickname"),
- "-all", 1, 2, 0, irc_cmd_nick },
+ "-all", 1, 2, 0, irc_command_nick },
{ "notice", N_("send notice message to user"),
N_("nickname text"),
N_("nickname: user to send notice to\n"
" text: text to send"),
- "%n %-", 2, MAX_ARGS, 1, irc_cmd_notice },
+ "%n %-", 2, MAX_ARGS, 1, irc_command_notice },
{ "op", N_("gives channel operator status to nickname(s)"),
N_("nickname [nickname]"), "",
- "", 1, MAX_ARGS, 0, irc_cmd_op },
+ "", 1, MAX_ARGS, 0, irc_command_op },
{ "oper", N_("get operator privileges"),
N_("user password"),
N_("user/password: used to get privileges on current IRC server"),
- NULL, 2, 2, 0, irc_cmd_oper },
+ NULL, 2, 2, 0, irc_command_oper },
{ "part", N_("leave a channel"),
N_("[channel[,channel]] [part_message]"),
N_(" channel: channel name to leave\n"
"part_message: part message (displayed to other users)"),
- "%p", 0, MAX_ARGS, 0, irc_cmd_part },
+ "%p", 0, MAX_ARGS, 0, irc_command_part },
{ "ping", N_("ping server"),
N_("server1 [server2]"),
N_("server1: server to ping\nserver2: forward ping to this server"),
- NULL, 1, 2, 0, irc_cmd_ping },
+ NULL, 1, 2, 0, irc_command_ping },
{ "pong", N_("answer to a ping message"),
N_("daemon [daemon2]"),
N_(" daemon: daemon who has responded to Ping message\n"
"daemon2: forward message to this daemon"),
- NULL, 1, 2, 0, irc_cmd_pong },
+ NULL, 1, 2, 0, irc_command_pong },
{ "query", N_("send a private message to a nick"),
N_("nickname [text]"),
N_("nickname: nickname for private conversation\n"
" text: text to send"),
- "%n %-", 1, MAX_ARGS, 1, irc_cmd_query },
+ "%n %-", 1, MAX_ARGS, 1, irc_command_query },
{ "quit", N_("close all connections and quit"),
N_("[quit_message]"),
N_("quit_message: quit message (displayed to other users)"),
- "%q", 0, MAX_ARGS, 1, irc_cmd_quit },
+ "%q", 0, MAX_ARGS, 1, irc_command_quit },
{ "quote", N_("send raw data to server without parsing"),
N_("data"),
N_("data: raw data to send"),
- "", 1, MAX_ARGS, 1, irc_cmd_quote },
+ "", 1, MAX_ARGS, 1, irc_command_quote },
{ "reconnect", N_("reconnect to server(s)"),
N_("[-all [-nojoin] | servername [servername ...] [-nojoin]]"),
N_(" -all: reconnect to all servers\n"
"servername: server name to reconnect\n"
" -nojoin: do not join any channel (even if autojoin is enabled on "
"server)"),
- "%S|-all|-nojoin|%*", 0, MAX_ARGS, 0, irc_cmd_reconnect },
+ "%S|-all|-nojoin|%*", 0, MAX_ARGS, 0, irc_command_reconnect },
{ "rehash", N_("tell the server to reload its config file"), "", "",
- NULL, 0, 0, 0, irc_cmd_rehash },
+ NULL, 0, 0, 0, irc_command_rehash },
{ "restart", N_("tell the server to restart itself"), "", "",
- NULL, 0, 0, 0, irc_cmd_restart },
+ NULL, 0, 0, 0, irc_command_restart },
{ "service", N_("register a new service"),
N_("nickname reserved distribution type reserved info"),
N_("distribution: visibility of service\n"
" type: reserved for future usage"),
- NULL, 6, 6, 0, irc_cmd_service },
+ NULL, 6, 6, 0, irc_command_service },
{ "server", N_("list, add or remove servers"),
N_("[list [servername]] | [listfull [servername]] | [add servername "
"hostname [-port port] [-temp] [-auto | -noauto] [-ipv6] [-ssl] "
@@ -291,83 +291,83 @@ t_weechat_command irc_commands[] =
" deloutq: delete messages out queue for all servers (all messages "
"WeeChat is currently sending)"),
"add|copy|rename|keep|del|deloutq|list|listfull %S %S",
- 0, MAX_ARGS, 0, irc_cmd_server },
+ 0, MAX_ARGS, 0, irc_command_server },
{ "servlist", N_("list services currently connected to the network"),
N_("[mask [type]]"),
N_("mask: list only services matching this mask\n"
"type: list only services of this type"),
- NULL, 0, 2, 0, irc_cmd_servlist },
+ NULL, 0, 2, 0, irc_command_servlist },
{ "squery", N_("deliver a message to a service"),
N_("service text"),
N_("service: name of service\ntext: text to send"),
- NULL, 2, MAX_ARGS, 1, irc_cmd_squery },
+ NULL, 2, MAX_ARGS, 1, irc_command_squery },
{ "squit", N_("disconnect server links"),
N_("server comment"),
N_( "server: server name\n"
"comment: comment for quit"),
- NULL, 2, 2, 1, irc_cmd_squit },
+ NULL, 2, 2, 1, irc_command_squit },
{ "stats", N_("query statistics about server"),
N_("[query [server]]"),
N_(" query: c/h/i/k/l/m/o/y/u (see RFC1459)\n"
"server: server name"),
- NULL, 0, 2, 0, irc_cmd_stats },
+ NULL, 0, 2, 0, irc_command_stats },
{ "summon",
N_("give users who are on a host running an IRC server a message "
"asking them to please join IRC"),
N_("user [target [channel]]"),
N_(" user: username\ntarget: server name\n"
"channel: channel name"),
- NULL, 1, 3, 0, irc_cmd_summon },
+ NULL, 1, 3, 0, irc_command_summon },
{ "time", N_("query local time from server"),
N_("[target]"),
N_("target: query time from specified server"),
- NULL, 0, 1, 0, irc_cmd_time },
+ NULL, 0, 1, 0, irc_command_time },
{ "topic", N_("get/set channel topic"),
N_("[channel] [topic]"),
N_("channel: channel name\ntopic: new topic for channel "
"(if topic is \"-delete\" then topic is deleted)"),
- "%t|-delete %-", 0, MAX_ARGS, 1, irc_cmd_topic },
+ "%t|-delete %-", 0, MAX_ARGS, 1, irc_command_topic },
{ "trace", N_("find the route to specific server"),
N_("[target]"),
N_("target: server"),
- NULL, 0, 1, 0, irc_cmd_trace },
+ NULL, 0, 1, 0, irc_command_trace },
{ "unban", N_("unbans nicks or hosts"),
N_("[channel] nickname [nickname ...]"),
N_(" channel: channel for unban\n"
"nickname: user or host to unban"),
- "", 1, MAX_ARGS, 0, irc_cmd_unban },
+ "", 1, MAX_ARGS, 0, irc_command_unban },
{ "userhost", N_("return a list of information about nicknames"),
N_("nickname [nickname ...]"),
N_("nickname: nickname"),
- "%n", 1, MAX_ARGS, 0, irc_cmd_userhost },
+ "%n", 1, MAX_ARGS, 0, irc_command_userhost },
{ "users", N_("list of users logged into the server"),
N_("[target]"),
N_("target: server"),
- NULL, 0, 1, 0, irc_cmd_users },
+ NULL, 0, 1, 0, irc_command_users },
{ "version",
N_("gives the version info of nick or server (current or specified)"),
N_("[server | nickname]"),
N_(" server: server name\n"
"nickname: nickname"),
- "%n", 0, 1, 0, irc_cmd_version },
+ "%n", 0, 1, 0, irc_command_version },
{ "voice", N_("gives voice to nickname(s)"),
N_("[nickname [nickname]]"), "",
- "", 0, MAX_ARGS, 0, irc_cmd_voice },
+ "", 0, MAX_ARGS, 0, irc_command_voice },
{ "wallops", N_("send a message to all currently connected users who have "
"set the 'w' user mode for themselves"),
N_("text"),
N_("text to send"),
- NULL, 1, MAX_ARGS, 1, irc_cmd_wallops },
+ NULL, 1, MAX_ARGS, 1, irc_command_wallops },
{ "who", N_("generate a query which returns a list of information"),
N_("[mask [\"o\"]]"),
N_("mask: only information which match this mask\n"
" o: only operators are returned according to the mask supplied"),
- "%C", 0, 2, 0, irc_cmd_who },
+ "%C", 0, 2, 0, irc_command_who },
{ "whois", N_("query information about user(s)"),
N_("[server] nickname[,nickname]"),
N_(" server: server name\n"
"nickname: nickname (may be a mask)"),
- "", 1, MAX_ARGS, 0, irc_cmd_whois },
+ "", 1, MAX_ARGS, 0, irc_command_whois },
{ "whowas",
N_("ask for information about a nickname which no longer exists"),
N_("nickname [,nickname [,nickname ...]] [count [target]]"),
@@ -375,18 +375,18 @@ t_weechat_command irc_commands[] =
" count: number of replies to return "
"(full search if negative number)\n"
" target: reply should match this mask"),
- "", 1, MAX_ARGS, 0, irc_cmd_whowas },
+ "", 1, MAX_ARGS, 0, irc_command_whowas },
{ NULL, NULL, NULL, NULL, NULL, 0, 0, 0, NULL }
};
/*
- * irc_cmd_admin: find information about the administrator of the server
+ * irc_command_admin: find information about the administrator of the server
*/
int
-irc_cmd_admin (t_gui_window *window,
- char *arguments, int argc, char **argv)
+irc_command_admin (t_gui_window *window,
+ char *arguments, int argc, char **argv)
{
IRC_BUFFER_GET_SERVER(window->buffer);
if (!ptr_server || !ptr_server->is_connected)
@@ -404,12 +404,12 @@ irc_cmd_admin (t_gui_window *window,
}
/*
- * irc_cmd_me_channel: send a ctcp action to a channel
+ * irc_command_me_channel: send a ctcp action to a channel
*/
int
-irc_cmd_me_channel (t_irc_server *server, t_irc_channel *channel,
- char *arguments)
+irc_command_me_channel (t_irc_server *server, t_irc_channel *channel,
+ char *arguments)
{
char *string;
@@ -430,11 +430,11 @@ irc_cmd_me_channel (t_irc_server *server, t_irc_channel *channel,
}
/*
- * irc_cmd_me_all_channels: send a ctcp action to all channels of a server
+ * irc_command_me_all_channels: send a ctcp action to all channels of a server
*/
int
-irc_cmd_me_all_channels (t_irc_server *server, char *arguments)
+irc_command_me_all_channels (t_irc_server *server, char *arguments)
{
t_irc_channel *ptr_channel;
@@ -442,18 +442,18 @@ irc_cmd_me_all_channels (t_irc_server *server, char *arguments)
ptr_channel = ptr_channel->next_channel)
{
if (ptr_channel->type == IRC_CHANNEL_TYPE_CHANNEL)
- irc_cmd_me_channel (server, ptr_channel, arguments);
+ irc_command_me_channel (server, ptr_channel, arguments);
}
return 0;
}
/*
- * irc_cmd_mode_nicks: send mode change for many nicks on a channel
+ * irc_command_mode_nicks: send mode change for many nicks on a channel
*/
void
-irc_cmd_mode_nicks (t_irc_server *server, char *channel,
- char *set, char *mode, int argc, char **argv)
+irc_command_mode_nicks (t_irc_server *server, char *channel,
+ char *set, char *mode, int argc, char **argv)
{
int i, length;
char *command;
@@ -479,12 +479,12 @@ irc_cmd_mode_nicks (t_irc_server *server, char *channel,
}
/*
- * irc_cmd_ame: send a ctcp action to all channels of all connected servers
+ * irc_command_ame: send a ctcp action to all channels of all connected servers
*/
int
-irc_cmd_ame (t_gui_window *window,
- char *arguments, int argc, char **argv)
+irc_command_ame (t_gui_window *window,
+ char *arguments, int argc, char **argv)
{
t_irc_server *ptr_server;
t_irc_channel *ptr_channel;
@@ -504,7 +504,7 @@ irc_cmd_ame (t_gui_window *window,
ptr_channel = ptr_channel->next_channel)
{
if (ptr_channel->type == IRC_CHANNEL_TYPE_CHANNEL)
- irc_cmd_me_channel (ptr_server, ptr_channel, arguments);
+ irc_command_me_channel (ptr_server, ptr_channel, arguments);
}
}
}
@@ -513,12 +513,12 @@ irc_cmd_ame (t_gui_window *window,
}
/*
- * irc_cmd_amsg: send message to all channels of all connected servers
+ * irc_command_amsg: send message to all channels of all connected servers
*/
int
-irc_cmd_amsg (t_gui_window *window,
- char *arguments, int argc, char **argv)
+irc_command_amsg (t_gui_window *window,
+ char *arguments, int argc, char **argv)
{
t_irc_server *ptr_server;
t_irc_channel *ptr_channel;
@@ -578,11 +578,11 @@ irc_cmd_amsg (t_gui_window *window,
}
/*
- * irc_cmd_away_server: toggle away status for one server
+ * irc_command_away_server: toggle away status for one server
*/
void
-irc_cmd_away_server (t_irc_server *server, char *arguments)
+irc_command_away_server (t_irc_server *server, char *arguments)
{
char *string, buffer[4096];
t_gui_window *ptr_window;
@@ -616,7 +616,7 @@ irc_cmd_away_server (t_irc_server *server, char *arguments)
{
snprintf (buffer, sizeof (buffer), "is away: %s",
(string) ? string : arguments);
- irc_cmd_me_all_channels (server, buffer);
+ irc_command_me_all_channels (server, buffer);
}
if (string)
free (string);
@@ -683,7 +683,7 @@ irc_cmd_away_server (t_irc_server *server, char *arguments)
(long int)(elapsed / 3600),
(long int)((elapsed / 60) % 60),
(long int)(elapsed % 60));
- irc_cmd_me_all_channels (server, buffer);
+ irc_command_me_all_channels (server, buffer);
}
}
}
@@ -703,12 +703,12 @@ irc_cmd_away_server (t_irc_server *server, char *arguments)
}
/*
- * irc_cmd_away: toggle away status
+ * irc_command_away: toggle away status
*/
int
-irc_cmd_away (t_gui_window *window,
- char *arguments, int argc, char **argv)
+irc_command_away (t_gui_window *window,
+ char *arguments, int argc, char **argv)
{
char *pos;
@@ -733,11 +733,11 @@ irc_cmd_away (t_gui_window *window,
ptr_server = ptr_server->next_server)
{
if (ptr_server->is_connected)
- irc_cmd_away_server (ptr_server, pos);
+ irc_command_away_server (ptr_server, pos);
}
}
else
- irc_cmd_away_server (ptr_server, arguments);
+ irc_command_away_server (ptr_server, arguments);
gui_status_draw (window->buffer, 1);
gui_add_hotlist = 1;
@@ -745,12 +745,12 @@ irc_cmd_away (t_gui_window *window,
}
/*
- * irc_cmd_ban: bans nicks or hosts
+ * irc_command_ban: bans nicks or hosts
*/
int
-irc_cmd_ban (t_gui_window *window,
- char *arguments, int argc, char **argv)
+irc_command_ban (t_gui_window *window,
+ char *arguments, int argc, char **argv)
{
char *pos_channel, *pos, *pos2;
@@ -833,12 +833,12 @@ irc_cmd_ban (t_gui_window *window,
}
/*
- * irc_cmd_connect_one_server: connect to one server
+ * irc_command_connect_one_server: connect to one server
* return 0 if error, 1 if ok
*/
int
-irc_cmd_connect_one_server (t_irc_server *server, int no_join)
+irc_command_connect_one_server (t_irc_server *server, int no_join)
{
if (!server)
return 0;
@@ -871,12 +871,12 @@ irc_cmd_connect_one_server (t_irc_server *server, int no_join)
}
/*
- * irc_cmd_connect: connect to server(s)
+ * irc_command_connect: connect to server(s)
*/
int
-irc_cmd_connect (t_gui_window *window,
- char *arguments, int argc, char **argv)
+irc_command_connect (t_gui_window *window,
+ char *arguments, int argc, char **argv)
{
t_irc_server server_tmp;
int i, nb_connect, connect_ok, all_servers, no_join, port, ipv6, ssl;
@@ -932,7 +932,7 @@ irc_cmd_connect (t_gui_window *window,
nb_connect++;
if (!ptr_server->is_connected && (ptr_server->child_pid == 0))
{
- if (!irc_cmd_connect_one_server (ptr_server, no_join))
+ if (!irc_command_connect_one_server (ptr_server, no_join))
connect_ok = 0;
}
}
@@ -947,7 +947,7 @@ irc_cmd_connect (t_gui_window *window,
ptr_server = irc_server_search (argv[i]);
if (ptr_server)
{
- if (!irc_cmd_connect_one_server (ptr_server, no_join))
+ if (!irc_command_connect_one_server (ptr_server, no_join))
connect_ok = 0;
}
else
@@ -988,7 +988,7 @@ irc_cmd_connect (t_gui_window *window,
GUI_COLOR(GUI_COLOR_CHAT_SERVER),
server_tmp.name,
GUI_COLOR(GUI_COLOR_CHAT));
- if (!irc_cmd_connect_one_server (ptr_server, 0))
+ if (!irc_command_connect_one_server (ptr_server, 0))
connect_ok = 0;
}
else
@@ -1009,7 +1009,7 @@ irc_cmd_connect (t_gui_window *window,
}
if (nb_connect == 0)
- connect_ok = irc_cmd_connect_one_server (ptr_server, no_join);
+ connect_ok = irc_command_connect_one_server (ptr_server, no_join);
if (!connect_ok)
return -1;
@@ -1018,12 +1018,12 @@ irc_cmd_connect (t_gui_window *window,
}
/*
- * irc_cmd_ctcp: send a ctcp message
+ * irc_command_ctcp: send a ctcp message
*/
int
-irc_cmd_ctcp (t_gui_window *window,
- char *arguments, int argc, char **argv)
+irc_command_ctcp (t_gui_window *window,
+ char *arguments, int argc, char **argv)
{
char *pos_type, *pos_args, *pos;
struct timeval tv;
@@ -1102,12 +1102,12 @@ irc_cmd_ctcp (t_gui_window *window,
}
/*
- * irc_cmd_cycle: leave and rejoin a channel
+ * irc_command_cycle: leave and rejoin a channel
*/
int
-irc_cmd_cycle (t_gui_window *window,
- char *arguments, int argc, char **argv)
+irc_command_cycle (t_gui_window *window,
+ char *arguments, int argc, char **argv)
{
char *channel_name, *pos_args, *ptr_arg, *buf;
char **channels;
@@ -1209,12 +1209,12 @@ irc_cmd_cycle (t_gui_window *window,
}
/*
- * irc_cmd_dcc: DCC control (file or chat)
+ * irc_command_dcc: DCC control (file or chat)
*/
int
-irc_cmd_dcc (t_gui_window *window,
- char *arguments, int argc, char **argv)
+irc_command_dcc (t_gui_window *window,
+ char *arguments, int argc, char **argv)
{
char *pos_nick, *pos_file;
@@ -1301,12 +1301,12 @@ irc_cmd_dcc (t_gui_window *window,
}
/*
- * irc_cmd_dehalfop: remove half operator privileges from nickname(s)
+ * irc_command_dehalfop: remove half operator privileges from nickname(s)
*/
int
-irc_cmd_dehalfop (t_gui_window *window,
- char *arguments, int argc, char **argv)
+irc_command_dehalfop (t_gui_window *window,
+ char *arguments, int argc, char **argv)
{
IRC_BUFFER_GET_SERVER_CHANNEL(window->buffer);
if (!ptr_server || !ptr_server->is_connected)
@@ -1322,8 +1322,8 @@ irc_cmd_dehalfop (t_gui_window *window,
ptr_channel->name,
ptr_server->nick);
else
- irc_cmd_mode_nicks (ptr_server, ptr_channel->name,
- "-", "h", argc, argv);
+ irc_command_mode_nicks (ptr_server, ptr_channel->name,
+ "-", "h", argc, argv);
}
else
{
@@ -1336,11 +1336,11 @@ irc_cmd_dehalfop (t_gui_window *window,
}
/*
- * irc_cmd_deop: remove operator privileges from nickname(s)
+ * irc_command_deop: remove operator privileges from nickname(s)
*/
int
-irc_cmd_deop (t_gui_window *window,
+irc_command_deop (t_gui_window *window,
char *arguments, int argc, char **argv)
{
IRC_BUFFER_GET_SERVER_CHANNEL(window->buffer);
@@ -1357,8 +1357,8 @@ irc_cmd_deop (t_gui_window *window,
ptr_channel->name,
ptr_server->nick);
else
- irc_cmd_mode_nicks (ptr_server, ptr_channel->name,
- "-", "o", argc, argv);
+ irc_command_mode_nicks (ptr_server, ptr_channel->name,
+ "-", "o", argc, argv);
}
else
{
@@ -1371,12 +1371,12 @@ irc_cmd_deop (t_gui_window *window,
}
/*
- * irc_cmd_devoice: remove voice from nickname(s)
+ * irc_command_devoice: remove voice from nickname(s)
*/
int
-irc_cmd_devoice (t_gui_window *window,
- char *arguments, int argc, char **argv)
+irc_command_devoice (t_gui_window *window,
+ char *arguments, int argc, char **argv)
{
IRC_BUFFER_GET_SERVER_CHANNEL(window->buffer);
if (!ptr_server || !ptr_server->is_connected)
@@ -1392,8 +1392,8 @@ irc_cmd_devoice (t_gui_window *window,
ptr_channel->name,
ptr_server->nick);
else
- irc_cmd_mode_nicks (ptr_server, ptr_channel->name,
- "-", "v", argc, argv);
+ irc_command_mode_nicks (ptr_server, ptr_channel->name,
+ "-", "v", argc, argv);
}
else
{
@@ -1407,12 +1407,12 @@ irc_cmd_devoice (t_gui_window *window,
}
/*
- * irc_cmd_die: shotdown the server
+ * irc_command_die: shotdown the server
*/
int
-irc_cmd_die (t_gui_window *window,
- char *arguments, int argc, char **argv)
+irc_command_die (t_gui_window *window,
+ char *arguments, int argc, char **argv)
{
IRC_BUFFER_GET_SERVER(window->buffer);
if (!ptr_server || !ptr_server->is_connected)
@@ -1428,11 +1428,11 @@ irc_cmd_die (t_gui_window *window,
}
/*
- * irc_cmd_quit_server: send QUIT to a server
+ * irc_command_quit_server: send QUIT to a server
*/
void
-irc_cmd_quit_server (t_irc_server *server, char *arguments)
+irc_command_quit_server (t_irc_server *server, char *arguments)
{
char *ptr_arg, *buf;
@@ -1459,12 +1459,12 @@ irc_cmd_quit_server (t_irc_server *server, char *arguments)
}
/*
- * irc_cmd_disconnect_one_server: disconnect from a server
+ * irc_command_disconnect_one_server: disconnect from a server
* return 0 if error, 1 if ok
*/
int
-irc_cmd_disconnect_one_server (t_irc_server *server)
+irc_command_disconnect_one_server (t_irc_server *server)
{
if (!server)
return 0;
@@ -1482,7 +1482,7 @@ irc_cmd_disconnect_one_server (t_irc_server *server)
gui_chat_printf_info (server->buffer,
_("Auto-reconnection is cancelled\n"));
}
- irc_cmd_quit_server (server, NULL);
+ irc_command_quit_server (server, NULL);
irc_server_disconnect (server, 0);
gui_status_draw (server->buffer, 1);
@@ -1491,11 +1491,11 @@ irc_cmd_disconnect_one_server (t_irc_server *server)
}
/*
- * irc_cmd_disconnect: disconnect from server(s)
+ * irc_command_disconnect: disconnect from server(s)
*/
int
-irc_cmd_disconnect (t_gui_window *window,
+irc_command_disconnect (t_gui_window *window,
char *arguments, int argc, char **argv)
{
int i, disconnect_ok;
@@ -1506,7 +1506,7 @@ irc_cmd_disconnect (t_gui_window *window,
(void) arguments;
if (argc == 0)
- disconnect_ok = irc_cmd_disconnect_one_server (ptr_server);
+ disconnect_ok = irc_command_disconnect_one_server (ptr_server);
else
{
disconnect_ok = 1;
@@ -1519,7 +1519,7 @@ irc_cmd_disconnect (t_gui_window *window,
if ((ptr_server->is_connected) || (ptr_server->child_pid != 0)
|| (ptr_server->reconnect_start != 0))
{
- if (!irc_cmd_disconnect_one_server (ptr_server))
+ if (!irc_command_disconnect_one_server (ptr_server))
disconnect_ok = 0;
}
}
@@ -1531,7 +1531,7 @@ irc_cmd_disconnect (t_gui_window *window,
ptr_server = irc_server_search (argv[i]);
if (ptr_server)
{
- if (!irc_cmd_disconnect_one_server (ptr_server))
+ if (!irc_command_disconnect_one_server (ptr_server))
disconnect_ok = 0;
}
else
@@ -1552,12 +1552,12 @@ irc_cmd_disconnect (t_gui_window *window,
}
/*
- * irc_cmd_halfop: give half operator privileges to nickname(s)
+ * irc_command_halfop: give half operator privileges to nickname(s)
*/
int
-irc_cmd_halfop (t_gui_window *window,
- char *arguments, int argc, char **argv)
+irc_command_halfop (t_gui_window *window,
+ char *arguments, int argc, char **argv)
{
IRC_BUFFER_GET_SERVER_CHANNEL(window->buffer);
if (!ptr_server || !ptr_server->is_connected)
@@ -1573,8 +1573,8 @@ irc_cmd_halfop (t_gui_window *window,
ptr_channel->name,
ptr_server->nick);
else
- irc_cmd_mode_nicks (ptr_server, ptr_channel->name,
- "+", "h", argc, argv);
+ irc_command_mode_nicks (ptr_server, ptr_channel->name,
+ "+", "h", argc, argv);
}
else
{
@@ -1588,12 +1588,12 @@ irc_cmd_halfop (t_gui_window *window,
}
/*
- * irc_cmd_info: get information describing the server
+ * irc_command_info: get information describing the server
*/
int
-irc_cmd_info (t_gui_window *window,
- char *arguments, int argc, char **argv)
+irc_command_info (t_gui_window *window,
+ char *arguments, int argc, char **argv)
{
IRC_BUFFER_GET_SERVER(window->buffer);
if (!ptr_server || !ptr_server->is_connected)
@@ -1611,12 +1611,12 @@ irc_cmd_info (t_gui_window *window,
}
/*
- * irc_cmd_invite: invite a nick on a channel
+ * irc_command_invite: invite a nick on a channel
*/
int
-irc_cmd_invite (t_gui_window *window,
- char *arguments, int argc, char **argv)
+irc_command_invite (t_gui_window *window,
+ char *arguments, int argc, char **argv)
{
IRC_BUFFER_GET_SERVER_CHANNEL(window->buffer);
if (!ptr_server || !ptr_server->is_connected)
@@ -1646,12 +1646,12 @@ irc_cmd_invite (t_gui_window *window,
}
/*
- * irc_cmd_ison: check if a nickname is currently on IRC
+ * irc_command_ison: check if a nickname is currently on IRC
*/
int
-irc_cmd_ison (t_gui_window *window,
- char *arguments, int argc, char **argv)
+irc_command_ison (t_gui_window *window,
+ char *arguments, int argc, char **argv)
{
IRC_BUFFER_GET_SERVER(window->buffer);
if (!ptr_server || !ptr_server->is_connected)
@@ -1666,11 +1666,11 @@ irc_cmd_ison (t_gui_window *window,
}
/*
- * irc_cmd_join_server: send JOIN command on a server
+ * irc_command_join_server: send JOIN command on a server
*/
void
-irc_cmd_join_server (t_irc_server *server, char *arguments)
+irc_command_join_server (t_irc_server *server, char *arguments)
{
if (irc_channel_is_channel (arguments))
irc_server_sendf (server, "JOIN %s", arguments);
@@ -1679,12 +1679,12 @@ irc_cmd_join_server (t_irc_server *server, char *arguments)
}
/*
- * irc_cmd_join: join a new channel
+ * irc_command_join: join a new channel
*/
int
-irc_cmd_join (t_gui_window *window,
- char *arguments, int argc, char **argv)
+irc_command_join (t_gui_window *window,
+ char *arguments, int argc, char **argv)
{
IRC_BUFFER_GET_SERVER(window->buffer);
if (!ptr_server || !ptr_server->is_connected)
@@ -1694,18 +1694,18 @@ irc_cmd_join (t_gui_window *window,
(void) argc;
(void) argv;
- irc_cmd_join_server (ptr_server, arguments);
+ irc_command_join_server (ptr_server, arguments);
return 0;
}
/*
- * irc_cmd_kick: forcibly remove a user from a channel
+ * irc_command_kick: forcibly remove a user from a channel
*/
int
-irc_cmd_kick (t_gui_window *window,
- char *arguments, int argc, char **argv)
+irc_command_kick (t_gui_window *window,
+ char *arguments, int argc, char **argv)
{
char *pos_channel, *pos_nick, *pos_comment;
@@ -1771,12 +1771,12 @@ irc_cmd_kick (t_gui_window *window,
}
/*
- * irc_cmd_kickban: forcibly remove a user from a channel and ban it
+ * irc_command_kickban: forcibly remove a user from a channel and ban it
*/
int
-irc_cmd_kickban (t_gui_window *window,
- char *arguments, int argc, char **argv)
+irc_command_kickban (t_gui_window *window,
+ char *arguments, int argc, char **argv)
{
char *pos_channel, *pos_nick, *pos_comment;
@@ -1844,12 +1844,12 @@ irc_cmd_kickban (t_gui_window *window,
}
/*
- * irc_cmd_kill: close client-server connection
+ * irc_command_kill: close client-server connection
*/
int
-irc_cmd_kill (t_gui_window *window,
- char *arguments, int argc, char **argv)
+irc_command_kill (t_gui_window *window,
+ char *arguments, int argc, char **argv)
{
char *pos;
@@ -1878,13 +1878,13 @@ irc_cmd_kill (t_gui_window *window,
}
/*
- * irc_cmd_links: list all servernames which are known by the server
+ * irc_command_links: list all servernames which are known by the server
* answering the query
*/
int
-irc_cmd_links (t_gui_window *window,
- char *arguments, int argc, char **argv)
+irc_command_links (t_gui_window *window,
+ char *arguments, int argc, char **argv)
{
IRC_BUFFER_GET_SERVER(window->buffer);
if (!ptr_server || !ptr_server->is_connected)
@@ -1902,12 +1902,12 @@ irc_cmd_links (t_gui_window *window,
}
/*
- * irc_cmd_list: close client-server connection
+ * irc_command_list: close client-server connection
*/
int
-irc_cmd_list (t_gui_window *window,
- char *arguments, int argc, char **argv)
+irc_command_list (t_gui_window *window,
+ char *arguments, int argc, char **argv)
{
char buf[512];
int ret;
@@ -1961,12 +1961,12 @@ irc_cmd_list (t_gui_window *window,
}
/*
- * irc_cmd_lusers: get statistics about ths size of the IRC network
+ * irc_command_lusers: get statistics about ths size of the IRC network
*/
int
-irc_cmd_lusers (t_gui_window *window,
- char *arguments, int argc, char **argv)
+irc_command_lusers (t_gui_window *window,
+ char *arguments, int argc, char **argv)
{
IRC_BUFFER_GET_SERVER(window->buffer);
if (!ptr_server || !ptr_server->is_connected)
@@ -1984,12 +1984,12 @@ irc_cmd_lusers (t_gui_window *window,
}
/*
- * irc_cmd_me: send a ctcp action to the current channel
+ * irc_command_me: send a ctcp action to the current channel
*/
int
-irc_cmd_me (t_gui_window *window,
- char *arguments, int argc, char **argv)
+irc_command_me (t_gui_window *window,
+ char *arguments, int argc, char **argv)
{
IRC_BUFFER_GET_SERVER_CHANNEL(window->buffer);
if (!ptr_server || !ptr_server->is_connected)
@@ -2007,27 +2007,27 @@ irc_cmd_me (t_gui_window *window,
WEECHAT_ERROR, "me");
return -1;
}
- irc_cmd_me_channel (ptr_server, ptr_channel, arguments);
+ irc_command_me_channel (ptr_server, ptr_channel, arguments);
return 0;
}
/*
- * irc_cmd_mode_server! send MODE command on a server
+ * irc_command_mode_server! send MODE command on a server
*/
void
-irc_cmd_mode_server (t_irc_server *server, char *arguments)
+irc_command_mode_server (t_irc_server *server, char *arguments)
{
irc_server_sendf (server, "MODE %s", arguments);
}
/*
- * irc_cmd_mode: change mode for channel/nickname
+ * irc_command_mode: change mode for channel/nickname
*/
int
-irc_cmd_mode (t_gui_window *window,
- char *arguments, int argc, char **argv)
+irc_command_mode (t_gui_window *window,
+ char *arguments, int argc, char **argv)
{
IRC_BUFFER_GET_SERVER(window->buffer);
if (!ptr_server || !ptr_server->is_connected)
@@ -2037,18 +2037,18 @@ irc_cmd_mode (t_gui_window *window,
(void) argc;
(void) argv;
- irc_cmd_mode_server (ptr_server, arguments);
+ irc_command_mode_server (ptr_server, arguments);
return 0;
}
/*
- * irc_cmd_motd: get the "Message Of The Day"
+ * irc_command_motd: get the "Message Of The Day"
*/
int
-irc_cmd_motd (t_gui_window *window,
- char *arguments, int argc, char **argv)
+irc_command_motd (t_gui_window *window,
+ char *arguments, int argc, char **argv)
{
IRC_BUFFER_GET_SERVER(window->buffer);
if (!ptr_server || !ptr_server->is_connected)
@@ -2066,12 +2066,12 @@ irc_cmd_motd (t_gui_window *window,
}
/*
- * irc_cmd_msg: send a message to a nick or channel
+ * irc_command_msg: send a message to a nick or channel
*/
int
-irc_cmd_msg (t_gui_window *window,
- char *arguments, int argc, char **argv)
+irc_command_msg (t_gui_window *window,
+ char *arguments, int argc, char **argv)
{
char *pos, *pos_comma;
char *msg_pwd_hidden;
@@ -2257,12 +2257,12 @@ irc_cmd_msg (t_gui_window *window,
}
/*
- * irc_cmd_names: list nicknames on channels
+ * irc_command_names: list nicknames on channels
*/
int
-irc_cmd_names (t_gui_window *window,
- char *arguments, int argc, char **argv)
+irc_command_names (t_gui_window *window,
+ char *arguments, int argc, char **argv)
{
IRC_BUFFER_GET_SERVER_CHANNEL(window->buffer);
if (!ptr_server || !ptr_server->is_connected)
@@ -2320,12 +2320,12 @@ irc_send_nick_server (t_irc_server *server, char *nickname)
}
/*
- * irc_cmd_nick: change nickname
+ * irc_command_nick: change nickname
*/
int
-irc_cmd_nick (t_gui_window *window,
- char *arguments, int argc, char **argv)
+irc_command_nick (t_gui_window *window,
+ char *arguments, int argc, char **argv)
{
IRC_BUFFER_GET_SERVER(window->buffer);
if (!ptr_server)
@@ -2357,12 +2357,12 @@ irc_cmd_nick (t_gui_window *window,
}
/*
- * irc_cmd_notice: send notice message
+ * irc_command_notice: send notice message
*/
int
-irc_cmd_notice (t_gui_window *window,
- char *arguments, int argc, char **argv)
+irc_command_notice (t_gui_window *window,
+ char *arguments, int argc, char **argv)
{
char *pos, *string;
@@ -2407,12 +2407,12 @@ irc_cmd_notice (t_gui_window *window,
}
/*
- * irc_cmd_op: give operator privileges to nickname(s)
+ * irc_command_op: give operator privileges to nickname(s)
*/
int
-irc_cmd_op (t_gui_window *window,
- char *arguments, int argc, char **argv)
+irc_command_op (t_gui_window *window,
+ char *arguments, int argc, char **argv)
{
IRC_BUFFER_GET_SERVER_CHANNEL(window->buffer);
if (!ptr_server || !ptr_server->is_connected)
@@ -2428,8 +2428,8 @@ irc_cmd_op (t_gui_window *window,
ptr_channel->name,
ptr_server->nick);
else
- irc_cmd_mode_nicks (ptr_server, ptr_channel->name,
- "+", "o", argc, argv);
+ irc_command_mode_nicks (ptr_server, ptr_channel->name,
+ "+", "o", argc, argv);
}
else
{
@@ -2443,12 +2443,12 @@ irc_cmd_op (t_gui_window *window,
}
/*
- * irc_cmd_oper: get oper privileges
+ * irc_command_oper: get oper privileges
*/
int
-irc_cmd_oper (t_gui_window *window,
- char *arguments, int argc, char **argv)
+irc_command_oper (t_gui_window *window,
+ char *arguments, int argc, char **argv)
{
IRC_BUFFER_GET_SERVER(window->buffer);
if (!ptr_server || !ptr_server->is_connected)
@@ -2463,12 +2463,12 @@ irc_cmd_oper (t_gui_window *window,
}
/*
- * irc_cmd_part: leave a channel or close a private window
+ * irc_command_part: leave a channel or close a private window
*/
int
-irc_cmd_part (t_gui_window *window,
- char *arguments, int argc, char **argv)
+irc_command_part (t_gui_window *window,
+ char *arguments, int argc, char **argv)
{
char *channel_name, *pos_args, *ptr_arg, *buf;
@@ -2552,12 +2552,12 @@ irc_cmd_part (t_gui_window *window,
}
/*
- * irc_cmd_ping: ping a server
+ * irc_command_ping: ping a server
*/
int
-irc_cmd_ping (t_gui_window *window,
- char *arguments, int argc, char **argv)
+irc_command_ping (t_gui_window *window,
+ char *arguments, int argc, char **argv)
{
IRC_BUFFER_GET_SERVER(window->buffer);
if (!ptr_server || !ptr_server->is_connected)
@@ -2572,12 +2572,12 @@ irc_cmd_ping (t_gui_window *window,
}
/*
- * irc_cmd_pong: send pong answer to a daemon
+ * irc_command_pong: send pong answer to a daemon
*/
int
-irc_cmd_pong (t_gui_window *window,
- char *arguments, int argc, char **argv)
+irc_command_pong (t_gui_window *window,
+ char *arguments, int argc, char **argv)
{
IRC_BUFFER_GET_SERVER(window->buffer);
if (!ptr_server)
@@ -2592,12 +2592,12 @@ irc_cmd_pong (t_gui_window *window,
}
/*
- * irc_cmd_query: start private conversation with a nick
+ * irc_command_query: start private conversation with a nick
*/
int
-irc_cmd_query (t_gui_window *window,
- char *arguments, int argc, char **argv)
+irc_command_query (t_gui_window *window,
+ char *arguments, int argc, char **argv)
{
char *pos, *string;
@@ -2667,12 +2667,12 @@ irc_cmd_query (t_gui_window *window,
}
/*
- * irc_cmd_quit: disconnect from all servers and quit WeeChat
+ * irc_command_quit: disconnect from all servers and quit WeeChat
*/
int
-irc_cmd_quit (t_gui_window *window,
- char *arguments, int argc, char **argv)
+irc_command_quit (t_gui_window *window,
+ char *arguments, int argc, char **argv)
{
t_irc_server *ptr_server;
@@ -2684,19 +2684,19 @@ irc_cmd_quit (t_gui_window *window,
for (ptr_server = irc_servers; ptr_server;
ptr_server = ptr_server->next_server)
{
- irc_cmd_quit_server (ptr_server, arguments);
+ irc_command_quit_server (ptr_server, arguments);
}
quit_weechat = 1;
return 0;
}
/*
- * irc_cmd_quote: send raw data to server
+ * irc_command_quote: send raw data to server
*/
int
-irc_cmd_quote (t_gui_window *window,
- char *arguments, int argc, char **argv)
+irc_command_quote (t_gui_window *window,
+ char *arguments, int argc, char **argv)
{
IRC_BUFFER_GET_SERVER(window->buffer);
if (!ptr_server || !ptr_server->is_connected)
@@ -2719,12 +2719,12 @@ irc_cmd_quote (t_gui_window *window,
}
/*
- * irc_cmd_reconnect_one_server: reconnect to a server
+ * irc_command_reconnect_one_server: reconnect to a server
* return 0 if error, 1 if ok
*/
int
-irc_cmd_reconnect_one_server (t_irc_server *server, int no_join)
+irc_command_reconnect_one_server (t_irc_server *server, int no_join)
{
if (!server)
return 0;
@@ -2736,7 +2736,7 @@ irc_cmd_reconnect_one_server (t_irc_server *server, int no_join)
WEECHAT_ERROR, server->name);
return 0;
}
- irc_cmd_quit_server (server, NULL);
+ irc_command_quit_server (server, NULL);
irc_server_disconnect (server, 0);
if (irc_server_connect (server, no_join))
{
@@ -2750,12 +2750,12 @@ irc_cmd_reconnect_one_server (t_irc_server *server, int no_join)
}
/*
- * irc_cmd_reconnect: reconnect to server(s)
+ * irc_command_reconnect: reconnect to server(s)
*/
int
-irc_cmd_reconnect (t_gui_window *window,
- char *arguments, int argc, char **argv)
+irc_command_reconnect (t_gui_window *window,
+ char *arguments, int argc, char **argv)
{
int i, nb_reconnect, reconnect_ok, all_servers, no_join;
@@ -2785,7 +2785,7 @@ irc_cmd_reconnect (t_gui_window *window,
nb_reconnect++;
if ((ptr_server->is_connected) || (ptr_server->child_pid != 0))
{
- if (!irc_cmd_reconnect_one_server (ptr_server, no_join))
+ if (!irc_command_reconnect_one_server (ptr_server, no_join))
reconnect_ok = 0;
}
}
@@ -2800,7 +2800,7 @@ irc_cmd_reconnect (t_gui_window *window,
ptr_server = irc_server_search (argv[i]);
if (ptr_server)
{
- if (!irc_cmd_reconnect_one_server (ptr_server, no_join))
+ if (!irc_command_reconnect_one_server (ptr_server, no_join))
reconnect_ok = 0;
}
else
@@ -2815,7 +2815,7 @@ irc_cmd_reconnect (t_gui_window *window,
}
if (nb_reconnect == 0)
- reconnect_ok = irc_cmd_reconnect_one_server (ptr_server, no_join);
+ reconnect_ok = irc_command_reconnect_one_server (ptr_server, no_join);
if (!reconnect_ok)
return -1;
@@ -2824,12 +2824,12 @@ irc_cmd_reconnect (t_gui_window *window,
}
/*
- * irc_cmd_rehash: tell the server to reload its config file
+ * irc_command_rehash: tell the server to reload its config file
*/
int
-irc_cmd_rehash (t_gui_window *window,
- char *arguments, int argc, char **argv)
+irc_command_rehash (t_gui_window *window,
+ char *arguments, int argc, char **argv)
{
IRC_BUFFER_GET_SERVER(window->buffer);
if (!ptr_server || !ptr_server->is_connected)
@@ -2845,12 +2845,12 @@ irc_cmd_rehash (t_gui_window *window,
}
/*
- * irc_cmd_restart: tell the server to restart itself
+ * irc_command_restart: tell the server to restart itself
*/
int
-irc_cmd_restart (t_gui_window *window,
- char *arguments, int argc, char **argv)
+irc_command_restart (t_gui_window *window,
+ char *arguments, int argc, char **argv)
{
IRC_BUFFER_GET_SERVER(window->buffer);
if (!ptr_server || !ptr_server->is_connected)
@@ -2866,12 +2866,12 @@ irc_cmd_restart (t_gui_window *window,
}
/*
- * irc_cmd_server: manage IRC servers
+ * irc_command_server: manage IRC servers
*/
int
-irc_cmd_server (t_gui_window *window,
- char *arguments, int argc, char **argv)
+irc_command_server (t_gui_window *window,
+ char *arguments, int argc, char **argv)
{
int i, detailed_list, one_server_found;
t_irc_server server_tmp, *ptr_server, *server_found, *new_server;
@@ -3353,12 +3353,12 @@ irc_cmd_server (t_gui_window *window,
}
/*
- * irc_cmd_service: register a new service
+ * irc_command_service: register a new service
*/
int
-irc_cmd_service (t_gui_window *window,
- char *arguments, int argc, char **argv)
+irc_command_service (t_gui_window *window,
+ char *arguments, int argc, char **argv)
{
IRC_BUFFER_GET_SERVER(window->buffer);
if (!ptr_server || !ptr_server->is_connected)
@@ -3373,12 +3373,12 @@ irc_cmd_service (t_gui_window *window,
}
/*
- * irc_cmd_servlist: list services currently connected to the network
+ * irc_command_servlist: list services currently connected to the network
*/
int
-irc_cmd_servlist (t_gui_window *window,
- char *arguments, int argc, char **argv)
+irc_command_servlist (t_gui_window *window,
+ char *arguments, int argc, char **argv)
{
IRC_BUFFER_GET_SERVER(window->buffer);
if (!ptr_server || !ptr_server->is_connected)
@@ -3396,12 +3396,12 @@ irc_cmd_servlist (t_gui_window *window,
}
/*
- * irc_cmd_squery: deliver a message to a service
+ * irc_command_squery: deliver a message to a service
*/
int
-irc_cmd_squery (t_gui_window *window,
- char *arguments, int argc, char **argv)
+irc_command_squery (t_gui_window *window,
+ char *arguments, int argc, char **argv)
{
char *pos;
@@ -3431,12 +3431,12 @@ irc_cmd_squery (t_gui_window *window,
}
/*
- * irc_cmd_squit: disconnect server links
+ * irc_command_squit: disconnect server links
*/
int
-irc_cmd_squit (t_gui_window *window,
- char *arguments, int argc, char **argv)
+irc_command_squit (t_gui_window *window,
+ char *arguments, int argc, char **argv)
{
IRC_BUFFER_GET_SERVER(window->buffer);
if (!ptr_server || !ptr_server->is_connected)
@@ -3451,12 +3451,12 @@ irc_cmd_squit (t_gui_window *window,
}
/*
- * irc_cmd_stats: query statistics about server
+ * irc_command_stats: query statistics about server
*/
int
-irc_cmd_stats (t_gui_window *window,
- char *arguments, int argc, char **argv)
+irc_command_stats (t_gui_window *window,
+ char *arguments, int argc, char **argv)
{
IRC_BUFFER_GET_SERVER(window->buffer);
if (!ptr_server || !ptr_server->is_connected)
@@ -3474,13 +3474,13 @@ irc_cmd_stats (t_gui_window *window,
}
/*
- * irc_cmd_summon: give users who are on a host running an IRC server
+ * irc_command_summon: give users who are on a host running an IRC server
* a message asking them to please join IRC
*/
int
-irc_cmd_summon (t_gui_window *window,
- char *arguments, int argc, char **argv)
+irc_command_summon (t_gui_window *window,
+ char *arguments, int argc, char **argv)
{
IRC_BUFFER_GET_SERVER(window->buffer);
if (!ptr_server || !ptr_server->is_connected)
@@ -3495,12 +3495,12 @@ irc_cmd_summon (t_gui_window *window,
}
/*
- * irc_cmd_time: query local time from server
+ * irc_command_time: query local time from server
*/
int
-irc_cmd_time (t_gui_window *window,
- char *arguments, int argc, char **argv)
+irc_command_time (t_gui_window *window,
+ char *arguments, int argc, char **argv)
{
IRC_BUFFER_GET_SERVER(window->buffer);
if (!ptr_server || !ptr_server->is_connected)
@@ -3518,12 +3518,12 @@ irc_cmd_time (t_gui_window *window,
}
/*
- * irc_cmd_topic: get/set topic for a channel
+ * irc_command_topic: get/set topic for a channel
*/
int
-irc_cmd_topic (t_gui_window *window,
- char *arguments, int argc, char **argv)
+irc_command_topic (t_gui_window *window,
+ char *arguments, int argc, char **argv)
{
char *channel_name, *new_topic, *pos;
@@ -3589,12 +3589,12 @@ irc_cmd_topic (t_gui_window *window,
}
/*
- * irc_cmd_trace: find the route to specific server
+ * irc_command_trace: find the route to specific server
*/
int
-irc_cmd_trace (t_gui_window *window,
- char *arguments, int argc, char **argv)
+irc_command_trace (t_gui_window *window,
+ char *arguments, int argc, char **argv)
{
IRC_BUFFER_GET_SERVER(window->buffer);
if (!ptr_server || !ptr_server->is_connected)
@@ -3612,12 +3612,12 @@ irc_cmd_trace (t_gui_window *window,
}
/*
- * irc_cmd_unban: unbans nicks or hosts
+ * irc_command_unban: unbans nicks or hosts
*/
int
-irc_cmd_unban (t_gui_window *window,
- char *arguments, int argc, char **argv)
+irc_command_unban (t_gui_window *window,
+ char *arguments, int argc, char **argv)
{
char *pos_channel, *pos, *pos2;
@@ -3697,12 +3697,12 @@ irc_cmd_unban (t_gui_window *window,
}
/*
- * irc_cmd_userhost: return a list of information about nicknames
+ * irc_command_userhost: return a list of information about nicknames
*/
int
-irc_cmd_userhost (t_gui_window *window,
- char *arguments, int argc, char **argv)
+irc_command_userhost (t_gui_window *window,
+ char *arguments, int argc, char **argv)
{
IRC_BUFFER_GET_SERVER(window->buffer);
if (!ptr_server || !ptr_server->is_connected)
@@ -3717,12 +3717,12 @@ irc_cmd_userhost (t_gui_window *window,
}
/*
- * irc_cmd_users: list of users logged into the server
+ * irc_command_users: list of users logged into the server
*/
int
-irc_cmd_users (t_gui_window *window,
- char *arguments, int argc, char **argv)
+irc_command_users (t_gui_window *window,
+ char *arguments, int argc, char **argv)
{
IRC_BUFFER_GET_SERVER(window->buffer);
if (!ptr_server || !ptr_server->is_connected)
@@ -3740,12 +3740,12 @@ irc_cmd_users (t_gui_window *window,
}
/*
- * irc_cmd_version: gives the version info of nick or server (current or specified)
+ * irc_command_version: gives the version info of nick or server (current or specified)
*/
int
-irc_cmd_version (t_gui_window *window,
- char *arguments, int argc, char **argv)
+irc_command_version (t_gui_window *window,
+ char *arguments, int argc, char **argv)
{
IRC_BUFFER_GET_SERVER_CHANNEL(window->buffer);
if (!ptr_server || !ptr_server->is_connected)
@@ -3777,12 +3777,12 @@ irc_cmd_version (t_gui_window *window,
}
/*
- * irc_cmd_voice: give voice to nickname(s)
+ * irc_command_voice: give voice to nickname(s)
*/
int
-irc_cmd_voice (t_gui_window *window,
- char *arguments, int argc, char **argv)
+irc_command_voice (t_gui_window *window,
+ char *arguments, int argc, char **argv)
{
IRC_BUFFER_GET_SERVER_CHANNEL(window->buffer);
if (!ptr_server || !ptr_server->is_connected)
@@ -3798,8 +3798,8 @@ irc_cmd_voice (t_gui_window *window,
ptr_channel->name,
ptr_server->nick);
else
- irc_cmd_mode_nicks (ptr_server, ptr_channel->name,
- "+", "v", argc, argv);
+ irc_command_mode_nicks (ptr_server, ptr_channel->name,
+ "+", "v", argc, argv);
}
else
{
@@ -3813,13 +3813,13 @@ irc_cmd_voice (t_gui_window *window,
}
/*
- * irc_cmd_wallops: send a message to all currently connected users who
+ * irc_command_wallops: send a message to all currently connected users who
* have set the 'w' user mode for themselves
*/
int
-irc_cmd_wallops (t_gui_window *window,
- char *arguments, int argc, char **argv)
+irc_command_wallops (t_gui_window *window,
+ char *arguments, int argc, char **argv)
{
IRC_BUFFER_GET_SERVER(window->buffer);
if (!ptr_server || !ptr_server->is_connected)
@@ -3834,12 +3834,12 @@ irc_cmd_wallops (t_gui_window *window,
}
/*
- * irc_cmd_who: generate a query which returns a list of information
+ * irc_command_who: generate a query which returns a list of information
*/
int
-irc_cmd_who (t_gui_window *window,
- char *arguments, int argc, char **argv)
+irc_command_who (t_gui_window *window,
+ char *arguments, int argc, char **argv)
{
IRC_BUFFER_GET_SERVER(window->buffer);
if (!ptr_server || !ptr_server->is_connected)
@@ -3857,12 +3857,12 @@ irc_cmd_who (t_gui_window *window,
}
/*
- * irc_cmd_whois: query information about user(s)
+ * irc_command_whois: query information about user(s)
*/
int
-irc_cmd_whois (t_gui_window *window,
- char *arguments, int argc, char **argv)
+irc_command_whois (t_gui_window *window,
+ char *arguments, int argc, char **argv)
{
IRC_BUFFER_GET_SERVER(window->buffer);
if (!ptr_server || !ptr_server->is_connected)
@@ -3877,12 +3877,12 @@ irc_cmd_whois (t_gui_window *window,
}
/*
- * irc_cmd_whowas: ask for information about a nickname which no longer exists
+ * irc_command_whowas: ask for information about a nickname which no longer exists
*/
int
-irc_cmd_whowas (t_gui_window *window,
- char *arguments, int argc, char **argv)
+irc_command_whowas (t_gui_window *window,
+ char *arguments, int argc, char **argv)
{
IRC_BUFFER_GET_SERVER(window->buffer);
if (!ptr_server || !ptr_server->is_connected)
@@ -3895,3 +3895,470 @@ irc_cmd_whowas (t_gui_window *window,
irc_server_sendf (ptr_server, "WHOWAS %s", arguments);
return 0;
}
+
+/*
+ * irc_command_init: init IRC commands (create hooks)
+ */
+
+void
+irc_command_init ()
+{
+ weechat_hook_command ("admin",
+ N_("find information about the administrator of the "
+ "server"),
+ N_("[target]"),
+ N_("target: server"),
+ NULL, irc_command_admin);
+ weechat_hook_command ("ame",
+ N_("send a CTCP action to all channels of all "
+ "connected servers"),
+ N_("message"),
+ N_("message: message to send"),
+ NULL, irc_command_ame);
+ weechat_hook_command ("amsg",
+ N_("send message to all channels of all connected "
+ "servers"),
+ N_("text"),
+ N_("text: text to send"),
+ NULL, irc_command_amsg);
+ weechat_hook_command ("away",
+ N_("toggle away status"),
+ N_("[-all] [message]"),
+ N_(" -all: toggle away status on all connected "
+ "servers\n"
+ "message: message for away (if no message is "
+ "given, away status is removed)"),
+ "-all", irc_command_away);
+ weechat_hook_command ("ban",
+ N_("bans nicks or hosts"),
+ N_("[channel] [nickname [nickname ...]]"),
+ N_(" channel: channel for ban\n"
+ "nickname: user or host to ban"),
+ "%N", irc_command_ban);
+ weechat_hook_command ("connect",
+ N_("connect to server(s)"),
+ N_("[-all [-nojoin] | servername [servername ...] "
+ "[-nojoin] | hostname [-port port] [-ipv6] "
+ "[-ssl]]"),
+ N_(" -all: connect to all servers\n"
+ "servername: internal server name to connect\n"
+ " -nojoin: do not join any channel (even if "
+ "autojoin is enabled on server)\n"
+ " hostname: hostname to connect, creating "
+ "temporary server\n"
+ " port: port for server (integer, default "
+ "is 6667)\n"
+ " ipv6: use IPv6 protocol\n"
+ " ssl: use SSL protocol"),
+ "%S|-all|-nojoin|%*", irc_command_connect);
+ weechat_hook_command ("ctcp",
+ N_("send a CTCP message (Client-To-Client Protocol)"),
+ N_("receiver type [arguments]"),
+ N_(" receiver: nick or channel to send CTCP to\n"
+ " type: CTCP type (examples: \"version\", "
+ "\"ping\", ..)\n"
+ "arguments: arguments for CTCP"),
+ "%c|%n action|ping|version", irc_command_ctcp);
+ weechat_hook_command ("cycle",
+ N_("leave and rejoin a channel"),
+ N_("[channel[,channel]] [part_message]"),
+ N_(" channel: channel name for cycle\n"
+ "part_message: part message (displayed to other "
+ "users)"),
+ "%p", irc_command_cycle);
+ weechat_hook_command ("dcc",
+ N_("starts DCC (file or chat) or close chat"),
+ N_("action [nickname [file]]"),
+ N_(" action: 'send' (file) or 'chat' or 'close' "
+ "(chat)\n"
+ "nickname: nickname to send file or chat\n"
+ " file: filename (on local host)"),
+ "chat|send|close %n %f", irc_command_dcc);
+ weechat_hook_command ("dehalfop",
+ N_("removes half channel operator status from "
+ "nickname(s)"),
+ N_("[nickname [nickname]]"),
+ "",
+ NULL, irc_command_dehalfop);
+ weechat_hook_command ("deop",
+ N_("removes channel operator status from "
+ "nickname(s)"),
+ N_("[nickname [nickname]]"),
+ "",
+ NULL, irc_command_deop);
+ weechat_hook_command ("devoice",
+ N_("removes voice from nickname(s)"),
+ N_("[nickname [nickname]]"),
+ "",
+ NULL, irc_command_devoice);
+ weechat_hook_command ("die",
+ N_("shutdown the server"),
+ "",
+ "",
+ NULL, irc_command_die);
+ weechat_hook_command ("disconnect",
+ N_("disconnect from server(s)"),
+ N_("[-all | servername [servername ...]]"),
+ N_(" -all: disconnect from all servers\n"
+ "servername: server name to disconnect"),
+ "%S|-all", irc_command_disconnect);
+ weechat_hook_command ("halfop",
+ N_("gives half channel operator status to "
+ "nickname(s)"),
+ N_("[nickname [nickname]]"),
+ "",
+ NULL, irc_command_halfop);
+ weechat_hook_command ("info",
+ N_("get information describing the server"),
+ N_("[target]"),
+ N_("target: server name"),
+ NULL, irc_command_info);
+ weechat_hook_command ("invite",
+ N_("invite a nick on a channel"),
+ N_("nickname channel"),
+ N_("nickname: nick to invite\n"
+ " channel: channel to invite"),
+ "%n %c", irc_command_invite);
+ weechat_hook_command ("ison",
+ N_("check if a nickname is currently on IRC"),
+ N_("nickname [nickname ...]"),
+ N_("nickname: nickname"),
+ NULL, irc_command_ison);
+ weechat_hook_command ("join",
+ N_("join a channel"),
+ N_("channel[,channel] [key[,key]]"),
+ N_("channel: channel name to join\n"
+ " key: key to join the channel"),
+ "%C", irc_command_join);
+ weechat_hook_command ("kick",
+ N_("forcibly remove a user from a channel"),
+ N_("[channel] nickname [comment]"),
+ N_(" channel: channel where user is\n"
+ "nickname: nickname to kick\n"
+ " comment: comment for kick"),
+ "%n %-", irc_command_kick);
+ weechat_hook_command ("kickban",
+ N_("kicks and bans a nick from a channel"),
+ N_("[channel] nickname [comment]"),
+ N_(" channel: channel where user is\n"
+ "nickname: nickname to kick and ban\n"
+ " comment: comment for kick"),
+ "%n %-", irc_command_kickban);
+ weechat_hook_command ("kill",
+ N_("close client-server connection"),
+ N_("nickname comment"),
+ N_("nickname: nickname\n"
+ " comment: comment for kill"),
+ "%n %-", irc_command_kill);
+ weechat_hook_command ("links",
+ N_("list all servernames which are known by the "
+ "server answering the query"),
+ N_("[[server] server_mask]"),
+ N_(" server: this server should answer the "
+ "query\n"
+ "server_mask: list of servers must match this "
+ "mask"),
+ NULL, irc_command_links);
+ weechat_hook_command ("list",
+ N_("list channels and their topic"),
+ N_("[channel[,channel] [server]]"),
+ N_("channel: channel to list (a regexp is allowed)\n"
+ "server: server name"),
+ NULL, irc_command_list);
+ weechat_hook_command ("lusers",
+ N_("get statistics about the size of the IRC "
+ "network"),
+ N_("[mask [target]]"),
+ N_(" mask: servers matching the mask only\n"
+ "target: server for forwarding request"),
+ NULL, irc_command_lusers);
+ weechat_hook_command ("me",
+ N_("send a CTCP action to the current channel"),
+ N_("message"),
+ N_("message: message to send"),
+ NULL, irc_command_me);
+ weechat_hook_command ("mode",
+ N_("change channel or user mode"),
+ N_("{ channel {[+|-]|o|p|s|i|t|n|b|v} [limit] "
+ "[user] [ban mask] } | { nickname "
+ "{[+|-]|i|w|s|o} }"),
+ N_("channel modes:\n"
+ " channel: channel name to modify\n"
+ " o: give/take channel operator privileges\n"
+ " p: private channel flag\n"
+ " s: secret channel flag\n"
+ " i: invite-only channel flag\n"
+ " t: topic settable by channel operator only "
+ "flag\n"
+ " n: no messages to channel from clients on the "
+ "outside\n"
+ " m: moderated channel\n"
+ " l: set the user limit to channel\n"
+ " b: set a ban mask to keep users out\n"
+ " e: set exception mask\n"
+ " v: give/take the ability to speak on a "
+ "moderated channel\n"
+ " k: set a channel key (password)\n"
+ "user modes:\n"
+ " nickname: nickname to modify\n"
+ " i: mark a user as invisible\n"
+ " s: mark a user for receive server notices\n"
+ " w: user receives wallops\n"
+ " o: operator flag"),
+ "%c|%m", irc_command_mode);
+ weechat_hook_command ("motd",
+ N_("get the \"Message Of The Day\""),
+ N_("[target]"),
+ N_("target: server name"),
+ NULL, irc_command_motd);
+ weechat_hook_command ("msg",
+ N_("send message to a nick or channel"),
+ N_("receiver[,receiver] text"),
+ N_("receiver: nick or channel (may be mask, '*' = "
+ "current channel)\n"
+ "text: text to send"),
+ NULL, irc_command_msg);
+ weechat_hook_command ("names",
+ N_("list nicknames on channels"),
+ N_("[channel[,channel]]"),
+ N_("channel: channel name"),
+ "%C|%*", irc_command_names);
+ weechat_hook_command ("nick",
+ N_("change current nickname"),
+ N_("[-all] nickname"),
+ N_(" -all: set new nickname for all connected "
+ "servers\n"
+ "nickname: new nickname"),
+ "-all", irc_command_nick);
+ weechat_hook_command ("notice",
+ N_("send notice message to user"),
+ N_("nickname text"),
+ N_("nickname: user to send notice to\n"
+ " text: text to send"),
+ "%n %-", irc_command_notice);
+ weechat_hook_command ("op",
+ N_("gives channel operator status to nickname(s)"),
+ N_("nickname [nickname]"),
+ "",
+ NULL, irc_command_op);
+ weechat_hook_command ("oper",
+ N_("get operator privileges"),
+ N_("user password"),
+ N_("user/password: used to get privileges on "
+ "current IRC server"),
+ NULL, irc_command_oper);
+ weechat_hook_command ("part",
+ N_("leave a channel"),
+ N_("[channel[,channel]] [part_message]"),
+ N_(" channel: channel name to leave\n"
+ "part_message: part message (displayed to other "
+ "users)"),
+ "%p", irc_command_part);
+ weechat_hook_command ("ping",
+ N_("ping server"),
+ N_("server1 [server2]"),
+ N_("server1: server to ping\nserver2: forward ping "
+ "to this server"),
+ NULL, irc_command_ping);
+ weechat_hook_command ("pong",
+ N_("answer to a ping message"),
+ N_("daemon [daemon2]"),
+ N_(" daemon: daemon who has responded to Ping "
+ "message\n"
+ "daemon2: forward message to this daemon"),
+ NULL, irc_command_pong);
+ weechat_hook_command ("query",
+ N_("send a private message to a nick"),
+ N_("nickname [text]"),
+ N_("nickname: nickname for private conversation\n"
+ " text: text to send"),
+ "%n %-", irc_command_query);
+ weechat_hook_command ("quit",
+ N_("close all connections and quit"),
+ N_("[quit_message]"),
+ N_("quit_message: quit message (displayed to other "
+ "users)"),
+ "%q", irc_command_quit);
+ weechat_hook_command ("quote",
+ N_("send raw data to server without parsing"),
+ N_("data"),
+ N_("data: raw data to send"),
+ NULL, irc_command_quote);
+ weechat_hook_command ("reconnect",
+ N_("reconnect to server(s)"),
+ N_("[-all [-nojoin] | servername [servername ...] "
+ "[-nojoin]]"),
+ N_(" -all: reconnect to all servers\n"
+ "servername: server name to reconnect\n"
+ " -nojoin: do not join any channel (even if "
+ "autojoin is enabled on server)"),
+ "%S|-all|-nojoin|%*", irc_command_reconnect);
+ weechat_hook_command ("rehash",
+ N_("tell the server to reload its config file"),
+ "",
+ "",
+ NULL, irc_command_rehash);
+ weechat_hook_command ("restart",
+ N_("tell the server to restart itself"),
+ "",
+ "",
+ NULL, irc_command_restart);
+ weechat_hook_command ("service",
+ N_("register a new service"),
+ N_("nickname reserved distribution type reserved "
+ "info"),
+ N_("distribution: visibility of service\n"
+ " type: reserved for future usage"),
+ NULL, irc_command_service);
+ weechat_hook_command ("server",
+ N_("list, add or remove servers"),
+ N_("[list [servername]] | [listfull [servername]] | "
+ "[add servername hostname [-port port] [-temp] "
+ "[-auto | -noauto] [-ipv6] [-ssl] [-pwd password] "
+ "[-nicks nick1 nick2 nick3] [-username username] "
+ "[-realname realname] [-command command] "
+ "[-autojoin channel[,channel]] ] | [copy "
+ "servername newservername] | [rename servername "
+ "newservername] | [keep servername] | [del "
+ "servername]"),
+ N_(" list: list servers (no parameter implies "
+ "this list)\n"
+ " listfull: list servers with detailed info for "
+ "each server\n"
+ " add: create a new server\n"
+ "servername: server name, for internal and "
+ "display use\n"
+ " hostname: name or IP address of server\n"
+ " port: port for server (integer, default "
+ "is 6667)\n"
+ " temp: create temporary server (not saved "
+ "in config file)\n"
+ " auto: automatically connect to server "
+ "when WeeChat starts\n"
+ " noauto: do not connect to server when "
+ "WeeChat starts (default)\n"
+ " ipv6: use IPv6 protocol\n"
+ " ssl: use SSL protocol\n"
+ " password: password for server\n"
+ " nick1: first nick for server\n"
+ " nick2: alternate nick for server\n"
+ " nick3: second alternate nick for server\n"
+ " username: user name\n"
+ " realname: real name of user\n"
+ " copy: duplicate a server\n"
+ " rename: rename a server\n"
+ " keep: keep server in config file (for "
+ "temporary servers only)\n"
+ " del: delete a server\n"
+ " deloutq: delete messages out queue for all "
+ "servers (all messages "
+ "WeeChat is currently sending)"),
+ "add|copy|rename|keep|del|deloutq|list|listfull %S %S",
+ irc_command_server);
+ weechat_hook_command ("servlist",
+ N_("list services currently connected to the "
+ "network"),
+ N_("[mask [type]]"),
+ N_("mask: list only services matching this mask\n"
+ "type: list only services of this type"),
+ NULL, irc_command_servlist);
+ weechat_hook_command ("squery",
+ N_("deliver a message to a service"),
+ N_("service text"),
+ N_("service: name of service\ntext: text to send"),
+ NULL, irc_command_squery);
+ weechat_hook_command ("squit",
+ N_("disconnect server links"),
+ N_("server comment"),
+ N_( "server: server name\n"
+ "comment: comment for quit"),
+ NULL, irc_command_squit);
+ weechat_hook_command ("stats",
+ N_("query statistics about server"),
+ N_("[query [server]]"),
+ N_(" query: c/h/i/k/l/m/o/y/u (see RFC1459)\n"
+ "server: server name"),
+ NULL, irc_command_stats);
+ weechat_hook_command ("summon",
+ N_("give users who are on a host running an IRC "
+ "server a message asking them to please join "
+ "IRC"),
+ N_("user [target [channel]]"),
+ N_(" user: username\ntarget: server name\n"
+ "channel: channel name"),
+ NULL, irc_command_summon);
+ weechat_hook_command ("time",
+ N_("query local time from server"),
+ N_("[target]"),
+ N_("target: query time from specified server"),
+ NULL, irc_command_time);
+ weechat_hook_command ("topic",
+ N_("get/set channel topic"),
+ N_("[channel] [topic]"),
+ N_("channel: channel name\ntopic: new topic for "
+ "channel (if topic is \"-delete\" then topic "
+ "is deleted)"),
+ "%t|-delete %-", irc_command_topic);
+ weechat_hook_command ("trace",
+ N_("find the route to specific server"),
+ N_("[target]"),
+ N_("target: server"),
+ NULL, irc_command_trace);
+ weechat_hook_command ("unban",
+ N_("[channel] nickname [nickname ...]"),
+ N_(" channel: channel for unban\n"
+ "nickname: user or host to unban"),
+ NULL, irc_command_unban);
+ weechat_hook_command ("userhost",
+ N_("return a list of information about nicknames"),
+ N_("nickname [nickname ...]"),
+ N_("nickname: nickname"),
+ "%n", irc_command_userhost);
+ weechat_hook_command ("users",
+ N_("list of users logged into the server"),
+ N_("[target]"),
+ N_("target: server"),
+ NULL, irc_command_users);
+ weechat_hook_command ("version",
+ N_("gives the version info of nick or server "
+ "(current or specified)"),
+ N_("[server | nickname]"),
+ N_(" server: server name\n"
+ "nickname: nickname"),
+ "%n", irc_command_version);
+ weechat_hook_command ("voice",
+ N_("gives voice to nickname(s)"),
+ N_("[nickname [nickname]]"),
+ "",
+ NULL, irc_command_voice);
+ weechat_hook_command ("wallops",
+ N_("send a message to all currently connected users "
+ "who have set the 'w' user mode for themselves"),
+ N_("text"),
+ N_("text to send"),
+ NULL, irc_command_wallops);
+ weechat_hook_command ("who",
+ N_("generate a query which returns a list of "
+ "information"),
+ N_("[mask [\"o\"]]"),
+ N_("mask: only information which match this mask\n"
+ " o: only operators are returned according to "
+ "the mask supplied"),
+ "%C", irc_command_who);
+ weechat_hook_command ("whois",
+ N_("query information about user(s)"),
+ N_("[server] nickname[,nickname]"),
+ N_(" server: server name\n"
+ "nickname: nickname (may be a mask)"),
+ NULL, irc_command_whois);
+ weechat_hook_command ("whowas",
+ N_("ask for information about a nickname which no "
+ "longer exists"),
+ N_("nickname [,nickname [,nickname ...]] [count "
+ "[target]]"),
+ N_("nickname: nickname to search\n"
+ " count: number of replies to return "
+ "(full search if negative number)\n"
+ " target: reply should match this mask"),
+ NULL, irc_command_whowas);
+}
diff --git a/src/plugins/irc/irc-command.h b/src/plugins/irc/irc-command.h
index f73f2e74f..ed5fe489f 100644
--- a/src/plugins/irc/irc-command.h
+++ b/src/plugins/irc/irc-command.h
@@ -20,70 +20,6 @@
#ifndef __WEECHAT_IRC_COMMAND_H
#define __WEECHAT_IRC_COMMAND_H 1
-extern t_weechat_command irc_commands[];
-
-extern int irc_cmd_admin (t_gui_window *, char *, int, char **);
-extern int irc_cmd_ame (t_gui_window *, char *, int, char **);
-extern int irc_cmd_amsg (t_gui_window *, char *, int, char **);
-extern int irc_cmd_away (t_gui_window *, char *, int, char **);
-extern int irc_cmd_ban (t_gui_window *, char *, int, char **);
-extern int irc_cmd_connect (t_gui_window *, char *, int, char **);
-extern int irc_cmd_ctcp (t_gui_window *, char *, int, char **);
-extern int irc_cmd_cycle (t_gui_window *, char *, int, char **);
-extern int irc_cmd_dcc (t_gui_window *, char *, int, char **);
-extern int irc_cmd_dehalfop (t_gui_window *, char *, int, char **);
-extern int irc_cmd_deop (t_gui_window *, char *, int, char **);
-extern int irc_cmd_devoice (t_gui_window *, char *, int, char **);
-extern int irc_cmd_die (t_gui_window *, char *, int, char **);
-extern int irc_cmd_disconnect (t_gui_window *, char *, int, char **);
-extern int irc_cmd_halfop (t_gui_window *, char *, int, char **);
-extern int irc_cmd_info (t_gui_window *, char *, int, char **);
-extern int irc_cmd_invite (t_gui_window *, char *, int, char **);
-extern int irc_cmd_ison (t_gui_window *, char *, int, char **);
-extern int irc_cmd_join (t_gui_window *, char *, int, char **);
-extern int irc_cmd_kick (t_gui_window *, char *, int, char **);
-extern int irc_cmd_kickban (t_gui_window *, char *, int, char **);
-extern int irc_cmd_kill (t_gui_window *, char *, int, char **);
-extern int irc_cmd_links (t_gui_window *, char *, int, char **);
-extern int irc_cmd_list (t_gui_window *, char *, int, char **);
-extern int irc_cmd_lusers (t_gui_window *, char *, int, char **);
-extern int irc_cmd_me (t_gui_window *, char *, int, char **);
-extern int irc_cmd_mode (t_gui_window *, char *, int, char **);
-extern int irc_cmd_motd (t_gui_window *, char *, int, char **);
-extern int irc_cmd_msg (t_gui_window *, char *, int, char **);
-extern int irc_cmd_msg (t_gui_window *, char *, int, char **);
-extern int irc_cmd_names (t_gui_window *, char *, int, char **);
-extern int irc_cmd_nick (t_gui_window *, char *, int, char **);
-extern int irc_cmd_notice (t_gui_window *, char *, int, char **);
-extern int irc_cmd_op (t_gui_window *, char *, int, char **);
-extern int irc_cmd_oper (t_gui_window *, char *, int, char **);
-extern int irc_cmd_part (t_gui_window *, char *, int, char **);
-extern int irc_cmd_ping (t_gui_window *, char *, int, char **);
-extern int irc_cmd_pong (t_gui_window *, char *, int, char **);
-extern int irc_cmd_query (t_gui_window *, char *, int, char **);
-extern int irc_cmd_quit (t_gui_window *, char *, int, char **);
-extern int irc_cmd_quote (t_gui_window *, char *, int, char **);
-extern int irc_cmd_reconnect (t_gui_window *, char *, int, char **);
-extern int irc_cmd_rehash (t_gui_window *, char *, int, char **);
-extern int irc_cmd_restart (t_gui_window *, char *, int, char **);
-extern int irc_cmd_service (t_gui_window *, char *, int, char **);
-extern int irc_cmd_server (t_gui_window *, char *, int, char **);
-extern int irc_cmd_servlist (t_gui_window *, char *, int, char **);
-extern int irc_cmd_squery (t_gui_window *, char *, int, char **);
-extern int irc_cmd_squit (t_gui_window *, char *, int, char **);
-extern int irc_cmd_stats (t_gui_window *, char *, int, char **);
-extern int irc_cmd_summon (t_gui_window *, char *, int, char **);
-extern int irc_cmd_time (t_gui_window *, char *, int, char **);
-extern int irc_cmd_topic (t_gui_window *, char *, int, char **);
-extern int irc_cmd_trace (t_gui_window *, char *, int, char **);
-extern int irc_cmd_unban (t_gui_window *, char *, int, char **);
-extern int irc_cmd_userhost (t_gui_window *, char *, int, char **);
-extern int irc_cmd_users (t_gui_window *, char *, int, char **);
-extern int irc_cmd_version (t_gui_window *, char *, int, char **);
-extern int irc_cmd_voice (t_gui_window *, char *, int, char **);
-extern int irc_cmd_wallops (t_gui_window *, char *, int, char **);
-extern int irc_cmd_who (t_gui_window *, char *, int, char **);
-extern int irc_cmd_whois (t_gui_window *, char *, int, char **);
-extern int irc_cmd_whowas (t_gui_window *, char *, int, char **);
+extern void irc_command_init ();
#endif /* irc-command.h */
diff --git a/src/plugins/irc/irc-config.c b/src/plugins/irc/irc-config.c
index 27819e262..5ec7ce3bd 100644
--- a/src/plugins/irc/irc-config.c
+++ b/src/plugins/irc/irc-config.c
@@ -29,357 +29,84 @@
#include <limits.h>
#include <pwd.h>
-#include "../../core/weechat.h"
#include "irc.h"
-#include "../../core/config-option.h"
-#include "../../core/config-file.h"
-#include "../../core/hook.h"
-#include "../../core/util.h"
+#include "irc-config.h"
+#include "irc-dcc.h"
+#include "irc-server.h"
+struct t_config_file *irc_config_file = NULL;
+struct t_config_section *irc_config_section_server = NULL;
+
/* config, irc section */
-int irc_cfg_irc_one_server_buffer;
-int irc_cfg_irc_open_near_server;
-char *irc_cfg_irc_nick_prefix;
-char *irc_cfg_irc_nick_suffix;
-int irc_cfg_irc_display_away;
-int irc_cfg_irc_show_away_once;
-char *irc_cfg_irc_display_away_values[] =
-{ "off", "local", "channel", NULL };
-char *irc_cfg_irc_default_msg_part;
-char *irc_cfg_irc_default_msg_quit;
-int irc_cfg_irc_notice_as_pv;
-int irc_cfg_irc_away_check;
-int irc_cfg_irc_away_check_max_nicks;
-int irc_cfg_irc_lag_check;
-int irc_cfg_irc_lag_min_show;
-int irc_cfg_irc_lag_disconnect;
-int irc_cfg_irc_anti_flood;
-char *irc_cfg_irc_highlight;
-int irc_cfg_irc_colors_receive;
-int irc_cfg_irc_colors_send;
-int irc_cfg_irc_send_unknown_commands;
-
-t_config_option irc_options_irc[] =
-{ { "irc_one_server_buffer",
- N_("use same buffer for all servers"),
- OPTION_TYPE_BOOLEAN, BOOL_FALSE, BOOL_TRUE, BOOL_FALSE, NULL, NULL,
- &irc_cfg_irc_one_server_buffer, NULL, irc_config_change_one_server_buffer },
- { "irc_open_near_server",
- N_("open new channels/privates near server"),
- OPTION_TYPE_BOOLEAN, BOOL_FALSE, BOOL_TRUE, BOOL_FALSE, NULL, NULL,
- &irc_cfg_irc_open_near_server, NULL, irc_config_change_noop },
- { "irc_nick_prefix",
- N_("text to display before nick in chat window"),
- OPTION_TYPE_STRING, 0, 0, 0, "", NULL,
- NULL, &irc_cfg_irc_nick_prefix, irc_config_change_noop },
- { "irc_nick_suffix",
- N_("text to display after nick in chat window"),
- OPTION_TYPE_STRING, 0, 0, 0, " |", NULL,
- NULL, &irc_cfg_irc_nick_suffix, irc_config_change_noop },
- { "irc_display_away",
- N_("display message when (un)marking as away"),
- OPTION_TYPE_INT_WITH_STRING, 0, 0, 0, "off", irc_cfg_irc_display_away_values,
- &irc_cfg_irc_display_away, NULL, irc_config_change_noop },
- { "irc_show_away_once",
- N_("show remote away message only once in private"),
- OPTION_TYPE_BOOLEAN, BOOL_FALSE, BOOL_TRUE, BOOL_TRUE, NULL, NULL,
- &irc_cfg_irc_show_away_once, NULL, irc_config_change_noop },
- { "irc_default_msg_part",
- N_("default part message (leaving channel) ('%v' will be replaced by "
- "WeeChat version in string)"),
- OPTION_TYPE_STRING, 0, 0, 0, "WeeChat %v", NULL,
- NULL, &irc_cfg_irc_default_msg_part, irc_config_change_noop },
- { "irc_default_msg_quit",
- N_("default quit message ('%v' will be replaced by WeeChat version in "
- "string)"),
- OPTION_TYPE_STRING, 0, 0, 0, "WeeChat %v", NULL,
- NULL, &irc_cfg_irc_default_msg_quit, irc_config_change_noop },
- { "irc_notice_as_pv",
- N_("display notices as private messages"),
- OPTION_TYPE_BOOLEAN, BOOL_FALSE, BOOL_TRUE, BOOL_FALSE, NULL, NULL,
- &irc_cfg_irc_notice_as_pv, NULL, irc_config_change_noop },
- { "irc_away_check",
- N_("interval between two checks for away (in minutes, 0 = never check)"),
- OPTION_TYPE_INT, 0, INT_MAX, 0, NULL, NULL,
- &irc_cfg_irc_away_check, NULL, irc_config_change_away_check },
- { "irc_away_check_max_nicks",
- N_("do not check away nicks on channels with high number of nicks (0 = unlimited)"),
- OPTION_TYPE_INT, 0, INT_MAX, 0, NULL, NULL,
- &irc_cfg_irc_away_check_max_nicks, NULL, irc_config_change_away_check },
- { "irc_lag_check",
- N_("interval between two checks for lag (in seconds)"),
- OPTION_TYPE_INT, 30, INT_MAX, 60, NULL, NULL,
- &irc_cfg_irc_lag_check, NULL, irc_config_change_noop },
- { "irc_lag_min_show",
- N_("minimum lag to show (in seconds)"),
- OPTION_TYPE_INT, 0, INT_MAX, 1, NULL, NULL,
- &irc_cfg_irc_lag_min_show, NULL, irc_config_change_noop },
- { "irc_lag_disconnect",
- N_("disconnect after important lag (in minutes, 0 = never disconnect)"),
- OPTION_TYPE_INT, 0, INT_MAX, 5, NULL, NULL,
- &irc_cfg_irc_lag_disconnect, NULL, irc_config_change_noop },
- { "irc_anti_flood",
- N_("anti-flood: # seconds between two user messages (0 = no anti-flood)"),
- OPTION_TYPE_INT, 0, 5, 2, NULL, NULL,
- &irc_cfg_irc_anti_flood, NULL, irc_config_change_noop },
- { "irc_highlight",
- N_("comma separated list of words to highlight (case insensitive comparison, "
- "words may begin or end with \"*\" for partial match)"),
- OPTION_TYPE_STRING, 0, 0, 0, "", NULL,
- NULL, &irc_cfg_irc_highlight, irc_config_change_noop },
- { "irc_colors_receive",
- N_("when off, colors codes are ignored in incoming messages"),
- OPTION_TYPE_BOOLEAN, BOOL_FALSE, BOOL_TRUE, BOOL_TRUE, NULL, NULL,
- &irc_cfg_irc_colors_receive, NULL, irc_config_change_noop },
- { "irc_colors_send",
- N_("allow user to send colors with special codes (^Cb=bold, ^Ccxx=color, "
- "^Ccxx,yy=color+background, ^Cu=underline, ^Cr=reverse)"),
- OPTION_TYPE_BOOLEAN, BOOL_FALSE, BOOL_TRUE, BOOL_TRUE, NULL, NULL,
- &irc_cfg_irc_colors_send, NULL, irc_config_change_noop },
- { "irc_send_unknown_commands",
- N_("send unknown commands to IRC server"),
- OPTION_TYPE_BOOLEAN, BOOL_FALSE, BOOL_TRUE, BOOL_FALSE, NULL, NULL,
- &irc_cfg_irc_send_unknown_commands, NULL, irc_config_change_noop },
- { NULL, NULL, 0, 0, 0, 0, NULL, NULL, NULL, NULL, NULL }
-};
+struct t_config_option *irc_config_irc_one_server_buffer;
+struct t_config_option *irc_config_irc_open_near_server;
+struct t_config_option *irc_config_irc_nick_prefix;
+struct t_config_option *irc_config_irc_nick_suffix;
+struct t_config_option *irc_config_irc_display_away;
+struct t_config_option *irc_config_irc_show_away_once;
+struct t_config_option *irc_config_irc_default_msg_part;
+struct t_config_option *irc_config_irc_default_msg_quit;
+struct t_config_option *irc_config_irc_notice_as_pv;
+struct t_config_option *irc_config_irc_away_check;
+struct t_config_option *irc_config_irc_away_check_max_nicks;
+struct t_config_option *irc_config_irc_lag_check;
+struct t_config_option *irc_config_irc_lag_min_show;
+struct t_config_option *irc_config_irc_lag_disconnect;
+struct t_config_option *irc_config_irc_anti_flood;
+struct t_config_option *irc_config_irc_highlight;
+struct t_config_option *irc_config_irc_colors_receive;
+struct t_config_option *irc_config_irc_colors_send;
+struct t_config_option *irc_config_irc_send_unknown_commands;
/* config, dcc section */
-int irc_cfg_dcc_auto_accept_files;
-int irc_cfg_dcc_auto_accept_chats;
-int irc_cfg_dcc_timeout;
-int irc_cfg_dcc_blocksize;
-int irc_cfg_dcc_fast_send;
-char *irc_cfg_dcc_port_range;
-char *irc_cfg_dcc_own_ip;
-char *irc_cfg_dcc_download_path;
-char *irc_cfg_dcc_upload_path;
-int irc_cfg_dcc_convert_spaces;
-int irc_cfg_dcc_auto_rename;
-int irc_cfg_dcc_auto_resume;
-
-t_config_option irc_options_dcc[] =
-{ { "dcc_auto_accept_files",
- N_("automatically accept incoming dcc files"),
- OPTION_TYPE_BOOLEAN, BOOL_FALSE, BOOL_TRUE, BOOL_FALSE, NULL, NULL,
- &irc_cfg_dcc_auto_accept_files, NULL, irc_config_change_noop },
- { "dcc_auto_accept_chats",
- N_("automatically accept dcc chats (use carefully!)"),
- OPTION_TYPE_BOOLEAN, BOOL_FALSE, BOOL_TRUE, BOOL_FALSE, NULL, NULL,
- &irc_cfg_dcc_auto_accept_chats, NULL, irc_config_change_noop },
- { "dcc_timeout",
- N_("timeout for dcc request (in seconds)"),
- OPTION_TYPE_INT, 5, INT_MAX, 300, NULL, NULL,
- &irc_cfg_dcc_timeout, NULL, irc_config_change_noop },
- { "dcc_blocksize",
- N_("block size for dcc packets in bytes (default: 65536)"),
- OPTION_TYPE_INT, IRC_DCC_MIN_BLOCKSIZE, IRC_DCC_MAX_BLOCKSIZE, 65536, NULL, NULL,
- &irc_cfg_dcc_blocksize, NULL, irc_config_change_noop },
- { "dcc_fast_send",
- N_("does not wait for ACK when sending file"),
- OPTION_TYPE_BOOLEAN, BOOL_FALSE, BOOL_TRUE, BOOL_TRUE, NULL, NULL,
- &irc_cfg_dcc_fast_send, NULL, irc_config_change_noop },
- { "dcc_port_range",
- N_("restricts outgoing dcc to use only ports in the given range "
- "(useful for NAT) (syntax: a single port, ie. 5000 or a port "
- "range, ie. 5000-5015, empty value means any port)"),
- OPTION_TYPE_STRING, 0, 0, 0, "", NULL,
- NULL, &irc_cfg_dcc_port_range, irc_config_change_noop },
- { "dcc_own_ip",
- N_("IP or DNS address used for outgoing dcc "
- "(if empty, local interface IP is used)"),
- OPTION_TYPE_STRING, 0, 0, 0, "", NULL,
- NULL, &irc_cfg_dcc_own_ip, irc_config_change_noop },
- { "dcc_download_path",
- N_("path for writing incoming files with dcc (default: user home)"),
- OPTION_TYPE_STRING, 0, 0, 0, "%h/dcc", NULL,
- NULL, &irc_cfg_dcc_download_path, irc_config_change_noop },
- { "dcc_upload_path",
- N_("path for reading files when sending thru dcc (when no path is "
- "specified)"),
- OPTION_TYPE_STRING, 0, 0, 0, "~", NULL,
- NULL, &irc_cfg_dcc_upload_path, irc_config_change_noop },
- { "dcc_convert_spaces",
- N_("convert spaces to underscores when sending files"),
- OPTION_TYPE_BOOLEAN, BOOL_FALSE, BOOL_TRUE, BOOL_TRUE, NULL, NULL,
- &irc_cfg_dcc_convert_spaces, NULL, irc_config_change_noop },
- { "dcc_auto_rename",
- N_("rename incoming files if already exists (add '.1', '.2', ...)"),
- OPTION_TYPE_BOOLEAN, BOOL_FALSE, BOOL_TRUE, BOOL_TRUE, NULL, NULL,
- &irc_cfg_dcc_auto_rename, NULL, irc_config_change_noop },
- { "dcc_auto_resume",
- N_("automatically resume dcc transfer if connection with remote host is "
- "loosed"),
- OPTION_TYPE_BOOLEAN, BOOL_FALSE, BOOL_TRUE, BOOL_TRUE, NULL, NULL,
- &irc_cfg_dcc_auto_resume, NULL, irc_config_change_noop },
- { NULL, NULL, 0, 0, 0, 0, NULL, NULL, NULL, NULL, NULL }
-};
+struct t_config_option *irc_config_dcc_auto_accept_files;
+struct t_config_option *irc_config_dcc_auto_accept_chats;
+struct t_config_option *irc_config_dcc_timeout;
+struct t_config_option *irc_config_dcc_blocksize;
+struct t_config_option *irc_config_dcc_fast_send;
+struct t_config_option *irc_config_dcc_port_range;
+struct t_config_option *irc_config_dcc_own_ip;
+struct t_config_option *irc_config_dcc_download_path;
+struct t_config_option *irc_config_dcc_upload_path;
+struct t_config_option *irc_config_dcc_convert_spaces;
+struct t_config_option *irc_config_dcc_auto_rename;
+struct t_config_option *irc_config_dcc_auto_resume;
/* config, log section */
-int irc_cfg_log_auto_server;
-int irc_cfg_log_auto_channel;
-int irc_cfg_log_auto_private;
-int irc_cfg_log_hide_nickserv_pwd;
-
-t_config_option irc_options_log[] =
-{ { "log_auto_server",
- N_("automatically log server messages"),
- OPTION_TYPE_BOOLEAN, BOOL_FALSE, BOOL_TRUE, BOOL_FALSE, NULL, NULL,
- &irc_cfg_log_auto_server, NULL, irc_config_change_log },
- { "log_auto_channel",
- N_("automatically log channel chats"),
- OPTION_TYPE_BOOLEAN, BOOL_FALSE, BOOL_TRUE, BOOL_FALSE, NULL, NULL,
- &irc_cfg_log_auto_channel, NULL, irc_config_change_log },
- { "log_auto_private",
- N_("automatically log private chats"),
- OPTION_TYPE_BOOLEAN, BOOL_FALSE, BOOL_TRUE, BOOL_FALSE, NULL, NULL,
- &irc_cfg_log_auto_private, NULL, irc_config_change_log },
- { "log_hide_nickserv_pwd",
- N_("hide password displayed by nickserv"),
- OPTION_TYPE_BOOLEAN, BOOL_FALSE, BOOL_TRUE, BOOL_TRUE, NULL, NULL,
- &irc_cfg_log_hide_nickserv_pwd, NULL, irc_config_change_noop },
- { NULL, NULL, 0, 0, 0, 0, NULL, NULL, NULL, NULL, NULL }
-};
-
-/* config, server section */
+struct t_config_option *irc_config_log_auto_server;
+struct t_config_option *irc_config_log_auto_channel;
+struct t_config_option *irc_config_log_auto_private;
+struct t_config_option *irc_config_log_hide_nickserv_pwd;
-static t_irc_server cfg_server;
-
-t_config_option irc_options_server[] =
-{ { "server_name",
- N_("name associated to IRC server (for display only)"),
- OPTION_TYPE_STRING, 0, 0, 0, "", NULL,
- NULL, &(cfg_server.name), NULL },
- { "server_autoconnect",
- N_("automatically connect to server when WeeChat is starting"),
- OPTION_TYPE_BOOLEAN, BOOL_FALSE, BOOL_TRUE, BOOL_TRUE, NULL, NULL,
- &(cfg_server.autoconnect), NULL, NULL },
- { "server_autoreconnect",
- N_("automatically reconnect to server when disconnected"),
- OPTION_TYPE_BOOLEAN, BOOL_FALSE, BOOL_TRUE, BOOL_TRUE, NULL, NULL,
- &(cfg_server.autoreconnect), NULL, NULL },
- { "server_autoreconnect_delay",
- N_("delay (in seconds) before trying again to reconnect to server"),
- OPTION_TYPE_INT, 0, 65535, 30, NULL, NULL,
- &(cfg_server.autoreconnect_delay), NULL, NULL },
- { "server_address",
- N_("IP address or hostname of IRC server"),
- OPTION_TYPE_STRING, 0, 0, 0, "", NULL,
- NULL, &(cfg_server.address), NULL },
- { "server_port",
- N_("port for connecting to server"),
- OPTION_TYPE_INT, 0, 65535, 6667, NULL, NULL,
- &(cfg_server.port), NULL, NULL },
- { "server_ipv6",
- N_("use IPv6 protocol for server communication"),
- OPTION_TYPE_BOOLEAN, BOOL_FALSE, BOOL_TRUE, BOOL_FALSE, NULL, NULL,
- &(cfg_server.ipv6), NULL, NULL },
- { "server_ssl",
- N_("use SSL for server communication"),
- OPTION_TYPE_BOOLEAN, BOOL_FALSE, BOOL_TRUE, BOOL_FALSE, NULL, NULL,
- &(cfg_server.ssl), NULL, NULL },
- { "server_password",
- N_("password for IRC server"),
- OPTION_TYPE_STRING, 0, 0, 0, "", NULL,
- NULL, &(cfg_server.password), NULL },
- { "server_nick1",
- N_("nickname to use on IRC server"),
- OPTION_TYPE_STRING, 0, 0, 0, "", NULL,
- NULL, &(cfg_server.nick1), NULL },
- { "server_nick2",
- N_("alternate nickname to use on IRC server (if nickname is already used)"),
- OPTION_TYPE_STRING, 0, 0, 0, "", NULL,
- NULL, &(cfg_server.nick2), NULL },
- { "server_nick3",
- N_("2nd alternate nickname to use on IRC server (if alternate nickname is "
- "already used)"),
- OPTION_TYPE_STRING, 0, 0, 0, "", NULL,
- NULL, &(cfg_server.nick3), NULL },
- { "server_username",
- N_("user name to use on IRC server"),
- OPTION_TYPE_STRING, 0, 0, 0, "", NULL,
- NULL, &(cfg_server.username), NULL },
- { "server_realname",
- N_("real name to use on IRC server"),
- OPTION_TYPE_STRING, 0, 0, 0, "", NULL,
- NULL, &(cfg_server.realname), NULL },
- { "server_hostname",
- N_("custom hostname/IP for server (optional, if empty local hostname is "
- "used)"),
- OPTION_TYPE_STRING, 0, 0, 0, "", NULL,
- NULL, &(cfg_server.hostname), NULL },
- { "server_command",
- N_("command(s) to run when connected to server (many commands should be "
- "separated by ';', use '\\;' for a semicolon, special variables $nick, "
- "$channel and $server are replaced by their value)"),
- OPTION_TYPE_STRING, 0, 0, 0, "", NULL,
- NULL, &(cfg_server.command), NULL },
- { "server_command_delay",
- N_("delay (in seconds) after command was executed (example: give some time "
- "for authentication)"),
- OPTION_TYPE_INT, 0, 3600, 0, NULL, NULL,
- &(cfg_server.command_delay), NULL, NULL },
- { "server_autojoin",
- N_("comma separated list of channels to join when connected to server "
- "(example: \"#chan1,#chan2,#chan3 key1,key2\")"),
- OPTION_TYPE_STRING, 0, 0, 0, "", NULL,
- NULL, &(cfg_server.autojoin), NULL },
- { "server_autorejoin",
- N_("automatically rejoin channels when kicked"),
- OPTION_TYPE_BOOLEAN, BOOL_FALSE, BOOL_TRUE, BOOL_TRUE, NULL, NULL,
- &(cfg_server.autorejoin), NULL, NULL },
- { "server_notify_levels",
- N_("comma separated list of notify levels for channels of this server "
- "(format: #channel:1,..), a channel name '*' is reserved for server "
- "default notify level"),
- OPTION_TYPE_STRING, 0, 0, 0, "", NULL,
- NULL, &(cfg_server.notify_levels), irc_config_change_notify_levels },
- { NULL, NULL, 0, 0, 0, 0, NULL, NULL, NULL, NULL, NULL }
-};
-
-char *weechat_protocol_config_sections[] =
-{ "irc", "dcc",
- "log", "server",
- NULL
-};
-
-t_config_option *weechat_protocol_config_options[] =
-{ irc_options_irc, irc_options_dcc,
- irc_options_log, NULL,
- NULL };
-
-t_config_func_read_option *irc_config_read_functions[] =
-{ config_file_read_option, config_file_read_option,
- config_file_read_option, irc_config_read_server,
- NULL
-};
-
-t_config_func_write_options *irc_config_write_functions[] =
-{ config_file_write_options, config_file_write_options,
- config_file_write_options, irc_config_write_servers,
- NULL
-};
-
-t_config_func_write_options *irc_config_write_default_functions[] =
-{ config_file_write_options_default_values, config_file_write_options_default_values,
- config_file_write_options_default_values, irc_config_write_servers_default_values,
- NULL
-};
+/* config, server section */
+struct t_config_option *irc_config_server_name;
+struct t_config_option *irc_config_server_autoconnect;
+struct t_config_option *irc_config_server_autoreconnect;
+struct t_config_option *irc_config_server_autoreconnect_delay;
+struct t_config_option *irc_config_server_address;
+struct t_config_option *irc_config_server_port;
+struct t_config_option *irc_config_server_ipv6;
+struct t_config_option *irc_config_server_ssl;
+struct t_config_option *irc_config_server_password;
+struct t_config_option *irc_config_server_nick1;
+struct t_config_option *irc_config_server_nick2;
+struct t_config_option *irc_config_server_nick3;
+struct t_config_option *irc_config_server_username;
+struct t_config_option *irc_config_server_realname;
+struct t_config_option *irc_config_server_hostname;
+struct t_config_option *irc_config_server_command;
+struct t_config_option *irc_config_server_command_delay;
+struct t_config_option *irc_config_server_autojoin;
+struct t_config_option *irc_config_server_autorejoin;
+struct t_config_option *irc_config_server_notify_levels;
+
+struct t_irc_server *irc_config_server = NULL;
-/*
- * irc_config_change_noop: called when an option is changed by /set command
- * and that no special action is needed after that
- */
-
-void
-irc_config_change_noop ()
-{
- /* do nothing */
-}
/*
* irc_config_change_one_server_buffer: called when the "one server buffer"
@@ -389,10 +116,11 @@ irc_config_change_noop ()
void
irc_config_change_one_server_buffer ()
{
- if (irc_cfg_irc_one_server_buffer)
+ /*if (irc_config_irc_one_server_buffer)
irc_buffer_merge_servers (gui_current_window);
else
irc_buffer_split_server (gui_current_window);
+ */
}
/*
@@ -402,19 +130,21 @@ irc_config_change_one_server_buffer ()
void
irc_config_change_away_check ()
{
- if (irc_hook_timer_check_away)
+ if (irc_timer_check_away)
{
- weechat_hook_remove (irc_hook_timer_check_away);
- irc_hook_timer_check_away = NULL;
+ weechat_unhook (irc_timer_check_away);
+ irc_timer_check_away = NULL;
}
- if (irc_cfg_irc_away_check == 0)
+ if (weechat_config_integer (irc_config_irc_away_check) == 0)
{
/* reset away flag for all nicks/chans/servers */
- irc_server_remove_away ();
+ //irc_server_remove_away ();
}
- weechat_hook_add_timer (irc_cfg_irc_away_check * 60 * 1000,
- irc_server_timer_check_away,
- NULL);
+ /*irc_timer_check_away = weechat_hook_timer (weechat_config_integer (irc_config_irc_away_check) * 60 * 1000,
+ 0,
+ irc_server_timer_check_away,
+ NULL);
+ */
}
/*
@@ -425,7 +155,7 @@ irc_config_change_away_check ()
void
irc_config_change_log ()
{
- t_gui_buffer *ptr_buffer;
+ /*t_gui_buffer *ptr_buffer;
t_irc_server *ptr_server;
t_irc_channel *ptr_channel;
@@ -439,30 +169,31 @@ irc_config_change_log ()
if (ptr_server && !ptr_channel)
{
- if (irc_cfg_log_auto_server && !ptr_buffer->log_file)
+ if (irc_config_log_auto_server && !ptr_buffer->log_file)
gui_log_start (ptr_buffer);
- else if (!irc_cfg_log_auto_server && ptr_buffer->log_file)
+ else if (!irc_config_log_auto_server && ptr_buffer->log_file)
gui_log_end (ptr_buffer);
}
if (ptr_server && ptr_channel)
{
if (ptr_channel->type == IRC_CHANNEL_TYPE_CHANNEL)
{
- if (irc_cfg_log_auto_channel && !ptr_buffer->log_file)
+ if (irc_config_log_auto_channel && !ptr_buffer->log_file)
gui_log_start (ptr_buffer);
- else if (!irc_cfg_log_auto_channel && ptr_buffer->log_file)
+ else if (!irc_config_log_auto_channel && ptr_buffer->log_file)
gui_log_end (ptr_buffer);
}
else
{
- if (irc_cfg_log_auto_private && !ptr_buffer->log_file)
+ if (irc_config_log_auto_private && !ptr_buffer->log_file)
gui_log_start (ptr_buffer);
- else if (!irc_cfg_log_auto_private && ptr_buffer->log_file)
+ else if (!irc_config_log_auto_private && ptr_buffer->log_file)
gui_log_end (ptr_buffer);
}
}
}
}
+ */
}
/*
@@ -475,243 +206,495 @@ irc_config_change_notify_levels ()
}
/*
- * irc_config_create_dirs: create configuratoin directories (read from configuration file)
+ * irc_config_read_server_line: read a server line in configuration file
*/
void
-irc_config_create_dirs ()
+irc_config_read_server_line (void *config_file, char *option_name, char *value)
{
- char *dir1, *dir2;
+ struct t_config_option *ptr_option;
+ int rc;
- /* create DCC download directory */
- dir1 = weechat_strreplace (irc_cfg_dcc_download_path, "~", getenv ("HOME"));
- dir2 = weechat_strreplace (dir1, "%h", weechat_home);
- (void) weechat_create_dir (dir2, 0700);
- if (dir1)
- free (dir1);
- if (dir2)
- free (dir2);
+ /* make C compiler happy */
+ (void) config_file;
+
+ if (option_name && value)
+ {
+ if (irc_config_server)
+ {
+ ptr_option = weechat_config_search_option (irc_config_file,
+ irc_config_section_server,
+ option_name);
+ if (ptr_option)
+ {
+ rc = weechat_config_option_set (ptr_option, value);
+ switch (rc)
+ {
+ case 2:
+ break;
+ case 1:
+ break;
+ case 0:
+ weechat_printf (NULL,
+ _("%sIrc: warning, failed to set option "
+ "\"%s\" with value \"%s\""),
+ weechat_prefix ("error"),
+ option_name, value);
+ break;
+ }
+ }
+ else
+ {
+ weechat_printf (NULL,
+ _("%sIrc: warning, option not found in config "
+ "file: \"%s\""),
+ weechat_prefix ("error"),
+ option_name);
+ }
+ }
+ }
+ else
+ {
+ /* beginning of [server] section: save current server and create new
+ with default values for filling with next lines in file */
+ if (irc_config_server)
+ {
+ irc_server_init_with_config_options (irc_config_server,
+ irc_config_section_server);
+ }
+ irc_config_server = irc_server_alloc ();
+ if (!irc_config_server)
+ {
+ weechat_printf (NULL,
+ _("%sIrc: error creating server for reading "
+ "config file"),
+ weechat_prefix ("error"));
+ }
+ }
}
/*
- * irc_config_get_server_option_ptr: get a pointer to a server configuration option
+ * irc_config_write_servers: write servers in configuration file
*/
-void *
-irc_config_get_server_option_ptr (t_irc_server *server, char *option_name)
+void
+irc_config_write_servers (void *config_file, char *section_name)
{
- if (weechat_strcasecmp (option_name, "server_name") == 0)
- return (void *)(&server->name);
- if (weechat_strcasecmp (option_name, "server_autoconnect") == 0)
- return (void *)(&server->autoconnect);
- if (weechat_strcasecmp (option_name, "server_autoreconnect") == 0)
- return (void *)(&server->autoreconnect);
- if (weechat_strcasecmp (option_name, "server_autoreconnect_delay") == 0)
- return (void *)(&server->autoreconnect_delay);
- if (weechat_strcasecmp (option_name, "server_address") == 0)
- return (void *)(&server->address);
- if (weechat_strcasecmp (option_name, "server_port") == 0)
- return (void *)(&server->port);
- if (weechat_strcasecmp (option_name, "server_ipv6") == 0)
- return (void *)(&server->ipv6);
- if (weechat_strcasecmp (option_name, "server_ssl") == 0)
- return (void *)(&server->ssl);
- if (weechat_strcasecmp (option_name, "server_password") == 0)
- return (void *)(&server->password);
- if (weechat_strcasecmp (option_name, "server_nick1") == 0)
- return (void *)(&server->nick1);
- if (weechat_strcasecmp (option_name, "server_nick2") == 0)
- return (void *)(&server->nick2);
- if (weechat_strcasecmp (option_name, "server_nick3") == 0)
- return (void *)(&server->nick3);
- if (weechat_strcasecmp (option_name, "server_username") == 0)
- return (void *)(&server->username);
- if (weechat_strcasecmp (option_name, "server_realname") == 0)
- return (void *)(&server->realname);
- if (weechat_strcasecmp (option_name, "server_hostname") == 0)
- return (void *)(&server->hostname);
- if (weechat_strcasecmp (option_name, "server_command") == 0)
- return (void *)(&server->command);
- if (weechat_strcasecmp (option_name, "server_command_delay") == 0)
- return (void *)(&server->command_delay);
- if (weechat_strcasecmp (option_name, "server_autojoin") == 0)
- return (void *)(&server->autojoin);
- if (weechat_strcasecmp (option_name, "server_autorejoin") == 0)
- return (void *)(&server->autorejoin);
- if (weechat_strcasecmp (option_name, "server_notify_levels") == 0)
- return (void *)(&server->notify_levels);
- /* option not found */
- return NULL;
+ struct t_irc_server *ptr_server;
+
+ for (ptr_server = irc_servers; ptr_server;
+ ptr_server = ptr_server->next_server)
+ {
+ if (!ptr_server->temp_server)
+ {
+ weechat_config_write_line (config_file, section_name, NULL);
+ weechat_config_write_line (config_file, "server_name", "\"%s\"",
+ ptr_server->name);
+ weechat_config_write_line (config_file, "server_autoconnect", "%s",
+ (ptr_server->autoconnect) ? "on" : "off");
+ weechat_config_write_line (config_file, "server_autoreconnect", "%s",
+ (ptr_server->autoreconnect) ? "on" : "off");
+ weechat_config_write_line (config_file, "server_autoreconnect_delay", "%d",
+ ptr_server->autoreconnect_delay);
+ weechat_config_write_line (config_file, "server_address", "\"%s\"", ptr_server->address);
+ weechat_config_write_line (config_file, "server_port", "%d", ptr_server->port);
+ weechat_config_write_line (config_file, "server_ipv6", "%s",
+ (ptr_server->ipv6) ? "on" : "off");
+ weechat_config_write_line (config_file, "server_ssl", "%s",
+ (ptr_server->ssl) ? "on" : "off");
+ weechat_config_write_line (config_file, "server_password", "\"%s\"",
+ (ptr_server->password) ? ptr_server->password : "");
+ weechat_config_write_line (config_file, "server_nick1", "\"%s\"",
+ ptr_server->nick1);
+ weechat_config_write_line (config_file, "server_nick2", "\"%s\"",
+ ptr_server->nick2);
+ weechat_config_write_line (config_file, "server_nick3", "\"%s\"",
+ ptr_server->nick3);
+ weechat_config_write_line (config_file, "server_username", "\"%s\"",
+ ptr_server->username);
+ weechat_config_write_line (config_file, "server_realname", "\"%s\"",
+ ptr_server->realname);
+ weechat_config_write_line (config_file, "server_hostname", "\"%s\"",
+ (ptr_server->hostname) ? ptr_server->hostname : "");
+ weechat_config_write_line (config_file, "server_command", "\"%s\"",
+ (ptr_server->command) ? ptr_server->command : "");
+ weechat_config_write_line (config_file, "server_command_delay", "%d",
+ ptr_server->command_delay);
+ weechat_config_write_line (config_file, "server_autojoin", "\"%s\"",
+ (ptr_server->autojoin) ? ptr_server->autojoin : "");
+ weechat_config_write_line (config_file, "server_autorejoin", "%s",
+ (ptr_server->autorejoin) ? "on" : "off");
+ weechat_config_write_line (config_file, "server_notify_levels", "\"%s\"",
+ (ptr_server->notify_levels) ? ptr_server->notify_levels : "");
+ }
+ }
}
/*
- * irc_config_set_server_value: set new value for an option of a server
- * return: 0 if success
- * -1 if option not found
- * -2 if bad value
+ * irc_config_write_server_default: write default server in configuration file
*/
-int
-irc_config_set_server_value (t_irc_server *server, char *option_name,
- char *value)
+void
+irc_config_write_server_default (void *config_file, char *section_name)
{
- t_config_option *ptr_option;
- int i;
- void *ptr_data;
- int int_value;
+ struct passwd *my_passwd;
+ char *realname, *pos;
+
+ weechat_config_write_line (config_file, section_name, NULL);
- ptr_data = irc_config_get_server_option_ptr (server, option_name);
- if (!ptr_data)
- return -1;
+ weechat_config_write_line (config_file, "server_name", "%s", "\"freenode\"");
+ weechat_config_write_line (config_file, "server_autoconnect", "%s", "off");
+ weechat_config_write_line (config_file, "server_autoreconnect", "%s", "on");
+ weechat_config_write_line (config_file, "server_autoreconnect_delay", "%s", "30");
+ weechat_config_write_line (config_file, "server_address", "%s", "\"irc.freenode.net\"");
+ weechat_config_write_line (config_file, "server_port", "%s", "6667");
+ weechat_config_write_line (config_file, "server_ipv6", "%s", "off");
+ weechat_config_write_line (config_file, "server_ssl", "%s", "off");
+ weechat_config_write_line (config_file, "server_password", "%s", "\"\"");
- ptr_option = NULL;
- for (i = 0; irc_options_server[i].name; i++)
+ /* Get the user's name from /etc/passwd */
+ if ((my_passwd = getpwuid (geteuid ())) != NULL)
{
- /* if option found, return pointer */
- if (weechat_strcasecmp (irc_options_server[i].name, option_name) == 0)
+ weechat_config_write_line (config_file, "server_nick1", "\"%s\"", my_passwd->pw_name);
+ weechat_config_write_line (config_file, "server_nick2", "\"%s1\"", my_passwd->pw_name);
+ weechat_config_write_line (config_file, "server_nick3", "\"%s2\"", my_passwd->pw_name);
+ weechat_config_write_line (config_file, "server_username", "\"%s\"", my_passwd->pw_name);
+ if ((!my_passwd->pw_gecos)
+ || (my_passwd->pw_gecos[0] == '\0')
+ || (my_passwd->pw_gecos[0] == ',')
+ || (my_passwd->pw_gecos[0] == ' '))
+ weechat_config_write_line (config_file, "server_realname", "\"%s\"", my_passwd->pw_name);
+ else
{
- ptr_option = &irc_options_server[i];
- break;
+ realname = strdup (my_passwd->pw_gecos);
+ pos = strchr (realname, ',');
+ if (pos)
+ pos[0] = '\0';
+ weechat_config_write_line (config_file, "server_realname", "\"%s\"",
+ realname);
+ if (pos)
+ pos[0] = ',';
+ free (realname);
}
}
- if (!ptr_option)
- return -1;
-
- switch (ptr_option->type)
+ else
{
- case OPTION_TYPE_BOOLEAN:
- int_value = config_option_option_get_boolean_value (value);
- switch (int_value)
- {
- case BOOL_TRUE:
- *((int *)(ptr_data)) = BOOL_TRUE;
- break;
- case BOOL_FALSE:
- *((int *)(ptr_data)) = BOOL_FALSE;
- break;
- default:
- return -2;
- }
- break;
- case OPTION_TYPE_INT:
- int_value = atoi (value);
- if ((int_value < ptr_option->min) || (int_value > ptr_option->max))
- return -2;
- *((int *)(ptr_data)) = int_value;
- break;
- case OPTION_TYPE_INT_WITH_STRING:
- int_value = config_option_get_pos_array_values (ptr_option->array_values,
- value);
- if (int_value < 0)
- return -2;
- *((int *)(ptr_data)) = int_value;
- break;
- case OPTION_TYPE_COLOR:
- if (!gui_color_assign ((int *)ptr_data, value))
- return -2;
- break;
- case OPTION_TYPE_STRING:
- if (*((char **)ptr_data))
- free (*((char **)ptr_data));
- *((char **)ptr_data) = strdup (value);
- break;
+ /* default values if /etc/passwd can't be read */
+ weechat_config_write_line (config_file, "server_nick1", "%s", "\"weechat1\"");
+ weechat_config_write_line (config_file, "server_nick2", "%s", "\"weechat2\"");
+ weechat_config_write_line (config_file, "server_nick3", "%s", "\"weechat3\"");
+ weechat_config_write_line (config_file, "server_username", "%s", "\"weechat\"");
+ weechat_config_write_line (config_file, "server_realname", "%s", "\"weechat\"");
}
- if (ptr_option->handler_change != NULL)
- (void) (ptr_option->handler_change());
- return 0;
+
+ weechat_config_write_line (config_file, "server_hostname", "%s", "\"\"");
+ weechat_config_write_line (config_file, "server_command", "%s", "\"\"");
+ weechat_config_write_line (config_file, "server_command_delay", "%s", "0");
+ weechat_config_write_line (config_file, "server_autojoin", "%s", "\"\"");
+ weechat_config_write_line (config_file, "server_autorejoin", "%s", "on");
+ weechat_config_write_line (config_file, "server_notify_levels", "%s", "\"\"");
}
/*
- * irc_config_allocate_server: allocate a new server
+ * irc_config_init: init IRC configuration file
+ * return: 1 if ok, 0 if error
*/
int
-irc_config_allocate_server (char *filename, int line_number)
+irc_config_init ()
{
- if (!cfg_server.name
- || !cfg_server.address
- || cfg_server.port < 0
- || !cfg_server.nick1
- || !cfg_server.nick2
- || !cfg_server.nick3
- || !cfg_server.username
- || !cfg_server.realname)
- {
- irc_server_free_all ();
- gui_chat_printf (NULL,
- _("%s %s, line %d: new server, but previous was "
- "incomplete\n"),
- WEECHAT_WARNING, filename, line_number);
+ struct t_config_section *ptr_section;
+
+ irc_config_file = weechat_config_new (IRC_CONFIG_FILENAME);
+ if (!irc_config_file)
return 0;
-
- }
- if (irc_server_name_already_exists (cfg_server.name))
+
+ ptr_section = weechat_config_new_section (irc_config_file, "irc",
+ NULL, NULL, NULL);
+ if (!ptr_section)
{
- irc_server_free_all ();
- gui_chat_printf (NULL,
- _("%s %s, line %d: server '%s' already exists\n"),
- WEECHAT_WARNING, filename, line_number,
- cfg_server.name);
+ weechat_config_free (irc_config_file);
return 0;
}
- if (!irc_server_new (cfg_server.name,
- cfg_server.autoconnect, cfg_server.autoreconnect,
- cfg_server.autoreconnect_delay, 0, cfg_server.address,
- cfg_server.port, cfg_server.ipv6, cfg_server.ssl,
- cfg_server.password, cfg_server.nick1,
- cfg_server.nick2, cfg_server.nick3,
- cfg_server.username, cfg_server.realname,
- cfg_server.hostname, cfg_server.command,
- cfg_server.command_delay, cfg_server.autojoin,
- cfg_server.autorejoin, cfg_server.notify_levels))
+
+ irc_config_irc_one_server_buffer = weechat_config_new_option (
+ ptr_section, "irc_one_server_buffer", "boolean",
+ N_("use same buffer for all servers"),
+ NULL, 0, 0, "off", &irc_config_change_one_server_buffer);
+ irc_config_irc_open_near_server = weechat_config_new_option (
+ ptr_section, "irc_open_near_server", "boolean",
+ N_("open new channels/privates near server"),
+ NULL, 0, 0, "off", NULL);
+ irc_config_irc_nick_prefix = weechat_config_new_option (
+ ptr_section, "irc_nick_prefix", "string",
+ N_("text to display before nick in chat window"),
+ NULL, 0, 0, "", NULL);
+ irc_config_irc_nick_suffix = weechat_config_new_option (
+ ptr_section, "irc_nick_suffix", "string",
+ N_("text to display after nick in chat window"),
+ NULL, 0, 0, "", NULL);
+ irc_config_irc_display_away = weechat_config_new_option (
+ ptr_section, "irc_display_away", "integer",
+ N_("display message when (un)marking as away"),
+ "off|local|channel", 0, 0, "local", NULL);
+ irc_config_irc_show_away_once = weechat_config_new_option (
+ ptr_section, "irc_show_away_once", "boolean",
+ N_("show remote away message only once in private"),
+ NULL, 0, 0, "on", NULL);
+ irc_config_irc_default_msg_part = weechat_config_new_option (
+ ptr_section, "irc_default_msg_part", "string",
+ N_("default part message (leaving channel) ('%v' will be replaced by "
+ "WeeChat version in string)"),
+ NULL, 0, 0, "WeeChat %v", NULL);
+ irc_config_irc_default_msg_quit = weechat_config_new_option (
+ ptr_section, "irc_default_msg_quit", "string",
+ N_("default quit message ('%v' will be replaced by WeeChat version in "
+ "string)"),
+ NULL, 0, 0, "WeeChat %v", NULL);
+ irc_config_irc_notice_as_pv = weechat_config_new_option (
+ ptr_section, "irc_notice_as_pv", "boolean",
+ N_("display notices as private messages"),
+ NULL, 0, 0, "off", NULL);
+ irc_config_irc_away_check = weechat_config_new_option (
+ ptr_section, "irc_away_check", "integer",
+ N_("interval between two checks for away (in minutes, 0 = never "
+ "check)"),
+ NULL, 0, INT_MAX, "0", &irc_config_change_away_check);
+ irc_config_irc_away_check_max_nicks = weechat_config_new_option (
+ ptr_section, "irc_away_check_max_nicks", "integer",
+ N_("do not check away nicks on channels with high number of nicks "
+ "(0 = unlimited)"),
+ NULL, 0, INT_MAX, "0", &irc_config_change_away_check);
+ irc_config_irc_lag_check = weechat_config_new_option (
+ ptr_section, "irc_lag_check", "integer",
+ N_("interval between two checks for lag (in seconds, 0 = never "
+ "check)"),
+ NULL, 0, INT_MAX, "60", NULL);
+ irc_config_irc_lag_min_show = weechat_config_new_option (
+ ptr_section, "irc_lag_min_show", "integer",
+ N_("minimum lag to show (in seconds)"),
+ NULL, 0, INT_MAX, "1", NULL);
+ irc_config_irc_lag_disconnect = weechat_config_new_option (
+ ptr_section, "irc_lag_disconnect", "integer",
+ N_("disconnect after important lag (in minutes, 0 = never "
+ "disconnect)"),
+ NULL, 0, INT_MAX, "5", NULL);
+ irc_config_irc_anti_flood = weechat_config_new_option (
+ ptr_section, "irc_anti_flood", "integer",
+ N_("anti-flood: # seconds between two user messages (0 = no "
+ "anti-flood)"),
+ NULL, 0, 5, "2", NULL);
+ irc_config_irc_highlight = weechat_config_new_option (
+ ptr_section, "irc_highlight", "string",
+ N_("comma separated list of words to highlight (case insensitive "
+ "comparison, words may begin or end with \"*\" for partial match)"),
+ NULL, 0, 0, "", NULL);
+ irc_config_irc_colors_receive = weechat_config_new_option (
+ ptr_section, "irc_colors_receive", "boolean",
+ N_("when off, colors codes are ignored in incoming messages"),
+ NULL, 0, 0, "on", NULL);
+ irc_config_irc_colors_send = weechat_config_new_option (
+ ptr_section, "irc_colors_send", "boolean",
+ N_("allow user to send colors with special codes (^Cb=bold, "
+ "^Ccxx=color, ^Ccxx,yy=color+background, ^Cu=underline, "
+ "^Cr=reverse)"),
+ NULL, 0, 0, "on", NULL);
+ irc_config_irc_send_unknown_commands = weechat_config_new_option (
+ ptr_section, "irc_send_unknown_commands", "boolean",
+ N_("send unknown commands to IRC server"),
+ NULL, 0, 0, "off", NULL);
+
+ ptr_section = weechat_config_new_section (irc_config_file, "dcc",
+ NULL, NULL, NULL);
+ if (!ptr_section)
{
- irc_server_free_all ();
- gui_chat_printf (NULL,
- _("%s %s, line %d: unable to create server\n"),
- WEECHAT_WARNING, filename, line_number);
+ weechat_config_free (irc_config_file);
return 0;
}
- irc_server_destroy (&cfg_server);
- irc_server_init (&cfg_server);
-
- return 1;
-}
-
-/*
- * irc_config_read_server: read a server option in configuration file
- * Return: 0 = successful
- * -1 = option not found
- * -2 = bad format/value
- */
-
-int
-irc_config_read_server (t_config_option *options,
- char *option_name, char *value)
-{
- /* make C compiler happy */
- (void) options;
+ irc_config_dcc_auto_accept_files = weechat_config_new_option (
+ ptr_section, "dcc_auto_accept_files", "boolean",
+ N_("automatically accept incoming dcc files (use carefully!)"),
+ NULL, 0, 0, "off", NULL);
+ irc_config_dcc_auto_accept_chats = weechat_config_new_option (
+ ptr_section, "dcc_auto_accept_chats", "boolean",
+ N_("automatically accept dcc chats (use carefully!)"),
+ NULL, 0, 0, "off", NULL);
+ irc_config_dcc_timeout = weechat_config_new_option (
+ ptr_section, "dcc_timeout", "integer",
+ N_("timeout for dcc request (in seconds)"),
+ NULL, 5, INT_MAX, "300", NULL);
+ irc_config_dcc_blocksize = weechat_config_new_option (
+ ptr_section, "dcc_blocksize", "integer",
+ N_("block size for dcc packets in bytes"),
+ NULL, IRC_DCC_MIN_BLOCKSIZE, IRC_DCC_MAX_BLOCKSIZE, "65536",
+ NULL);
+ irc_config_dcc_fast_send = weechat_config_new_option (
+ ptr_section, "dcc_fast_send", "boolean",
+ N_("does not wait for ACK when sending file"),
+ NULL, 0, 0, "on", NULL);
+ irc_config_dcc_port_range = weechat_config_new_option (
+ ptr_section, "dcc_port_range", "string",
+ N_("restricts outgoing dcc to use only ports in the given range "
+ "(useful for NAT) (syntax: a single port, ie. 5000 or a port "
+ "range, ie. 5000-5015, empty value means any port)"),
+ NULL, 0, 0, "", NULL);
+ irc_config_dcc_own_ip = weechat_config_new_option (
+ ptr_section, "dcc_own_ip", "string",
+ N_("IP or DNS address used for outgoing dcc "
+ "(if empty, local interface IP is used)"),
+ NULL, 0, 0, "", NULL);
+ irc_config_dcc_download_path = weechat_config_new_option (
+ ptr_section, "dcc_download_path", "string",
+ N_("path for writing incoming files with dcc"),
+ NULL, 0, 0, "%h/dcc", NULL);
+ irc_config_dcc_upload_path = weechat_config_new_option (
+ ptr_section, "dcc_upload_path", "string",
+ N_("path for reading files when sending thru dcc (when no path is "
+ "specified)"),
+ NULL, 0, 0, "~", NULL);
+ irc_config_dcc_convert_spaces = weechat_config_new_option (
+ ptr_section, "dcc_convert_spaces", "boolean",
+ N_("convert spaces to underscores when sending files"),
+ NULL, 0, 0, "on", NULL);
+ irc_config_dcc_auto_rename = weechat_config_new_option (
+ ptr_section, "dcc_auto_rename", "boolean",
+ N_("rename incoming files if already exists (add '.1', '.2', ...)"),
+ NULL, 0, 0, "on", NULL);
+ irc_config_dcc_auto_resume = weechat_config_new_option (
+ ptr_section, "dcc_auto_resume", "boolean",
+ N_("automatically resume dcc transfer if connection with remote host "
+ "is loosed"),
+ NULL, 0, 0, "on", NULL);
- if (option_name)
+ ptr_section = weechat_config_new_section (irc_config_file, "log",
+ NULL, NULL, NULL);
+ if (!ptr_section)
{
- if (value[0])
- {
- /* bind key (overwrite any binding with same key) */
- gui_keyboard_bind (option_name, value);
- }
- else
- {
- /* unbin key if no value given */
- gui_keyboard_unbind (option_name);
- }
+ weechat_config_free (irc_config_file);
+ return 0;
}
- else
+
+ irc_config_log_auto_server = weechat_config_new_option (
+ ptr_section, "log_auto_server", "boolean",
+ N_("automatically log server messages"),
+ NULL, 0, 0, "off", &irc_config_change_log);
+ irc_config_log_auto_channel = weechat_config_new_option (
+ ptr_section, "log_auto_channel", "boolean",
+ N_("automatically log channel chats"),
+ NULL, 0, 0, "off", &irc_config_change_log);
+ irc_config_log_auto_private = weechat_config_new_option (
+ ptr_section, "log_auto_private", "boolean",
+ N_("automatically log private chats"),
+ NULL, 0, 0, "off", &irc_config_change_log);
+ irc_config_log_hide_nickserv_pwd = weechat_config_new_option (
+ ptr_section, "log_hide_nickserv_pwd", "boolean",
+ N_("hide password displayed by nickserv"),
+ NULL, 0, 0, "on", &irc_config_change_log);
+
+ ptr_section = weechat_config_new_section (irc_config_file, "server",
+ irc_config_read_server_line,
+ irc_config_write_servers,
+ irc_config_write_server_default);
+ if (!ptr_section)
{
- /* does nothing for new [key] section */
+ weechat_config_free (irc_config_file);
+ return 0;
}
- /* all ok */
- return 0;
+ irc_config_section_server = ptr_section;
+
+ irc_config_server_name = weechat_config_new_option (
+ ptr_section, "server_name", "string",
+ N_("name associated to IRC server (for display only)"),
+ NULL, 0, 0, "", NULL);
+ irc_config_server_autoconnect = weechat_config_new_option (
+ ptr_section, "server_autoconnect", "boolean",
+ N_("automatically connect to server when WeeChat is starting"),
+ NULL, 0, 0, "off", NULL);
+ irc_config_server_autoreconnect = weechat_config_new_option (
+ ptr_section, "server_autoreconnect", "boolean",
+ N_("automatically reconnect to server when disconnected"),
+ NULL, 0, 0, "on", NULL);
+ irc_config_server_autoreconnect_delay = weechat_config_new_option (
+ ptr_section, "server_autoreconnect_delay", "integer",
+ N_("delay (in seconds) before trying again to reconnect to server"),
+ NULL, 0, 65535, "30", NULL);
+ irc_config_server_address = weechat_config_new_option (
+ ptr_section, "server_address", "string",
+ N_("IP address or hostname of IRC server"),
+ NULL, 0, 0, "", NULL);
+ irc_config_server_port = weechat_config_new_option (
+ ptr_section, "server_port", "integer",
+ N_("port for connecting to server"),
+ NULL, 0, 65535, "6667", NULL);
+ irc_config_server_ipv6 = weechat_config_new_option (
+ ptr_section, "server_ipv6", "boolean",
+ N_("use IPv6 protocol for server communication"),
+ NULL, 0, 0, "on", NULL);
+ irc_config_server_ssl = weechat_config_new_option (
+ ptr_section, "server_ssl", "boolean",
+ N_("use SSL for server communication"),
+ NULL, 0, 0, "on", NULL);
+ irc_config_server_password = weechat_config_new_option (
+ ptr_section, "server_password", "string",
+ N_("password for IRC server"),
+ NULL, 0, 0, "", NULL);
+ irc_config_server_nick1 = weechat_config_new_option (
+ ptr_section, "server_nick1", "string",
+ N_("nickname to use on IRC server"),
+ NULL, 0, 0, "", NULL);
+ irc_config_server_nick2 = weechat_config_new_option (
+ ptr_section, "server_nick2", "string",
+ N_("alternate nickname to use on IRC server (if nickname is already "
+ "used)"),
+ NULL, 0, 0, "", NULL);
+ irc_config_server_nick3 = weechat_config_new_option (
+ ptr_section, "server_nick3", "string",
+ N_("2nd alternate nickname to use on IRC server (if alternate "
+ "nickname is already used)"),
+ NULL, 0, 0, "", NULL);
+ irc_config_server_username = weechat_config_new_option (
+ ptr_section, "server_username", "string",
+ N_("user name to use on IRC server"),
+ NULL, 0, 0, "", NULL);
+ irc_config_server_realname = weechat_config_new_option (
+ ptr_section, "server_realname", "string",
+ N_("real name to use on IRC server"),
+ NULL, 0, 0, "", NULL);
+ irc_config_server_hostname = weechat_config_new_option (
+ ptr_section, "server_hostname", "string",
+ N_("custom hostname/IP for server (optional, if empty local hostname "
+ "is used)"),
+ NULL, 0, 0, "", NULL);
+ irc_config_server_command = weechat_config_new_option (
+ ptr_section, "server_command", "string",
+ N_("command(s) to run when connected to server (many commands should "
+ "be separated by ';', use '\\;' for a semicolon, special variables "
+ "$nick, $channel and $server are replaced by their value)"),
+ NULL, 0, 0, "", NULL);
+ irc_config_server_command_delay = weechat_config_new_option (
+ ptr_section, "server_command_delay", "integer",
+ N_("delay (in seconds) after command was executed (example: give some "
+ "time for authentication)"),
+ NULL, 0, 3600, "0", NULL);
+ irc_config_server_autojoin = weechat_config_new_option (
+ ptr_section, "server_autojoin", "string",
+ N_("comma separated list of channels to join when connected to server "
+ "(example: \"#chan1,#chan2,#chan3 key1,key2\")"),
+ NULL, 0, 0, "", NULL);
+ irc_config_server_autorejoin = weechat_config_new_option (
+ ptr_section, "server_autorejoin", "string",
+ N_("automatically rejoin channels when kicked"),
+ NULL, 0, 0, "on", NULL);
+ irc_config_server_notify_levels = weechat_config_new_option (
+ ptr_section, "server_notify_levels", "string",
+ N_("comma separated list of notify levels for channels of this server "
+ "(format: #channel:1,..), a channel name '*' is reserved for "
+ "server default notify level"),
+ NULL, 0, 0, "", NULL);
+
+ return 1;
}
/*
@@ -724,147 +707,30 @@ irc_config_read_server (t_config_option *options,
int
irc_config_read ()
{
- irc_server_init (&cfg_server);
+ int rc;
- return config_file_read (weechat_protocol_config_sections,
- weechat_protocol_config_options,
- irc_config_read_functions,
- irc_config_write_default_functions,
- IRC_CONFIG_NAME);
-}
+ irc_config_server = NULL;
-/*
- * irc_config_write_servers: write servers sections in configuration file
- * Return: 0 = successful
- * -1 = write error
- */
+ rc = weechat_config_read (irc_config_file);
-int
-irc_config_write_servers (FILE *file, char *section_name,
- t_config_option *options)
-{
- t_irc_server *ptr_server;
-
- /* make C compiler happy */
- (void) options;
+ if (irc_config_server)
+ irc_server_init_with_config_options (irc_config_server,
+ irc_config_section_server);
- for (ptr_server = irc_servers; ptr_server;
- ptr_server = ptr_server->next_server)
- {
- if (!ptr_server->temp_server)
- {
- weechat_iconv_fprintf (file, "\n[%s]\n", section_name);
- weechat_iconv_fprintf (file, "server_name = \"%s\"\n", ptr_server->name);
- weechat_iconv_fprintf (file, "server_autoconnect = %s\n",
- (ptr_server->autoconnect) ? "on" : "off");
- weechat_iconv_fprintf (file, "server_autoreconnect = %s\n",
- (ptr_server->autoreconnect) ? "on" : "off");
- weechat_iconv_fprintf (file, "server_autoreconnect_delay = %d\n",
- ptr_server->autoreconnect_delay);
- weechat_iconv_fprintf (file, "server_address = \"%s\"\n", ptr_server->address);
- weechat_iconv_fprintf (file, "server_port = %d\n", ptr_server->port);
- weechat_iconv_fprintf (file, "server_ipv6 = %s\n",
- (ptr_server->ipv6) ? "on" : "off");
- weechat_iconv_fprintf (file, "server_ssl = %s\n",
- (ptr_server->ssl) ? "on" : "off");
- weechat_iconv_fprintf (file, "server_password = \"%s\"\n",
- (ptr_server->password) ? ptr_server->password : "");
- weechat_iconv_fprintf (file, "server_nick1 = \"%s\"\n", ptr_server->nick1);
- weechat_iconv_fprintf (file, "server_nick2 = \"%s\"\n", ptr_server->nick2);
- weechat_iconv_fprintf (file, "server_nick3 = \"%s\"\n", ptr_server->nick3);
- weechat_iconv_fprintf (file, "server_username = \"%s\"\n", ptr_server->username);
- weechat_iconv_fprintf (file, "server_realname = \"%s\"\n", ptr_server->realname);
- weechat_iconv_fprintf (file, "server_hostname = \"%s\"\n",
- (ptr_server->hostname) ? ptr_server->hostname : "");
- weechat_iconv_fprintf (file, "server_command = \"%s\"\n",
- (ptr_server->command) ? ptr_server->command : "");
- weechat_iconv_fprintf (file, "server_command_delay = %d\n", ptr_server->command_delay);
- weechat_iconv_fprintf (file, "server_autojoin = \"%s\"\n",
- (ptr_server->autojoin) ? ptr_server->autojoin : "");
- weechat_iconv_fprintf (file, "server_autorejoin = %s\n",
- (ptr_server->autorejoin) ? "on" : "off");
- weechat_iconv_fprintf (file, "server_notify_levels = \"%s\"\n",
- (ptr_server->notify_levels) ? ptr_server->notify_levels : "");
- }
- }
-
- /* all ok */
- return 0;
+ return rc;
}
/*
- * irc_config_write_server_default_values: write server section with default values
- * in configuration file
- * Return: 0 = successful
- * -1 = write error
+ * irc_config_reload: read IRC configuration file
+ * return: 0 = successful
+ * -1 = configuration file file not found
+ * -2 = error in configuration file
*/
int
-irc_config_write_server_default_values (FILE *file, char *section_name,
- t_config_option *options)
+irc_config_reload ()
{
- /* make C compiler happy */
- (void) options;
-
- struct passwd *my_passwd;
- char *realname, *pos;
-
- weechat_iconv_fprintf (file, "\n[%s]\n", section_name);
-
- weechat_iconv_fprintf (file, "server_name = \"freenode\"\n");
- weechat_iconv_fprintf (file, "server_autoconnect = on\n");
- weechat_iconv_fprintf (file, "server_autoreconnect = on\n");
- weechat_iconv_fprintf (file, "server_autoreconnect_delay = 30\n");
- weechat_iconv_fprintf (file, "server_address = \"irc.freenode.net\"\n");
- weechat_iconv_fprintf (file, "server_port = 6667\n");
- weechat_iconv_fprintf (file, "server_ipv6 = off\n");
- weechat_iconv_fprintf (file, "server_ssl = off\n");
- weechat_iconv_fprintf (file, "server_password = \"\"\n");
-
- /* Get the user's name from /etc/passwd */
- if ((my_passwd = getpwuid (geteuid ())) != NULL)
- {
- weechat_iconv_fprintf (file, "server_nick1 = \"%s\"\n", my_passwd->pw_name);
- weechat_iconv_fprintf (file, "server_nick2 = \"%s1\"\n", my_passwd->pw_name);
- weechat_iconv_fprintf (file, "server_nick3 = \"%s2\"\n", my_passwd->pw_name);
- weechat_iconv_fprintf (file, "server_username = \"%s\"\n", my_passwd->pw_name);
- if ((!my_passwd->pw_gecos)
- || (my_passwd->pw_gecos[0] == '\0')
- || (my_passwd->pw_gecos[0] == ',')
- || (my_passwd->pw_gecos[0] == ' '))
- weechat_iconv_fprintf (file, "server_realname = \"%s\"\n", my_passwd->pw_name);
- else
- {
- realname = strdup (my_passwd->pw_gecos);
- pos = strchr (realname, ',');
- if (pos)
- pos[0] = '\0';
- weechat_iconv_fprintf (file, "server_realname = \"%s\"\n",
- realname);
- if (pos)
- pos[0] = ',';
- free (realname);
- }
- }
- else
- {
- /* default values if /etc/passwd can't be read */
- weechat_iconv_fprintf (file, "server_nick1 = \"weechat1\"\n");
- weechat_iconv_fprintf (file, "server_nick2 = \"weechat2\"\n");
- weechat_iconv_fprintf (file, "server_nick3 = \"weechat3\"\n");
- weechat_iconv_fprintf (file, "server_username = \"weechat\"\n");
- weechat_iconv_fprintf (file, "server_realname = \"weechat\"\n");
- }
-
- weechat_iconv_fprintf (file, "server_hostname = \"\"\n");
- weechat_iconv_fprintf (file, "server_command = \"\"\n");
- weechat_iconv_fprintf (file, "server_command_delay = 0\n");
- weechat_iconv_fprintf (file, "server_autojoin = \"\"\n");
- weechat_iconv_fprintf (file, "server_autorejoin = on\n");
- weechat_iconv_fprintf (file, "server_notify_levels = \"\"\n");
-
- /* all ok */
- return 0;
+ return weechat_config_reload (irc_config_file);
}
/*
@@ -876,8 +742,5 @@ irc_config_write_server_default_values (FILE *file, char *section_name,
int
irc_config_write ()
{
- return config_file_write (weechat_protocol_config_sections,
- weechat_protocol_config_options,
- irc_config_write_functions,
- IRC_CONFIG_NAME);
+ return weechat_config_write (irc_config_file);
}
diff --git a/src/plugins/irc/irc-config.h b/src/plugins/irc/irc-config.h
index 1d3efedb4..6dc336005 100644
--- a/src/plugins/irc/irc-config.h
+++ b/src/plugins/irc/irc-config.h
@@ -20,62 +20,60 @@
#ifndef __WEECHAT_IRC_CONFIG_H
#define __WEECHAT_IRC_CONFIG_H 1
-#include "../../core/config-option.h"
+#define IRC_CONFIG_FILENAME "irc.rc"
-#define IRC_CONFIG_NAME "irc.rc"
+#define IRC_CONFIG_DISPLAY_AWAY_OFF 0
+#define IRC_CONFIG_DISPLAY_AWAY_LOCAL 1
+#define IRC_CONFIG_DISPLAY_AWAY_CHANNEL 2
-#define CFG_IRC_DISPLAY_AWAY_OFF 0
-#define CFG_IRC_DISPLAY_AWAY_LOCAL 1
-#define CFG_IRC_DISPLAY_AWAY_CHANNEL 2
+struct t_config_file *irc_config;
-extern int irc_cfg_irc_one_server_buffer;
-extern int irc_cfg_irc_open_near_server;
-extern char *irc_cfg_irc_nick_prefix;
-extern char *irc_cfg_irc_nick_suffix;
-extern int irc_cfg_irc_display_away;
-extern int irc_cfg_irc_show_away_once;
-extern char *irc_cfg_irc_default_msg_part;
-extern char *irc_cfg_irc_default_msg_quit;
-extern int irc_cfg_irc_notice_as_pv;
-extern int irc_cfg_irc_away_check;
-extern int irc_cfg_irc_away_check_max_nicks;
-extern int irc_cfg_irc_lag_check;
-extern int irc_cfg_irc_lag_min_show;
-extern int irc_cfg_irc_lag_disconnect;
-extern int irc_cfg_irc_anti_flood;
-extern char *irc_cfg_irc_highlight;
-extern int irc_cfg_irc_colors_receive;
-extern int irc_cfg_irc_colors_send;
-extern int irc_cfg_irc_send_unknown_commands;
+struct t_config_option *irc_config_irc_one_server_buffer;
+struct t_config_option *irc_config_irc_open_near_server;
+struct t_config_option *irc_config_irc_nick_prefix;
+struct t_config_option *irc_config_irc_nick_suffix;
+struct t_config_option *irc_config_irc_display_away;
+struct t_config_option *irc_config_irc_show_away_once;
+struct t_config_option *irc_config_irc_default_msg_part;
+struct t_config_option *irc_config_irc_default_msg_quit;
+struct t_config_option *irc_config_irc_notice_as_pv;
+struct t_config_option *irc_config_irc_away_check;
+struct t_config_option *irc_config_irc_away_check_max_nicks;
+struct t_config_option *irc_config_irc_lag_check;
+struct t_config_option *irc_config_irc_lag_min_show;
+struct t_config_option *irc_config_irc_lag_disconnect;
+struct t_config_option *irc_config_irc_anti_flood;
+struct t_config_option *irc_config_irc_highlight;
+struct t_config_option *irc_config_irc_colors_receive;
+struct t_config_option *irc_config_irc_colors_send;
+struct t_config_option *irc_config_irc_send_unknown_commands;
-extern int irc_cfg_dcc_auto_accept_files;
-extern int irc_cfg_dcc_auto_accept_chats;
-extern int irc_cfg_dcc_timeout;
-extern int irc_cfg_dcc_blocksize;
-extern int irc_cfg_dcc_fast_send;
-extern char *irc_cfg_dcc_port_range;
-extern char *irc_cfg_dcc_own_ip;
-extern char *irc_cfg_dcc_download_path;
-extern char *irc_cfg_dcc_upload_path;
-extern int irc_cfg_dcc_convert_spaces;
-extern int irc_cfg_dcc_auto_rename;
-extern int irc_cfg_dcc_auto_resume;
+struct t_config_option *irc_config_dcc_auto_accept_files;
+struct t_config_option *irc_config_dcc_auto_accept_chats;
+struct t_config_option *irc_config_dcc_timeout;
+struct t_config_option *irc_config_dcc_blocksize;
+struct t_config_option *irc_config_dcc_fast_send;
+struct t_config_option *irc_config_dcc_port_range;
+struct t_config_option *irc_config_dcc_own_ip;
+struct t_config_option *irc_config_dcc_download_path;
+struct t_config_option *irc_config_dcc_upload_path;
+struct t_config_option *irc_config_dcc_convert_spaces;
+struct t_config_option *irc_config_dcc_auto_rename;
+struct t_config_option *irc_config_dcc_auto_resume;
-extern int irc_cfg_log_auto_server;
-extern int irc_cfg_log_auto_channel;
-extern int irc_cfg_log_auto_private;
-extern int irc_cfg_log_hide_nickserv_pwd;
+struct t_config_option *irc_config_log_auto_server;
+struct t_config_option *irc_config_log_auto_channel;
+struct t_config_option *irc_config_log_auto_private;
+struct t_config_option *irc_config_log_hide_nickserv_pwd;
-extern void irc_config_change_noop ();
-extern void irc_config_change_one_server_buffer ();
-extern void irc_config_change_away_check ();
-extern void irc_config_change_log ();
-extern void irc_config_change_notify_levels ();
-extern int irc_config_read_server (t_config_option *, char *, char *);
-extern int irc_config_read ();
-extern int irc_config_write_servers (FILE *, char *, t_config_option *);
-extern int irc_config_write_servers_default_values (FILE *, char *,
- t_config_option *);
-extern int irc_config_write ();
+void irc_config_change_noop ();
+void irc_config_change_one_server_buffer ();
+void irc_config_change_away_check ();
+void irc_config_change_log ();
+void irc_config_change_notify_levels ();
+int irc_config_init ();
+int irc_config_read ();
+int irc_config_reload ();
+int irc_config_write ();
#endif /* irc-config.h */
diff --git a/src/plugins/irc/irc-dcc.c b/src/plugins/irc/irc-dcc.c
index 9d5cd76de..3c6b130e4 100644
--- a/src/plugins/irc/irc-dcc.c
+++ b/src/plugins/irc/irc-dcc.c
@@ -39,17 +39,15 @@
#include <arpa/inet.h>
#include <netdb.h>
-#include "../../core/weechat.h"
#include "irc.h"
-#include "../../core/log.h"
-#include "../../core/util.h"
-#include "../../core/weechat-config.h"
-#include "../../gui/gui.h"
+#include "irc-dcc.h"
+#include "irc-config.h"
-t_irc_dcc *irc_dcc_list = NULL; /* DCC files & chat list */
-t_irc_dcc *irc_last_dcc = NULL; /* last DCC in list */
-char *irc_dcc_status_string[] = /* strings for DCC status */
+struct t_irc_dcc *irc_dcc_list = NULL; /* DCC files & chat list */
+struct t_irc_dcc *irc_last_dcc = NULL; /* last DCC in list */
+
+char *irc_dcc_status_string[] = /* strings for DCC status */
{ N_("Waiting"), N_("Connecting"), N_("Active"), N_("Done"), N_("Failed"),
N_("Aborted") };
@@ -61,7 +59,8 @@ char *irc_dcc_status_string[] = /* strings for DCC status */
void
irc_dcc_redraw (int highlight)
{
- t_gui_buffer *ptr_buffer;
+ (void) highlight;
+ /*struct t_gui_buffer *ptr_buffer;
ptr_buffer = gui_buffer_get_dcc (gui_current_window);
gui_window_redraw_buffer (ptr_buffer);
@@ -70,16 +69,17 @@ irc_dcc_redraw (int highlight)
gui_hotlist_add (highlight, NULL, ptr_buffer, 0);
gui_status_draw (gui_current_window->buffer, 0);
}
+ */
}
/*
* irc_dcc_search: search a DCC
*/
-t_irc_dcc *
-irc_dcc_search (t_irc_server *server, int type, int status, int port)
+struct t_irc_dcc *
+irc_dcc_search (struct t_irc_server *server, int type, int status, int port)
{
- t_irc_dcc *ptr_dcc;
+ struct t_irc_dcc *ptr_dcc;
for (ptr_dcc = irc_dcc_list; ptr_dcc; ptr_dcc = ptr_dcc->next_dcc)
{
@@ -102,7 +102,7 @@ irc_dcc_search (t_irc_server *server, int type, int status, int port)
int
irc_dcc_port_in_use (int port)
{
- t_irc_dcc *ptr_dcc;
+ struct t_irc_dcc *ptr_dcc;
/* skip any currently used ports */
for (ptr_dcc = irc_dcc_list; ptr_dcc; ptr_dcc = ptr_dcc->next_dcc)
@@ -120,7 +120,7 @@ irc_dcc_port_in_use (int port)
*/
int
-irc_dcc_file_is_resumable (t_irc_dcc *ptr_dcc, char *filename)
+irc_dcc_file_is_resumable (struct t_irc_dcc *ptr_dcc, char *filename)
{
struct stat st;
@@ -152,7 +152,7 @@ irc_dcc_file_is_resumable (t_irc_dcc *ptr_dcc, char *filename)
*/
void
-irc_dcc_find_filename (t_irc_dcc *ptr_dcc)
+irc_dcc_find_filename (struct t_irc_dcc *ptr_dcc)
{
char *dir1, *dir2, *filename2;
@@ -236,7 +236,7 @@ irc_dcc_find_filename (t_irc_dcc *ptr_dcc)
*/
void
-irc_dcc_calculate_speed (t_irc_dcc *ptr_dcc, int ended)
+irc_dcc_calculate_speed (struct t_irc_dcc *ptr_dcc, int ended)
{
time_t local_time, elapsed;
unsigned long bytes_per_sec_total;
@@ -280,7 +280,7 @@ irc_dcc_calculate_speed (t_irc_dcc *ptr_dcc, int ended)
*/
int
-irc_dcc_connect_to_sender (t_irc_dcc *ptr_dcc)
+irc_dcc_connect_to_sender (struct t_irc_dcc *ptr_dcc)
{
struct sockaddr_in addr;
struct hostent *hostent;
@@ -324,7 +324,7 @@ irc_dcc_connect_to_sender (t_irc_dcc *ptr_dcc)
*/
int
-irc_dcc_connect (t_irc_dcc *ptr_dcc)
+irc_dcc_connect (struct t_irc_dcc *ptr_dcc)
{
if (ptr_dcc->type == IRC_DCC_CHAT_SEND)
ptr_dcc->status = IRC_DCC_WAITING;
@@ -367,9 +367,9 @@ irc_dcc_connect (t_irc_dcc *ptr_dcc)
*/
void
-irc_dcc_free (t_irc_dcc *ptr_dcc)
+irc_dcc_free (struct t_irc_dcc *ptr_dcc)
{
- t_irc_dcc *new_dcc_list;
+ struct t_irc_dcc *new_dcc_list;
if (!ptr_dcc)
return;
@@ -380,7 +380,7 @@ irc_dcc_free (t_irc_dcc *ptr_dcc)
{
/* check if channel is used for another active DCC CHAT */
if (!ptr_dcc->channel->dcc_chat
- || (IRC_DCC_ENDED(((t_irc_dcc *)(ptr_dcc->channel->dcc_chat))->status)))
+ || (IRC_DCC_ENDED(((struct t_irc_dcc *)(ptr_dcc->channel->dcc_chat))->status)))
{
gui_buffer_free (ptr_dcc->channel->buffer, 1);
if (ptr_dcc->channel)
@@ -418,7 +418,7 @@ irc_dcc_free (t_irc_dcc *ptr_dcc)
*/
void
-irc_dcc_file_child_kill (t_irc_dcc *ptr_dcc)
+irc_dcc_file_child_kill (struct t_irc_dcc *ptr_dcc)
{
/* kill process */
if (ptr_dcc->child_pid > 0)
@@ -446,7 +446,7 @@ irc_dcc_file_child_kill (t_irc_dcc *ptr_dcc)
*/
void
-irc_dcc_close (t_irc_dcc *ptr_dcc, int status)
+irc_dcc_close (struct t_irc_dcc *ptr_dcc, int status)
{
t_gui_buffer *ptr_buffer;
struct stat st;
@@ -541,7 +541,7 @@ irc_dcc_close (t_irc_dcc *ptr_dcc, int status)
*/
void
-irc_dcc_channel_for_chat (t_irc_dcc *ptr_dcc)
+irc_dcc_channel_for_chat (struct t_irc_dcc *ptr_dcc)
{
if (!irc_channel_create_dcc (ptr_dcc))
{
@@ -576,9 +576,9 @@ irc_dcc_channel_for_chat (t_irc_dcc *ptr_dcc)
*/
void
-irc_dcc_chat_remove_channel (t_irc_channel *channel)
+irc_dcc_chat_remove_channel (struct t_irc_channel *channel)
{
- t_irc_dcc *ptr_dcc;
+ struct t_irc_dcc *ptr_dcc;
if (!channel)
return;
@@ -595,7 +595,7 @@ irc_dcc_chat_remove_channel (t_irc_channel *channel)
*/
void
-irc_dcc_recv_connect_init (t_irc_dcc *ptr_dcc)
+irc_dcc_recv_connect_init (struct t_irc_dcc *ptr_dcc)
{
if (!irc_dcc_connect (ptr_dcc))
{
@@ -625,7 +625,7 @@ irc_dcc_recv_connect_init (t_irc_dcc *ptr_dcc)
*/
void
-irc_dcc_accept (t_irc_dcc *ptr_dcc)
+irc_dcc_accept (struct t_irc_dcc *ptr_dcc)
{
if (IRC_DCC_IS_FILE(ptr_dcc->type) && (ptr_dcc->start_resume > 0))
{
@@ -647,10 +647,10 @@ irc_dcc_accept (t_irc_dcc *ptr_dcc)
*/
void
-irc_dcc_accept_resume (t_irc_server *server, char *filename, int port,
+irc_dcc_accept_resume (struct t_irc_server *server, char *filename, int port,
unsigned long pos_start)
{
- t_irc_dcc *ptr_dcc;
+ struct t_irc_dcc *ptr_dcc;
ptr_dcc = irc_dcc_search (server, IRC_DCC_FILE_SEND, IRC_DCC_CONNECTING,
port);
@@ -688,10 +688,10 @@ irc_dcc_accept_resume (t_irc_server *server, char *filename, int port,
*/
void
-irc_dcc_start_resume (t_irc_server *server, char *filename, int port,
+irc_dcc_start_resume (struct t_irc_server *server, char *filename, int port,
unsigned long pos_start)
{
- t_irc_dcc *ptr_dcc;
+ struct t_irc_dcc *ptr_dcc;
ptr_dcc = irc_dcc_search (server, IRC_DCC_FILE_RECV, IRC_DCC_CONNECTING,
port);
@@ -714,13 +714,13 @@ irc_dcc_start_resume (t_irc_server *server, char *filename, int port,
* irc_dcc_alloc: allocate a new DCC file
*/
-t_irc_dcc *
+struct t_irc_dcc *
irc_dcc_alloc ()
{
- t_irc_dcc *new_dcc;
+ struct t_irc_dcc *new_dcc;
/* create new DCC struct */
- if ((new_dcc = (t_irc_dcc *) malloc (sizeof (t_irc_dcc))) == NULL)
+ if ((new_dcc = (struct t_irc_dcc *) malloc (sizeof (struct t_irc_dcc))) == NULL)
return NULL;
/* default values */
@@ -769,11 +769,11 @@ irc_dcc_alloc ()
* irc_dcc_add: add a DCC file to queue
*/
-t_irc_dcc *
-irc_dcc_add (t_irc_server *server, int type, unsigned long addr, int port, char *nick,
+struct t_irc_dcc *
+irc_dcc_add (struct t_irc_server *server, int type, unsigned long addr, int port, char *nick,
int sock, char *filename, char *local_filename, unsigned long size)
{
- t_irc_dcc *new_dcc;
+ struct t_irc_dcc *new_dcc;
new_dcc = irc_dcc_alloc ();
if (!new_dcc)
@@ -937,7 +937,7 @@ irc_dcc_add (t_irc_server *server, int type, unsigned long addr, int port, char
*/
void
-irc_dcc_send_request (t_irc_server *server, int type, char *nick, char *filename)
+irc_dcc_send_request (struct t_irc_server *server, int type, char *nick, char *filename)
{
char *dir1, *dir2, *filename2, *short_filename, *pos;
int spaces, args, port_start, port_end;
@@ -948,7 +948,7 @@ irc_dcc_send_request (t_irc_server *server, int type, char *nick, char *filename
struct sockaddr_in addr;
socklen_t length;
unsigned long local_addr;
- t_irc_dcc *ptr_dcc;
+ struct t_irc_dcc *ptr_dcc;
filename2 = NULL;
short_filename = NULL;
@@ -1177,7 +1177,7 @@ irc_dcc_send_request (t_irc_server *server, int type, char *nick, char *filename
*/
int
-irc_dcc_chat_send (t_irc_dcc *ptr_dcc, char *buffer, int size_buf)
+irc_dcc_chat_send (struct t_irc_dcc *ptr_dcc, char *buffer, int size_buf)
{
if (!ptr_dcc)
return -1;
@@ -1190,7 +1190,7 @@ irc_dcc_chat_send (t_irc_dcc *ptr_dcc, char *buffer, int size_buf)
*/
void
-irc_dcc_chat_sendf (t_irc_dcc *ptr_dcc, char *fmt, ...)
+irc_dcc_chat_sendf (struct t_irc_dcc *ptr_dcc, char *fmt, ...)
{
va_list args;
static char buffer[4096];
@@ -1231,7 +1231,7 @@ irc_dcc_chat_sendf (t_irc_dcc *ptr_dcc, char *fmt, ...)
*/
void
-irc_dcc_chat_recv (t_irc_dcc *ptr_dcc)
+irc_dcc_chat_recv (struct t_irc_dcc *ptr_dcc)
{
fd_set read_fd;
static struct timeval timeout;
@@ -1348,7 +1348,7 @@ irc_dcc_chat_recv (t_irc_dcc *ptr_dcc)
*/
int
-irc_dcc_file_create_pipe (t_irc_dcc *ptr_dcc)
+irc_dcc_file_create_pipe (struct t_irc_dcc *ptr_dcc)
{
int child_pipe[2];
@@ -1372,7 +1372,7 @@ irc_dcc_file_create_pipe (t_irc_dcc *ptr_dcc)
*/
void
-irc_dcc_file_write_pipe (t_irc_dcc *ptr_dcc, int status, int error)
+irc_dcc_file_write_pipe (struct t_irc_dcc *ptr_dcc, int status, int error)
{
char buffer[1 + 1 + 12 + 1]; /* status + error + pos + \0 */
@@ -1386,7 +1386,7 @@ irc_dcc_file_write_pipe (t_irc_dcc *ptr_dcc, int status, int error)
*/
void
-irc_dcc_file_send_child (t_irc_dcc *ptr_dcc)
+irc_dcc_file_send_child (struct t_irc_dcc *ptr_dcc)
{
int num_read, num_sent;
static char buffer[IRC_DCC_MAX_BLOCKSIZE];
@@ -1472,7 +1472,7 @@ irc_dcc_file_send_child (t_irc_dcc *ptr_dcc)
*/
void
-irc_dcc_file_recv_child (t_irc_dcc *ptr_dcc)
+irc_dcc_file_recv_child (struct t_irc_dcc *ptr_dcc)
{
int num_read;
static char buffer[IRC_DCC_MAX_BLOCKSIZE];
@@ -1546,7 +1546,7 @@ irc_dcc_file_recv_child (t_irc_dcc *ptr_dcc)
*/
void
-irc_dcc_file_child_read (t_irc_dcc *ptr_dcc)
+irc_dcc_file_child_read (struct t_irc_dcc *ptr_dcc)
{
fd_set read_fd;
static struct timeval timeout;
@@ -1650,7 +1650,7 @@ irc_dcc_file_child_read (t_irc_dcc *ptr_dcc)
*/
void
-irc_dcc_file_send_fork (t_irc_dcc *ptr_dcc)
+irc_dcc_file_send_fork (struct t_irc_dcc *ptr_dcc)
{
pid_t pid;
@@ -1685,7 +1685,7 @@ irc_dcc_file_send_fork (t_irc_dcc *ptr_dcc)
*/
void
-irc_dcc_file_recv_fork (t_irc_dcc *ptr_dcc)
+irc_dcc_file_recv_fork (struct t_irc_dcc *ptr_dcc)
{
pid_t pid;
@@ -1728,7 +1728,7 @@ irc_dcc_file_recv_fork (t_irc_dcc *ptr_dcc)
void
irc_dcc_handle ()
{
- t_irc_dcc *ptr_dcc;
+ struct t_irc_dcc *ptr_dcc;
fd_set read_fd;
static struct timeval timeout;
int sock;
@@ -1867,14 +1867,14 @@ irc_dcc_handle ()
void
irc_dcc_end ()
{
- t_irc_dcc *ptr_dcc;
+ struct t_irc_dcc *ptr_dcc;
for (ptr_dcc = irc_dcc_list; ptr_dcc; ptr_dcc = ptr_dcc->next_dcc)
{
if (ptr_dcc->sock >= 0)
{
if (ptr_dcc->status == IRC_DCC_ACTIVE)
- weechat_log_printf (_("Aborting active DCC: \"%s\" from %s\n"),
+ weechat_log_printf (_("Aborting active DCC: \"%s\" from %s"),
ptr_dcc->filename, ptr_dcc->nick);
irc_dcc_close (ptr_dcc, IRC_DCC_FAILED);
}
@@ -1888,42 +1888,42 @@ irc_dcc_end ()
void
irc_dcc_print_log ()
{
- t_irc_dcc *ptr_dcc;
+ struct t_irc_dcc *ptr_dcc;
for (ptr_dcc = irc_dcc_list; ptr_dcc; ptr_dcc = ptr_dcc->next_dcc)
{
- weechat_log_printf ("\n");
- weechat_log_printf ("[DCC (addr:0x%X)]\n", ptr_dcc);
- weechat_log_printf (" server. . . . . . . : 0x%X\n", ptr_dcc->server);
- weechat_log_printf (" channel . . . . . . : 0x%X\n", ptr_dcc->channel);
- weechat_log_printf (" type. . . . . . . . : %d\n", ptr_dcc->type);
- weechat_log_printf (" status. . . . . . . : %d\n", ptr_dcc->status);
- weechat_log_printf (" start_time. . . . . : %ld\n", ptr_dcc->start_time);
- weechat_log_printf (" start_transfer. . . : %ld\n", ptr_dcc->start_transfer);
- weechat_log_printf (" addr. . . . . . . . : %lu\n", ptr_dcc->addr);
- weechat_log_printf (" port. . . . . . . . : %d\n", ptr_dcc->port);
- weechat_log_printf (" nick. . . . . . . . : '%s'\n", ptr_dcc->nick);
- weechat_log_printf (" sock. . . . . . . . : %d\n", ptr_dcc->sock);
- weechat_log_printf (" child_pid . . . . . : %d\n", ptr_dcc->child_pid);
- weechat_log_printf (" child_read. . . . . : %d\n", ptr_dcc->child_read);
- weechat_log_printf (" child_write . . . . : %d\n", ptr_dcc->child_write);
- weechat_log_printf (" unterminated_message: '%s'\n", ptr_dcc->unterminated_message);
- weechat_log_printf (" fast_send . . . . . : %d\n", ptr_dcc->fast_send);
- weechat_log_printf (" file. . . . . . . . : %d\n", ptr_dcc->file);
- weechat_log_printf (" filename. . . . . . : '%s'\n", ptr_dcc->filename);
- weechat_log_printf (" local_filename. . . : '%s'\n", ptr_dcc->local_filename);
- weechat_log_printf (" filename_suffix . . : %d\n", ptr_dcc->filename_suffix);
- weechat_log_printf (" blocksize . . . . . : %d\n", ptr_dcc->blocksize);
- weechat_log_printf (" size. . . . . . . . : %lu\n", ptr_dcc->size);
- weechat_log_printf (" pos . . . . . . . . : %lu\n", ptr_dcc->pos);
- weechat_log_printf (" ack . . . . . . . . : %lu\n", ptr_dcc->ack);
- weechat_log_printf (" start_resume. . . . : %lu\n", ptr_dcc->start_resume);
- weechat_log_printf (" last_check_time . . : %ld\n", ptr_dcc->last_check_time);
- weechat_log_printf (" last_check_pos. . . : %lu\n", ptr_dcc->last_check_pos);
- weechat_log_printf (" last_activity . . . : %ld\n", ptr_dcc->last_activity);
- weechat_log_printf (" bytes_per_sec . . . : %lu\n", ptr_dcc->bytes_per_sec);
- weechat_log_printf (" eta . . . . . . . . : %lu\n", ptr_dcc->eta);
- weechat_log_printf (" prev_dcc. . . . . . : 0x%X\n", ptr_dcc->prev_dcc);
- weechat_log_printf (" next_dcc. . . . . . : 0x%X\n", ptr_dcc->next_dcc);
+ weechat_log_printf ("");
+ weechat_log_printf ("[DCC (addr:0x%X)]", ptr_dcc);
+ weechat_log_printf (" server. . . . . . . : 0x%X", ptr_dcc->server);
+ weechat_log_printf (" channel . . . . . . : 0x%X", ptr_dcc->channel);
+ weechat_log_printf (" type. . . . . . . . : %d", ptr_dcc->type);
+ weechat_log_printf (" status. . . . . . . : %d", ptr_dcc->status);
+ weechat_log_printf (" start_time. . . . . : %ld", ptr_dcc->start_time);
+ weechat_log_printf (" start_transfer. . . : %ld", ptr_dcc->start_transfer);
+ weechat_log_printf (" addr. . . . . . . . : %lu", ptr_dcc->addr);
+ weechat_log_printf (" port. . . . . . . . : %d", ptr_dcc->port);
+ weechat_log_printf (" nick. . . . . . . . : '%s'", ptr_dcc->nick);
+ weechat_log_printf (" sock. . . . . . . . : %d", ptr_dcc->sock);
+ weechat_log_printf (" child_pid . . . . . : %d", ptr_dcc->child_pid);
+ weechat_log_printf (" child_read. . . . . : %d", ptr_dcc->child_read);
+ weechat_log_printf (" child_write . . . . : %d", ptr_dcc->child_write);
+ weechat_log_printf (" unterminated_message: '%s'", ptr_dcc->unterminated_message);
+ weechat_log_printf (" fast_send . . . . . : %d", ptr_dcc->fast_send);
+ weechat_log_printf (" file. . . . . . . . : %d", ptr_dcc->file);
+ weechat_log_printf (" filename. . . . . . : '%s'", ptr_dcc->filename);
+ weechat_log_printf (" local_filename. . . : '%s'", ptr_dcc->local_filename);
+ weechat_log_printf (" filename_suffix . . : %d", ptr_dcc->filename_suffix);
+ weechat_log_printf (" blocksize . . . . . : %d", ptr_dcc->blocksize);
+ weechat_log_printf (" size. . . . . . . . : %lu", ptr_dcc->size);
+ weechat_log_printf (" pos . . . . . . . . : %lu", ptr_dcc->pos);
+ weechat_log_printf (" ack . . . . . . . . : %lu", ptr_dcc->ack);
+ weechat_log_printf (" start_resume. . . . : %lu", ptr_dcc->start_resume);
+ weechat_log_printf (" last_check_time . . : %ld", ptr_dcc->last_check_time);
+ weechat_log_printf (" last_check_pos. . . : %lu", ptr_dcc->last_check_pos);
+ weechat_log_printf (" last_activity . . . : %ld", ptr_dcc->last_activity);
+ weechat_log_printf (" bytes_per_sec . . . : %lu", ptr_dcc->bytes_per_sec);
+ weechat_log_printf (" eta . . . . . . . . : %lu", ptr_dcc->eta);
+ weechat_log_printf (" prev_dcc. . . . . . : 0x%X", ptr_dcc->prev_dcc);
+ weechat_log_printf (" next_dcc. . . . . . : 0x%X", ptr_dcc->next_dcc);
}
}
diff --git a/src/plugins/irc/irc-dcc.h b/src/plugins/irc/irc-dcc.h
index 27cab49bb..af8f0baf7 100644
--- a/src/plugins/irc/irc-dcc.h
+++ b/src/plugins/irc/irc-dcc.h
@@ -20,6 +20,9 @@
#ifndef __WEECHAT_IRC_DCC_H
#define __WEECHAT_IRC_DCC_H 1
+#include "irc-server.h"
+#include "irc-channel.h"
+
/* DCC types */
#define IRC_DCC_CHAT_RECV 0 /* receiving DCC chat */
@@ -107,4 +110,22 @@ extern struct t_irc_dcc *irc_dcc_list;
extern struct t_irc_dcc *irc_last_dcc;
extern char *irc_dcc_status_string[6];
+extern void irc_dcc_redraw (int);
+extern void irc_dcc_free (struct t_irc_dcc *);
+extern void irc_dcc_close (struct t_irc_dcc *, int);
+extern void irc_dcc_chat_remove_channel (struct t_irc_channel *);
+extern void irc_dcc_accept (struct t_irc_dcc *);
+extern void irc_dcc_accept_resume (struct t_irc_server *, char *, int, unsigned long);
+extern void irc_dcc_start_resume (struct t_irc_server *, char *, int, unsigned long);
+extern struct t_irc_dcc *irc_dcc_alloc ();
+extern struct t_irc_dcc *irc_dcc_add (struct t_irc_server *, int, unsigned long, int, char *, int,
+ char *, char *, unsigned long);
+extern void irc_dcc_send_request (struct t_irc_server *, int, char *, char *);
+extern void irc_dcc_chat_sendf (struct t_irc_dcc *, char *, ...);
+extern void irc_dcc_file_send_fork (struct t_irc_dcc *);
+extern void irc_dcc_file_recv_fork (struct t_irc_dcc *);
+extern void irc_dcc_handle ();
+extern void irc_dcc_end ();
+extern void irc_dcc_print_log ();
+
#endif /* irc-dcc.h */
diff --git a/src/plugins/irc/irc-display.h b/src/plugins/irc/irc-display.h
new file mode 100644
index 000000000..778eea778
--- /dev/null
+++ b/src/plugins/irc/irc-display.h
@@ -0,0 +1,31 @@
+/*
+ * Copyright (c) 2003-2007 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_DISPLAY_H
+#define __WEECHAT_IRC_DISPLAY_H 1
+
+extern void irc_display_hide_password (char *, int);
+extern void irc_display_nick (struct t_gui_buffer *, struct t_irc_nick *,
+ char *, int, int, char *, int);
+extern void irc_display_away (struct t_irc_server *, char *, char *);
+extern void irc_display_mode (struct t_gui_buffer *, char *, char *,
+ char, char *, char *, char *, char *);
+extern void irc_display_server (struct t_irc_server *, int);
+
+#endif /* irc-display.h */
diff --git a/src/plugins/irc/irc-mode.h b/src/plugins/irc/irc-mode.h
new file mode 100644
index 000000000..814788e52
--- /dev/null
+++ b/src/plugins/irc/irc-mode.h
@@ -0,0 +1,28 @@
+/*
+ * Copyright (c) 2003-2007 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_MODE_H
+#define __WEECHAT_IRC_MODE_H 1
+
+extern void irc_mode_channel_set (struct t_irc_server *, struct t_irc_channel *,
+ char *);
+extern void irc_mode_user_set (struct t_irc_server *, char *);
+extern int irc_mode_nick_prefix_allowed (struct t_irc_server *, char);
+
+#endif /* irc-mode.h */
diff --git a/src/plugins/irc/irc-nick.c b/src/plugins/irc/irc-nick.c
index 2357c8833..db56a16ba 100644
--- a/src/plugins/irc/irc-nick.c
+++ b/src/plugins/irc/irc-nick.c
@@ -27,12 +27,10 @@
#include <string.h>
#include <limits.h>
-#include "../../core/weechat.h"
#include "irc.h"
-#include "../../core/log.h"
-#include "../../core/utf8.h"
-#include "../../core/util.h"
-#include "../../core/weechat-config.h"
+#include "irc-nick.h"
+#include "irc-server.h"
+#include "irc-channel.h"
/*
@@ -40,7 +38,7 @@
*/
int
-irc_nick_find_color (t_irc_nick *nick)
+irc_nick_find_color (struct t_irc_nick *nick)
{
int i, color;
@@ -49,9 +47,9 @@ irc_nick_find_color (t_irc_nick *nick)
{
color += (int)(nick->nick[i]);
}
- color = (color % cfg_look_color_nicks_number);
+ color = (color % weechat_config_integer (weechat_config_get ("look_color_nicks_number")));
- return GUI_COLOR_CHAT_NICK1 + color;
+ return color;
}
/*
@@ -60,56 +58,56 @@ irc_nick_find_color (t_irc_nick *nick)
*/
void
-irc_nick_get_gui_infos (t_irc_nick *nick,
+irc_nick_get_gui_infos (struct t_irc_nick *nick,
int *sort_index, char *prefix, int *color_prefix)
{
if (nick->flags & IRC_NICK_CHANOWNER)
{
*sort_index = 1;
*prefix = '~';
- *color_prefix = GUI_COLOR_NICKLIST_PREFIX1;
+ *color_prefix = 1;
}
else if (nick->flags & IRC_NICK_CHANADMIN)
{
*sort_index = 2;
*prefix = '&';
- *color_prefix = GUI_COLOR_NICKLIST_PREFIX1;
+ *color_prefix = 1;
}
else if (nick->flags & IRC_NICK_CHANADMIN2)
{
*sort_index = 3;
*prefix = '!';
- *color_prefix = GUI_COLOR_NICKLIST_PREFIX1;
+ *color_prefix = 1;
}
else if (nick->flags & IRC_NICK_OP)
{
*sort_index = 4;
*prefix = '@';
- *color_prefix = GUI_COLOR_NICKLIST_PREFIX1;
+ *color_prefix = 1;
}
else if (nick->flags & IRC_NICK_HALFOP)
{
*sort_index = 5;
*prefix = '%';
- *color_prefix = GUI_COLOR_NICKLIST_PREFIX2;
+ *color_prefix = 2;
}
else if (nick->flags & IRC_NICK_VOICE)
{
*sort_index = 6;
*prefix = '+';
- *color_prefix = GUI_COLOR_NICKLIST_PREFIX3;
+ *color_prefix = 3;
}
else if (nick->flags & IRC_NICK_CHANUSER)
{
*sort_index = 7;
*prefix = '-';
- *color_prefix = GUI_COLOR_NICKLIST_PREFIX4;
+ *color_prefix = 4;
}
else
{
*sort_index = 8;
*prefix = ' ';
- *color_prefix = GUI_COLOR_NICKLIST;
+ *color_prefix = 0;
}
}
@@ -117,13 +115,14 @@ irc_nick_get_gui_infos (t_irc_nick *nick,
* irc_nick_new: allocate a new nick for a channel and add it to the nick list
*/
-t_irc_nick *
-irc_nick_new (t_irc_server *server, t_irc_channel *channel, char *nick_name,
- int is_chanowner, int is_chanadmin, int is_chanadmin2, int is_op,
- int is_halfop, int has_voice, int is_chanuser)
+struct t_irc_nick *
+irc_nick_new (struct t_irc_server *server, struct t_irc_channel *channel,
+ char *nick_name, int is_chanowner, int is_chanadmin,
+ int is_chanadmin2, int is_op, int is_halfop, int has_voice,
+ int is_chanuser)
{
- t_irc_nick *new_nick;
- t_gui_nick *ptr_gui_nick;
+ struct t_irc_nick *new_nick;
+ struct t_gui_nick *ptr_gui_nick;
int sort_index, color_prefix;
char prefix;
@@ -151,7 +150,7 @@ irc_nick_new (t_irc_server *server, t_irc_channel *channel, char *nick_name,
}
/* alloc memory for new nick */
- if ((new_nick = (t_irc_nick *) malloc (sizeof (t_irc_nick))) == NULL)
+ if ((new_nick = (struct t_irc_nick *) malloc (sizeof (struct t_irc_nick))) == NULL)
return NULL;
/* initialize new nick */
@@ -197,8 +196,8 @@ irc_nick_new (t_irc_server *server, t_irc_channel *channel, char *nick_name,
*/
void
-irc_nick_change (t_irc_server *server, t_irc_channel *channel,
- t_irc_nick *nick, char *new_nick)
+irc_nick_change (struct t_irc_server *server, struct t_irc_channel *channel,
+ struct t_irc_nick *nick, char *new_nick)
{
int nick_is_me;
t_weelist *ptr_weelist;
@@ -240,9 +239,9 @@ irc_nick_change (t_irc_server *server, t_irc_channel *channel,
*/
void
-irc_nick_free (t_irc_channel *channel, t_irc_nick *nick)
+irc_nick_free (struct t_irc_channel *channel, struct t_irc_nick *nick)
{
- t_irc_nick *new_nicks;
+ struct t_irc_nick *new_nicks;
if (!channel || !nick)
return;
@@ -282,7 +281,7 @@ irc_nick_free (t_irc_channel *channel, t_irc_nick *nick)
*/
void
-irc_nick_free_all (t_irc_channel *channel)
+irc_nick_free_all (struct t_irc_channel *channel)
{
if (!channel)
return;
@@ -299,10 +298,10 @@ irc_nick_free_all (t_irc_channel *channel)
* irc_nick_search: returns pointer on a nick
*/
-t_irc_nick *
-irc_nick_search (t_irc_channel *channel, char *nickname)
+struct t_irc_nick *
+irc_nick_search (struct t_irc_channel *channel, char *nickname)
{
- t_irc_nick *ptr_nick;
+ struct t_irc_nick *ptr_nick;
if (!nickname)
return NULL;
@@ -321,10 +320,10 @@ irc_nick_search (t_irc_channel *channel, char *nickname)
*/
void
-irc_nick_count (t_irc_channel *channel, int *total, int *count_op,
+irc_nick_count (struct t_irc_channel *channel, int *total, int *count_op,
int *count_halfop, int *count_voice, int *count_normal)
{
- t_irc_nick *ptr_nick;
+ struct t_irc_nick *ptr_nick;
(*total) = 0;
(*count_op) = 0;
@@ -360,7 +359,7 @@ irc_nick_count (t_irc_channel *channel, int *total, int *count_op,
*/
void
-irc_nick_set_away (t_irc_channel *channel, t_irc_nick *nick, int is_away)
+irc_nick_set_away (struct t_irc_channel *channel, struct t_irc_nick *nick, int is_away)
{
t_gui_nick *ptr_nick;
@@ -390,12 +389,12 @@ irc_nick_set_away (t_irc_channel *channel, t_irc_nick *nick, int is_away)
*/
void
-irc_nick_print_log (t_irc_nick *nick)
+irc_nick_print_log (struct t_irc_nick *nick)
{
- weechat_log_printf ("=> nick %s (addr:0x%X):\n", nick->nick, nick);
- weechat_log_printf (" host . . . . . : %s\n", nick->host);
- weechat_log_printf (" flags. . . . . : %d\n", nick->flags);
- weechat_log_printf (" color. . . . . : %d\n", nick->color);
- weechat_log_printf (" prev_nick. . . : 0x%X\n", nick->prev_nick);
- weechat_log_printf (" next_nick. . . : 0x%X\n", nick->next_nick);
+ weechat_log_printf ("=> nick %s (addr:0x%X):", nick->nick, nick);
+ weechat_log_printf (" host . . . . . : %s", nick->host);
+ weechat_log_printf (" flags. . . . . : %d", nick->flags);
+ weechat_log_printf (" color. . . . . : %d", nick->color);
+ weechat_log_printf (" prev_nick. . . : 0x%X", nick->prev_nick);
+ weechat_log_printf (" next_nick. . . : 0x%X", nick->next_nick);
}
diff --git a/src/plugins/irc/irc-nick.h b/src/plugins/irc/irc-nick.h
index 230f49503..9f66002e4 100644
--- a/src/plugins/irc/irc-nick.h
+++ b/src/plugins/irc/irc-nick.h
@@ -20,6 +20,9 @@
#ifndef __WEECHAT_IRC_NICK_H
#define __WEECHAT_IRC_NICK_H 1
+#include "irc-server.h"
+#include "irc-channel.h"
+
#define IRC_NICK_DEFAULT_PREFIXES_LIST "@%+~&!-"
#define IRC_NICK_CHANOWNER 1
@@ -47,4 +50,18 @@ struct t_irc_nick
struct t_irc_nick *next_nick; /* link to next nick on channel */
};
+extern int irc_nick_find_color (struct t_irc_nick *);
+extern void irc_nick_get_gui_infos (struct t_irc_nick *, int *, char *, int *);
+extern struct t_irc_nick *irc_nick_new (struct t_irc_server *,
+ struct t_irc_channel *, char *,
+ int, int, int, int, int, int, int);
+extern void irc_nick_change (struct t_irc_server *, struct t_irc_channel *,
+ struct t_irc_nick *, char *);
+extern void irc_nick_free (struct t_irc_channel *, struct t_irc_nick *);
+extern void irc_nick_free_all (struct t_irc_channel *);
+extern struct t_irc_nick *irc_nick_search (struct t_irc_channel *, char *);
+extern void irc_nick_count (struct t_irc_channel *, int *, int *, int *, int *, int *);
+extern void irc_nick_set_away (struct t_irc_channel *, struct t_irc_nick *, int);
+extern void irc_nick_print_log (struct t_irc_nick *);
+
#endif /* irc-nick.h */
diff --git a/src/plugins/irc/irc-protocol.c b/src/plugins/irc/irc-protocol.c
index 6e985125a..3a219768b 100644
--- a/src/plugins/irc/irc-protocol.c
+++ b/src/plugins/irc/irc-protocol.c
@@ -39,7 +39,7 @@
#include "../../core/weechat-config.h"
-t_irc_protocol_msg irc_protocol_messages[] =
+struct t_irc_protocol_msg irc_protocol_messages[] =
{ { "error", N_("error received from IRC server"), irc_protocol_cmd_error },
{ "invite", N_("invite a nick on a channel"), irc_protocol_cmd_invite },
{ "join", N_("join a channel"), irc_protocol_cmd_join },
@@ -338,7 +338,7 @@ irc_protocol_is_highlight (char *message, char *nick)
*/
char *
-irc_protocol_replace_vars (t_irc_server *server, t_irc_channel *channel, char *string)
+irc_protocol_replace_vars (struct t_irc_server *server, struct t_irc_channel *channel, char *string)
{
char *var_nick, *var_channel, *var_server;
char empty_string[1] = { '\0' };
@@ -381,13 +381,13 @@ irc_protocol_replace_vars (t_irc_server *server, t_irc_channel *channel, char *s
*/
int
-irc_protocol_recv_command (t_irc_server *server, char *entire_line,
+irc_protocol_recv_command (struct t_irc_server *server, char *entire_line,
char *host, char *command, char *arguments)
{
int i, cmd_found, return_code, ignore, highlight;
char *pos, *nick;
char *dup_entire_line, *dup_host, *dup_arguments, *irc_message;
- t_irc_recv_func *cmd_recv_func;
+ struct t_irc_recv_func *cmd_recv_func;
char *cmd_name;
if (!command)
@@ -474,13 +474,13 @@ irc_protocol_recv_command (t_irc_server *server, char *entire_line,
*/
int
-irc_protocol_cmd_error (t_irc_server *server, char *irc_message, char *host,
+irc_protocol_cmd_error (struct t_irc_server *server, char *irc_message, char *host,
char *nick, char *arguments, int ignore, int highlight)
{
char *pos;
int first;
- t_gui_buffer *ptr_buffer;
- t_irc_channel *ptr_channel;
+ struct t_gui_buffer *ptr_buffer;
+ struct t_irc_channel *ptr_channel;
/* make C compiler happy */
(void) irc_message;
@@ -557,7 +557,7 @@ irc_protocol_cmd_error (t_irc_server *server, char *irc_message, char *host,
*/
int
-irc_protocol_cmd_invite (t_irc_server *server, char *irc_message, char *host,
+irc_protocol_cmd_invite (struct t_irc_server *server, char *irc_message, char *host,
char *nick, char *arguments, int ignore, int highlight)
{
char *pos_channel;
@@ -614,11 +614,11 @@ irc_protocol_cmd_invite (t_irc_server *server, char *irc_message, char *host,
*/
int
-irc_protocol_cmd_join (t_irc_server *server, char *irc_message, char *host,
+irc_protocol_cmd_join (struct t_irc_server *server, char *irc_message, char *host,
char *nick, char *arguments, int ignore, int highlight)
{
- t_irc_channel *ptr_channel;
- t_irc_nick *ptr_nick;
+ struct t_irc_channel *ptr_channel;
+ struct t_irc_nick *ptr_nick;
char *pos;
/* make C compiler happy */
@@ -697,12 +697,12 @@ irc_protocol_cmd_join (t_irc_server *server, char *irc_message, char *host,
*/
int
-irc_protocol_cmd_kick (t_irc_server *server, char *irc_message, char *host,
+irc_protocol_cmd_kick (struct t_irc_server *server, char *irc_message, char *host,
char *nick, char *arguments, int ignore, int highlight)
{
char *pos_nick, *pos_comment;
- t_irc_channel *ptr_channel;
- t_irc_nick *ptr_nick;
+ struct t_irc_channel *ptr_channel;
+ struct t_irc_nick *ptr_nick;
/* make C compiler happy */
(void) irc_message;
@@ -795,11 +795,11 @@ irc_protocol_cmd_kick (t_irc_server *server, char *irc_message, char *host,
*/
int
-irc_protocol_cmd_kill (t_irc_server *server, char *irc_message, char *host,
+irc_protocol_cmd_kill (struct t_irc_server *server, char *irc_message, char *host,
char *nick, char *arguments, int ignore, int highlight)
{
char *pos_host2, *pos_comment;
- t_irc_channel *ptr_channel;
+ struct t_irc_channel *ptr_channel;
/* make C compiler happy */
(void) irc_message;
@@ -871,11 +871,11 @@ irc_protocol_cmd_kill (t_irc_server *server, char *irc_message, char *host,
*/
int
-irc_protocol_cmd_mode (t_irc_server *server, char *irc_message, char *host,
+irc_protocol_cmd_mode (struct t_irc_server *server, char *irc_message, char *host,
char *nick, char *arguments, int ignore, int highlight)
{
char *pos_modes, *pos;
- t_irc_channel *ptr_channel;
+ struct t_irc_channel *ptr_channel;
/* make C compiler happy */
(void) irc_message;
@@ -970,13 +970,13 @@ irc_protocol_cmd_mode (t_irc_server *server, char *irc_message, char *host,
*/
int
-irc_protocol_cmd_nick (t_irc_server *server, char *irc_message, char *host,
+irc_protocol_cmd_nick (struct t_irc_server *server, char *irc_message, char *host,
char *nick, char *arguments, int ignore, int highlight)
{
- t_irc_channel *ptr_channel;
- t_irc_nick *ptr_nick;
+ struct t_irc_channel *ptr_channel;
+ struct t_irc_nick *ptr_nick;
int nick_is_me;
- t_gui_window *ptr_window;
+ struct t_gui_window *ptr_window;
/* make C compiler happy */
(void) irc_message;
@@ -1070,13 +1070,13 @@ irc_protocol_cmd_nick (t_irc_server *server, char *irc_message, char *host,
*/
int
-irc_protocol_cmd_notice (t_irc_server *server, char *irc_message, char *host,
+irc_protocol_cmd_notice (struct t_irc_server *server, char *irc_message, char *host,
char *nick, char *arguments, int ignore, int highlight)
{
char *host2, *pos, *pos2, *pos_usec;
struct timeval tv;
long sec1, usec1, sec2, usec2, difftime;
- t_irc_channel *ptr_channel;
+ struct t_irc_channel *ptr_channel;
int highlight_displayed;
/* make C compiler happy */
@@ -1282,13 +1282,13 @@ irc_protocol_cmd_notice (t_irc_server *server, char *irc_message, char *host,
*/
int
-irc_protocol_cmd_part (t_irc_server *server, char *irc_message, char *host,
+irc_protocol_cmd_part (struct t_irc_server *server, char *irc_message, char *host,
char *nick, char *arguments, int ignore, int highlight)
{
char *pos, *pos_args, *join_string;
int join_length;
- t_irc_channel *ptr_channel;
- t_irc_nick *ptr_nick;
+ struct t_irc_channel *ptr_channel;
+ struct t_irc_nick *ptr_nick;
/* make C compiler happy */
(void) irc_message;
@@ -1412,7 +1412,7 @@ irc_protocol_cmd_part (t_irc_server *server, char *irc_message, char *host,
*/
int
-irc_protocol_cmd_ping (t_irc_server *server, char *irc_message, char *host,
+irc_protocol_cmd_ping (struct t_irc_server *server, char *irc_message, char *host,
char *nick, char *arguments, int ignore, int highlight)
{
char *pos;
@@ -1441,7 +1441,7 @@ irc_protocol_cmd_ping (t_irc_server *server, char *irc_message, char *host,
*/
int
-irc_protocol_cmd_pong (t_irc_server *server, char *irc_message, char *host,
+irc_protocol_cmd_pong (struct t_irc_server *server, char *irc_message, char *host,
char *nick, char *arguments, int ignore, int highlight)
{
struct timeval tv;
@@ -1477,12 +1477,12 @@ irc_protocol_cmd_pong (t_irc_server *server, char *irc_message, char *host,
*/
void
-irc_cmd_reply_version (t_irc_server *server, t_irc_channel *channel,
+irc_cmd_reply_version (struct t_irc_server *server, struct t_irc_channel *channel,
char *nick, char *message, int ignore)
{
char *pos;
struct utsname *buf;
- t_gui_buffer *ptr_buffer;
+ struct t_gui_buffer *ptr_buffer;
ptr_buffer = (channel) ? channel->buffer : server->buffer;
@@ -1540,13 +1540,13 @@ irc_cmd_reply_version (t_irc_server *server, t_irc_channel *channel,
*/
int
-irc_protocol_cmd_privmsg (t_irc_server *server, char *irc_message, char *host,
+irc_protocol_cmd_privmsg (struct t_irc_server *server, char *irc_message, char *host,
char *nick, char *arguments, int ignore, int highlight)
{
char *pos, *pos2, *host2;
char *pos_file, *pos_addr, *pos_port, *pos_size, *pos_start_resume; /* for DCC */
- t_irc_channel *ptr_channel;
- t_irc_nick *ptr_nick;
+ struct t_irc_channel *ptr_channel;
+ struct t_irc_nick *ptr_nick;
int highlight_displayed;
/* make C compiler happy */
@@ -2302,12 +2302,12 @@ irc_protocol_cmd_privmsg (t_irc_server *server, char *irc_message, char *host,
*/
int
-irc_protocol_cmd_quit (t_irc_server *server, char *irc_message, char *host,
+irc_protocol_cmd_quit (struct t_irc_server *server, char *irc_message, char *host,
char *nick, char *arguments, int ignore, int highlight)
{
char *pos;
- t_irc_channel *ptr_channel;
- t_irc_nick *ptr_nick;
+ struct t_irc_channel *ptr_channel;
+ struct t_irc_nick *ptr_nick;
/* make C compiler happy */
(void) irc_message;
@@ -2372,7 +2372,7 @@ irc_protocol_cmd_quit (t_irc_server *server, char *irc_message, char *host,
*/
int
-irc_protocol_cmd_server_mode_reason (t_irc_server *server, char *irc_message, char *host,
+irc_protocol_cmd_server_mode_reason (struct t_irc_server *server, char *irc_message, char *host,
char *nick, char *arguments, int ignore, int highlight)
{
char *ptr_msg;
@@ -2416,7 +2416,7 @@ irc_protocol_cmd_server_mode_reason (t_irc_server *server, char *irc_message, ch
*/
int
-irc_protocol_cmd_server_msg (t_irc_server *server, char *irc_message, char *host,
+irc_protocol_cmd_server_msg (struct t_irc_server *server, char *irc_message, char *host,
char *nick, char *arguments, int ignore, int highlight)
{
/* make C compiler happy */
@@ -2452,12 +2452,12 @@ irc_protocol_cmd_server_msg (t_irc_server *server, char *irc_message, char *host
*/
int
-irc_protocol_cmd_topic (t_irc_server *server, char *irc_message, char *host,
+irc_protocol_cmd_topic (struct t_irc_server *server, char *irc_message, char *host,
char *nick, char *arguments, int ignore, int highlight)
{
char *pos;
- t_irc_channel *ptr_channel;
- t_gui_buffer *buffer;
+ struct t_irc_channel *ptr_channel;
+ struct t_gui_buffer *buffer;
/* make C compiler happy */
(void) irc_message;
@@ -2531,7 +2531,7 @@ irc_protocol_cmd_topic (t_irc_server *server, char *irc_message, char *host,
*/
int
-irc_protocol_cmd_wallops (t_irc_server *server, char *irc_message, char *host,
+irc_protocol_cmd_wallops (struct t_irc_server *server, char *irc_message, char *host,
char *nick, char *arguments, int ignore, int highlight)
{
/* make C compiler happy */
@@ -2559,7 +2559,7 @@ irc_protocol_cmd_wallops (t_irc_server *server, char *irc_message, char *host,
*/
int
-irc_protocol_cmd_001 (t_irc_server *server, char *irc_message, char *host,
+irc_protocol_cmd_001 (struct t_irc_server *server, char *irc_message, char *host,
char *nick, char *arguments, int ignore, int highlight)
{
char *pos;
@@ -2630,7 +2630,7 @@ irc_protocol_cmd_001 (t_irc_server *server, char *irc_message, char *host,
*/
int
-irc_protocol_cmd_005 (t_irc_server *server, char *irc_message, char *host,
+irc_protocol_cmd_005 (struct t_irc_server *server, char *irc_message, char *host,
char *nick, char *arguments, int ignore, int highlight)
{
char *pos, *pos2;
@@ -2667,7 +2667,7 @@ irc_protocol_cmd_005 (t_irc_server *server, char *irc_message, char *host,
*/
int
-irc_protocol_cmd_221 (t_irc_server *server, char *irc_message, char *host,
+irc_protocol_cmd_221 (struct t_irc_server *server, char *irc_message, char *host,
char *nick, char *arguments, int ignore, int highlight)
{
char *pos_mode;
@@ -2716,12 +2716,12 @@ irc_protocol_cmd_221 (t_irc_server *server, char *irc_message, char *host,
*/
int
-irc_protocol_cmd_301 (t_irc_server *server, char *irc_message, char *host,
+irc_protocol_cmd_301 (struct t_irc_server *server, char *irc_message, char *host,
char *nick, char *arguments, int ignore, int highlight)
{
char *pos_nick, *pos_message;
- t_irc_channel *ptr_channel;
- t_gui_buffer *ptr_buffer;
+ struct t_irc_channel *ptr_channel;
+ struct t_gui_buffer *ptr_buffer;
/* make C compiler happy */
(void) server;
@@ -2778,7 +2778,7 @@ irc_protocol_cmd_301 (t_irc_server *server, char *irc_message, char *host,
*/
int
-irc_protocol_cmd_302 (t_irc_server *server, char *irc_message, char *host,
+irc_protocol_cmd_302 (struct t_irc_server *server, char *irc_message, char *host,
char *nick, char *arguments, int ignore, int highlight)
{
char *pos_host, *ptr_next;
@@ -2839,7 +2839,7 @@ irc_protocol_cmd_302 (t_irc_server *server, char *irc_message, char *host,
*/
int
-irc_protocol_cmd_303 (t_irc_server *server, char *irc_message, char *host,
+irc_protocol_cmd_303 (struct t_irc_server *server, char *irc_message, char *host,
char *nick, char *arguments, int ignore, int highlight)
{
char *ptr_next;
@@ -2889,10 +2889,10 @@ irc_protocol_cmd_303 (t_irc_server *server, char *irc_message, char *host,
*/
int
-irc_protocol_cmd_305 (t_irc_server *server, char *irc_message, char *host,
+irc_protocol_cmd_305 (struct t_irc_server *server, char *irc_message, char *host,
char *nick, char *arguments, int ignore, int highlight)
{
- t_gui_window *ptr_window;
+ struct t_gui_window *ptr_window;
/* make C compiler happy */
(void) irc_message;
@@ -2929,10 +2929,10 @@ irc_protocol_cmd_305 (t_irc_server *server, char *irc_message, char *host,
*/
int
-irc_protocol_cmd_306 (t_irc_server *server, char *irc_message, char *host,
+irc_protocol_cmd_306 (struct t_irc_server *server, char *irc_message, char *host,
char *nick, char *arguments, int ignore, int highlight)
{
- t_gui_window *ptr_window;
+ struct t_gui_window *ptr_window;
/* make C compiler happy */
(void) irc_message;
@@ -2975,7 +2975,7 @@ irc_protocol_cmd_306 (t_irc_server *server, char *irc_message, char *host,
*/
int
-irc_protocol_cmd_whois_nick_msg (t_irc_server *server, char *irc_message, char *host,
+irc_protocol_cmd_whois_nick_msg (struct t_irc_server *server, char *irc_message, char *host,
char *nick, char *arguments, int ignore, int highlight)
{
char *pos_nick, *pos_msg;
@@ -3021,7 +3021,7 @@ irc_protocol_cmd_whois_nick_msg (t_irc_server *server, char *irc_message, char *
*/
int
-irc_protocol_cmd_310 (t_irc_server *server, char *irc_message, char *host,
+irc_protocol_cmd_310 (struct t_irc_server *server, char *irc_message, char *host,
char *nick, char *arguments, int ignore, int highlight)
{
char *pos_nick;
@@ -3057,7 +3057,7 @@ irc_protocol_cmd_310 (t_irc_server *server, char *irc_message, char *host,
*/
int
-irc_protocol_cmd_311 (t_irc_server *server, char *irc_message, char *host,
+irc_protocol_cmd_311 (struct t_irc_server *server, char *irc_message, char *host,
char *nick, char *arguments, int ignore, int highlight)
{
char *pos_nick, *pos_user, *pos_host, *pos_realname;
@@ -3128,7 +3128,7 @@ irc_protocol_cmd_311 (t_irc_server *server, char *irc_message, char *host,
*/
int
-irc_protocol_cmd_312 (t_irc_server *server, char *irc_message, char *host,
+irc_protocol_cmd_312 (struct t_irc_server *server, char *irc_message, char *host,
char *nick, char *arguments, int ignore, int highlight)
{
char *pos_nick, *pos_server, *pos_serverinfo;
@@ -3187,7 +3187,7 @@ irc_protocol_cmd_312 (t_irc_server *server, char *irc_message, char *host,
*/
int
-irc_protocol_cmd_314 (t_irc_server *server, char *irc_message, char *host,
+irc_protocol_cmd_314 (struct t_irc_server *server, char *irc_message, char *host,
char *nick, char *arguments, int ignore, int highlight)
{
char *pos_nick, *pos_user, *pos_host, *pos_realname;
@@ -3261,11 +3261,11 @@ irc_protocol_cmd_314 (t_irc_server *server, char *irc_message, char *host,
*/
int
-irc_protocol_cmd_315 (t_irc_server *server, char *irc_message, char *host,
+irc_protocol_cmd_315 (struct t_irc_server *server, char *irc_message, char *host,
char *nick, char *arguments, int ignore, int highlight)
{
char *pos;
- t_irc_channel *ptr_channel;
+ struct t_irc_channel *ptr_channel;
/* make C compiler happy */
(void) irc_message;
@@ -3315,7 +3315,7 @@ irc_protocol_cmd_315 (t_irc_server *server, char *irc_message, char *host,
*/
int
-irc_protocol_cmd_317 (t_irc_server *server, char *irc_message, char *host,
+irc_protocol_cmd_317 (struct t_irc_server *server, char *irc_message, char *host,
char *nick, char *arguments, int ignore, int highlight)
{
char *pos_nick, *pos_idle, *pos_signon, *pos_message;
@@ -3405,7 +3405,7 @@ irc_protocol_cmd_317 (t_irc_server *server, char *irc_message, char *host,
*/
int
-irc_protocol_cmd_319 (t_irc_server *server, char *irc_message, char *host,
+irc_protocol_cmd_319 (struct t_irc_server *server, char *irc_message, char *host,
char *nick, char *arguments, int ignore, int highlight)
{
char *pos_nick, *pos_channel, *pos;
@@ -3502,7 +3502,7 @@ irc_protocol_cmd_319 (t_irc_server *server, char *irc_message, char *host,
*/
int
-irc_protocol_cmd_321 (t_irc_server *server, char *irc_message, char *host,
+irc_protocol_cmd_321 (struct t_irc_server *server, char *irc_message, char *host,
char *nick, char *arguments, int ignore, int highlight)
{
char *pos;
@@ -3536,7 +3536,7 @@ irc_protocol_cmd_321 (t_irc_server *server, char *irc_message, char *host,
*/
int
-irc_protocol_cmd_322 (t_irc_server *server, char *irc_message, char *host,
+irc_protocol_cmd_322 (struct t_irc_server *server, char *irc_message, char *host,
char *nick, char *arguments, int ignore, int highlight)
{
char *pos;
@@ -3576,7 +3576,7 @@ irc_protocol_cmd_322 (t_irc_server *server, char *irc_message, char *host,
*/
int
-irc_protocol_cmd_323 (t_irc_server *server, char *irc_message, char *host,
+irc_protocol_cmd_323 (struct t_irc_server *server, char *irc_message, char *host,
char *nick, char *arguments, int ignore, int highlight)
{
char *pos;
@@ -3610,11 +3610,11 @@ irc_protocol_cmd_323 (t_irc_server *server, char *irc_message, char *host,
*/
int
-irc_protocol_cmd_324 (t_irc_server *server, char *irc_message, char *host,
+irc_protocol_cmd_324 (struct t_irc_server *server, char *irc_message, char *host,
char *nick, char *arguments, int ignore, int highlight)
{
char *pos_channel, *pos_modes, *pos;
- t_irc_channel *ptr_channel;
+ struct t_irc_channel *ptr_channel;
/* make C compiler happy */
(void) irc_message;
@@ -3681,7 +3681,7 @@ irc_protocol_cmd_324 (t_irc_server *server, char *irc_message, char *host,
*/
int
-irc_protocol_cmd_327 (t_irc_server *server, char *irc_message, char *host,
+irc_protocol_cmd_327 (struct t_irc_server *server, char *irc_message, char *host,
char *nick, char *arguments, int ignore, int highlight)
{
char *pos_nick, *pos_host1, *pos_host2, *pos_other;
@@ -3750,11 +3750,11 @@ irc_protocol_cmd_327 (t_irc_server *server, char *irc_message, char *host,
*/
int
-irc_protocol_cmd_329 (t_irc_server *server, char *irc_message, char *host,
+irc_protocol_cmd_329 (struct t_irc_server *server, char *irc_message, char *host,
char *nick, char *arguments, int ignore, int highlight)
{
char *pos_channel, *pos_date;
- t_irc_channel *ptr_channel;
+ struct t_irc_channel *ptr_channel;
time_t datetime;
/* make C compiler happy */
@@ -3820,11 +3820,11 @@ irc_protocol_cmd_329 (t_irc_server *server, char *irc_message, char *host,
*/
int
-irc_protocol_cmd_331 (t_irc_server *server, char *irc_message, char *host,
+irc_protocol_cmd_331 (struct t_irc_server *server, char *irc_message, char *host,
char *nick, char *arguments, int ignore, int highlight)
{
char *pos_channel, *pos;
- t_irc_channel *ptr_channel;
+ struct t_irc_channel *ptr_channel;
/* make C compiler happy */
(void) irc_message;
@@ -3869,12 +3869,12 @@ irc_protocol_cmd_331 (t_irc_server *server, char *irc_message, char *host,
*/
int
-irc_protocol_cmd_332 (t_irc_server *server, char *irc_message, char *host,
+irc_protocol_cmd_332 (struct t_irc_server *server, char *irc_message, char *host,
char *nick, char *arguments, int ignore, int highlight)
{
char *pos, *pos2;
- t_irc_channel *ptr_channel;
- t_gui_buffer *ptr_buffer;
+ struct t_irc_channel *ptr_channel;
+ struct t_gui_buffer *ptr_buffer;
/* make C compiler happy */
(void) irc_message;
@@ -3935,12 +3935,12 @@ irc_protocol_cmd_332 (t_irc_server *server, char *irc_message, char *host,
*/
int
-irc_protocol_cmd_333 (t_irc_server *server, char *irc_message, char *host,
+irc_protocol_cmd_333 (struct t_irc_server *server, char *irc_message, char *host,
char *nick, char *arguments, int ignore, int highlight)
{
char *pos_channel, *pos_nick, *pos_date;
- t_irc_channel *ptr_channel;
- t_gui_buffer *ptr_buffer;
+ struct t_irc_channel *ptr_channel;
+ struct t_gui_buffer *ptr_buffer;
time_t datetime;
/* make C compiler happy */
@@ -4006,7 +4006,7 @@ irc_protocol_cmd_333 (t_irc_server *server, char *irc_message, char *host,
*/
int
-irc_protocol_cmd_338 (t_irc_server *server, char *irc_message, char *host,
+irc_protocol_cmd_338 (struct t_irc_server *server, char *irc_message, char *host,
char *nick, char *arguments, int ignore, int highlight)
{
char *pos_nick, *pos_host, *pos_message;
@@ -4065,7 +4065,7 @@ irc_protocol_cmd_338 (t_irc_server *server, char *irc_message, char *host,
*/
int
-irc_protocol_cmd_341 (t_irc_server *server, char *irc_message, char *host,
+irc_protocol_cmd_341 (struct t_irc_server *server, char *irc_message, char *host,
char *nick, char *arguments, int ignore, int highlight)
{
char *pos_nick, *pos_channel;
@@ -4134,7 +4134,7 @@ irc_protocol_cmd_341 (t_irc_server *server, char *irc_message, char *host,
*/
int
-irc_protocol_cmd_344 (t_irc_server *server, char *irc_message, char *host,
+irc_protocol_cmd_344 (struct t_irc_server *server, char *irc_message, char *host,
char *nick, char *arguments, int ignore, int highlight)
{
char *pos_channel, *pos_host;
@@ -4178,7 +4178,7 @@ irc_protocol_cmd_344 (t_irc_server *server, char *irc_message, char *host,
*/
int
-irc_protocol_cmd_345 (t_irc_server *server, char *irc_message, char *host,
+irc_protocol_cmd_345 (struct t_irc_server *server, char *irc_message, char *host,
char *nick, char *arguments, int ignore, int highlight)
{
char *pos;
@@ -4223,12 +4223,12 @@ irc_protocol_cmd_345 (t_irc_server *server, char *irc_message, char *host,
*/
int
-irc_protocol_cmd_348 (t_irc_server *server, char *irc_message, char *host,
+irc_protocol_cmd_348 (struct t_irc_server *server, char *irc_message, char *host,
char *nick, char *arguments, int ignore, int highlight)
{
char *pos_channel, *pos_exception, *pos_user, *pos_date, *pos;
- t_irc_channel *ptr_channel;
- t_gui_buffer *buffer;
+ struct t_irc_channel *ptr_channel;
+ struct t_gui_buffer *buffer;
time_t datetime;
/* make C compiler happy */
@@ -4342,12 +4342,12 @@ irc_protocol_cmd_348 (t_irc_server *server, char *irc_message, char *host,
*/
int
-irc_protocol_cmd_349 (t_irc_server *server, char *irc_message, char *host,
+irc_protocol_cmd_349 (struct t_irc_server *server, char *irc_message, char *host,
char *nick, char *arguments, int ignore, int highlight)
{
char *pos_channel, *pos_msg;
- t_irc_channel *ptr_channel;
- t_gui_buffer *buffer;
+ struct t_irc_channel *ptr_channel;
+ struct t_gui_buffer *buffer;
/* make C compiler happy */
(void) irc_message;
@@ -4405,7 +4405,7 @@ irc_protocol_cmd_349 (t_irc_server *server, char *irc_message, char *host,
*/
int
-irc_protocol_cmd_351 (t_irc_server *server, char *irc_message, char *host,
+irc_protocol_cmd_351 (struct t_irc_server *server, char *irc_message, char *host,
char *nick, char *arguments, int ignore, int highlight)
{
char *pos, *pos2;
@@ -4448,14 +4448,14 @@ irc_protocol_cmd_351 (t_irc_server *server, char *irc_message, char *host,
*/
int
-irc_protocol_cmd_352 (t_irc_server *server, char *irc_message, char *host,
+irc_protocol_cmd_352 (struct t_irc_server *server, char *irc_message, char *host,
char *nick, char *arguments, int ignore, int highlight)
{
char *pos_channel, *pos_user, *pos_host, *pos_server, *pos_nick;
char *pos_attr, *pos_hopcount, *pos_realname;
int length;
- t_irc_channel *ptr_channel;
- t_irc_nick *ptr_nick;
+ struct t_irc_channel *ptr_channel;
+ struct t_irc_nick *ptr_nick;
/* make C compiler happy */
(void) irc_message;
@@ -4576,15 +4576,15 @@ irc_protocol_cmd_352 (t_irc_server *server, char *irc_message, char *host,
*/
int
-irc_protocol_cmd_353 (t_irc_server *server, char *irc_message, char *host,
+irc_protocol_cmd_353 (struct t_irc_server *server, char *irc_message, char *host,
char *nick, char *arguments, int ignore, int highlight)
{
char *pos, *pos_nick;
int is_chanowner, is_chanadmin, is_chanadmin2, is_op, is_halfop;
int has_voice, is_chanuser;
int prefix_found, color;
- t_irc_channel *ptr_channel;
- t_gui_buffer *ptr_buffer;
+ struct t_irc_channel *ptr_channel;
+ struct t_gui_buffer *ptr_buffer;
/* make C compiler happy */
(void) irc_message;
@@ -4762,12 +4762,12 @@ irc_protocol_cmd_353 (t_irc_server *server, char *irc_message, char *host,
*/
int
-irc_protocol_cmd_366 (t_irc_server *server, char *irc_message, char *host,
+irc_protocol_cmd_366 (struct t_irc_server *server, char *irc_message, char *host,
char *nick, char *arguments, int ignore, int highlight)
{
char *pos, *pos2;
- t_irc_channel *ptr_channel;
- t_irc_nick *ptr_nick;
+ struct t_irc_channel *ptr_channel;
+ struct t_irc_nick *ptr_nick;
int num_nicks, num_op, num_halfop, num_voice, num_normal;
/* make C compiler happy */
@@ -4873,12 +4873,12 @@ irc_protocol_cmd_366 (t_irc_server *server, char *irc_message, char *host,
*/
int
-irc_protocol_cmd_367 (t_irc_server *server, char *irc_message, char *host,
+irc_protocol_cmd_367 (struct t_irc_server *server, char *irc_message, char *host,
char *nick, char *arguments, int ignore, int highlight)
{
char *pos_channel, *pos_ban, *pos_user, *pos_date, *pos;
- t_irc_channel *ptr_channel;
- t_gui_buffer *buffer;
+ struct t_irc_channel *ptr_channel;
+ struct t_gui_buffer *buffer;
time_t datetime;
/* make C compiler happy */
@@ -5000,12 +5000,12 @@ irc_protocol_cmd_367 (t_irc_server *server, char *irc_message, char *host,
*/
int
-irc_protocol_cmd_368 (t_irc_server *server, char *irc_message, char *host,
+irc_protocol_cmd_368 (struct t_irc_server *server, char *irc_message, char *host,
char *nick, char *arguments, int ignore, int highlight)
{
char *pos_channel, *pos_msg;
- t_irc_channel *ptr_channel;
- t_gui_buffer *buffer;
+ struct t_irc_channel *ptr_channel;
+ struct t_gui_buffer *buffer;
/* make C compiler happy */
(void) irc_message;
@@ -5063,7 +5063,7 @@ irc_protocol_cmd_368 (t_irc_server *server, char *irc_message, char *host,
*/
int
-irc_protocol_cmd_432 (t_irc_server *server, char *irc_message, char *host,
+irc_protocol_cmd_432 (struct t_irc_server *server, char *irc_message, char *host,
char *nick, char *arguments, int ignore, int highlight)
{
/* Note: this IRC command can not be ignored */
@@ -5123,7 +5123,7 @@ irc_protocol_cmd_432 (t_irc_server *server, char *irc_message, char *host,
*/
int
-irc_protocol_cmd_433 (t_irc_server *server, char *irc_message, char *host,
+irc_protocol_cmd_433 (struct t_irc_server *server, char *irc_message, char *host,
char *nick, char *arguments, int ignore, int highlight)
{
/* Note: this IRC command can not be ignored */
@@ -5186,7 +5186,7 @@ irc_protocol_cmd_433 (t_irc_server *server, char *irc_message, char *host,
*/
int
-irc_protocol_cmd_438 (t_irc_server *server, char *irc_message, char *host,
+irc_protocol_cmd_438 (struct t_irc_server *server, char *irc_message, char *host,
char *nick, char *arguments, int ignore, int highlight)
{
char *pos, *pos2;
@@ -5231,7 +5231,7 @@ irc_protocol_cmd_438 (t_irc_server *server, char *irc_message, char *host,
*/
int
-irc_protocol_cmd_671 (t_irc_server *server, char *irc_message, char *host,
+irc_protocol_cmd_671 (struct t_irc_server *server, char *irc_message, char *host,
char *nick, char *arguments, int ignore, int highlight)
{
char *pos_nick, *pos_message;
diff --git a/src/plugins/irc/irc-protocol.h b/src/plugins/irc/irc-protocol.h
index 4c1e324f8..55e02ba40 100644
--- a/src/plugins/irc/irc-protocol.h
+++ b/src/plugins/irc/irc-protocol.h
@@ -20,8 +20,10 @@
#ifndef __WEECHAT_IRC_PROTOCOL_H
#define __WEECHAT_IRC_PROTOCOL_H 1
-typedef int (t_irc_recv_func)(t_irc_server *, char *, char *, char *, char *,
- int, int);
+#include "irc-server.h"
+
+typedef int (t_irc_recv_func)(struct t_irc_server *, char *, char *, char *,
+ char *, int, int);
struct t_irc_protocol_msg
{
@@ -30,4 +32,67 @@ struct t_irc_protocol_msg
t_irc_recv_func *recv_function; /* function called when msg is received */
};
+extern int irc_protocol_is_highlight (char *, char *);
+extern int irc_protocol_recv_command (struct t_irc_server *, char *, char *, char *, char *);
+extern int irc_protocol_cmd_error (struct t_irc_server *, char *, char *, char *, char *, int, int);
+extern int irc_protocol_cmd_invite (struct t_irc_server *, char *, char *, char *, char *, int, int);
+extern int irc_protocol_cmd_join (struct t_irc_server *, char *, char *, char *, char *, int, int);
+extern int irc_protocol_cmd_kick (struct t_irc_server *, char *, char *, char *, char *, int, int);
+extern int irc_protocol_cmd_kill (struct t_irc_server *, char *, char *, char *, char *, int, int);
+extern int irc_protocol_cmd_mode (struct t_irc_server *, char *, char *, char *, char *, int, int);
+extern int irc_protocol_cmd_nick (struct t_irc_server *, char *, char *, char *, char *, int, int);
+extern int irc_protocol_cmd_notice (struct t_irc_server *, char *, char *, char *, char *, int, int);
+extern int irc_protocol_cmd_part (struct t_irc_server *, char *, char *, char *, char *, int, int);
+extern int irc_protocol_cmd_ping (struct t_irc_server *, char *, char *, char *, char *, int, int);
+extern int irc_protocol_cmd_pong (struct t_irc_server *, char *, char *, char *, char *, int, int);
+extern int irc_protocol_cmd_privmsg (struct t_irc_server *, char *, char *, char *, char *, int, int);
+extern int irc_protocol_cmd_quit (struct t_irc_server *, char *, char *, char *, char *, int, int);
+extern int irc_protocol_cmd_server_mode_reason (struct t_irc_server *, char *, char *, char *, char *, int, int);
+extern int irc_protocol_cmd_server_msg (struct t_irc_server *, char *, char *, char *, char *, int, int);
+extern int irc_protocol_cmd_server_reply (struct t_irc_server *, char *, char *, char *, char *, int, int);
+extern int irc_protocol_cmd_topic (struct t_irc_server *, char *, char *, char *, char *, int, int);
+extern int irc_protocol_cmd_wallops (struct t_irc_server *, char *, char *, char *, char *, int, int);
+extern int irc_protocol_cmd_001 (struct t_irc_server *, char *, char *, char *, char *, int, int);
+extern int irc_protocol_cmd_005 (struct t_irc_server *, char *, char *, char *, char *, int, int);
+extern int irc_protocol_cmd_221 (struct t_irc_server *, char *, char *, char *, char *, int, int);
+extern int irc_protocol_cmd_301 (struct t_irc_server *, char *, char *, char *, char *, int, int);
+extern int irc_protocol_cmd_302 (struct t_irc_server *, char *, char *, char *, char *, int, int);
+extern int irc_protocol_cmd_303 (struct t_irc_server *, char *, char *, char *, char *, int, int);
+extern int irc_protocol_cmd_305 (struct t_irc_server *, char *, char *, char *, char *, int, int);
+extern int irc_protocol_cmd_306 (struct t_irc_server *, char *, char *, char *, char *, int, int);
+extern int irc_protocol_cmd_whois_nick_msg (struct t_irc_server *, char *, char *, char *, char *, int, int);
+extern int irc_protocol_cmd_310 (struct t_irc_server *, char *, char *, char *, char *, int, int);
+extern int irc_protocol_cmd_311 (struct t_irc_server *, char *, char *, char *, char *, int, int);
+extern int irc_protocol_cmd_312 (struct t_irc_server *, char *, char *, char *, char *, int, int);
+extern int irc_protocol_cmd_314 (struct t_irc_server *, char *, char *, char *, char *, int, int);
+extern int irc_protocol_cmd_315 (struct t_irc_server *, char *, char *, char *, char *, int, int);
+extern int irc_protocol_cmd_317 (struct t_irc_server *, char *, char *, char *, char *, int, int);
+extern int irc_protocol_cmd_319 (struct t_irc_server *, char *, char *, char *, char *, int, int);
+extern int irc_protocol_cmd_321 (struct t_irc_server *, char *, char *, char *, char *, int, int);
+extern int irc_protocol_cmd_322 (struct t_irc_server *, char *, char *, char *, char *, int, int);
+extern int irc_protocol_cmd_323 (struct t_irc_server *, char *, char *, char *, char *, int, int);
+extern int irc_protocol_cmd_324 (struct t_irc_server *, char *, char *, char *, char *, int, int);
+extern int irc_protocol_cmd_327 (struct t_irc_server *, char *, char *, char *, char *, int, int);
+extern int irc_protocol_cmd_329 (struct t_irc_server *, char *, char *, char *, char *, int, int);
+extern int irc_protocol_cmd_331 (struct t_irc_server *, char *, char *, char *, char *, int, int);
+extern int irc_protocol_cmd_332 (struct t_irc_server *, char *, char *, char *, char *, int, int);
+extern int irc_protocol_cmd_333 (struct t_irc_server *, char *, char *, char *, char *, int, int);
+extern int irc_protocol_cmd_338 (struct t_irc_server *, char *, char *, char *, char *, int, int);
+extern int irc_protocol_cmd_341 (struct t_irc_server *, char *, char *, char *, char *, int, int);
+extern int irc_protocol_cmd_344 (struct t_irc_server *, char *, char *, char *, char *, int, int);
+extern int irc_protocol_cmd_345 (struct t_irc_server *, char *, char *, char *, char *, int, int);
+extern int irc_protocol_cmd_348 (struct t_irc_server *, char *, char *, char *, char *, int, int);
+extern int irc_protocol_cmd_349 (struct t_irc_server *, char *, char *, char *, char *, int, int);
+extern int irc_protocol_cmd_351 (struct t_irc_server *, char *, char *, char *, char *, int, int);
+extern int irc_protocol_cmd_352 (struct t_irc_server *, char *, char *, char *, char *, int, int);
+extern int irc_protocol_cmd_353 (struct t_irc_server *, char *, char *, char *, char *, int, int);
+extern int irc_protocol_cmd_365 (struct t_irc_server *, char *, char *, char *, char *, int, int);
+extern int irc_protocol_cmd_366 (struct t_irc_server *, char *, char *, char *, char *, int, int);
+extern int irc_protocol_cmd_367 (struct t_irc_server *, char *, char *, char *, char *, int, int);
+extern int irc_protocol_cmd_368 (struct t_irc_server *, char *, char *, char *, char *, int, int);
+extern int irc_protocol_cmd_432 (struct t_irc_server *, char *, char *, char *, char *, int, int);
+extern int irc_protocol_cmd_433 (struct t_irc_server *, char *, char *, char *, char *, int, int);
+extern int irc_protocol_cmd_438 (struct t_irc_server *, char *, char *, char *, char *, int, int);
+extern int irc_protocol_cmd_671 (struct t_irc_server *, char *, char *, char *, char *, int, int);
+
#endif /* irc-protocol.h */
diff --git a/src/plugins/irc/irc-server.c b/src/plugins/irc/irc-server.c
index 2e751eb95..38a76a457 100644
--- a/src/plugins/irc/irc-server.c
+++ b/src/plugins/irc/irc-server.c
@@ -32,8 +32,10 @@
#include <string.h>
#include <pwd.h>
#include <sys/socket.h>
+#include <sys/time.h>
#include <sys/types.h>
#include <sys/wait.h>
+#include <time.h>
#include <netinet/in.h>
#include <arpa/inet.h>
#include <netdb.h>
@@ -42,21 +44,18 @@
#include <gnutls/gnutls.h>
#endif
-#include "../../core/weechat.h"
#include "irc.h"
-#include "../../core/hook.h"
-#include "../../core/log.h"
-#include "../../core/util.h"
-#include "../../core/weechat-config.h"
-#include "../../gui/gui.h"
-#include "../../plugins/plugins.h"
+#include "irc-server.h"
+#include "irc-channel.h"
+#include "irc-config.h"
+#include "irc-nick.h"
-t_irc_server *irc_servers = NULL;
-t_irc_server *last_irc_server = NULL;
+struct t_irc_server *irc_servers = NULL;
+struct t_irc_server *last_irc_server = NULL;
-t_irc_message *irc_recv_msgq = NULL;
-t_irc_message *irc_msgq_last_msg = NULL;
+struct t_irc_message *irc_recv_msgq = NULL;
+struct t_irc_message *irc_msgq_last_msg = NULL;
#ifdef HAVE_GNUTLS
const int gnutls_cert_type_prio[] = { GNUTLS_CRT_X509, GNUTLS_CRT_OPENPGP, 0 };
@@ -75,7 +74,7 @@ const int gnutls_cert_type_prio[] = { GNUTLS_CRT_X509, GNUTLS_CRT_OPENPGP, 0 };
*/
void
-irc_server_init (t_irc_server *server)
+irc_server_init (struct t_irc_server *server)
{
/* user choices */
server->name = NULL;
@@ -122,7 +121,8 @@ irc_server_init (t_irc_server *server)
server->lag = 0;
server->lag_check_time.tv_sec = 0;
server->lag_check_time.tv_usec = 0;
- server->lag_next_check = time (NULL) + irc_cfg_irc_lag_check;
+ server->lag_next_check = time (NULL) +
+ weechat_config_integer (irc_config_irc_lag_check);
server->cmd_list_regexp = NULL;
server->queue_msg = 0;
server->last_user_message = 0;
@@ -141,7 +141,7 @@ irc_server_init (t_irc_server *server)
*/
int
-irc_server_init_with_url (char *irc_url, t_irc_server *server)
+irc_server_init_with_url (struct t_irc_server *server, char *irc_url)
{
char *url, *pos_server, *pos_channel, *pos, *pos2;
int ipv6, ssl;
@@ -199,10 +199,10 @@ irc_server_init_with_url (char *irc_url, t_irc_server *server)
server->nick1 = strdup (my_passwd->pw_name);
else
{
- weechat_iconv_fprintf (stderr, "%s: %s (%s).",
- WEECHAT_WARNING,
- _("Unable to get user's name"),
- strerror (errno));
+ weechat_printf (NULL,
+ _("%sIrc: error retrieving user's name: %s"),
+ weechat_prefix ("error"),
+ strerror (errno));
free (url);
return -1;
}
@@ -258,26 +258,118 @@ irc_server_init_with_url (char *irc_url, t_irc_server *server)
}
/*
+ * irc_server_init_with_config_options: init a server with config options
+ * (called when reading config file)
+ */
+
+void
+irc_server_init_with_config_options (struct t_irc_server *server,
+ void *section)
+{
+ struct t_config_option *ptr_option;
+
+ ptr_option = weechat_config_search_option (NULL, section, "server_name");
+ if (ptr_option)
+ server->name = strdup (weechat_config_string (ptr_option));
+
+ ptr_option = weechat_config_search_option (NULL, section, "server_autoconnect");
+ if (ptr_option)
+ server->autoconnect = weechat_config_integer (ptr_option);
+
+ ptr_option = weechat_config_search_option (NULL, section, "server_autoreconnect");
+ if (ptr_option)
+ server->autoreconnect = weechat_config_integer (ptr_option);
+
+ ptr_option = weechat_config_search_option (NULL, section, "server_autoreconnect_delay");
+ if (ptr_option)
+ server->autoreconnect_delay = weechat_config_integer (ptr_option);
+
+ ptr_option = weechat_config_search_option (NULL, section, "server_address");
+ if (ptr_option)
+ server->address = strdup (weechat_config_string (ptr_option));
+
+ ptr_option = weechat_config_search_option (NULL, section, "server_port");
+ if (ptr_option)
+ server->port = weechat_config_integer (ptr_option);
+
+ ptr_option = weechat_config_search_option (NULL, section, "server_ipv6");
+ if (ptr_option)
+ server->ipv6 = weechat_config_integer (ptr_option);
+
+ ptr_option = weechat_config_search_option (NULL, section, "server_ssl");
+ if (ptr_option)
+ server->ssl = weechat_config_integer (ptr_option);
+
+ ptr_option = weechat_config_search_option (NULL, section, "server_password");
+ if (ptr_option)
+ server->password = strdup (weechat_config_string (ptr_option));
+
+ ptr_option = weechat_config_search_option (NULL, section, "server_nick1");
+ if (ptr_option)
+ server->nick1 = strdup (weechat_config_string (ptr_option));
+
+ ptr_option = weechat_config_search_option (NULL, section, "server_nick2");
+ if (ptr_option)
+ server->nick2 = strdup (weechat_config_string (ptr_option));
+
+ ptr_option = weechat_config_search_option (NULL, section, "server_nick3");
+ if (ptr_option)
+ server->nick3 = strdup (weechat_config_string (ptr_option));
+
+ ptr_option = weechat_config_search_option (NULL, section, "server_username");
+ if (ptr_option)
+ server->username = strdup (weechat_config_string (ptr_option));
+
+ ptr_option = weechat_config_search_option (NULL, section, "server_realname");
+ if (ptr_option)
+ server->realname = strdup (weechat_config_string (ptr_option));
+
+ ptr_option = weechat_config_search_option (NULL, section, "server_hostname");
+ if (ptr_option)
+ server->hostname = strdup (weechat_config_string (ptr_option));
+
+ ptr_option = weechat_config_search_option (NULL, section, "server_command");
+ if (ptr_option)
+ server->command = strdup (weechat_config_string (ptr_option));
+
+ ptr_option = weechat_config_search_option (NULL, section, "server_command_delay");
+ if (ptr_option)
+ server->command_delay = weechat_config_integer (ptr_option);
+
+ ptr_option = weechat_config_search_option (NULL, section, "server_autojoin");
+ if (ptr_option)
+ server->autojoin = strdup (weechat_config_string (ptr_option));
+
+ ptr_option = weechat_config_search_option (NULL, section, "server_autorejoin");
+ if (ptr_option)
+ server->autorejoin = weechat_config_integer (ptr_option);
+
+ ptr_option = weechat_config_search_option (NULL, section, "server_notify_levels");
+ if (ptr_option)
+ server->notify_levels = strdup (weechat_config_string (ptr_option));
+}
+
+/*
* irc_server_alloc: allocate a new server and add it to the servers queue
*/
-t_irc_server *
+struct t_irc_server *
irc_server_alloc ()
{
- t_irc_server *new_server;
+ struct t_irc_server *new_server;
/* alloc memory for new server */
- if ((new_server = (t_irc_server *) malloc (sizeof (t_irc_server))) == NULL)
+ if ((new_server = (struct t_irc_server *) malloc (sizeof (struct t_irc_server))) == NULL)
{
- weechat_iconv_fprintf (stderr,
- _("%s cannot allocate new server\n"),
- WEECHAT_ERROR);
+ weechat_printf (NULL,
+ _("%sIrc: error when allocating new server"),
+ weechat_prefix ("error"));
return NULL;
}
-
+
/* initialize new server */
irc_server_init (new_server);
-
+
/* add new server to queue */
new_server->prev_server = last_irc_server;
new_server->next_server = NULL;
@@ -296,12 +388,12 @@ irc_server_alloc ()
*/
void
-irc_server_outqueue_add (t_irc_server *server, char *msg1, char *msg2,
+irc_server_outqueue_add (struct t_irc_server *server, char *msg1, char *msg2,
int modified)
{
- t_irc_outqueue *new_outqueue;
+ struct t_irc_outqueue *new_outqueue;
- new_outqueue = (t_irc_outqueue *)malloc (sizeof (t_irc_outqueue));
+ new_outqueue = (struct t_irc_outqueue *)malloc (sizeof (struct t_irc_outqueue));
if (new_outqueue)
{
new_outqueue->message_before_mod = (msg1) ? strdup (msg1) : NULL;
@@ -323,9 +415,10 @@ irc_server_outqueue_add (t_irc_server *server, char *msg1, char *msg2,
*/
void
-irc_server_outqueue_free (t_irc_server *server, t_irc_outqueue *outqueue)
+irc_server_outqueue_free (struct t_irc_server *server,
+ struct t_irc_outqueue *outqueue)
{
- t_irc_outqueue *new_outqueue;
+ struct t_irc_outqueue *new_outqueue;
/* remove outqueue message */
if (server->last_outqueue == outqueue)
@@ -354,7 +447,7 @@ irc_server_outqueue_free (t_irc_server *server, t_irc_outqueue *outqueue)
*/
void
-irc_server_outqueue_free_all (t_irc_server *server)
+irc_server_outqueue_free_all (struct t_irc_server *server)
{
while (server->outqueue)
irc_server_outqueue_free (server, server->outqueue);
@@ -365,7 +458,7 @@ irc_server_outqueue_free_all (t_irc_server *server)
*/
void
-irc_server_destroy (t_irc_server *server)
+irc_server_destroy (struct t_irc_server *server)
{
if (!server)
return;
@@ -416,9 +509,9 @@ irc_server_destroy (t_irc_server *server)
*/
void
-irc_server_free (t_irc_server *server)
+irc_server_free (struct t_irc_server *server)
{
- t_irc_server *new_irc_servers;
+ struct t_irc_server *new_irc_servers;
if (!server)
return;
@@ -462,7 +555,7 @@ irc_server_free_all ()
* irc_server_new: creates a new server, and initialize it
*/
-t_irc_server *
+struct t_irc_server *
irc_server_new (char *name, int autoconnect, int autoreconnect,
int autoreconnect_delay, int temp_server, char *address,
int port, int ipv6, int ssl, char *password,
@@ -470,7 +563,7 @@ irc_server_new (char *name, int autoconnect, int autoreconnect,
char *realname, char *hostname, char *command, int command_delay,
char *autojoin, int autorejoin, char *notify_levels)
{
- t_irc_server *new_server;
+ struct t_irc_server *new_server;
if (!name || !address || (port < 0))
return NULL;
@@ -479,7 +572,7 @@ irc_server_new (char *name, int autoconnect, int autoreconnect,
weechat_log_printf ("Creating new server (name:%s, address:%s, port:%d, pwd:%s, "
"nick1:%s, nick2:%s, nick3:%s, username:%s, realname:%s, "
"hostname: %s, command:%s, autojoin:%s, autorejoin:%s, "
- "notify_levels:%s)\n",
+ "notify_levels:%s)",
name, address, port, (password) ? password : "",
(nick1) ? nick1 : "", (nick2) ? nick2 : "", (nick3) ? nick3 : "",
(username) ? username : "", (realname) ? realname : "",
@@ -528,10 +621,10 @@ irc_server_new (char *name, int autoconnect, int autoreconnect,
* return: pointer to new server, NULL if error
*/
-t_irc_server *
-irc_server_duplicate (t_irc_server *server, char *new_name)
+struct t_irc_server *
+irc_server_duplicate (struct t_irc_server *server, char *new_name)
{
- t_irc_server *new_server;
+ struct t_irc_server *new_server;
/* check if another server exists with this name */
if (irc_server_search (new_name))
@@ -569,7 +662,7 @@ irc_server_duplicate (t_irc_server *server, char *new_name)
*/
int
-irc_server_rename (t_irc_server *server, char *new_name)
+irc_server_rename (struct t_irc_server *server, char *new_name)
{
char *str;
@@ -595,27 +688,26 @@ irc_server_rename (t_irc_server *server, char *new_name)
*/
int
-irc_server_send (t_irc_server *server, char *buffer, int size_buf)
+irc_server_send (struct t_irc_server *server, char *buffer, int size_buf)
{
int rc;
if (!server)
{
- gui_chat_printf_error (NULL,
- _("%s error sending data to IRC server: null "
- "pointer (please report problem to "
- "developers)"),
- WEECHAT_ERROR);
+ weechat_printf (NULL,
+ _("%sIrc: error sending data to IRC server: null "
+ "pointer (please report problem to developers)"),
+ weechat_prefix ("error"));
return 0;
}
if (size_buf <= 0)
{
- gui_chat_printf_error (server->buffer,
- _("%s error sending data to IRC server: empty "
- "buffer (please report problem to "
- "developers)"),
- WEECHAT_ERROR);
+ weechat_printf (server->buffer,
+ _("%sIrc: error sending data to IRC server: empty "
+ "buffer (please report problem to "
+ "developers)"),
+ weechat_prefix ("error"));
return 0;
}
@@ -628,9 +720,10 @@ irc_server_send (t_irc_server *server, char *buffer, int size_buf)
if (rc < 0)
{
- gui_chat_printf_error (server->buffer,
- _("%s error sending data to IRC server (%s)"),
- WEECHAT_ERROR, strerror (errno));
+ weechat_printf (server->buffer,
+ _("%sIrc: error sending data to IRC server (%s)"),
+ weechat_prefix ("error"),
+ strerror (errno));
}
return rc;
@@ -641,7 +734,7 @@ irc_server_send (t_irc_server *server, char *buffer, int size_buf)
*/
void
-irc_server_outqueue_send (t_irc_server *server)
+irc_server_outqueue_send (struct t_irc_server *server)
{
time_t time_now;
char *pos;
@@ -649,15 +742,16 @@ irc_server_outqueue_send (t_irc_server *server)
if (server->outqueue)
{
time_now = time (NULL);
- if (time_now >= server->last_user_message + irc_cfg_irc_anti_flood)
+ if (time_now >= server->last_user_message +
+ weechat_config_integer (irc_config_irc_anti_flood))
{
if (server->outqueue->message_before_mod)
{
pos = strchr (server->outqueue->message_before_mod, '\r');
if (pos)
pos[0] = '\0';
- gui_chat_printf_raw_data (server, 1, 0,
- server->outqueue->message_before_mod);
+ //gui_chat_printf_raw_data (server, 1, 0,
+ // server->outqueue->message_before_mod);
if (pos)
pos[0] = '\r';
}
@@ -666,18 +760,18 @@ irc_server_outqueue_send (t_irc_server *server)
pos = strchr (server->outqueue->message_after_mod, '\r');
if (pos)
pos[0] = '\0';
- gui_chat_printf_raw_data (server, 1, server->outqueue->modified,
- server->outqueue->message_after_mod);
+ //gui_chat_printf_raw_data (server, 1, server->outqueue->modified,
+ // server->outqueue->message_after_mod);
if (pos)
pos[0] = '\r';
}
if (irc_server_send (server, server->outqueue->message_after_mod,
strlen (server->outqueue->message_after_mod)) < 0)
{
- gui_chat_printf_error (server->buffer,
- _("%s error sending data to IRC "
- "server\n"),
- WEECHAT_ERROR);
+ weechat_printf (server->buffer,
+ _("%sIrc: error sending data to IRC "
+ "server"),
+ weechat_prefix ("error"));
}
server->last_user_message = time_now;
irc_server_outqueue_free (server, server->outqueue);
@@ -690,7 +784,7 @@ irc_server_outqueue_send (t_irc_server *server)
*/
int
-irc_server_send_one_msg (t_irc_server *server, char *message)
+irc_server_send_one_msg (struct t_irc_server *server, char *message)
{
static char buffer[4096];
char *new_msg, *ptr_msg, *pos;
@@ -700,12 +794,13 @@ irc_server_send_one_msg (t_irc_server *server, char *message)
rc = 1;
#ifdef DEBUG
- gui_chat_printf (server->buffer, "[DEBUG] Sending to server >>> %s\n",
- message);
+ weechat_printf (server->buffer,
+ "[DEBUG] Sending to server >>> %s",
+ message);
#endif
- new_msg = plugin_modifier_exec (PLUGIN_MODIFIER_IRC_OUT,
+ /*new_msg = plugin_modifier_exec (PLUGIN_MODIFIER_IRC_OUT,
server->name,
- message);
+ message);*/
/* no changes in new message */
if (new_msg && (strcmp (buffer, new_msg) == 0))
@@ -733,8 +828,9 @@ irc_server_send_one_msg (t_irc_server *server, char *message)
queue = 0;
if ((server->queue_msg)
&& ((server->outqueue)
- || ((irc_cfg_irc_anti_flood > 0)
- && (time_now - server->last_user_message < irc_cfg_irc_anti_flood))))
+ || ((weechat_config_integer (irc_config_irc_anti_flood) > 0)
+ && (time_now - server->last_user_message <
+ weechat_config_integer (irc_config_irc_anti_flood)))))
queue = 1;
/* if queue, then only queue message and send nothing now */
@@ -747,16 +843,16 @@ irc_server_send_one_msg (t_irc_server *server, char *message)
}
else
{
- if (first_message)
- gui_chat_printf_raw_data (server, 1, 0, message);
- if (new_msg)
- gui_chat_printf_raw_data (server, 1, 1, ptr_msg);
+ //if (first_message)
+ // gui_chat_printf_raw_data (server, 1, 0, message);
+ //if (new_msg)
+ // gui_chat_printf_raw_data (server, 1, 1, ptr_msg);
if (irc_server_send (server, buffer, strlen (buffer)) <= 0)
{
- gui_chat_printf_error (server->buffer,
- _("%s error sending data to IRC "
- "server\n"),
- WEECHAT_ERROR);
+ weechat_printf (server->buffer,
+ _("%sIrc: error sending data to IRC "
+ "server"),
+ weechat_prefix ("error"));
rc = 0;
}
else
@@ -776,8 +872,8 @@ irc_server_send_one_msg (t_irc_server *server, char *message)
first_message = 0;
}
}
- else
- gui_chat_printf_raw_data (server, 1, 1, _("(message dropped)"));
+ //else
+ // gui_chat_printf_raw_data (server, 1, 1, _("(message dropped)"));
if (new_msg)
free (new_msg);
@@ -790,7 +886,7 @@ irc_server_send_one_msg (t_irc_server *server, char *message)
*/
void
-irc_server_sendf (t_irc_server *server, char *fmt, ...)
+irc_server_sendf (struct t_irc_server *server, char *fmt, ...)
{
va_list args;
static char buffer[4096];
@@ -875,20 +971,20 @@ irc_server_parse_message (char *message, char **host, char **command, char **arg
*/
void
-irc_server_msgq_add_msg (t_irc_server *server, char *msg)
+irc_server_msgq_add_msg (struct t_irc_server *server, char *msg)
{
- t_irc_message *message;
+ struct t_irc_message *message;
if (!server->unterminated_message && !msg[0])
return;
- message = (t_irc_message *) malloc (sizeof (t_irc_message));
+ message = (struct t_irc_message *) malloc (sizeof (struct t_irc_message));
if (!message)
{
- gui_chat_printf_error (server->buffer,
- _("%s not enough memory for received IRC "
- "message\n"),
- WEECHAT_ERROR);
+ weechat_printf (server->buffer,
+ _("%sIrc: not enough memory for received IRC "
+ "message"),
+ weechat_prefix ("error"));
return;
}
message->server = server;
@@ -898,10 +994,10 @@ irc_server_msgq_add_msg (t_irc_server *server, char *msg)
strlen (msg) + 1);
if (!message->data)
{
- gui_chat_printf_error (server->buffer,
- _("%s not enough memory for received IRC "
- "message\n"),
- WEECHAT_ERROR);
+ weechat_printf (server->buffer,
+ _("%sIrc: not enough memory for received IRC "
+ "message"),
+ weechat_prefix ("error"));
}
else
{
@@ -932,7 +1028,7 @@ irc_server_msgq_add_msg (t_irc_server *server, char *msg)
*/
void
-irc_server_msgq_add_unterminated (t_irc_server *server, char *string)
+irc_server_msgq_add_unterminated (struct t_irc_server *server, char *string)
{
if (!string[0])
return;
@@ -945,10 +1041,10 @@ irc_server_msgq_add_unterminated (t_irc_server *server, char *string)
strlen (string) + 1);
if (!server->unterminated_message)
{
- gui_chat_printf_error (server->buffer,
- _("%s not enough memory for received IRC "
- "message\n"),
- WEECHAT_ERROR);
+ weechat_printf (server->buffer,
+ _("%sIrc: not enough memory for received IRC "
+ "message"),
+ weechat_prefix ("error"));
}
else
strcat (server->unterminated_message, string);
@@ -958,10 +1054,10 @@ irc_server_msgq_add_unterminated (t_irc_server *server, char *string)
server->unterminated_message = strdup (string);
if (!server->unterminated_message)
{
- gui_chat_printf_error (server->buffer,
- _("%s not enough memory for received IRC "
- "message\n"),
- WEECHAT_ERROR);
+ weechat_printf (server->buffer,
+ _("%sIrc: not enough memory for received IRC "
+ "message"),
+ weechat_prefix ("error"));
}
}
}
@@ -971,7 +1067,7 @@ irc_server_msgq_add_unterminated (t_irc_server *server, char *string)
*/
void
-irc_server_msgq_add_buffer (t_irc_server *server, char *buffer)
+irc_server_msgq_add_buffer (struct t_irc_server *server, char *buffer)
{
char *pos_cr, *pos_lf;
@@ -1011,7 +1107,7 @@ irc_server_msgq_add_buffer (t_irc_server *server, char *buffer)
void
irc_server_msgq_flush ()
{
- t_irc_message *next;
+ struct t_irc_message *next;
char *ptr_data, *new_msg, *ptr_msg, *pos;
char *host, *command, *args;
@@ -1020,9 +1116,9 @@ irc_server_msgq_flush ()
if (irc_recv_msgq->data)
{
#ifdef DEBUG
- gui_chat_printf (gui_current_window->buffer,
- "[DEBUG] %s\n",
- irc_recv_msgq->data);
+ weechat_printf (weechat_current_buffer,
+ "[DEBUG] %s",
+ irc_recv_msgq->data);
#endif
ptr_data = irc_recv_msgq->data;
while (ptr_data[0] == ' ')
@@ -1030,16 +1126,16 @@ irc_server_msgq_flush ()
if (ptr_data[0])
{
- gui_chat_printf_raw_data (irc_recv_msgq->server, 0, 0,
- ptr_data);
+ //gui_chat_printf_raw_data (irc_recv_msgq->server, 0, 0,
+ // ptr_data);
#ifdef DEBUG
- gui_chat_printf (NULL,
- "[DEBUG] data received from server: %s\n",
- ptr_data);
+ weechat_printf (NULL,
+ "[DEBUG] data received from server: %s",
+ ptr_data);
#endif
- new_msg = plugin_modifier_exec (PLUGIN_MODIFIER_IRC_IN,
+ /*new_msg = plugin_modifier_exec (PLUGIN_MODIFIER_IRC_IN,
irc_recv_msgq->server->name,
- ptr_data);
+ ptr_data);*/
/* no changes in new message */
if (new_msg && (strcmp (ptr_data, new_msg) == 0))
{
@@ -1059,39 +1155,41 @@ irc_server_msgq_flush ()
if (pos)
pos[0] = '\0';
- if (new_msg)
- gui_chat_printf_raw_data (irc_recv_msgq->server,
- 0, 1, ptr_msg);
+ //if (new_msg)
+ // gui_chat_printf_raw_data (irc_recv_msgq->server,
+ // 0, 1, ptr_msg);
irc_server_parse_message (ptr_msg, &host,
&command, &args);
- switch (irc_protocol_recv_command (irc_recv_msgq->server,
+ /*switch (irc_protocol_recv_command (irc_recv_msgq->server,
ptr_msg,
host, command, args))
{
case -1:
- gui_chat_printf_error (irc_recv_msgq->server->buffer,
- _("%s Command \"%s\" "
- "failed!\n"),
- WEECHAT_ERROR, command);
+ weechat_printf (irc_recv_msgq->server->buffer,
+ _("%sIrc: command \"%s\" "
+ "failed!"),
+ weechat_prefix ("error"),
+ command);
break;
case -2:
- gui_chat_printf_error (irc_recv_msgq->server->buffer,
- _("%s No command to "
- "execute!\n"),
- WEECHAT_ERROR);
+ weechat_printf (irc_recv_msgq->server->buffer,
+ _("%sIrc: no command to "
+ "execute!"),
+ weechat_prefix ("error"));
break;
case -3:
- gui_chat_printf_error (irc_recv_msgq->server->buffer,
- _("%s Unknown command: "
- "cmd=\"%s\", "
- "host=\"%s\", "
- "args=\"%s\"\n"),
- WEECHAT_WARNING,
- command, host, args);
+ weechat_printf (irc_recv_msgq->server->buffer,
+ _("%sIrc: unknown command: "
+ "cmd=\"%s\", "
+ "host=\"%s\", "
+ "args=\"%s\""),
+ weechat_prefix ("error"),
+ command, host, args);
break;
}
+ */
if (host)
free (host);
if (command)
@@ -1108,9 +1206,9 @@ irc_server_msgq_flush ()
ptr_msg = NULL;
}
}
- else
- gui_chat_printf_raw_data (irc_recv_msgq->server, 0, 1,
- _("(message dropped)"));
+ //else
+ // gui_chat_printf_raw_data (irc_recv_msgq->server, 0, 1,
+ // _("(message dropped)"));
if (new_msg)
free (new_msg);
}
@@ -1129,18 +1227,18 @@ irc_server_msgq_flush ()
* irc_server_recv: receive data from an irc server
*/
-void
+int
irc_server_recv (void *arg_server)
{
- t_irc_server *server;
+ struct t_irc_server *server;
- server = (t_irc_server *)arg_server;
+ server = (struct t_irc_server *)arg_server;
static char buffer[4096 + 2];
int num_read;
if (!server)
- return;
+ return PLUGIN_RC_FAILED;
#ifdef HAVE_GNUTLS
if (server->ssl_connected)
@@ -1158,12 +1256,14 @@ irc_server_recv (void *arg_server)
}
else
{
- gui_chat_printf_error (server->buffer,
- _("%s cannot read data from socket, "
- "disconnecting from server...\n"),
- WEECHAT_ERROR);
+ weechat_printf (server->buffer,
+ _("%sIrc: cannot read data from socket, "
+ "disconnecting from server..."),
+ weechat_prefix ("error"));
irc_server_disconnect (server, 1);
}
+
+ return PLUGIN_RC_SUCCESS;
}
/*
@@ -1174,7 +1274,7 @@ irc_server_recv (void *arg_server)
void
irc_server_timer (void *empty)
{
- t_irc_server *ptr_server;
+ struct t_irc_server *ptr_server;
time_t new_time;
static struct timeval tv;
int diff;
@@ -1216,18 +1316,18 @@ irc_server_timer (void *empty)
/* lag timeout => disconnect */
if ((ptr_server->lag_check_time.tv_sec != 0)
- && (irc_cfg_irc_lag_disconnect > 0))
+ && (weechat_config_integer (irc_config_irc_lag_disconnect) > 0))
{
gettimeofday (&tv, NULL);
- diff = (int) weechat_get_timeval_diff (&(ptr_server->lag_check_time),
- &tv);
- if (diff / 1000 > irc_cfg_irc_lag_disconnect * 60)
+ diff = (int) weechat_timeval_diff (&(ptr_server->lag_check_time),
+ &tv);
+ if (diff / 1000 > weechat_config_integer (irc_config_irc_lag_disconnect) * 60)
{
- gui_chat_printf_error (ptr_server->buffer,
- _("%s lag is high, "
- "disconnecting from "
- "server...\n"),
- WEECHAT_WARNING);
+ weechat_printf (ptr_server->buffer,
+ _("%sIrc: lag is high, "
+ "disconnecting from "
+ "server..."),
+ weechat_prefix ("info"));
irc_server_disconnect (ptr_server, 1);
}
}
@@ -1246,7 +1346,7 @@ irc_server_timer_check_away (void *empty)
{
(void) empty;
- if (irc_cfg_irc_away_check > 0)
+ if (weechat_config_integer (irc_config_irc_away_check) > 0)
irc_server_check_away ();
}
@@ -1255,7 +1355,7 @@ irc_server_timer_check_away (void *empty)
*/
void
-irc_server_child_kill (t_irc_server *server)
+irc_server_child_kill (struct t_irc_server *server)
{
/* kill process */
if (server->child_pid > 0)
@@ -1284,7 +1384,7 @@ irc_server_child_kill (t_irc_server *server)
*/
void
-irc_server_close_connection (t_irc_server *server)
+irc_server_close_connection (struct t_irc_server *server)
{
irc_server_child_kill (server);
@@ -1321,14 +1421,15 @@ irc_server_close_connection (t_irc_server *server)
*/
void
-irc_server_reconnect_schedule (t_irc_server *server)
+irc_server_reconnect_schedule (struct t_irc_server *server)
{
if (server->autoreconnect)
{
server->reconnect_start = time (NULL);
- gui_chat_printf_info (server->buffer,
- _("%s: Reconnecting to server in %d seconds\n"),
- PACKAGE_NAME, server->autoreconnect_delay);
+ weechat_printf (server->buffer,
+ _("%sIrc: reconnecting to server in %d seconds"),
+ weechat_prefix ("info"),
+ server->autoreconnect_delay);
}
else
server->reconnect_start = 0;
@@ -1339,7 +1440,7 @@ irc_server_reconnect_schedule (t_irc_server *server)
*/
void
-irc_server_login (t_irc_server *server)
+irc_server_login (struct t_irc_server *server)
{
if ((server->password) && (server->password[0]))
irc_server_sendf (server, "PASS %s", server->password);
@@ -1351,25 +1452,27 @@ irc_server_login (t_irc_server *server)
"USER %s %s %s :%s",
server->nick, server->username, server->username,
server->address, server->realname);
- gui_input_draw (gui_current_window->buffer, 1);
+ //gui_input_draw (weechat_current_buffer, 1);
}
/*
* irc_server_child_read: read connection progress from child process
*/
-void
+int
irc_server_child_read (void *arg_server)
{
- t_irc_server *server;
+ struct t_irc_server *server;
char buffer[1];
int num_read;
+ int config_proxy_use;
- server = (t_irc_server *)arg_server;
+ server = (struct t_irc_server *)arg_server;
num_read = read (server->child_read, buffer, sizeof (buffer));
if (num_read > 0)
{
+ config_proxy_use = weechat_config_boolean (weechat_config_get ("proxy_use"));
switch (buffer[0])
{
/* connection OK */
@@ -1382,78 +1485,76 @@ irc_server_child_read (void *arg_server)
(gnutls_transport_ptr) ((unsigned long) server->sock));
if (gnutls_handshake (server->gnutls_sess) < 0)
{
- gui_chat_printf_error (server->buffer,
- _("%s GnuTLS handshake "
- "failed\n"),
- WEECHAT_ERROR);
+ weechat_printf (server->buffer,
+ _("%sIrc: GnuTLS handshake failed"),
+ weechat_prefix ("error"));
irc_server_close_connection (server);
irc_server_reconnect_schedule (server);
- return;
+ return PLUGIN_RC_SUCCESS;
}
}
#endif
/* kill child and login to server */
irc_server_child_kill (server);
irc_server_login (server);
- weechat_hook_remove (server->hook_fd);
- server->hook_fd = weechat_hook_add_fd (server->sock,
- WEECHAT_HOOK_FD_READ,
- irc_server_recv,
- server);
+ weechat_unhook (server->hook_fd);
+ server->hook_fd = weechat_hook_fd (server->sock,
+ 1, 0, 0,
+ irc_server_recv,
+ server);
break;
/* adress not found */
case '1':
- gui_chat_printf_error (server->buffer,
- (cfg_proxy_use) ?
- _("%s proxy address \"%s\" not "
- "found\n") :
- _("%s address \"%s\" not found\n"),
- WEECHAT_ERROR, server->address);
+ weechat_printf (server->buffer,
+ (config_proxy_use) ?
+ _("%sIrc: proxy address \"%s\" not found") :
+ _("%sIrc: address \"%s\" not found"),
+ weechat_prefix ("error"),
+ server->address);
irc_server_close_connection (server);
irc_server_reconnect_schedule (server);
break;
/* IP address not found */
case '2':
- gui_chat_printf_error (server->buffer,
- (cfg_proxy_use) ?
- _("%s proxy IP address not found\n") :
- _("%s IP address not found\n"),
- WEECHAT_ERROR);
+ weechat_printf (server->buffer,
+ (config_proxy_use) ?
+ _("%sIrc: proxy IP address not found") :
+ _("%sIrc: IP address not found"),
+ weechat_prefix ("error"));
irc_server_close_connection (server);
irc_server_reconnect_schedule (server);
break;
/* connection refused */
case '3':
- gui_chat_printf_error (server->buffer,
- (cfg_proxy_use) ?
- _("%s proxy connection refused\n") :
- _("%s connection refused\n"),
- WEECHAT_ERROR);
+ weechat_printf (server->buffer,
+ (config_proxy_use) ?
+ _("%sIrc: proxy connection refused") :
+ _("%sIrc: connection refused"),
+ weechat_prefix ("error"));
irc_server_close_connection (server);
irc_server_reconnect_schedule (server);
break;
/* proxy fails to connect to server */
case '4':
- gui_chat_printf_error (server->buffer,
- _("%s proxy fails to establish "
- "connection to "
- "server (check username/password if "
- "used)\n"),
- WEECHAT_ERROR);
+ weechat_printf (server->buffer,
+ _("%sIrc: proxy fails to establish "
+ "connection to server "
+ "(check username/password if used)"),
+ weechat_prefix ("error"));
irc_server_close_connection (server);
irc_server_reconnect_schedule (server);
break;
/* fails to set local hostname/IP */
case '5':
- gui_chat_printf_error (server->buffer,
- _("%s unable to set local "
- "hostname/IP\n"),
- WEECHAT_ERROR);
+ weechat_printf (server->buffer,
+ _("%sIrc: unable to set local hostname/IP"),
+ weechat_prefix ("error"));
irc_server_close_connection (server);
irc_server_reconnect_schedule (server);
break;
}
}
+ return PLUGIN_RC_SUCCESS;
}
/*
@@ -1527,16 +1628,19 @@ int
irc_server_pass_httpproxy (int sock, char *address, int port)
{
- char buffer[256];
- char authbuf[128];
- char authbuf_base64[196];
+ char buffer[256], authbuf[128], authbuf_base64[196];
+ char *config_proxy_username, *config_proxy_password;
int n, m;
+
+ config_proxy_username = weechat_config_string (weechat_config_get ("proxy_username"));
+ config_proxy_username = weechat_config_string (weechat_config_get ("proxy_password"));
- if (cfg_proxy_username && cfg_proxy_username[0])
+ if (config_proxy_username && config_proxy_username[0])
{
/* authentification */
snprintf (authbuf, sizeof (authbuf), "%s:%s",
- cfg_proxy_username, cfg_proxy_password);
+ config_proxy_username,
+ (config_proxy_password) ? config_proxy_password : "");
irc_server_base64encode (authbuf, authbuf_base64);
n = snprintf (buffer, sizeof (buffer),
"CONNECT %s:%d HTTP/1.0\r\nProxy-Authorization: Basic %s\r\n\r\n",
@@ -1677,11 +1781,15 @@ irc_server_pass_socks5proxy (int sock, char *address, int port)
unsigned char buffer[288];
int username_len, password_len, addr_len, addr_buffer_len;
unsigned char *addr_buffer;
+ char *config_proxy_username, *config_proxy_password;
socks5.version = 5;
socks5.nmethods = 1;
- if (cfg_proxy_username && cfg_proxy_username[0])
+ config_proxy_username = weechat_config_string (weechat_config_get ("proxy_username"));
+ config_proxy_username = weechat_config_string (weechat_config_get ("proxy_password"));
+
+ if (config_proxy_username && config_proxy_username[0])
socks5.method = 2; /* with authentication */
else
socks5.method = 0; /* without authentication */
@@ -1691,7 +1799,7 @@ irc_server_pass_socks5proxy (int sock, char *address, int port)
if (recv (sock, buffer, 2, 0) != 2)
return 1;
- if (cfg_proxy_username && cfg_proxy_username[0])
+ if (config_proxy_username && config_proxy_username[0])
{
/* with authentication */
/* -> socks server must respond with :
@@ -1703,15 +1811,15 @@ irc_server_pass_socks5proxy (int sock, char *address, int port)
return 1;
/* authentication as in RFC 1929 */
- username_len = strlen(cfg_proxy_username);
- password_len = strlen(cfg_proxy_password);
+ username_len = strlen (config_proxy_username);
+ password_len = strlen (config_proxy_password);
/* make username/password buffer */
buffer[0] = 1;
buffer[1] = (unsigned char) username_len;
- memcpy(buffer + 2, cfg_proxy_username, username_len);
+ memcpy(buffer + 2, config_proxy_username, username_len);
buffer[2 + username_len] = (unsigned char) password_len;
- memcpy (buffer + 3 + username_len, cfg_proxy_password, password_len);
+ memcpy (buffer + 3 + username_len, config_proxy_password, password_len);
send (sock, buffer, 3 + username_len + password_len, 0);
@@ -1759,7 +1867,7 @@ irc_server_pass_socks5proxy (int sock, char *address, int port)
return 1;
/* buffer[3] = address type */
- switch(buffer[3])
+ switch (buffer[3])
{
case 1 :
/* ipv4
@@ -1805,15 +1913,23 @@ irc_server_pass_socks5proxy (int sock, char *address, int port)
int
irc_server_pass_proxy (int sock, char *address, int port, char *username)
-{
- if (strcmp (cfg_proxy_type_values[cfg_proxy_type], "http") == 0)
- return irc_server_pass_httpproxy (sock, address, port);
- if (strcmp (cfg_proxy_type_values[cfg_proxy_type], "socks4") == 0)
- return irc_server_pass_socks4proxy (sock, address, port, username);
- if (strcmp (cfg_proxy_type_values[cfg_proxy_type], "socks5") == 0)
- return irc_server_pass_socks5proxy (sock, address, port);
+{
+ int rc;
+ char *config_proxy_type;
- return 1;
+ config_proxy_type = weechat_config_string (weechat_config_get ("proxy_type"));
+
+ rc = 1;
+ if (config_proxy_type)
+ {
+ if (weechat_strcasecmp (config_proxy_type, "http") == 0)
+ rc = irc_server_pass_httpproxy (sock, address, port);
+ if (weechat_strcasecmp (config_proxy_type, "socks4") == 0)
+ rc = irc_server_pass_socks4proxy (sock, address, port, username);
+ if (weechat_strcasecmp (config_proxy_type, "socks5") == 0)
+ rc = irc_server_pass_socks5proxy (sock, address, port);
+ }
+ return rc;
}
/*
@@ -1821,54 +1937,61 @@ irc_server_pass_proxy (int sock, char *address, int port, char *username)
*/
int
-irc_server_child (t_irc_server *server)
+irc_server_child (struct t_irc_server *server)
{
struct addrinfo hints, *res, *res_local;
int rc;
+ int config_proxy_use, config_proxy_ipv6, config_proxy_port;
+ char *config_proxy_address;
res = NULL;
res_local = NULL;
+
+ config_proxy_use = weechat_config_boolean (weechat_config_get ("proxy_use"));
+ config_proxy_ipv6 = weechat_config_integer (weechat_config_get ("proxy_ipv6"));
+ config_proxy_port = weechat_config_integer (weechat_config_get ("proxy_port"));
+ config_proxy_address = weechat_config_string (weechat_config_get ("proxy_address"));
- if (cfg_proxy_use)
+ if (config_proxy_use)
{
/* get info about server */
memset (&hints, 0, sizeof (hints));
- hints.ai_family = (cfg_proxy_ipv6) ? AF_INET6 : AF_INET;
+ hints.ai_family = (config_proxy_ipv6) ? AF_INET6 : AF_INET;
hints.ai_socktype = SOCK_STREAM;
- if (getaddrinfo (cfg_proxy_address, NULL, &hints, &res) !=0)
+ if (getaddrinfo (config_proxy_address, NULL, &hints, &res) !=0)
{
- write(server->child_write, "1", 1);
+ write (server->child_write, "1", 1);
return 0;
}
if (!res)
{
- write(server->child_write, "1", 1);
+ write (server->child_write, "1", 1);
return 0;
}
- if ((cfg_proxy_ipv6 && (res->ai_family != AF_INET6))
- || ((!cfg_proxy_ipv6 && (res->ai_family != AF_INET))))
+ if ((config_proxy_ipv6 && (res->ai_family != AF_INET6))
+ || ((!config_proxy_ipv6 && (res->ai_family != AF_INET))))
{
write (server->child_write, "2", 1);
freeaddrinfo (res);
return 0;
}
- if (cfg_proxy_ipv6)
- ((struct sockaddr_in6 *)(res->ai_addr))->sin6_port = htons (cfg_proxy_port);
+ if (config_proxy_ipv6)
+ ((struct sockaddr_in6 *)(res->ai_addr))->sin6_port = htons (config_proxy_port);
else
- ((struct sockaddr_in *)(res->ai_addr))->sin_port = htons (cfg_proxy_port);
+ ((struct sockaddr_in *)(res->ai_addr))->sin_port = htons (config_proxy_port);
/* connect to server */
if (connect (server->sock, res->ai_addr, res->ai_addrlen) != 0)
{
- write(server->child_write, "3", 1);
+ write (server->child_write, "3", 1);
freeaddrinfo (res);
return 0;
}
if (irc_server_pass_proxy (server->sock, server->address, server->port, server->username))
{
- write(server->child_write, "4", 1);
+ write (server->child_write, "4", 1);
freeaddrinfo (res);
return 0;
}
@@ -1955,30 +2078,24 @@ irc_server_child (t_irc_server *server)
*/
int
-irc_server_connect (t_irc_server *server, int disable_autojoin)
+irc_server_connect (struct t_irc_server *server, int disable_autojoin)
{
int child_pipe[2], set;
#ifndef __CYGWIN__
pid_t pid;
#endif
- char *log_filename;
+ char *config_proxy_type, *config_proxy_address;
+ int config_proxy_use, config_proxy_ipv6, config_proxy_port;
+
+ config_proxy_use = weechat_config_boolean (weechat_config_get ("proxy_use"));
+ config_proxy_ipv6 = weechat_config_boolean (weechat_config_get ("proxy_ipv6"));
+ config_proxy_type = weechat_config_string (weechat_config_get ("proxy_type"));
+ config_proxy_address = weechat_config_string (weechat_config_get ("proxy_address"));
+ config_proxy_port = weechat_config_integer (weechat_config_get ("proxy_port"));
if (!server->buffer)
{
- log_filename = irc_log_get_filename (server->name, NULL, 0);
- server->buffer = gui_buffer_new (gui_current_window, 0,
- server->name, server->name,
- GUI_BUFFER_ATTRIB_TEXT | GUI_BUFFER_ATTRIB_INPUT |
- GUI_BUFFER_ATTRIB_NICKS,
- irc_protocol,
- irc_buffer_data_create (server),
- &irc_buffer_data_free,
- GUI_NOTIFY_LEVEL_DEFAULT,
- NULL, server->nick,
- irc_cfg_log_auto_server, log_filename,
- 1);
- if (log_filename)
- free (log_filename);
+ server->buffer = weechat_buffer_new ("irc", server->name, NULL);
if (!server->buffer)
return 0;
}
@@ -1986,41 +2103,43 @@ irc_server_connect (t_irc_server *server, int disable_autojoin)
#ifndef HAVE_GNUTLS
if (server->ssl)
{
- gui_chat_printf_error (server->buffer,
- _("%s cannot connect with SSL since WeeChat "
- "was not built with GnuTLS support\n"),
- WEECHAT_ERROR);
+ weechat_printf (server->buffer,
+ _("%sIrc: cannot connect with SSL since WeeChat "
+ "was not built with GnuTLS support"),
+ weechat_prefix ("error"));
return 0;
}
#endif
- if (cfg_proxy_use)
- {
- gui_chat_printf_info (server->buffer,
- _("%s: connecting to server %s:%d%s%s via %s "
- "proxy %s:%d%s...\n"),
- PACKAGE_NAME, server->address, server->port,
- (server->ipv6) ? " (IPv6)" : "",
- (server->ssl) ? " (SSL)" : "",
- cfg_proxy_type_values[cfg_proxy_type],
- cfg_proxy_address, cfg_proxy_port,
- (cfg_proxy_ipv6) ? " (IPv6)" : "");
+ if (config_proxy_use)
+ {
+ weechat_printf (server->buffer,
+ _("%sIrc: connecting to server %s:%d%s%s via %s "
+ "proxy %s:%d%s..."),
+ weechat_prefix ("info"),
+ server->address, server->port,
+ (server->ipv6) ? " (IPv6)" : "",
+ (server->ssl) ? " (SSL)" : "",
+ config_proxy_type,
+ config_proxy_address, config_proxy_port,
+ (config_proxy_ipv6) ? " (IPv6)" : "");
weechat_log_printf (_("Connecting to server %s:%d%s%s via %s proxy "
- "%s:%d%s...\n"),
+ "%s:%d%s..."),
server->address, server->port,
(server->ipv6) ? " (IPv6)" : "",
(server->ssl) ? " (SSL)" : "",
- cfg_proxy_type_values[cfg_proxy_type],
- cfg_proxy_address, cfg_proxy_port,
- (cfg_proxy_ipv6) ? " (IPv6)" : "");
+ config_proxy_type,
+ config_proxy_address, config_proxy_port,
+ (config_proxy_ipv6) ? " (IPv6)" : "");
}
else
{
- gui_chat_printf_info (server->buffer,
- _("%s: connecting to server %s:%d%s%s...\n"),
- PACKAGE_NAME, server->address, server->port,
- (server->ipv6) ? " (IPv6)" : "",
- (server->ssl) ? " (SSL)" : "");
- weechat_log_printf (_("Connecting to server %s:%d%s%s...\n"),
+ weechat_printf (server->buffer,
+ _("%sIrc: connecting to server %s:%d%s%s..."),
+ weechat_prefix ("info"),
+ server->address, server->port,
+ (server->ipv6) ? " (IPv6)" : "",
+ (server->ssl) ? " (SSL)" : "");
+ weechat_log_printf (_("Irc: caonnecting to server %s:%d%s%s..."),
server->address, server->port,
(server->ipv6) ? " (IPv6)" : "",
(server->ssl) ? " (SSL)" : "");
@@ -2036,9 +2155,9 @@ irc_server_connect (t_irc_server *server, int disable_autojoin)
{
if (gnutls_init (&server->gnutls_sess, GNUTLS_CLIENT) != 0)
{
- gui_chat_printf_error (server->buffer,
- _("%s GnuTLS init error\n"),
- WEECHAT_ERROR);
+ weechat_printf (server->buffer,
+ _("%sIrc: GnuTLS init error"),
+ weechat_prefix ("error"));
return 0;
}
gnutls_set_default_priority (server->gnutls_sess);
@@ -2054,24 +2173,24 @@ irc_server_connect (t_irc_server *server, int disable_autojoin)
/* create pipe for child process */
if (pipe (child_pipe) < 0)
{
- gui_chat_printf_error (server->buffer,
- _("%s cannot create pipe\n"),
- WEECHAT_ERROR);
+ weechat_printf (server->buffer,
+ _("%sIrc: cannot create pipe"),
+ weechat_prefix ("error"));
return 0;
}
server->child_read = child_pipe[0];
server->child_write = child_pipe[1];
/* create socket and set options */
- if (cfg_proxy_use)
- server->sock = socket ((cfg_proxy_ipv6) ? AF_INET6 : AF_INET, SOCK_STREAM, 0);
+ if (config_proxy_use)
+ server->sock = socket ((config_proxy_ipv6) ? AF_INET6 : AF_INET, SOCK_STREAM, 0);
else
server->sock = socket ((server->ipv6) ? AF_INET6 : AF_INET, SOCK_STREAM, 0);
if (server->sock == -1)
{
- gui_chat_printf_error (server->buffer,
- _("%s cannot create socket\n"),
- WEECHAT_ERROR);
+ weechat_printf (server->buffer,
+ _("%sIrc: cannot create socket"),
+ weechat_prefix ("error"));
return 0;
}
@@ -2080,10 +2199,10 @@ irc_server_connect (t_irc_server *server, int disable_autojoin)
if (setsockopt (server->sock, SOL_SOCKET, SO_REUSEADDR,
(void *) &set, sizeof (set)) == -1)
{
- gui_chat_printf_error (server->buffer,
- _("%s cannot set socket option "
- "\"SO_REUSEADDR\"\n"),
- WEECHAT_WARNING);
+ weechat_printf (server->buffer,
+ _("%sIrc: cannot set socket option "
+ "\"SO_REUSEADDR\""),
+ weechat_prefix ("error"));
}
/* set SO_KEEPALIVE option for socket */
@@ -2091,10 +2210,10 @@ irc_server_connect (t_irc_server *server, int disable_autojoin)
if (setsockopt (server->sock, SOL_SOCKET, SO_KEEPALIVE,
(void *) &set, sizeof (set)) == -1)
{
- gui_chat_printf_error (server->buffer,
- _("%s cannot set socket option "
- "\"SO_KEEPALIVE\"\n"),
- WEECHAT_WARNING);
+ weechat_printf (server->buffer,
+ _("%sIrc: cannot set socket option "
+ "\"SO_KEEPALIVE\""),
+ weechat_prefix ("error"));
}
#ifdef __CYGWIN__
@@ -2120,10 +2239,10 @@ irc_server_connect (t_irc_server *server, int disable_autojoin)
}
/* parent process */
server->child_pid = pid;
- server->hook_fd = weechat_hook_add_fd (server->child_read,
- WEECHAT_HOOK_FD_READ,
- irc_server_child_read,
- server);
+ server->hook_fd = weechat_hook_fd (server->child_read,
+ 1, 0, 0,
+ irc_server_child_read,
+ server);
#endif
server->disable_autojoin = disable_autojoin;
@@ -2136,10 +2255,11 @@ irc_server_connect (t_irc_server *server, int disable_autojoin)
*/
void
-irc_server_reconnect (t_irc_server *server)
+irc_server_reconnect (struct t_irc_server *server)
{
- gui_chat_printf_info (server->buffer,
- _("Reconnecting to server...\n"));
+ weechat_printf (server->buffer,
+ _("%sIrc: reconnecting to server..."),
+ weechat_prefix ("info"));
server->reconnect_start = 0;
if (irc_server_connect (server, 0))
@@ -2155,7 +2275,7 @@ irc_server_reconnect (t_irc_server *server)
void
irc_server_auto_connect (int auto_connect, int temp_server)
{
- t_irc_server *ptr_server;
+ struct t_irc_server *ptr_server;
for (ptr_server = irc_servers; ptr_server;
ptr_server = ptr_server->next_server)
@@ -2174,9 +2294,9 @@ irc_server_auto_connect (int auto_connect, int temp_server)
*/
void
-irc_server_disconnect (t_irc_server *server, int reconnect)
+irc_server_disconnect (struct t_irc_server *server, int reconnect)
{
- t_irc_channel *ptr_channel;
+ struct t_irc_channel *ptr_channel;
if (server->is_connected)
{
@@ -2184,19 +2304,21 @@ irc_server_disconnect (t_irc_server *server, int reconnect)
for (ptr_channel = server->channels; ptr_channel;
ptr_channel = ptr_channel->next_channel)
{
- irc_nick_free_all (ptr_channel);
- gui_chat_printf_info (ptr_channel->buffer,
- _("Disconnected from server!\n"));
- gui_nicklist_draw (ptr_channel->buffer, 1, 1);
- gui_status_draw (ptr_channel->buffer, 1);
+ //irc_nick_free_all (ptr_channel);
+ weechat_printf (ptr_channel->buffer,
+ _("%sIrc: disconnected from server!"),
+ weechat_prefix ("info"));
+ //gui_nicklist_draw (ptr_channel->buffer, 1, 1);
+ //gui_status_draw (ptr_channel->buffer, 1);
}
}
irc_server_close_connection (server);
if (server->buffer)
- gui_chat_printf_info (server->buffer,
- _("Disconnected from server!\n"));
+ weechat_printf (server->buffer,
+ _("%sIrc: disconnected from server!"),
+ weechat_prefix ("info"));
if (server->nick_modes)
{
@@ -2213,7 +2335,8 @@ irc_server_disconnect (t_irc_server *server, int reconnect)
server->lag = 0;
server->lag_check_time.tv_sec = 0;
server->lag_check_time.tv_usec = 0;
- server->lag_next_check = time (NULL) + irc_cfg_irc_lag_check;
+ server->lag_next_check = time (NULL) +
+ weechat_config_integer (irc_config_irc_lag_check);
if ((reconnect) && (server->autoreconnect))
irc_server_reconnect_schedule (server);
@@ -2227,7 +2350,7 @@ irc_server_disconnect (t_irc_server *server, int reconnect)
server->nick = NULL;
}
- gui_window_redraw_buffer (gui_current_window->buffer);
+ //gui_window_redraw_buffer (weechat_current_buffer);
}
/*
@@ -2237,7 +2360,7 @@ irc_server_disconnect (t_irc_server *server, int reconnect)
void
irc_server_disconnect_all ()
{
- t_irc_server *ptr_server;
+ struct t_irc_server *ptr_server;
for (ptr_server = irc_servers; ptr_server; ptr_server = ptr_server->next_server)
irc_server_disconnect (ptr_server, 0);
@@ -2248,9 +2371,9 @@ irc_server_disconnect_all ()
*/
void
-irc_server_autojoin_channels (t_irc_server *server)
+irc_server_autojoin_channels (struct t_irc_server *server)
{
- t_irc_channel *ptr_channel;
+ struct t_irc_channel *ptr_channel;
/* auto-join after disconnection (only rejoins opened channels) */
if (!server->disable_autojoin && server->reconnect_join && server->channels)
@@ -2273,8 +2396,8 @@ irc_server_autojoin_channels (t_irc_server *server)
else
{
/* auto-join when connecting to server for first time */
- if (!server->disable_autojoin && server->autojoin && server->autojoin[0])
- irc_cmd_join_server (server, server->autojoin);
+ //if (!server->disable_autojoin && server->autojoin && server->autojoin[0])
+ // irc_cmd_join_server (server, server->autojoin);
}
server->disable_autojoin = 0;
@@ -2284,10 +2407,10 @@ irc_server_autojoin_channels (t_irc_server *server)
* irc_server_search: return pointer on a server with a name
*/
-t_irc_server *
+struct t_irc_server *
irc_server_search (char *servername)
{
- t_irc_server *ptr_server;
+ struct t_irc_server *ptr_server;
if (!servername)
return NULL;
@@ -2308,7 +2431,7 @@ irc_server_search (char *servername)
int
irc_server_get_number_connected ()
{
- t_irc_server *ptr_server;
+ struct t_irc_server *ptr_server;
int number;
number = 0;
@@ -2326,10 +2449,10 @@ irc_server_get_number_connected ()
*/
void
-irc_server_get_number_buffer (t_irc_server *server,
+irc_server_get_number_buffer (struct t_irc_server *server,
int *server_pos, int *server_total)
{
- t_irc_server *ptr_server;
+ struct t_irc_server *ptr_server;
*server_pos = 0;
*server_total = 0;
@@ -2353,7 +2476,7 @@ irc_server_get_number_buffer (t_irc_server *server,
int
irc_server_name_already_exists (char *name)
{
- t_irc_server *ptr_server;
+ struct t_irc_server *ptr_server;
if (!name)
return 0;
@@ -2371,10 +2494,10 @@ irc_server_name_already_exists (char *name)
*/
int
-irc_server_get_channel_count (t_irc_server *server)
+irc_server_get_channel_count (struct t_irc_server *server)
{
int count;
- t_irc_channel *ptr_channel;
+ struct t_irc_channel *ptr_channel;
count = 0;
for (ptr_channel = server->channels; ptr_channel;
@@ -2391,10 +2514,10 @@ irc_server_get_channel_count (t_irc_server *server)
*/
int
-irc_server_get_pv_count (t_irc_server *server)
+irc_server_get_pv_count (struct t_irc_server *server)
{
int count;
- t_irc_channel *ptr_channel;
+ struct t_irc_channel *ptr_channel;
count = 0;
for (ptr_channel = server->channels; ptr_channel;
@@ -2413,8 +2536,8 @@ irc_server_get_pv_count (t_irc_server *server)
void
irc_server_remove_away ()
{
- t_irc_server *ptr_server;
- t_irc_channel *ptr_channel;
+ struct t_irc_server *ptr_server;
+ struct t_irc_channel *ptr_channel;
for (ptr_server = irc_servers; ptr_server; ptr_server = ptr_server->next_server)
{
@@ -2436,8 +2559,8 @@ irc_server_remove_away ()
void
irc_server_check_away ()
{
- t_irc_server *ptr_server;
- t_irc_channel *ptr_channel;
+ struct t_irc_server *ptr_server;
+ struct t_irc_channel *ptr_channel;
for (ptr_server = irc_servers; ptr_server; ptr_server = ptr_server->next_server)
{
@@ -2457,9 +2580,9 @@ irc_server_check_away ()
*/
void
-irc_server_set_away (t_irc_server *server, char *nick, int is_away)
+irc_server_set_away (struct t_irc_server *server, char *nick, int is_away)
{
- t_irc_channel *ptr_channel;
+ struct t_irc_channel *ptr_channel;
for (ptr_channel = server->channels; ptr_channel; ptr_channel = ptr_channel->next_channel)
{
@@ -2476,9 +2599,11 @@ irc_server_set_away (t_irc_server *server, char *nick, int is_away)
*/
int
-irc_server_get_default_notify_level (t_irc_server *server)
+irc_server_get_default_notify_level (struct t_irc_server *server)
{
- int notify, value;
+ (void) server;
+
+ /*int notify, value;
char *pos;
notify = GUI_NOTIFY_LEVEL_DEFAULT;
@@ -2499,7 +2624,8 @@ irc_server_get_default_notify_level (t_irc_server *server)
}
}
- return notify;
+ return notify;*/
+ return 0;
}
/*
@@ -2507,9 +2633,12 @@ irc_server_get_default_notify_level (t_irc_server *server)
*/
void
-irc_server_set_default_notify_level (t_irc_server *server, int notify)
+irc_server_set_default_notify_level (struct t_irc_server *server, int notify)
{
- char level_string[2];
+ (void) server;
+ (void) notify;
+
+ /*char level_string[2];
if (server)
{
@@ -2517,6 +2646,7 @@ irc_server_set_default_notify_level (t_irc_server *server, int notify)
level_string[1] = '\0';
config_option_list_set (&(server->notify_levels), "*", level_string);
}
+ */
}
/*
@@ -2524,61 +2654,68 @@ irc_server_set_default_notify_level (t_irc_server *server, int notify)
*/
void
-irc_server_print_log (t_irc_server *server)
+irc_server_print_log ()
{
- weechat_log_printf ("[server %s (addr:0x%X)]\n", server->name, server);
- weechat_log_printf (" autoconnect . . . . : %d\n", server->autoconnect);
- weechat_log_printf (" autoreconnect . . . : %d\n", server->autoreconnect);
- weechat_log_printf (" autoreconnect_delay : %d\n", server->autoreconnect_delay);
- weechat_log_printf (" temp_server . . . . : %d\n", server->temp_server);
- weechat_log_printf (" address . . . . . . : '%s'\n", server->address);
- weechat_log_printf (" port. . . . . . . . : %d\n", server->port);
- weechat_log_printf (" ipv6. . . . . . . . : %d\n", server->ipv6);
- weechat_log_printf (" ssl . . . . . . . . : %d\n", server->ssl);
- weechat_log_printf (" password. . . . . . : '%s'\n",
- (server->password && server->password[0]) ?
- "(hidden)" : server->password);
- weechat_log_printf (" nick1 . . . . . . . : '%s'\n", server->nick1);
- weechat_log_printf (" nick2 . . . . . . . : '%s'\n", server->nick2);
- weechat_log_printf (" nick3 . . . . . . . : '%s'\n", server->nick3);
- weechat_log_printf (" username. . . . . . : '%s'\n", server->username);
- weechat_log_printf (" realname. . . . . . : '%s'\n", server->realname);
- weechat_log_printf (" command . . . . . . : '%s'\n",
- (server->command && server->command[0]) ?
- "(hidden)" : server->command);
- weechat_log_printf (" command_delay . . . : %d\n", server->command_delay);
- weechat_log_printf (" autojoin. . . . . . : '%s'\n", server->autojoin);
- weechat_log_printf (" autorejoin. . . . . : %d\n", server->autorejoin);
- weechat_log_printf (" notify_levels . . . : %s\n", server->notify_levels);
- weechat_log_printf (" child_pid . . . . . : %d\n", server->child_pid);
- weechat_log_printf (" child_read . . . . : %d\n", server->child_read);
- weechat_log_printf (" child_write . . . . : %d\n", server->child_write);
- weechat_log_printf (" sock. . . . . . . . : %d\n", server->sock);
- weechat_log_printf (" hook_fd . . . . . . : 0x%X\n", server->hook_fd);
- weechat_log_printf (" is_connected. . . . : %d\n", server->is_connected);
- weechat_log_printf (" ssl_connected . . . : %d\n", server->ssl_connected);
- weechat_log_printf (" unterminated_message: '%s'\n", server->unterminated_message);
- weechat_log_printf (" nick. . . . . . . . : '%s'\n", server->nick);
- weechat_log_printf (" nick_modes. . . . . : '%s'\n", server->nick_modes);
- weechat_log_printf (" prefix. . . . . . . : '%s'\n", server->prefix);
- weechat_log_printf (" reconnect_start . . : %ld\n", server->reconnect_start);
- weechat_log_printf (" command_time. . . . : %ld\n", server->command_time);
- weechat_log_printf (" reconnect_join. . . : %d\n", server->reconnect_join);
- weechat_log_printf (" disable_autojoin. . : %d\n", server->disable_autojoin);
- weechat_log_printf (" is_away . . . . . . : %d\n", server->is_away);
- weechat_log_printf (" away_message. . . . : '%s'\n", server->away_message);
- weechat_log_printf (" away_time . . . . . : %ld\n", server->away_time);
- weechat_log_printf (" lag . . . . . . . . : %d\n", server->lag);
- weechat_log_printf (" lag_check_time. . . : tv_sec:%d, tv_usec:%d\n",
- server->lag_check_time.tv_sec,
- server->lag_check_time.tv_usec);
- weechat_log_printf (" lag_next_check. . . : %ld\n", server->lag_next_check);
- weechat_log_printf (" last_user_message . : %ld\n", server->last_user_message);
- weechat_log_printf (" outqueue. . . . . . : 0x%X\n", server->outqueue);
- weechat_log_printf (" last_outqueue . . . : 0x%X\n", server->last_outqueue);
- weechat_log_printf (" buffer. . . . . . . : 0x%X\n", server->buffer);
- weechat_log_printf (" channels. . . . . . : 0x%X\n", server->channels);
- weechat_log_printf (" last_channel. . . . : 0x%X\n", server->last_channel);
- weechat_log_printf (" prev_server . . . . : 0x%X\n", server->prev_server);
- weechat_log_printf (" next_server . . . . : 0x%X\n", server->next_server);
+ struct t_irc_server *ptr_server;
+
+ for (ptr_server = irc_servers; ptr_server;
+ ptr_server = ptr_server->next_server)
+ {
+ weechat_log_printf ("");
+ weechat_log_printf ("[server %s (addr:0x%X)]", ptr_server->name, ptr_server);
+ weechat_log_printf (" autoconnect . . . . : %d", ptr_server->autoconnect);
+ weechat_log_printf (" autoreconnect . . . : %d", ptr_server->autoreconnect);
+ weechat_log_printf (" autoreconnect_delay : %d", ptr_server->autoreconnect_delay);
+ weechat_log_printf (" temp_server . . . . : %d", ptr_server->temp_server);
+ weechat_log_printf (" address . . . . . . : '%s'", ptr_server->address);
+ weechat_log_printf (" port. . . . . . . . : %d", ptr_server->port);
+ weechat_log_printf (" ipv6. . . . . . . . : %d", ptr_server->ipv6);
+ weechat_log_printf (" ssl . . . . . . . . : %d", ptr_server->ssl);
+ weechat_log_printf (" password. . . . . . : '%s'",
+ (ptr_server->password && ptr_server->password[0]) ?
+ "(hidden)" : ptr_server->password);
+ weechat_log_printf (" nick1 . . . . . . . : '%s'", ptr_server->nick1);
+ weechat_log_printf (" nick2 . . . . . . . : '%s'", ptr_server->nick2);
+ weechat_log_printf (" nick3 . . . . . . . : '%s'", ptr_server->nick3);
+ weechat_log_printf (" username. . . . . . : '%s'", ptr_server->username);
+ weechat_log_printf (" realname. . . . . . : '%s'", ptr_server->realname);
+ weechat_log_printf (" command . . . . . . : '%s'",
+ (ptr_server->command && ptr_server->command[0]) ?
+ "(hidden)" : ptr_server->command);
+ weechat_log_printf (" command_delay . . . : %d", ptr_server->command_delay);
+ weechat_log_printf (" autojoin. . . . . . : '%s'", ptr_server->autojoin);
+ weechat_log_printf (" autorejoin. . . . . : %d", ptr_server->autorejoin);
+ weechat_log_printf (" notify_levels . . . : %s", ptr_server->notify_levels);
+ weechat_log_printf (" child_pid . . . . . : %d", ptr_server->child_pid);
+ weechat_log_printf (" child_read . . . . : %d", ptr_server->child_read);
+ weechat_log_printf (" child_write . . . . : %d", ptr_server->child_write);
+ weechat_log_printf (" sock. . . . . . . . : %d", ptr_server->sock);
+ weechat_log_printf (" hook_fd . . . . . . : 0x%X", ptr_server->hook_fd);
+ weechat_log_printf (" is_connected. . . . : %d", ptr_server->is_connected);
+ weechat_log_printf (" ssl_connected . . . : %d", ptr_server->ssl_connected);
+ weechat_log_printf (" unterminated_message: '%s'", ptr_server->unterminated_message);
+ weechat_log_printf (" nick. . . . . . . . : '%s'", ptr_server->nick);
+ weechat_log_printf (" nick_modes. . . . . : '%s'", ptr_server->nick_modes);
+ weechat_log_printf (" prefix. . . . . . . : '%s'", ptr_server->prefix);
+ weechat_log_printf (" reconnect_start . . : %ld", ptr_server->reconnect_start);
+ weechat_log_printf (" command_time. . . . : %ld", ptr_server->command_time);
+ weechat_log_printf (" reconnect_join. . . : %d", ptr_server->reconnect_join);
+ weechat_log_printf (" disable_autojoin. . : %d", ptr_server->disable_autojoin);
+ weechat_log_printf (" is_away . . . . . . : %d", ptr_server->is_away);
+ weechat_log_printf (" away_message. . . . : '%s'", ptr_server->away_message);
+ weechat_log_printf (" away_time . . . . . : %ld", ptr_server->away_time);
+ weechat_log_printf (" lag . . . . . . . . : %d", ptr_server->lag);
+ weechat_log_printf (" lag_check_time. . . : tv_sec:%d, tv_usec:%d",
+ ptr_server->lag_check_time.tv_sec,
+ ptr_server->lag_check_time.tv_usec);
+ weechat_log_printf (" lag_next_check. . . : %ld", ptr_server->lag_next_check);
+ weechat_log_printf (" last_user_message . : %ld", ptr_server->last_user_message);
+ weechat_log_printf (" outqueue. . . . . . : 0x%X", ptr_server->outqueue);
+ weechat_log_printf (" last_outqueue . . . : 0x%X", ptr_server->last_outqueue);
+ weechat_log_printf (" buffer. . . . . . . : 0x%X", ptr_server->buffer);
+ weechat_log_printf (" channels. . . . . . : 0x%X", ptr_server->channels);
+ weechat_log_printf (" last_channel. . . . : 0x%X", ptr_server->last_channel);
+ weechat_log_printf (" prev_server . . . . : 0x%X", ptr_server->prev_server);
+ weechat_log_printf (" next_server . . . . : 0x%X", ptr_server->next_server);
+ }
}
diff --git a/src/plugins/irc/irc-server.h b/src/plugins/irc/irc-server.h
index e759877a9..733b3b110 100644
--- a/src/plugins/irc/irc-server.h
+++ b/src/plugins/irc/irc-server.h
@@ -131,4 +131,51 @@ extern const int gnutls_prot_prio[];
#endif
extern struct t_irc_message *irc_recv_msgq, *irc_msgq_last_msg;
+extern void irc_server_init (struct t_irc_server *);
+extern int irc_server_init_with_url (struct t_irc_server *, char *);
+extern void irc_server_init_with_config_options (struct t_irc_server *, void *);
+extern struct t_irc_server *irc_server_alloc ();
+extern void irc_server_outqueue_free_all (struct t_irc_server *);
+extern void irc_server_destroy (struct t_irc_server *);
+extern void irc_server_free (struct t_irc_server *);
+extern void irc_server_free_all ();
+extern struct t_irc_server *irc_server_new (char *, int, int, int, int, char *, int, int, int,
+ char *, char *, char *, char *, char *, char *,
+ char *, char *, int, char *, int, char *);
+extern struct t_irc_server *irc_server_duplicate (struct t_irc_server *, char *);
+extern int irc_server_rename (struct t_irc_server *, char *);
+extern int irc_server_send (struct t_irc_server *, char *, int);
+extern void irc_server_outqueue_send (struct t_irc_server *);
+extern void irc_server_sendf (struct t_irc_server *, char *, ...);
+extern void irc_server_parse_message (char *, char **, char **, char **);
+extern int irc_server_recv (void *);
+extern void irc_server_timer (void *);
+extern void irc_server_timer_check_away (void *);
+extern int irc_server_child_read (void *);
+extern void irc_server_convbase64_8x3_to_6x4 (char *, char*);
+extern void irc_server_base64encode (char *, char *);
+extern int irc_server_pass_httpproxy (int, char*, int);
+extern int irc_server_resolve (char *, char *, int *);
+extern int irc_server_pass_socks4proxy (int, char*, int, char*);
+extern int irc_server_pass_socks5proxy (int, char*, int);
+extern int irc_server_pass_proxy (int, char*, int, char*);
+extern int irc_server_connect (struct t_irc_server *, int);
+extern void irc_server_reconnect (struct t_irc_server *);
+extern void irc_server_auto_connect (int, int);
+extern void irc_server_disconnect (struct t_irc_server *, int);
+extern void irc_server_disconnect_all ();
+extern void irc_server_autojoin_channels ();
+extern struct t_irc_server *irc_server_search (char *);
+extern int irc_server_get_number_connected ();
+extern void irc_server_get_number_buffer (struct t_irc_server *, int *, int *);
+extern int irc_server_name_already_exists (char *);
+extern int irc_server_get_channel_count (struct t_irc_server *);
+extern int irc_server_get_pv_count (struct t_irc_server *);
+extern void irc_server_remove_away ();
+extern void irc_server_check_away ();
+extern void irc_server_set_away (struct t_irc_server *, char *, int);
+extern int irc_server_get_default_notify_level (struct t_irc_server *);
+extern void irc_server_set_default_notify_level (struct t_irc_server *, int);
+extern void irc_server_print_log ();
+
#endif /* irc-server.h */
diff --git a/src/plugins/irc/irc.c b/src/plugins/irc/irc.c
index e2cae9b9d..31d4010c2 100644
--- a/src/plugins/irc/irc.c
+++ b/src/plugins/irc/irc.c
@@ -23,22 +23,28 @@
#include "config.h"
#endif
+#include <stdlib.h>
+
#ifdef HAVE_GNUTLS
#include <gnutls/gnutls.h>
#endif
-#include "../../core/weechat.h"
#include "irc.h"
-#include "../../core/log.h"
-#include "../../gui/gui.h"
+#include "irc-config.h"
+#include "irc-server.h"
+
+char plugin_name[] = "irc";
+char plugin_version[] = "0.1";
+char plugin_description[] = "IRC (Internet Relay Chat)";
-static struct t_weechat_plugin *weechat_plugin = NULL;
-static struct t_hook *irc_hook_timer = NULL;
-static struct t_hook *irc_hook_timer_check_away = NULL;
+struct t_weechat_plugin *weechat_irc_plugin = NULL;
+
+struct t_hook *irc_timer = NULL;
+struct t_hook *irc_timer_check_away = NULL;
#ifdef HAVE_GNUTLS
-gnutls_certificate_credentials gnutls_xcred; /* gnutls client credentials */
+gnutls_certificate_credentials gnutls_xcred; /* gnutls client credentials */
#endif
@@ -46,7 +52,7 @@ gnutls_certificate_credentials gnutls_xcred; /* gnutls client credentials */
* irc_dump: dump IRC data in WeeChat log file
*/
-static int
+/*int
irc_dump ()
{
struct t_irc_server *ptr_server;
@@ -56,19 +62,19 @@ irc_dump ()
for (ptr_server = irc_servers; ptr_server;
ptr_server = ptr_server->next_server)
{
- weechat_log_printf ("\n");
+ weechat_log_printf ("");
irc_server_print_log (ptr_server);
for (ptr_channel = ptr_server->channels; ptr_channel;
ptr_channel = ptr_channel->next_channel)
{
- weechat_log_printf ("\n");
+ weechat_log_printf ("");
irc_channel_print_log (ptr_channel);
for (ptr_nick = ptr_channel->nicks; ptr_nick;
ptr_nick = ptr_nick->next_nick)
{
- weechat_log_printf ("\n");
+ weechat_log_printf ("");
irc_nick_print_log (ptr_nick);
}
}
@@ -78,7 +84,34 @@ irc_dump ()
return PLUGIN_RC_SUCCESS;
}
-
+*/
+
+/*
+ * irc_create_directories: create directories for IRC plugin
+ */
+
+void
+irc_create_directories ()
+{
+ char *weechat_dir, *dir1, *dir2;
+
+ /* create DCC download directory */
+ weechat_dir = weechat_info_get ("weechat_dir");
+ if (weechat_dir)
+ {
+ dir1 = weechat_string_replace (weechat_config_string (irc_config_dcc_download_path),
+ "~", getenv ("HOME"));
+ dir2 = weechat_string_replace (dir1, "%h", weechat_dir);
+ if (dir2)
+ (void) weechat_mkdir (dir2, 0700);
+ if (dir1)
+ free (dir1);
+ if (dir2)
+ free (dir2);
+ free (weechat_dir);
+ }
+}
+
/*
* weechat_plugin_init: initialize IRC plugin
*/
@@ -95,17 +128,24 @@ weechat_plugin_init (struct t_weechat_plugin *plugin)
gnutls_certificate_set_x509_trust_file (gnutls_xcred, "ca.pem", GNUTLS_X509_FMT_PEM);
#endif
- irc_config_read ();
+ if (!irc_config_init ())
+ return PLUGIN_RC_FAILED;
+
+ if (irc_config_read () < 0)
+ return PLUGIN_RC_FAILED;
+
+ irc_create_directories ();
- irc_server_auto_connect (1, 0);
+ //irc_server_auto_connect (1, 0);
- irc_hook_timer = weechat_hook_add_timer (1 * 1000,
- irc_server_timer,
- NULL);
+ /*irc_timer = weechat_hook_timer (1 * 1000, 0,
+ irc_server_timer,
+ NULL);
if (irc_cfg_irc_away_check != 0)
- weechat_hook_timer (irc_cfg_irc_away_check * 60 * 1000,
- irc_server_timer_check_away,
- NULL);
+ irc_timer_check_away = weechat_hook_timer (irc_cfg_irc_away_check * 60 * 1000,
+ 0,
+ irc_server_timer_check_away,
+ NULL);*/
return PLUGIN_RC_SUCCESS;
}
@@ -117,20 +157,20 @@ weechat_plugin_init (struct t_weechat_plugin *plugin)
int
weechat_plugin_end ()
{
- if (irc_hook_timer)
+ if (irc_timer)
{
- weechat_unhook (irc_hook_timer);
- irc_hook_timer = NULL;
+ weechat_unhook (irc_timer);
+ irc_timer = NULL;
}
- if (irc_hook_timer_check_away)
+ if (irc_timer_check_away)
{
- weechat_unhook (irc_hook_timer_check_away);
- irc_hook_timer_check_away = NULL;
+ weechat_unhook (irc_timer_check_away);
+ irc_timer_check_away = NULL;
}
- irc_server_disconnect_all ();
- irc_dcc_end ();
- irc_server_free_all ();
+ //irc_server_disconnect_all ();
+ //irc_dcc_end ();
+ //irc_server_free_all ();
irc_config_write ();
diff --git a/src/plugins/irc/irc.h b/src/plugins/irc/irc.h
index 7d29c71e5..b9ba65a03 100644
--- a/src/plugins/irc/irc.h
+++ b/src/plugins/irc/irc.h
@@ -20,297 +20,18 @@
#ifndef __WEECHAT_IRC_H
#define __WEECHAT_IRC_H 1
-#include "irc-buffer.h"
-#include "irc-color.h"
-#include "irc-command.h"
-#include "irc-config.h"
-#include "irc-server.h"
-#include "irc-channel.h"
-#include "irc-nick.h"
-#include "irc-dcc.h"
-#include "irc-protocol.h"
+#ifdef HAVE_GNUTLS
+#include <gnutls/gnutls.h>
+#endif
-#include "../protocol.h"
+#include "../weechat-plugin.h"
-char plugin_name[] = "irc";
-char plugin_version[] = "0.1";
-char plugin_description[] = "IRC (Internet Relay Chat)";
+#define weechat_plugin weechat_irc_plugin
extern struct t_weechat_plugin *weechat_plugin;
-extern struct t_hook *irc_hook_timer, *irc_hook_timer_check_away;
-
-/* buffer functions (irc-buffer.c) */
-
-extern t_irc_buffer_data *irc_buffer_data_create (t_irc_server *);
-extern void irc_buffer_data_free (t_gui_buffer *);
-extern void irc_buffer_merge_servers (t_gui_window *);
-extern void irc_buffer_split_server (t_gui_window *);
-
-/* channel functions (irc-channel.c) */
-
-extern t_irc_channel *irc_channel_new (t_irc_server *, int, char *, int);
-extern void irc_channel_free (t_irc_server *, t_irc_channel *);
-extern void irc_channel_free_all (t_irc_server *);
-extern t_irc_channel *irc_channel_search (t_irc_server *, char *);
-extern t_irc_channel *irc_channel_search_any (t_irc_server *, char *);
-extern t_irc_channel *irc_channel_search_any_without_buffer (t_irc_server *, char *);
-extern t_irc_channel *irc_channel_search_dcc (t_irc_server *, char *);
-extern int irc_channel_is_channel (char *);
-extern void irc_channel_remove_away (t_irc_channel *);
-extern void irc_channel_check_away (t_irc_server *, t_irc_channel *, int);
-extern void irc_channel_set_away (t_irc_channel *, char *, int);
-extern int irc_channel_create_dcc (t_irc_dcc *);
-extern int irc_channel_get_notify_level (t_irc_server *, t_irc_channel *);
-extern void irc_channel_set_notify_level (t_irc_server *, t_irc_channel *, int);
-extern void irc_channel_add_nick_speaking (t_irc_channel *, char *);
-extern void irc_channel_print_log (t_irc_channel *);
-
-/* color functions (irc-color.c) */
-
-extern unsigned char *irc_color_decode (unsigned char *, int, int);
-extern unsigned char *irc_color_decode_for_user_entry (unsigned char *);
-extern unsigned char *irc_color_encode (unsigned char *, int);
-
-/* IRC commands (irc-command.c) */
-
-extern int irc_cmd_admin (t_gui_window *, char *, int, char **);
-extern void irc_cmd_mode_nicks (t_irc_server *, char *, char *, char *, int, char **);
-extern int irc_cmd_ame (t_gui_window *, char *, int, char **);
-extern int irc_cmd_amsg (t_gui_window *, char *, int, char **);
-extern void irc_cmd_away_server (t_irc_server *, char *);
-extern int irc_cmd_away (t_gui_window *, char *, int, char **);
-extern int irc_cmd_ban (t_gui_window *, char *, int, char **);
-extern int irc_cmd_ctcp (t_gui_window *, char *, int, char **);
-extern int irc_cmd_cycle (t_gui_window *, char *, int, char **);
-extern int irc_cmd_dehalfop (t_gui_window *, char *, int, char **);
-extern int irc_cmd_deop (t_gui_window *, char *, int, char **);
-extern int irc_cmd_devoice (t_gui_window *, char *, int, char **);
-extern int irc_cmd_die (t_gui_window *, char *, int, char **);
-extern int irc_cmd_halfop (t_gui_window *, char *, int, char **);
-extern int irc_cmd_info (t_gui_window *, char *, int, char **);
-extern int irc_cmd_invite (t_gui_window *, char *, int, char **);
-extern int irc_cmd_ison (t_gui_window *, char *, int, char **);
-extern void irc_cmd_join_server (t_irc_server *, char *);
-extern int irc_cmd_join (t_gui_window *, char *, int, char **);
-extern int irc_cmd_kick (t_gui_window *, char *, int, char **);
-extern int irc_cmd_kickban (t_gui_window *, char *, int, char **);
-extern int irc_cmd_kill (t_gui_window *, char *, int, char **);
-extern int irc_cmd_links (t_gui_window *, char *, int, char **);
-extern int irc_cmd_list (t_gui_window *, char *, int, char **);
-extern int irc_cmd_lusers (t_gui_window *, char *, int, char **);
-extern int irc_cmd_me (t_gui_window *, char *, int, char **);
-extern void irc_cmd_mode_server (t_irc_server *, char *);
-extern int irc_cmd_mode (t_gui_window *, char *, int, char **);
-extern int irc_cmd_motd (t_gui_window *, char *, int, char **);
-extern int irc_cmd_msg (t_gui_window *, char *, int, char **);
-extern int irc_cmd_names (t_gui_window *, char *, int, char **);
-extern int irc_cmd_nick (t_gui_window *, char *, int, char **);
-extern int irc_cmd_notice (t_gui_window *, char *, int, char **);
-extern int irc_cmd_op (t_gui_window *, char *, int, char **);
-extern int irc_cmd_oper (t_gui_window *, char *, int, char **);
-extern int irc_cmd_part (t_gui_window *, char *, int, char **);
-extern int irc_cmd_ping (t_gui_window *, char *, int, char **);
-extern int irc_cmd_pong (t_gui_window *, char *, int, char **);
-extern int irc_cmd_query (t_gui_window *, char *, int, char **);
-extern int irc_cmd_quit (t_gui_window *, char *, int, char **);
-extern int irc_cmd_quote (t_gui_window *, char *, int, char **);
-extern int irc_cmd_rehash (t_gui_window *, char *, int, char **);
-extern int irc_cmd_restart (t_gui_window *, char *, int, char **);
-extern int irc_cmd_service (t_gui_window *, char *, int, char **);
-extern int irc_cmd_servlist (t_gui_window *, char *, int, char **);
-extern int irc_cmd_squery (t_gui_window *, char *, int, char **);
-extern int irc_cmd_squit (t_gui_window *, char *, int, char **);
-extern int irc_cmd_stats (t_gui_window *, char *, int, char **);
-extern int irc_cmd_summon (t_gui_window *, char *, int, char **);
-extern int irc_cmd_time (t_gui_window *, char *, int, char **);
-extern int irc_cmd_topic (t_gui_window *, char *, int, char **);
-extern int irc_cmd_trace (t_gui_window *, char *, int, char **);
-extern int irc_cmd_unban (t_gui_window *, char *, int, char **);
-extern int irc_cmd_userhost (t_gui_window *, char *, int, char **);
-extern int irc_cmd_users (t_gui_window *, char *, int, char **);
-extern int irc_cmd_version (t_gui_window *, char *, int, char **);
-extern int irc_cmd_voice (t_gui_window *, char *, int, char **);
-extern int irc_cmd_wallops (t_gui_window *, char *, int, char **);
-extern int irc_cmd_who (t_gui_window *, char *, int, char **);
-extern int irc_cmd_whois (t_gui_window *, char *, int, char **);
-extern int irc_cmd_whowas (t_gui_window *, char *, int, char **);
-
-/* config functions (irc-config.c) */
-
-extern void irc_config_create_dirs ();
-extern void *irc_config_get_server_option_ptr (t_irc_server *, char *);
-extern int irc_config_set_server_value (t_irc_server *, char *, char *);
-extern int irc_config_read ();
-extern int irc_config_write ();
-
-/* DCC functions (irc-dcc.c) */
-
-extern void irc_dcc_redraw (int);
-extern void irc_dcc_free (t_irc_dcc *);
-extern void irc_dcc_close (t_irc_dcc *, int);
-extern void irc_dcc_chat_remove_channel (t_irc_channel *);
-extern void irc_dcc_accept (t_irc_dcc *);
-extern void irc_dcc_accept_resume (t_irc_server *, char *, int, unsigned long);
-extern void irc_dcc_start_resume (t_irc_server *, char *, int, unsigned long);
-extern t_irc_dcc *irc_dcc_alloc ();
-extern t_irc_dcc *irc_dcc_add (t_irc_server *, int, unsigned long, int, char *, int,
- char *, char *, unsigned long);
-extern void irc_dcc_send_request (t_irc_server *, int, char *, char *);
-extern void irc_dcc_chat_sendf (t_irc_dcc *, char *, ...);
-extern void irc_dcc_file_send_fork (t_irc_dcc *);
-extern void irc_dcc_file_recv_fork (t_irc_dcc *);
-extern void irc_dcc_handle ();
-extern void irc_dcc_end ();
-extern void irc_dcc_print_log ();
-
-/* display functions (irc-diplay.c) */
-
-extern void irc_display_hide_password (char *, int);
-extern void irc_display_nick (t_gui_buffer *, t_irc_nick *, char *, int,
- int, char *, int);
-extern void irc_display_away (t_irc_server *, char *, char *);
-extern void irc_display_mode (t_gui_buffer *, char *, char *,
- char, char *, char *, char *, char *);
-extern void irc_display_server (t_irc_server *ptr_server, int);
-
-/* input functions (irc-input.c) */
-
-extern int irc_input_data (t_gui_window *, char *);
-
-/* log functions (irc-log.c) */
-extern char *irc_log_get_filename (char *, char *, int);
-
-/* mode functions (irc-mode.c) */
-
-extern void irc_mode_channel_set (t_irc_server *, t_irc_channel *, char *);
-extern void irc_mode_user_set (t_irc_server *, char *);
-extern int irc_mode_nick_prefix_allowed (t_irc_server *, char);
-
-/* nick functions (irc-nick.c) */
-
-extern int irc_nick_find_color (t_irc_nick *);
-extern void irc_nick_get_gui_infos (t_irc_nick *, int *, char *, int *);
-extern t_irc_nick *irc_nick_new (t_irc_server *, t_irc_channel *, char *,
- int, int, int, int, int, int, int);
-extern void irc_nick_change (t_irc_server *, t_irc_channel *, t_irc_nick *, char *);
-extern void irc_nick_free (t_irc_channel *, t_irc_nick *);
-extern void irc_nick_free_all (t_irc_channel *);
-extern t_irc_nick *irc_nick_search (t_irc_channel *, char *);
-extern void irc_nick_count (t_irc_channel *, int *, int *, int *, int *, int *);
-extern void irc_nick_set_away (t_irc_channel *, t_irc_nick *, int);
-extern void irc_nick_print_log (t_irc_nick *);
-
-/* IRC protocol (irc-protocol.c) */
-
-extern int irc_protocol_is_highlight (char *, char *);
-extern int irc_protocol_recv_command (t_irc_server *, char *, char *, char *, char *);
-extern int irc_protocol_cmd_error (t_irc_server *, char *, char *, char *, char *, int, int);
-extern int irc_protocol_cmd_invite (t_irc_server *, char *, char *, char *, char *, int, int);
-extern int irc_protocol_cmd_join (t_irc_server *, char *, char *, char *, char *, int, int);
-extern int irc_protocol_cmd_kick (t_irc_server *, char *, char *, char *, char *, int, int);
-extern int irc_protocol_cmd_kill (t_irc_server *, char *, char *, char *, char *, int, int);
-extern int irc_protocol_cmd_mode (t_irc_server *, char *, char *, char *, char *, int, int);
-extern int irc_protocol_cmd_nick (t_irc_server *, char *, char *, char *, char *, int, int);
-extern int irc_protocol_cmd_notice (t_irc_server *, char *, char *, char *, char *, int, int);
-extern int irc_protocol_cmd_part (t_irc_server *, char *, char *, char *, char *, int, int);
-extern int irc_protocol_cmd_ping (t_irc_server *, char *, char *, char *, char *, int, int);
-extern int irc_protocol_cmd_pong (t_irc_server *, char *, char *, char *, char *, int, int);
-extern int irc_protocol_cmd_privmsg (t_irc_server *, char *, char *, char *, char *, int, int);
-extern int irc_protocol_cmd_quit (t_irc_server *, char *, char *, char *, char *, int, int);
-extern int irc_protocol_cmd_server_mode_reason (t_irc_server *, char *, char *, char *, char *, int, int);
-extern int irc_protocol_cmd_server_msg (t_irc_server *, char *, char *, char *, char *, int, int);
-extern int irc_protocol_cmd_server_reply (t_irc_server *, char *, char *, char *, char *, int, int);
-extern int irc_protocol_cmd_topic (t_irc_server *, char *, char *, char *, char *, int, int);
-extern int irc_protocol_cmd_wallops (t_irc_server *, char *, char *, char *, char *, int, int);
-extern int irc_protocol_cmd_001 (t_irc_server *, char *, char *, char *, char *, int, int);
-extern int irc_protocol_cmd_005 (t_irc_server *, char *, char *, char *, char *, int, int);
-extern int irc_protocol_cmd_221 (t_irc_server *, char *, char *, char *, char *, int, int);
-extern int irc_protocol_cmd_301 (t_irc_server *, char *, char *, char *, char *, int, int);
-extern int irc_protocol_cmd_302 (t_irc_server *, char *, char *, char *, char *, int, int);
-extern int irc_protocol_cmd_303 (t_irc_server *, char *, char *, char *, char *, int, int);
-extern int irc_protocol_cmd_305 (t_irc_server *, char *, char *, char *, char *, int, int);
-extern int irc_protocol_cmd_306 (t_irc_server *, char *, char *, char *, char *, int, int);
-extern int irc_protocol_cmd_whois_nick_msg (t_irc_server *, char *, char *, char *, char *, int, int);
-extern int irc_protocol_cmd_310 (t_irc_server *, char *, char *, char *, char *, int, int);
-extern int irc_protocol_cmd_311 (t_irc_server *, char *, char *, char *, char *, int, int);
-extern int irc_protocol_cmd_312 (t_irc_server *, char *, char *, char *, char *, int, int);
-extern int irc_protocol_cmd_314 (t_irc_server *, char *, char *, char *, char *, int, int);
-extern int irc_protocol_cmd_315 (t_irc_server *, char *, char *, char *, char *, int, int);
-extern int irc_protocol_cmd_317 (t_irc_server *, char *, char *, char *, char *, int, int);
-extern int irc_protocol_cmd_319 (t_irc_server *, char *, char *, char *, char *, int, int);
-extern int irc_protocol_cmd_321 (t_irc_server *, char *, char *, char *, char *, int, int);
-extern int irc_protocol_cmd_322 (t_irc_server *, char *, char *, char *, char *, int, int);
-extern int irc_protocol_cmd_323 (t_irc_server *, char *, char *, char *, char *, int, int);
-extern int irc_protocol_cmd_324 (t_irc_server *, char *, char *, char *, char *, int, int);
-extern int irc_protocol_cmd_327 (t_irc_server *, char *, char *, char *, char *, int, int);
-extern int irc_protocol_cmd_329 (t_irc_server *, char *, char *, char *, char *, int, int);
-extern int irc_protocol_cmd_331 (t_irc_server *, char *, char *, char *, char *, int, int);
-extern int irc_protocol_cmd_332 (t_irc_server *, char *, char *, char *, char *, int, int);
-extern int irc_protocol_cmd_333 (t_irc_server *, char *, char *, char *, char *, int, int);
-extern int irc_protocol_cmd_338 (t_irc_server *, char *, char *, char *, char *, int, int);
-extern int irc_protocol_cmd_341 (t_irc_server *, char *, char *, char *, char *, int, int);
-extern int irc_protocol_cmd_344 (t_irc_server *, char *, char *, char *, char *, int, int);
-extern int irc_protocol_cmd_345 (t_irc_server *, char *, char *, char *, char *, int, int);
-extern int irc_protocol_cmd_348 (t_irc_server *, char *, char *, char *, char *, int, int);
-extern int irc_protocol_cmd_349 (t_irc_server *, char *, char *, char *, char *, int, int);
-extern int irc_protocol_cmd_351 (t_irc_server *, char *, char *, char *, char *, int, int);
-extern int irc_protocol_cmd_352 (t_irc_server *, char *, char *, char *, char *, int, int);
-extern int irc_protocol_cmd_353 (t_irc_server *, char *, char *, char *, char *, int, int);
-extern int irc_protocol_cmd_365 (t_irc_server *, char *, char *, char *, char *, int, int);
-extern int irc_protocol_cmd_366 (t_irc_server *, char *, char *, char *, char *, int, int);
-extern int irc_protocol_cmd_367 (t_irc_server *, char *, char *, char *, char *, int, int);
-extern int irc_protocol_cmd_368 (t_irc_server *, char *, char *, char *, char *, int, int);
-extern int irc_protocol_cmd_432 (t_irc_server *, char *, char *, char *, char *, int, int);
-extern int irc_protocol_cmd_433 (t_irc_server *, char *, char *, char *, char *, int, int);
-extern int irc_protocol_cmd_438 (t_irc_server *, char *, char *, char *, char *, int, int);
-extern int irc_protocol_cmd_671 (t_irc_server *, char *, char *, char *, char *, int, int);
-
-/* server functions (irc-server.c) */
+extern struct t_weechat_plugin *weechat_plugin;
+extern struct t_hook *irc_timer_check_away;
-extern void irc_server_init (t_irc_server *);
-extern int irc_server_init_with_url (char *, t_irc_server *);
-extern t_irc_server *irc_server_alloc ();
-extern void irc_server_outqueue_free_all (t_irc_server *);
-extern void irc_server_destroy (t_irc_server *);
-extern void irc_server_free (t_irc_server *);
-extern void irc_server_free_all ();
-extern t_irc_server *irc_server_new (char *, int, int, int, int, char *, int, int, int,
- char *, char *, char *, char *, char *, char *,
- char *, char *, int, char *, int, char *);
-extern t_irc_server *irc_server_duplicate (t_irc_server *, char *);
-extern int irc_server_rename (t_irc_server *, char *);
-extern int irc_server_send (t_irc_server *, char *, int);
-extern void irc_server_outqueue_send (t_irc_server *);
-extern void irc_server_sendf (t_irc_server *, char *, ...);
-extern void irc_server_parse_message (char *, char **, char **, char **);
-extern void irc_server_recv (void *);
-extern void irc_server_timer (void *);
-extern void irc_server_timer_check_away (void *);
-extern void irc_server_child_read (void *);
-extern void irc_server_convbase64_8x3_to_6x4 (char *, char*);
-extern void irc_server_base64encode (char *, char *);
-extern int irc_server_pass_httpproxy (int, char*, int);
-extern int irc_server_resolve (char *, char *, int *);
-extern int irc_server_pass_socks4proxy (int, char*, int, char*);
-extern int irc_server_pass_socks5proxy (int, char*, int);
-extern int irc_server_pass_proxy (int, char*, int, char*);
-extern int irc_server_connect (t_irc_server *, int);
-extern void irc_server_reconnect (t_irc_server *);
-extern void irc_server_auto_connect (int, int);
-extern void irc_server_disconnect (t_irc_server *, int);
-extern void irc_server_disconnect_all ();
-extern void irc_server_autojoin_channels ();
-extern t_irc_server *irc_server_search (char *);
-extern int irc_server_get_number_connected ();
-extern void irc_server_get_number_buffer (t_irc_server *, int *, int *);
-extern int irc_server_name_already_exists (char *);
-extern int irc_server_get_channel_count (t_irc_server *);
-extern int irc_server_get_pv_count (t_irc_server *);
-extern void irc_server_remove_away ();
-extern void irc_server_check_away ();
-extern void irc_server_set_away (t_irc_server *, char *, int);
-extern int irc_server_get_default_notify_level (t_irc_server *);
-extern void irc_server_set_default_notify_level (t_irc_server *, int);
-extern void irc_server_print_log (t_irc_server *);
+extern gnutls_certificate_credentials gnutls_xcred;
#endif /* irc.h */