summaryrefslogtreecommitdiff
path: root/src/plugins/irc
diff options
context:
space:
mode:
Diffstat (limited to 'src/plugins/irc')
-rw-r--r--src/plugins/irc/irc-buffer.h8
-rw-r--r--src/plugins/irc/irc-channel.c18
-rw-r--r--src/plugins/irc/irc-channel.h88
-rw-r--r--src/plugins/irc/irc-color.c3
-rw-r--r--src/plugins/irc/irc-color.h8
-rw-r--r--src/plugins/irc/irc-command.c249
-rw-r--r--src/plugins/irc/irc-command.h14
-rw-r--r--src/plugins/irc/irc-completion.c64
-rw-r--r--src/plugins/irc/irc-completion.h11
-rw-r--r--src/plugins/irc/irc-config.c11
-rw-r--r--src/plugins/irc/irc-config.h5
-rw-r--r--src/plugins/irc/irc-dcc.c517
-rw-r--r--src/plugins/irc/irc-dcc.h32
-rw-r--r--src/plugins/irc/irc-display.h18
-rw-r--r--src/plugins/irc/irc-mode.c10
-rw-r--r--src/plugins/irc/irc-mode.h9
-rw-r--r--src/plugins/irc/irc-nick.c5
-rw-r--r--src/plugins/irc/irc-nick.h39
-rw-r--r--src/plugins/irc/irc-protocol.c16
-rw-r--r--src/plugins/irc/irc-protocol.h125
-rw-r--r--src/plugins/irc/irc-server.c117
-rw-r--r--src/plugins/irc/irc-server.h98
-rw-r--r--src/plugins/irc/irc.c14
23 files changed, 770 insertions, 709 deletions
diff --git a/src/plugins/irc/irc-buffer.h b/src/plugins/irc/irc-buffer.h
index 88bd8eafa..600493bf5 100644
--- a/src/plugins/irc/irc-buffer.h
+++ b/src/plugins/irc/irc-buffer.h
@@ -42,9 +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 *);
+extern struct t_irc_buffer_data *irc_buffer_data_create (struct t_irc_server *server);
+extern void irc_buffer_data_free (struct t_gui_buffer *buffer);
+extern void irc_buffer_merge_servers (struct t_gui_window *window);
+extern void irc_buffer_split_server (struct t_gui_window *window);
#endif /* irc-buffer.h */
diff --git a/src/plugins/irc/irc-channel.c b/src/plugins/irc/irc-channel.c
index d3975bbb7..39a9b8ff7 100644
--- a/src/plugins/irc/irc-channel.c
+++ b/src/plugins/irc/irc-channel.c
@@ -48,7 +48,7 @@ irc_channel_new (struct t_irc_server *server, int channel_type,
struct t_gui_buffer *new_buffer;
/* alloc memory for new channel */
- if ((new_channel = (struct t_irc_channel *) malloc (sizeof (struct t_irc_channel))) == NULL)
+ if ((new_channel = (struct t_irc_channel *)malloc (sizeof (struct t_irc_channel))) == NULL)
{
weechat_printf (NULL,
_("%sirc: cannot allocate new channel"),
@@ -88,7 +88,7 @@ irc_channel_new (struct t_irc_server *server, int channel_type,
//new_buffer->notify_level = irc_channel_get_notify_level (server, new_channel);
/* add new channel to channels list */
- new_channel->prev_channel = ((struct t_irc_server *)server)->last_channel;
+ new_channel->prev_channel = server->last_channel;
new_channel->next_channel = NULL;
if (server->channels)
(server->last_channel)->next_channel = new_channel;
@@ -346,17 +346,17 @@ irc_channel_set_away (struct t_irc_channel *channel, char *nick, int is_away)
*/
int
-irc_channel_create_dcc (void *dcc)
+irc_channel_create_dcc (struct t_irc_dcc *dcc)
{
struct t_irc_channel *ptr_channel;
- ptr_channel = irc_channel_search_dcc (((struct t_irc_dcc *)dcc)->server,
- ((struct t_irc_dcc *)dcc)->nick);
+ ptr_channel = irc_channel_search_dcc (dcc->server, dcc->nick);
if (!ptr_channel)
{
- ptr_channel = irc_channel_new (((struct t_irc_dcc *)dcc)->server,
+ ptr_channel = irc_channel_new (dcc->server,
IRC_CHANNEL_TYPE_DCC_CHAT,
- ((struct t_irc_dcc *)dcc)->nick, 0);
+ dcc->nick,
+ 0);
if (!ptr_channel)
return 0;
}
@@ -366,7 +366,7 @@ irc_channel_create_dcc (void *dcc)
return 0;
ptr_channel->dcc_chat = dcc;
- ((struct t_irc_dcc *)dcc)->channel = ptr_channel;
+ dcc->channel = ptr_channel;
//gui_window_redraw_buffer (ptr_channel->buffer);
return 1;
}
@@ -395,7 +395,7 @@ irc_channel_get_notify_level (struct t_irc_server *server,
&& (server_default_notify == 1))
server_default_notify = 2;
- name = (char *) malloc (strlen (channel->name) + 2);
+ name = (char *)malloc (strlen (channel->name) + 2);
strcpy (name, channel->name);
strcat (name, ":");
pos = strstr (server->notify_levels, name);
diff --git a/src/plugins/irc/irc-channel.h b/src/plugins/irc/irc-channel.h
index eecce10c6..cd3c453e7 100644
--- a/src/plugins/irc/irc-channel.h
+++ b/src/plugins/irc/irc-channel.h
@@ -34,44 +34,58 @@
struct t_irc_channel
{
- int type; /* channel type */
- 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 */
- int limit; /* user limit (0 is limit not set) */
- char *key; /* channel key (NULL if no key is set) */
- int nicks_count; /* # nicks on channel (0 if dcc/pv) */
- int checking_away; /* = 1 if checking away with WHO cmd */
- char *away_message; /* to display away only once in private */
- int cycle; /* currently cycling (/part then /join) */
- int close; /* close request (/buffer close) */
- int display_creation_date; /* 1 if creation date should be displayed*/
- int nick_completion_reset; /* 1 if nick completion should be rebuilt*/
- /* there was some join/part on 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_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 */
+ int type; /* channel type */
+ 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 pv) */
+ char *modes; /* channel modes */
+ int limit; /* user limit (0 is limit not set) */
+ char *key; /* channel key (NULL if no key set) */
+ int nicks_count; /* # nicks on channel (0 if dcc/pv) */
+ int checking_away; /* = 1 if checking away with WHO cmd */
+ char *away_message; /* to display away only once in pv */
+ int cycle; /* currently cycling (/part + /join) */
+ int close; /* close request (/buffer close) */
+ int display_creation_date; /* 1 for displaying creation date */
+ int nick_completion_reset; /* 1 for resetting nick completion */
+ /* there was some join/part on chan */
+ 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_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 *);
+extern struct t_irc_channel *irc_channel_new (struct t_irc_server *server,
+ int channel_type,
+ char *channel_name,
+ int switch_to_channel);
+extern void irc_channel_free (struct t_irc_server *server,
+ struct t_irc_channel *channel);
+extern void irc_channel_free_all (struct t_irc_server *server);
+extern struct t_irc_channel *irc_channel_search (struct t_irc_server *server,
+ char *channel_name);
+extern struct t_irc_channel *irc_channel_search_any (struct t_irc_server *server,
+ char *channel_name);
+extern struct t_irc_channel *irc_channel_search_any_without_buffer (struct t_irc_server *server,
+ char *channel_name);
+extern struct t_irc_channel *irc_channel_search_dcc (struct t_irc_server *server,
+ char *channel_name);
+extern int irc_channel_is_channel (char *string);
+extern void irc_channel_remove_away (struct t_irc_channel *channel);
+extern void irc_channel_check_away (struct t_irc_server *server,
+ struct t_irc_channel *channel, int force);
+extern void irc_channel_set_away (struct t_irc_channel *channel, char *nick,
+ int is_away);
+extern int irc_channel_create_dcc (struct t_irc_dcc *dcc);
+extern int irc_channel_get_notify_level (struct t_irc_server *server,
+ struct t_irc_channel *channel);
+extern void irc_channel_set_notify_level (struct t_irc_server *server,
+ struct t_irc_channel *channel,
+ int notify);
+extern void irc_channel_add_nick_speaking (struct t_irc_channel *channel,
+ char *nick);
+extern void irc_channel_print_log (struct t_irc_channel *channel);
#endif /* irc-channel.h */
diff --git a/src/plugins/irc/irc-color.c b/src/plugins/irc/irc-color.c
index 11fc52c7a..4a604f89a 100644
--- a/src/plugins/irc/irc-color.c
+++ b/src/plugins/irc/irc-color.c
@@ -40,7 +40,8 @@
*/
unsigned char *
-irc_color_decode (unsigned char *string, int keep_irc_colors, int keep_weechat_attr)
+irc_color_decode (unsigned char *string, int keep_irc_colors,
+ int keep_weechat_attr)
{
/*unsigned char *out;
int out_length, out_pos, length;
diff --git a/src/plugins/irc/irc-color.h b/src/plugins/irc/irc-color.h
index bee7f1426..7673bbd95 100644
--- a/src/plugins/irc/irc-color.h
+++ b/src/plugins/irc/irc-color.h
@@ -51,8 +51,10 @@
#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);
+extern unsigned char *irc_color_decode (unsigned char *string,
+ int keep_irc_colors,
+ int keep_weechat_attr);
+extern unsigned char *irc_color_decode_for_user_entry (unsigned char *string);
+extern unsigned char *irc_color_encode (unsigned char *string, int keep_colors);
#endif /* irc-color.h */
diff --git a/src/plugins/irc/irc-command.c b/src/plugins/irc/irc-command.c
index a0c064210..8ee43daff 100644
--- a/src/plugins/irc/irc-command.c
+++ b/src/plugins/irc/irc-command.c
@@ -45,8 +45,8 @@
*/
int
-irc_command_admin (void *data, void *buffer, int argc, char **argv,
- char **argv_eol)
+irc_command_admin (void *data, struct t_gui_buffer *buffer, int argc,
+ char **argv, char **argv_eol)
{
IRC_GET_SERVER(buffer);
if (!ptr_server || !ptr_server->is_connected)
@@ -143,8 +143,8 @@ irc_command_mode_nicks (struct t_irc_server *server, char *channel,
*/
int
-irc_command_ame (void *data, void *buffer, int argc, char **argv,
- char **argv_eol)
+irc_command_ame (void *data, struct t_gui_buffer *buffer, int argc,
+ char **argv, char **argv_eol)
{
struct t_irc_server *ptr_server;
struct t_irc_channel *ptr_channel;
@@ -181,8 +181,8 @@ irc_command_ame (void *data, void *buffer, int argc, char **argv,
*/
int
-irc_command_amsg (void *data, void *buffer, int argc, char **argv,
- char **argv_eol)
+irc_command_amsg (void *data, struct t_gui_buffer *buffer, int argc,
+ char **argv, char **argv_eol)
{
struct t_irc_server *ptr_server;
struct t_irc_channel *ptr_channel;
@@ -261,7 +261,7 @@ irc_command_away_server (struct t_irc_server *server, char *arguments)
{
if (server->away_message)
free (server->away_message);
- server->away_message = (char *) malloc (strlen (arguments) + 1);
+ server->away_message = (char *)malloc (strlen (arguments) + 1);
if (server->away_message)
strcpy (server->away_message, arguments);
@@ -376,8 +376,8 @@ irc_command_away_server (struct t_irc_server *server, char *arguments)
*/
int
-irc_command_away (void *data, void *buffer, int argc, char **argv,
- char **argv_eol)
+irc_command_away (void *data, struct t_gui_buffer *buffer, int argc,
+ char **argv, char **argv_eol)
{
IRC_GET_SERVER(buffer);
if (!ptr_server)
@@ -410,8 +410,8 @@ irc_command_away (void *data, void *buffer, int argc, char **argv,
*/
int
-irc_command_ban (void *data, void *buffer, int argc, char **argv,
- char **argv_eol)
+irc_command_ban (void *data, struct t_gui_buffer *buffer, int argc,
+ char **argv, char **argv_eol)
{
char *pos_channel;
int pos_args;
@@ -522,8 +522,8 @@ irc_command_connect_one_server (struct t_irc_server *server, int no_join)
*/
int
-irc_command_connect (void *data, void *buffer, int argc, char **argv,
- char **argv_eol)
+irc_command_connect (void *data, struct t_gui_buffer *buffer, int argc,
+ char **argv, char **argv_eol)
{
struct t_irc_server server_tmp;
int i, nb_connect, connect_ok, all_servers, no_join, port, ipv6, ssl;
@@ -672,8 +672,8 @@ irc_command_connect (void *data, void *buffer, int argc, char **argv,
*/
int
-irc_command_ctcp (void *data, void *buffer, int argc, char **argv,
- char **argv_eol)
+irc_command_ctcp (void *data, struct t_gui_buffer *buffer, int argc,
+ char **argv, char **argv_eol)
{
char *pos, *irc_cmd;
struct timeval tv;
@@ -760,8 +760,8 @@ irc_command_ctcp (void *data, void *buffer, int argc, char **argv,
*/
int
-irc_command_cycle (void *data, void *buffer, int argc, char **argv,
- char **argv_eol)
+irc_command_cycle (void *data, struct t_gui_buffer *buffer, int argc,
+ char **argv, char **argv_eol)
{
char *channel_name, *pos_args, *ptr_arg, *buf, *version;
char **channels;
@@ -863,8 +863,8 @@ irc_command_cycle (void *data, void *buffer, int argc, char **argv,
*/
int
-irc_command_dcc (void *data, void *buffer, int argc, char **argv,
- char **argv_eol)
+irc_command_dcc (void *data, struct t_gui_buffer *buffer, int argc,
+ char **argv, char **argv_eol)
{
IRC_GET_SERVER_CHANNEL(buffer);
if (!ptr_server || !ptr_server->is_connected)
@@ -872,6 +872,7 @@ irc_command_dcc (void *data, void *buffer, int argc, char **argv,
/* make compiler happy */
(void) data;
+ (void) argv_eol; // to remove!
if (argc > 1)
{
@@ -928,8 +929,8 @@ irc_command_dcc (void *data, void *buffer, int argc, char **argv,
*/
int
-irc_command_dehalfop (void *data, void *buffer, int argc, char **argv,
- char **argv_eol)
+irc_command_dehalfop (void *data, struct t_gui_buffer *buffer, int argc,
+ char **argv, char **argv_eol)
{
IRC_GET_SERVER_CHANNEL(buffer);
if (!ptr_server || !ptr_server->is_connected)
@@ -965,8 +966,8 @@ irc_command_dehalfop (void *data, void *buffer, int argc, char **argv,
*/
int
-irc_command_deop (void *data, void *buffer, int argc, char **argv,
- char **argv_eol)
+irc_command_deop (void *data, struct t_gui_buffer *buffer, int argc,
+ char **argv, char **argv_eol)
{
IRC_GET_SERVER_CHANNEL(buffer);
if (!ptr_server || !ptr_server->is_connected)
@@ -1002,8 +1003,8 @@ irc_command_deop (void *data, void *buffer, int argc, char **argv,
*/
int
-irc_command_devoice (void *data, void *buffer, int argc, char **argv,
- char **argv_eol)
+irc_command_devoice (void *data, struct t_gui_buffer *buffer, int argc,
+ char **argv, char **argv_eol)
{
IRC_GET_SERVER_CHANNEL(buffer);
if (!ptr_server || !ptr_server->is_connected)
@@ -1039,8 +1040,8 @@ irc_command_devoice (void *data, void *buffer, int argc, char **argv,
*/
int
-irc_command_die (void *data, void *buffer, int argc, char **argv,
- char **argv_eol)
+irc_command_die (void *data, struct t_gui_buffer *buffer, int argc,
+ char **argv, char **argv_eol)
{
IRC_GET_SERVER(buffer);
if (!ptr_server || !ptr_server->is_connected)
@@ -1129,8 +1130,8 @@ irc_command_disconnect_one_server (struct t_irc_server *server)
*/
int
-irc_command_disconnect (void *data, void *buffer, int argc, char **argv,
- char **argv_eol)
+irc_command_disconnect (void *data, struct t_gui_buffer *buffer, int argc,
+ char **argv, char **argv_eol)
{
int i, disconnect_ok;
@@ -1191,8 +1192,8 @@ irc_command_disconnect (void *data, void *buffer, int argc, char **argv,
*/
int
-irc_command_halfop (void *data, void *buffer, int argc, char **argv,
- char **argv_eol)
+irc_command_halfop (void *data, struct t_gui_buffer *buffer, int argc,
+ char **argv, char **argv_eol)
{
IRC_GET_SERVER_CHANNEL(buffer);
if (!ptr_server || !ptr_server->is_connected)
@@ -1228,8 +1229,8 @@ irc_command_halfop (void *data, void *buffer, int argc, char **argv,
*/
int
-irc_command_info (void *data, void *buffer, int argc, char **argv,
- char **argv_eol)
+irc_command_info (void *data, struct t_gui_buffer *buffer, int argc,
+ char **argv, char **argv_eol)
{
IRC_GET_SERVER(buffer);
if (!ptr_server || !ptr_server->is_connected)
@@ -1251,8 +1252,8 @@ irc_command_info (void *data, void *buffer, int argc, char **argv,
*/
int
-irc_command_invite (void *data, void *buffer, int argc, char **argv,
- char **argv_eol)
+irc_command_invite (void *data, struct t_gui_buffer *buffer, int argc,
+ char **argv, char **argv_eol)
{
IRC_GET_SERVER_CHANNEL(buffer);
if (!ptr_server || !ptr_server->is_connected)
@@ -1287,8 +1288,8 @@ irc_command_invite (void *data, void *buffer, int argc, char **argv,
*/
int
-irc_command_ison (void *data, void *buffer, int argc, char **argv,
- char **argv_eol)
+irc_command_ison (void *data, struct t_gui_buffer *buffer, int argc,
+ char **argv, char **argv_eol)
{
IRC_GET_SERVER(buffer);
if (!ptr_server || !ptr_server->is_connected)
@@ -1326,8 +1327,8 @@ irc_command_join_server (struct t_irc_server *server, char *arguments)
*/
int
-irc_command_join (void *data, void *buffer, int argc, char **argv,
- char **argv_eol)
+irc_command_join (void *data, struct t_gui_buffer *buffer, int argc,
+ char **argv, char **argv_eol)
{
IRC_GET_SERVER(buffer);
if (!ptr_server || !ptr_server->is_connected)
@@ -1352,8 +1353,8 @@ irc_command_join (void *data, void *buffer, int argc, char **argv,
*/
int
-irc_command_kick (void *data, void *buffer, int argc, char **argv,
- char **argv_eol)
+irc_command_kick (void *data, struct t_gui_buffer *buffer, int argc,
+ char **argv, char **argv_eol)
{
char *pos_channel, *pos_nick, *pos_comment;
@@ -1418,8 +1419,8 @@ irc_command_kick (void *data, void *buffer, int argc, char **argv,
*/
int
-irc_command_kickban (void *data, void *buffer, int argc, char **argv,
- char **argv_eol)
+irc_command_kickban (void *data, struct t_gui_buffer *buffer, int argc,
+ char **argv, char **argv_eol)
{
char *pos_channel, *pos_nick, *pos_comment;
@@ -1486,8 +1487,8 @@ irc_command_kickban (void *data, void *buffer, int argc, char **argv,
*/
int
-irc_command_kill (void *data, void *buffer, int argc, char **argv,
- char **argv_eol)
+irc_command_kill (void *data, struct t_gui_buffer *buffer, int argc,
+ char **argv, char **argv_eol)
{
IRC_GET_SERVER(buffer);
if (!ptr_server || !ptr_server->is_connected)
@@ -1515,8 +1516,8 @@ irc_command_kill (void *data, void *buffer, int argc, char **argv,
*/
int
-irc_command_links (void *data, void *buffer, int argc, char **argv,
- char **argv_eol)
+irc_command_links (void *data, struct t_gui_buffer *buffer, int argc,
+ char **argv, char **argv_eol)
{
IRC_GET_SERVER(buffer);
if (!ptr_server || !ptr_server->is_connected)
@@ -1539,8 +1540,8 @@ irc_command_links (void *data, void *buffer, int argc, char **argv,
*/
int
-irc_command_list (void *data, void *buffer, int argc, char **argv,
- char **argv_eol)
+irc_command_list (void *data, struct t_gui_buffer *buffer, int argc,
+ char **argv, char **argv_eol)
{
char buf[512];
int ret;
@@ -1562,7 +1563,7 @@ irc_command_list (void *data, void *buffer, int argc, char **argv,
if (argc > 1)
{
- ptr_server->cmd_list_regexp = (regex_t *) malloc (sizeof (regex_t));
+ ptr_server->cmd_list_regexp = (regex_t *)malloc (sizeof (regex_t));
if (ptr_server->cmd_list_regexp)
{
if ((ret = regcomp (ptr_server->cmd_list_regexp,
@@ -1600,8 +1601,8 @@ irc_command_list (void *data, void *buffer, int argc, char **argv,
*/
int
-irc_command_lusers (void *data, void *buffer, int argc, char **argv,
- char **argv_eol)
+irc_command_lusers (void *data, struct t_gui_buffer *buffer, int argc,
+ char **argv, char **argv_eol)
{
IRC_GET_SERVER(buffer);
if (!ptr_server || !ptr_server->is_connected)
@@ -1624,7 +1625,7 @@ irc_command_lusers (void *data, void *buffer, int argc, char **argv,
*/
int
-irc_command_me (void *data, void *buffer, int argc, char **argv,
+irc_command_me (void *data, struct t_gui_buffer *buffer, int argc, char **argv,
char **argv_eol)
{
IRC_GET_SERVER_CHANNEL(buffer);
@@ -1670,8 +1671,8 @@ irc_command_mode_server (struct t_irc_server *server, char *arguments)
*/
int
-irc_command_mode (void *data, void *buffer, int argc, char **argv,
- char **argv_eol)
+irc_command_mode (void *data, struct t_gui_buffer *buffer, int argc,
+ char **argv, char **argv_eol)
{
IRC_GET_SERVER(buffer);
if (!ptr_server || !ptr_server->is_connected)
@@ -1696,8 +1697,8 @@ irc_command_mode (void *data, void *buffer, int argc, char **argv,
*/
int
-irc_command_motd (void *data, void *buffer, int argc, char **argv,
- char **argv_eol)
+irc_command_motd (void *data, struct t_gui_buffer *buffer, int argc,
+ char **argv, char **argv_eol)
{
IRC_GET_SERVER(buffer);
if (!ptr_server || !ptr_server->is_connected)
@@ -1720,8 +1721,8 @@ irc_command_motd (void *data, void *buffer, int argc, char **argv,
*/
int
-irc_command_msg (void *data, void *buffer, int argc, char **argv,
- char **argv_eol)
+irc_command_msg (void *data, struct t_gui_buffer *buffer, int argc,
+ char **argv, char **argv_eol)
{
char **targets;
int num_targets, i;
@@ -1895,8 +1896,8 @@ irc_command_msg (void *data, void *buffer, int argc, char **argv,
*/
int
-irc_command_names (void *data, void *buffer, int argc, char **argv,
- char **argv_eol)
+irc_command_names (void *data, struct t_gui_buffer *buffer, int argc,
+ char **argv, char **argv_eol)
{
IRC_GET_SERVER_CHANNEL(buffer);
if (!ptr_server || !ptr_server->is_connected)
@@ -1959,8 +1960,8 @@ irc_send_nick_server (struct t_irc_server *server, char *nickname)
*/
int
-irc_command_nick (void *data, void *buffer, int argc, char **argv,
- char **argv_eol)
+irc_command_nick (void *data, struct t_gui_buffer *buffer, int argc,
+ char **argv, char **argv_eol)
{
IRC_GET_SERVER(buffer);
if (!ptr_server)
@@ -2003,8 +2004,8 @@ irc_command_nick (void *data, void *buffer, int argc, char **argv,
*/
int
-irc_command_notice (void *data, void *buffer, int argc, char **argv,
- char **argv_eol)
+irc_command_notice (void *data, struct t_gui_buffer *buffer, int argc,
+ char **argv, char **argv_eol)
{
char *string;
@@ -2045,7 +2046,7 @@ irc_command_notice (void *data, void *buffer, int argc, char **argv,
*/
int
-irc_command_op (void *data, void *buffer, int argc, char **argv,
+irc_command_op (void *data, struct t_gui_buffer *buffer, int argc, char **argv,
char **argv_eol)
{
IRC_GET_SERVER_CHANNEL(buffer);
@@ -2082,8 +2083,8 @@ irc_command_op (void *data, void *buffer, int argc, char **argv,
*/
int
-irc_command_oper (void *data, void *buffer, int argc, char **argv,
- char **argv_eol)
+irc_command_oper (void *data, struct t_gui_buffer *buffer, int argc,
+ char **argv, char **argv_eol)
{
IRC_GET_SERVER(buffer);
if (!ptr_server || !ptr_server->is_connected)
@@ -2108,8 +2109,8 @@ irc_command_oper (void *data, void *buffer, int argc, char **argv,
*/
int
-irc_command_part (void *data, void *buffer, int argc, char **argv,
- char **argv_eol)
+irc_command_part (void *data, struct t_gui_buffer *buffer, int argc,
+ char **argv, char **argv_eol)
{
char *channel_name, *pos_args, *ptr_arg, *buf, *version;
@@ -2155,7 +2156,7 @@ irc_command_part (void *data, void *buffer, int argc, char **argv,
}
if (!ptr_channel->nicks)
{
- weechat_buffer_close (ptr_channel->buffer);
+ weechat_buffer_close (ptr_channel->buffer, 1);
ptr_channel->buffer = NULL;
irc_channel_free (ptr_server, ptr_channel);
//gui_status_draw (gui_current_window->buffer, 1);
@@ -2194,8 +2195,8 @@ irc_command_part (void *data, void *buffer, int argc, char **argv,
*/
int
-irc_command_ping (void *data, void *buffer, int argc, char **argv,
- char **argv_eol)
+irc_command_ping (void *data, struct t_gui_buffer *buffer, int argc,
+ char **argv, char **argv_eol)
{
IRC_GET_SERVER(buffer);
if (!ptr_server || !ptr_server->is_connected)
@@ -2220,8 +2221,8 @@ irc_command_ping (void *data, void *buffer, int argc, char **argv,
*/
int
-irc_command_pong (void *data, void *buffer, int argc, char **argv,
- char **argv_eol)
+irc_command_pong (void *data, struct t_gui_buffer *buffer, int argc,
+ char **argv, char **argv_eol)
{
IRC_GET_SERVER(buffer);
if (!ptr_server)
@@ -2246,8 +2247,8 @@ irc_command_pong (void *data, void *buffer, int argc, char **argv,
*/
int
-irc_command_query (void *data, void *buffer, int argc, char **argv,
- char **argv_eol)
+irc_command_query (void *data, struct t_gui_buffer *buffer, int argc,
+ char **argv, char **argv_eol)
{
char *string;
@@ -2310,8 +2311,8 @@ irc_command_query (void *data, void *buffer, int argc, char **argv,
*/
int
-irc_command_quote (void *data, void *buffer, int argc, char **argv,
- char **argv_eol)
+irc_command_quote (void *data, struct t_gui_buffer *buffer, int argc,
+ char **argv, char **argv_eol)
{
IRC_GET_SERVER(buffer);
if (!ptr_server)// || !ptr_server->is_connected)
@@ -2367,8 +2368,8 @@ irc_command_reconnect_one_server (struct t_irc_server *server, int no_join)
*/
int
-irc_command_reconnect (void *data, void *buffer, int argc, char **argv,
- char **argv_eol)
+irc_command_reconnect (void *data, struct t_gui_buffer *buffer, int argc,
+ char **argv, char **argv_eol)
{
int i, nb_reconnect, reconnect_ok, all_servers, no_join;
@@ -2442,8 +2443,8 @@ irc_command_reconnect (void *data, void *buffer, int argc, char **argv,
*/
int
-irc_command_rehash (void *data, void *buffer, int argc, char **argv,
- char **argv_eol)
+irc_command_rehash (void *data, struct t_gui_buffer *buffer, int argc,
+ char **argv, char **argv_eol)
{
IRC_GET_SERVER(buffer);
if (!ptr_server || !ptr_server->is_connected)
@@ -2465,8 +2466,8 @@ irc_command_rehash (void *data, void *buffer, int argc, char **argv,
*/
int
-irc_command_restart (void *data, void *buffer, int argc, char **argv,
- char **argv_eol)
+irc_command_restart (void *data, struct t_gui_buffer *buffer, int argc,
+ char **argv, char **argv_eol)
{
IRC_GET_SERVER(buffer);
if (!ptr_server || !ptr_server->is_connected)
@@ -2488,8 +2489,8 @@ irc_command_restart (void *data, void *buffer, int argc, char **argv,
*/
int
-irc_command_server (void *data, void *buffer, int argc, char **argv,
- char **argv_eol)
+irc_command_server (void *data, struct t_gui_buffer *buffer, int argc,
+ char **argv, char **argv_eol)
{
int i, detailed_list, one_server_found;
struct t_irc_server server_tmp, *ptr_server, *server_found, *new_server;
@@ -2568,7 +2569,7 @@ irc_command_server (void *data, void *buffer, int argc, char **argv,
{
IRC_COMMAND_TOO_FEW_ARGUMENTS(NULL, "server add");
}
- if (irc_server_name_already_exists (argv[2]))
+ if (irc_server_search (argv[2]))
{
weechat_printf (NULL,
_("%sirc: server \"%s\" already exists, "
@@ -2974,8 +2975,8 @@ irc_command_server (void *data, void *buffer, int argc, char **argv,
*/
int
-irc_command_service (void *data, void *buffer, int argc, char **argv,
- char **argv_eol)
+irc_command_service (void *data, struct t_gui_buffer *buffer, int argc,
+ char **argv, char **argv_eol)
{
IRC_GET_SERVER(buffer);
if (!ptr_server || !ptr_server->is_connected)
@@ -3000,8 +3001,8 @@ irc_command_service (void *data, void *buffer, int argc, char **argv,
*/
int
-irc_command_servlist (void *data, void *buffer, int argc, char **argv,
- char **argv_eol)
+irc_command_servlist (void *data, struct t_gui_buffer *buffer, int argc,
+ char **argv, char **argv_eol)
{
IRC_GET_SERVER(buffer);
if (!ptr_server || !ptr_server->is_connected)
@@ -3024,8 +3025,8 @@ irc_command_servlist (void *data, void *buffer, int argc, char **argv,
*/
int
-irc_command_squery (void *data, void *buffer, int argc, char **argv,
- char **argv_eol)
+irc_command_squery (void *data, struct t_gui_buffer *buffer, int argc,
+ char **argv, char **argv_eol)
{
IRC_GET_SERVER(buffer);
if (!ptr_server || !ptr_server->is_connected)
@@ -3055,8 +3056,8 @@ irc_command_squery (void *data, void *buffer, int argc, char **argv,
*/
int
-irc_command_squit (void *data, void *buffer, int argc, char **argv,
- char **argv_eol)
+irc_command_squit (void *data, struct t_gui_buffer *buffer, int argc,
+ char **argv, char **argv_eol)
{
IRC_GET_SERVER(buffer);
if (!ptr_server || !ptr_server->is_connected)
@@ -3081,8 +3082,8 @@ irc_command_squit (void *data, void *buffer, int argc, char **argv,
*/
int
-irc_command_stats (void *data, void *buffer, int argc, char **argv,
- char **argv_eol)
+irc_command_stats (void *data, struct t_gui_buffer *buffer, int argc,
+ char **argv, char **argv_eol)
{
IRC_GET_SERVER(buffer);
if (!ptr_server || !ptr_server->is_connected)
@@ -3106,8 +3107,8 @@ irc_command_stats (void *data, void *buffer, int argc, char **argv,
*/
int
-irc_command_summon (void *data, void *buffer, int argc, char **argv,
- char **argv_eol)
+irc_command_summon (void *data, struct t_gui_buffer *buffer, int argc,
+ char **argv, char **argv_eol)
{
IRC_GET_SERVER(buffer);
if (!ptr_server || !ptr_server->is_connected)
@@ -3132,8 +3133,8 @@ irc_command_summon (void *data, void *buffer, int argc, char **argv,
*/
int
-irc_command_time (void *data, void *buffer, int argc, char **argv,
- char **argv_eol)
+irc_command_time (void *data, struct t_gui_buffer *buffer, int argc,
+ char **argv, char **argv_eol)
{
IRC_GET_SERVER(buffer);
if (!ptr_server || !ptr_server->is_connected)
@@ -3156,8 +3157,8 @@ irc_command_time (void *data, void *buffer, int argc, char **argv,
*/
int
-irc_command_topic (void *data, void *buffer, int argc, char **argv,
- char **argv_eol)
+irc_command_topic (void *data, struct t_gui_buffer *buffer, int argc,
+ char **argv, char **argv_eol)
{
char *channel_name, *new_topic;
@@ -3219,8 +3220,8 @@ irc_command_topic (void *data, void *buffer, int argc, char **argv,
*/
int
-irc_command_trace (void *data, void *buffer, int argc, char **argv,
- char **argv_eol)
+irc_command_trace (void *data, struct t_gui_buffer *buffer, int argc,
+ char **argv, char **argv_eol)
{
IRC_GET_SERVER(buffer);
if (!ptr_server || !ptr_server->is_connected)
@@ -3243,8 +3244,8 @@ irc_command_trace (void *data, void *buffer, int argc, char **argv,
*/
int
-irc_command_unban (void *data, void *buffer, int argc, char **argv,
- char **argv_eol)
+irc_command_unban (void *data, struct t_gui_buffer *buffer, int argc,
+ char **argv, char **argv_eol)
{
char *pos_channel;
int pos_args;
@@ -3309,8 +3310,8 @@ irc_command_unban (void *data, void *buffer, int argc, char **argv,
*/
int
-irc_command_userhost (void *data, void *buffer, int argc, char **argv,
- char **argv_eol)
+irc_command_userhost (void *data, struct t_gui_buffer *buffer, int argc,
+ char **argv, char **argv_eol)
{
IRC_GET_SERVER(buffer);
if (!ptr_server || !ptr_server->is_connected)
@@ -3335,8 +3336,8 @@ irc_command_userhost (void *data, void *buffer, int argc, char **argv,
*/
int
-irc_command_users (void *data, void *buffer, int argc, char **argv,
- char **argv_eol)
+irc_command_users (void *data, struct t_gui_buffer *buffer, int argc,
+ char **argv, char **argv_eol)
{
IRC_GET_SERVER(buffer);
if (!ptr_server || !ptr_server->is_connected)
@@ -3359,8 +3360,8 @@ irc_command_users (void *data, void *buffer, int argc, char **argv,
*/
int
-irc_command_version (void *data, void *buffer, int argc, char **argv,
- char **argv_eol)
+irc_command_version (void *data, struct t_gui_buffer *buffer, int argc,
+ char **argv, char **argv_eol)
{
IRC_GET_SERVER_CHANNEL(buffer);
if (!ptr_server || !ptr_server->is_connected)
@@ -3391,8 +3392,8 @@ irc_command_version (void *data, void *buffer, int argc, char **argv,
*/
int
-irc_command_voice (void *data, void *buffer, int argc, char **argv,
- char **argv_eol)
+irc_command_voice (void *data, struct t_gui_buffer *buffer, int argc,
+ char **argv, char **argv_eol)
{
IRC_GET_SERVER_CHANNEL(buffer);
if (!ptr_server || !ptr_server->is_connected)
@@ -3429,8 +3430,8 @@ irc_command_voice (void *data, void *buffer, int argc, char **argv,
*/
int
-irc_command_wallops (void *data, void *buffer, int argc, char **argv,
- char **argv_eol)
+irc_command_wallops (void *data, struct t_gui_buffer *buffer, int argc,
+ char **argv, char **argv_eol)
{
IRC_GET_SERVER(buffer);
if (!ptr_server || !ptr_server->is_connected)
@@ -3455,8 +3456,8 @@ irc_command_wallops (void *data, void *buffer, int argc, char **argv,
*/
int
-irc_command_who (void *data, void *buffer, int argc, char **argv,
- char **argv_eol)
+irc_command_who (void *data, struct t_gui_buffer *buffer, int argc,
+ char **argv, char **argv_eol)
{
IRC_GET_SERVER(buffer);
if (!ptr_server || !ptr_server->is_connected)
@@ -3479,8 +3480,8 @@ irc_command_who (void *data, void *buffer, int argc, char **argv,
*/
int
-irc_command_whois (void *data, void *buffer, int argc, char **argv,
- char **argv_eol)
+irc_command_whois (void *data, struct t_gui_buffer *buffer, int argc,
+ char **argv, char **argv_eol)
{
IRC_GET_SERVER(buffer);
if (!ptr_server || !ptr_server->is_connected)
@@ -3505,8 +3506,8 @@ irc_command_whois (void *data, void *buffer, int argc, char **argv,
*/
int
-irc_command_whowas (void *data, void *buffer, int argc, char **argv,
- char **argv_eol)
+irc_command_whowas (void *data, struct t_gui_buffer *buffer, int argc,
+ char **argv, char **argv_eol)
{
IRC_GET_SERVER(buffer);
if (!ptr_server || !ptr_server->is_connected)
diff --git a/src/plugins/irc/irc-command.h b/src/plugins/irc/irc-command.h
index d4c4eb66a..dd9e98c79 100644
--- a/src/plugins/irc/irc-command.h
+++ b/src/plugins/irc/irc-command.h
@@ -20,7 +20,7 @@
#ifndef __WEECHAT_IRC_COMMAND_H
#define __WEECHAT_IRC_COMMAND_H 1
-#include "irc-server.h"
+struct t_irc_server;
#define IRC_COMMAND_TOO_FEW_ARGUMENTS(__buffer, __command) \
weechat_printf (__buffer, \
@@ -29,10 +29,14 @@
return WEECHAT_RC_ERROR;
-extern void irc_command_away_server (struct t_irc_server *, char *);
-extern void irc_command_join_server (struct t_irc_server *, char *);
-extern void irc_command_mode_server (struct t_irc_server *, char *);
-extern void irc_command_quit_server (struct t_irc_server *, char *);
+extern void irc_command_away_server (struct t_irc_server *server,
+ char *arguments);
+extern void irc_command_join_server (struct t_irc_server *server,
+ char *arguments);
+extern void irc_command_mode_server (struct t_irc_server *server,
+ char *arguments);
+extern void irc_command_quit_server (struct t_irc_server *server,
+ char *arguments);
extern void irc_command_init ();
#endif /* irc-command.h */
diff --git a/src/plugins/irc/irc-completion.c b/src/plugins/irc/irc-completion.c
index 3e0eeb99f..82eb4e46f 100644
--- a/src/plugins/irc/irc-completion.c
+++ b/src/plugins/irc/irc-completion.c
@@ -40,8 +40,8 @@
*/
int
-irc_completion_server_cb (void *data, char *completion, void *buffer,
- void *list)
+irc_completion_server_cb (void *data, char *completion,
+ struct t_gui_buffer *buffer, struct t_weelist *list)
{
IRC_GET_SERVER(buffer);
@@ -61,8 +61,9 @@ irc_completion_server_cb (void *data, char *completion, void *buffer,
*/
int
-irc_completion_server_nicks_cb (void *data, char *completion, void *buffer,
- void *list)
+irc_completion_server_nicks_cb (void *data, char *completion,
+ struct t_gui_buffer *buffer,
+ struct t_weelist *list)
{
struct t_irc_server *ptr_server2;
struct t_irc_channel *ptr_channel2;
@@ -117,8 +118,8 @@ irc_completion_server_nicks_cb (void *data, char *completion, void *buffer,
*/
int
-irc_completion_servers_cb (void *data, char *completion, void *buffer,
- void *list)
+irc_completion_servers_cb (void *data, char *completion,
+ struct t_gui_buffer *buffer, struct t_weelist *list)
{
struct t_irc_server *ptr_server;
@@ -141,8 +142,8 @@ irc_completion_servers_cb (void *data, char *completion, void *buffer,
*/
int
-irc_completion_channel_cb (void *data, char *completion, void *buffer,
- void *list)
+irc_completion_channel_cb (void *data, char *completion,
+ struct t_gui_buffer *buffer, struct t_weelist *list)
{
IRC_GET_SERVER_CHANNEL(buffer);
@@ -162,8 +163,9 @@ irc_completion_channel_cb (void *data, char *completion, void *buffer,
*/
int
-irc_completion_channel_nicks_cb (void *data, char *completion, void *buffer,
- void *list)
+irc_completion_channel_nicks_cb (void *data, char *completion,
+ struct t_gui_buffer *buffer,
+ struct t_weelist *list)
{
struct t_irc_nick *ptr_nick;
char *nick;
@@ -218,8 +220,9 @@ irc_completion_channel_nicks_cb (void *data, char *completion, void *buffer,
*/
int
-irc_completion_channel_nicks_hosts_cb (void *data, char *completion, void *buffer,
- void *list)
+irc_completion_channel_nicks_hosts_cb (void *data, char *completion,
+ struct t_gui_buffer *buffer,
+ struct t_weelist *list)
{
struct t_irc_nick *ptr_nick;
char *buf;
@@ -243,7 +246,7 @@ irc_completion_channel_nicks_hosts_cb (void *data, char *completion, void *buffe
{
length = strlen (ptr_nick->nick) + 1 +
strlen (ptr_nick->host) + 1;
- buf = (char *) malloc (length);
+ buf = (char *)malloc (length);
if (buf)
{
snprintf (buf, length, "%s!%s",
@@ -270,8 +273,9 @@ irc_completion_channel_nicks_hosts_cb (void *data, char *completion, void *buffe
*/
int
-irc_completion_channel_topic_cb (void *data, char *completion, void *buffer,
- void *list)
+irc_completion_channel_topic_cb (void *data, char *completion,
+ struct t_gui_buffer *buffer,
+ struct t_weelist *list)
{
IRC_GET_SERVER_CHANNEL(buffer);
@@ -292,8 +296,8 @@ irc_completion_channel_topic_cb (void *data, char *completion, void *buffer,
*/
int
-irc_completion_channels_cb (void *data, char *completion, void *buffer,
- void *list)
+irc_completion_channels_cb (void *data, char *completion,
+ struct t_gui_buffer *buffer, struct t_weelist *list)
{
struct t_irc_server *ptr_server;
struct t_irc_channel *ptr_channel;
@@ -321,8 +325,8 @@ irc_completion_channels_cb (void *data, char *completion, void *buffer,
*/
int
-irc_completion_msg_part_cb (void *data, char *completion, void *buffer,
- void *list)
+irc_completion_msg_part_cb (void *data, char *completion,
+ struct t_gui_buffer *buffer, struct t_weelist *list)
{
/* make C compiler happy */
(void) data;
@@ -339,3 +343,25 @@ irc_completion_msg_part_cb (void *data, char *completion, void *buffer,
return WEECHAT_RC_OK;
}
+
+/*
+ * irc_completion_init: init completion for IRC plugin
+ */
+
+void
+irc_completion_init ()
+{
+ weechat_hook_completion ("irc_server", &irc_completion_server_cb, NULL);
+ weechat_hook_completion ("irc_server_nicks",
+ &irc_completion_server_nicks_cb, NULL);
+ weechat_hook_completion ("irc_servers", &irc_completion_servers_cb, NULL);
+ weechat_hook_completion ("irc_channel", &irc_completion_channel_cb, NULL);
+ weechat_hook_completion ("irc_channel_nicks",
+ &irc_completion_channel_nicks_cb, NULL);
+ weechat_hook_completion ("irc_channel_nicks_hosts",
+ &irc_completion_channel_nicks_hosts_cb, NULL);
+ weechat_hook_completion ("irc_channel_topic",
+ &irc_completion_channel_topic_cb, NULL);
+ weechat_hook_completion ("irc_channels", &irc_completion_channels_cb, NULL);
+ weechat_hook_completion ("irc_msg_part", &irc_completion_msg_part_cb, NULL);
+}
diff --git a/src/plugins/irc/irc-completion.h b/src/plugins/irc/irc-completion.h
index c0d2b250c..351c0cc97 100644
--- a/src/plugins/irc/irc-completion.h
+++ b/src/plugins/irc/irc-completion.h
@@ -20,15 +20,6 @@
#ifndef __WEECHAT_IRC_COMPLETION_H
#define __WEECHAT_IRC_COMPLETION_H 1
-extern int irc_completion_server_cb (void *, char *, void *, void *);
-extern int irc_completion_server_nicks_cb (void *, char *, void *, void *);
-extern int irc_completion_servers_cb (void *, char *, void *, void *);
-extern int irc_completion_channel_cb (void *, char *, void *, void *);
-extern int irc_completion_channel_nicks_cb (void *, char *, void *, void *);
-extern int irc_completion_channel_nicks_hosts_cb (void *, char *, void *,
- void *);
-extern int irc_completion_channel_topic_cb (void *, char *, void *, void *);
-extern int irc_completion_channels_cb (void *, char *, void *, void *);
-extern int irc_completion_msg_part_cb (void *, char *, void *, void *);
+extern void irc_completion_init ();
#endif /* irc-completion.h */
diff --git a/src/plugins/irc/irc-config.c b/src/plugins/irc/irc-config.c
index 7d8f9192d..d3c0ae443 100644
--- a/src/plugins/irc/irc-config.c
+++ b/src/plugins/irc/irc-config.c
@@ -211,7 +211,8 @@ irc_config_change_notify_levels ()
*/
void
-irc_config_read_server_line (void *config_file, char *option_name, char *value)
+irc_config_read_server_line (struct t_config_file *config_file,
+ char *option_name, char *value)
{
struct t_config_option *ptr_option;
int rc;
@@ -228,7 +229,7 @@ irc_config_read_server_line (void *config_file, char *option_name, char *value)
option_name);
if (ptr_option)
{
- rc = weechat_config_option_set (ptr_option, value);
+ rc = weechat_config_option_set (ptr_option, value, 0);
switch (rc)
{
case 2:
@@ -280,7 +281,8 @@ irc_config_read_server_line (void *config_file, char *option_name, char *value)
*/
void
-irc_config_write_servers (void *config_file, char *section_name)
+irc_config_write_servers (struct t_config_file *config_file,
+ char *section_name)
{
struct t_irc_server *ptr_server;
@@ -337,7 +339,8 @@ irc_config_write_servers (void *config_file, char *section_name)
*/
void
-irc_config_write_server_default (void *config_file, char *section_name)
+irc_config_write_server_default (struct t_config_file *config_file,
+ char *section_name)
{
struct passwd *my_passwd;
char *realname, *pos;
diff --git a/src/plugins/irc/irc-config.h b/src/plugins/irc/irc-config.h
index b1cf9756e..405f7bb8f 100644
--- a/src/plugins/irc/irc-config.h
+++ b/src/plugins/irc/irc-config.h
@@ -67,11 +67,6 @@ 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;
-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_cb ();
diff --git a/src/plugins/irc/irc-dcc.c b/src/plugins/irc/irc-dcc.c
index 01da53991..4c84000aa 100644
--- a/src/plugins/irc/irc-dcc.c
+++ b/src/plugins/irc/irc-dcc.c
@@ -169,9 +169,9 @@ irc_dcc_find_filename (struct t_irc_dcc *ptr_dcc)
return;
}
- ptr_dcc->local_filename = (char *) malloc (strlen (dir2) +
- strlen (ptr_dcc->nick) +
- strlen (ptr_dcc->filename) + 4);
+ ptr_dcc->local_filename = (char *)malloc (strlen (dir2) +
+ strlen (ptr_dcc->nick) +
+ strlen (ptr_dcc->filename) + 4);
if (!ptr_dcc->local_filename)
return;
@@ -201,7 +201,7 @@ irc_dcc_find_filename (struct t_irc_dcc *ptr_dcc)
return;
}
- filename2 = (char *) malloc (strlen (ptr_dcc->local_filename) + 16);
+ filename2 = (char *)malloc (strlen (ptr_dcc->local_filename) + 16);
if (!filename2)
{
irc_dcc_close (ptr_dcc, IRC_DCC_FAILED);
@@ -367,49 +367,49 @@ irc_dcc_connect (struct t_irc_dcc *ptr_dcc)
*/
void
-irc_dcc_free (struct t_irc_dcc *ptr_dcc)
+irc_dcc_free (struct t_irc_dcc *dcc)
{
struct t_irc_dcc *new_dcc_list;
- if (!ptr_dcc)
+ if (!dcc)
return;
/* DCC CHAT with channel => remove channel
(to prevent channel from becoming standard pv) */
- if (ptr_dcc->channel)
+ if (dcc->channel)
{
/* check if channel is used for another active DCC CHAT */
- if (!ptr_dcc->channel->dcc_chat
- || (IRC_DCC_ENDED(ptr_dcc->channel->dcc_chat->status)))
+ if (!dcc->channel->dcc_chat
+ || (IRC_DCC_ENDED(dcc->channel->dcc_chat->status)))
{
- gui_buffer_free (ptr_dcc->channel->buffer, 1);
- if (ptr_dcc->channel)
- irc_channel_free (ptr_dcc->server, ptr_dcc->channel);
+ gui_buffer_free (dcc->channel->buffer, 1);
+ if (dcc->channel)
+ irc_channel_free (dcc->server, dcc->channel);
}
}
/* remove DCC from list */
- if (irc_last_dcc == ptr_dcc)
- irc_last_dcc = ptr_dcc->prev_dcc;
- if (ptr_dcc->prev_dcc)
+ if (irc_last_dcc == dcc)
+ irc_last_dcc = dcc->prev_dcc;
+ if (dcc->prev_dcc)
{
- (ptr_dcc->prev_dcc)->next_dcc = ptr_dcc->next_dcc;
+ (dcc->prev_dcc)->next_dcc = dcc->next_dcc;
new_dcc_list = irc_dcc_list;
}
else
- new_dcc_list = ptr_dcc->next_dcc;
- if (ptr_dcc->next_dcc)
- (ptr_dcc->next_dcc)->prev_dcc = ptr_dcc->prev_dcc;
+ new_dcc_list = dcc->next_dcc;
+ if (dcc->next_dcc)
+ (dcc->next_dcc)->prev_dcc = dcc->prev_dcc;
/* free data */
- if (ptr_dcc->nick)
- free (ptr_dcc->nick);
- if (ptr_dcc->unterminated_message)
- free (ptr_dcc->unterminated_message);
- if (ptr_dcc->filename)
- free (ptr_dcc->filename);
-
- free (ptr_dcc);
+ if (dcc->nick)
+ free (dcc->nick);
+ if (dcc->unterminated_message)
+ free (dcc->unterminated_message);
+ if (dcc->filename)
+ free (dcc->filename);
+
+ free (dcc);
irc_dcc_list = new_dcc_list;
}
@@ -418,26 +418,26 @@ irc_dcc_free (struct t_irc_dcc *ptr_dcc)
*/
void
-irc_dcc_file_child_kill (struct t_irc_dcc *ptr_dcc)
+irc_dcc_file_child_kill (struct t_irc_dcc *dcc)
{
/* kill process */
- if (ptr_dcc->child_pid > 0)
+ if (dcc->child_pid > 0)
{
- kill (ptr_dcc->child_pid, SIGKILL);
- waitpid (ptr_dcc->child_pid, NULL, 0);
- ptr_dcc->child_pid = 0;
+ kill (dcc->child_pid, SIGKILL);
+ waitpid (dcc->child_pid, NULL, 0);
+ dcc->child_pid = 0;
}
/* close pipe used with child */
- if (ptr_dcc->child_read != -1)
+ if (dcc->child_read != -1)
{
- close (ptr_dcc->child_read);
- ptr_dcc->child_read = -1;
+ close (dcc->child_read);
+ dcc->child_read = -1;
}
- if (ptr_dcc->child_write != -1)
+ if (dcc->child_write != -1)
{
- close (ptr_dcc->child_write);
- ptr_dcc->child_write = -1;
+ close (dcc->child_write);
+ dcc->child_write = -1;
}
}
@@ -446,93 +446,93 @@ irc_dcc_file_child_kill (struct t_irc_dcc *ptr_dcc)
*/
void
-irc_dcc_close (struct t_irc_dcc *ptr_dcc, int status)
+irc_dcc_close (struct t_irc_dcc *dcc, int status)
{
t_gui_buffer *ptr_buffer;
struct stat st;
- ptr_dcc->status = status;
+ dcc->status = status;
if ((status == IRC_DCC_DONE) || (status == IRC_DCC_ABORTED)
|| (status == IRC_DCC_FAILED))
{
- if (IRC_DCC_IS_FILE(ptr_dcc->type))
+ if (IRC_DCC_IS_FILE(dcc->type))
{
- gui_chat_printf_info (ptr_dcc->server->buffer,
+ gui_chat_printf_info (dcc->server->buffer,
_("DCC: file %s%s%s"),
GUI_COLOR(GUI_COLOR_CHAT_CHANNEL),
- ptr_dcc->filename,
+ dcc->filename,
GUI_COLOR(GUI_COLOR_CHAT));
- if (ptr_dcc->local_filename)
- gui_chat_printf (ptr_dcc->server->buffer,
+ if (dcc->local_filename)
+ gui_chat_printf (dcc->server->buffer,
_(" (local filename: %s%s%s)"),
GUI_COLOR(GUI_COLOR_CHAT_CHANNEL),
- ptr_dcc->local_filename,
+ dcc->local_filename,
GUI_COLOR(GUI_COLOR_CHAT));
- if (ptr_dcc->type == IRC_DCC_FILE_SEND)
- gui_chat_printf (ptr_dcc->server->buffer,
+ if (dcc->type == IRC_DCC_FILE_SEND)
+ gui_chat_printf (dcc->server->buffer,
_(" sent to "));
else
- gui_chat_printf (ptr_dcc->server->buffer,
+ gui_chat_printf (dcc->server->buffer,
_(" received from "));
- gui_chat_printf (ptr_dcc->server->buffer, "%s%s%s: %s\n",
+ gui_chat_printf (dcc->server->buffer, "%s%s%s: %s\n",
GUI_COLOR(GUI_COLOR_CHAT_NICK),
- ptr_dcc->nick,
+ dcc->nick,
GUI_COLOR(GUI_COLOR_CHAT),
(status == IRC_DCC_DONE) ? _("OK") : _("FAILED"));
- irc_dcc_file_child_kill (ptr_dcc);
+ irc_dcc_file_child_kill (dcc);
}
}
if (status == IRC_DCC_ABORTED)
{
- if (IRC_DCC_IS_CHAT(ptr_dcc->type))
+ if (IRC_DCC_IS_CHAT(dcc->type))
{
- if (ptr_dcc->channel)
- ptr_buffer = ptr_dcc->channel->buffer;
+ if (dcc->channel)
+ ptr_buffer = dcc->channel->buffer;
else
- ptr_buffer = ptr_dcc->server->buffer;
+ ptr_buffer = dcc->server->buffer;
gui_chat_printf_info (ptr_buffer,
_("DCC chat closed with %s%s "
"%s(%s%d.%d.%d.%d%s)\n"),
GUI_COLOR(GUI_COLOR_CHAT_NICK),
- ptr_dcc->nick,
+ dcc->nick,
GUI_COLOR(GUI_COLOR_CHAT_DELIMITERS),
GUI_COLOR(GUI_COLOR_CHAT_HOST),
- ptr_dcc->addr >> 24,
- (ptr_dcc->addr >> 16) & 0xff,
- (ptr_dcc->addr >> 8) & 0xff,
- ptr_dcc->addr & 0xff,
+ dcc->addr >> 24,
+ (dcc->addr >> 16) & 0xff,
+ (dcc->addr >> 8) & 0xff,
+ dcc->addr & 0xff,
GUI_COLOR(GUI_COLOR_CHAT_DELIMITERS));
}
}
/* remove empty file if received file failed and nothing was transfered */
if (((status == IRC_DCC_FAILED) || (status == IRC_DCC_ABORTED))
- && IRC_DCC_IS_FILE(ptr_dcc->type)
- && IRC_DCC_IS_RECV(ptr_dcc->type)
- && ptr_dcc->local_filename
- && ptr_dcc->pos == 0)
+ && IRC_DCC_IS_FILE(dcc->type)
+ && IRC_DCC_IS_RECV(dcc->type)
+ && dcc->local_filename
+ && dcc->pos == 0)
{
/* erase file only if really empty on disk */
- if (stat (ptr_dcc->local_filename, &st) != -1)
+ if (stat (dcc->local_filename, &st) != -1)
{
if ((unsigned long) st.st_size == 0)
- unlink (ptr_dcc->local_filename);
+ unlink (dcc->local_filename);
}
}
- if (IRC_DCC_IS_FILE(ptr_dcc->type))
- irc_dcc_calculate_speed (ptr_dcc, 1);
+ if (IRC_DCC_IS_FILE(dcc->type))
+ irc_dcc_calculate_speed (dcc, 1);
- if (ptr_dcc->sock >= 0)
+ if (dcc->sock >= 0)
{
- close (ptr_dcc->sock);
- ptr_dcc->sock = -1;
+ close (dcc->sock);
+ dcc->sock = -1;
}
- if (ptr_dcc->file >= 0)
+ if (dcc->file >= 0)
{
- close (ptr_dcc->file);
- ptr_dcc->file = -1;
+ close (dcc->file);
+ dcc->file = -1;
}
}
@@ -541,32 +541,32 @@ irc_dcc_close (struct t_irc_dcc *ptr_dcc, int status)
*/
void
-irc_dcc_channel_for_chat (struct t_irc_dcc *ptr_dcc)
+irc_dcc_channel_for_chat (struct t_irc_dcc *dcc)
{
- if (!irc_channel_create_dcc (ptr_dcc))
+ if (!irc_channel_create_dcc (dcc))
{
- gui_chat_printf_error (ptr_dcc->server->buffer,
+ gui_chat_printf_error (dcc->server->buffer,
_("%s can't associate DCC chat with private "
"buffer (maybe private buffer has already "
"DCC CHAT?)\n"),
WEECHAT_ERROR);
- irc_dcc_close (ptr_dcc, IRC_DCC_FAILED);
+ irc_dcc_close (dcc, IRC_DCC_FAILED);
irc_dcc_redraw (GUI_HOTLIST_MSG);
return;
}
- gui_chat_printf_type (ptr_dcc->channel->buffer, GUI_MSG_TYPE_MSG,
+ gui_chat_printf_type (dcc->channel->buffer, GUI_MSG_TYPE_MSG,
cfg_look_prefix_info, cfg_col_chat_prefix_info,
_("Connected to %s%s %s(%s%d.%d.%d.%d%s)%s via DCC "
"chat\n"),
GUI_COLOR(GUI_COLOR_CHAT_NICK),
- ptr_dcc->nick,
+ dcc->nick,
GUI_COLOR(GUI_COLOR_CHAT_DELIMITERS),
GUI_COLOR(GUI_COLOR_CHAT_HOST),
- ptr_dcc->addr >> 24,
- (ptr_dcc->addr >> 16) & 0xff,
- (ptr_dcc->addr >> 8) & 0xff,
- ptr_dcc->addr & 0xff,
+ dcc->addr >> 24,
+ (dcc->addr >> 16) & 0xff,
+ (dcc->addr >> 8) & 0xff,
+ dcc->addr & 0xff,
GUI_COLOR(GUI_COLOR_CHAT_DELIMITERS),
GUI_COLOR(GUI_COLOR_CHAT));
}
@@ -595,26 +595,26 @@ irc_dcc_chat_remove_channel (struct t_irc_channel *channel)
*/
void
-irc_dcc_recv_connect_init (struct t_irc_dcc *ptr_dcc)
+irc_dcc_recv_connect_init (struct t_irc_dcc *dcc)
{
- if (!irc_dcc_connect (ptr_dcc))
+ if (!irc_dcc_connect (dcc))
{
- irc_dcc_close (ptr_dcc, IRC_DCC_FAILED);
+ irc_dcc_close (dcc, IRC_DCC_FAILED);
irc_dcc_redraw (GUI_HOTLIST_MSG);
}
else
{
/* DCC file => launch child process */
- if (IRC_DCC_IS_FILE(ptr_dcc->type))
+ if (IRC_DCC_IS_FILE(dcc->type))
{
- ptr_dcc->status = IRC_DCC_CONNECTING;
- irc_dcc_file_recv_fork (ptr_dcc);
+ dcc->status = IRC_DCC_CONNECTING;
+ irc_dcc_file_recv_fork (dcc);
}
else
{
/* DCC CHAT => associate DCC with channel */
- ptr_dcc->status = IRC_DCC_ACTIVE;
- irc_dcc_channel_for_chat (ptr_dcc);
+ dcc->status = IRC_DCC_ACTIVE;
+ irc_dcc_channel_for_chat (dcc);
}
}
irc_dcc_redraw (GUI_HOTLIST_MSG);
@@ -625,21 +625,21 @@ irc_dcc_recv_connect_init (struct t_irc_dcc *ptr_dcc)
*/
void
-irc_dcc_accept (struct t_irc_dcc *ptr_dcc)
+irc_dcc_accept (struct t_irc_dcc *dcc)
{
- if (IRC_DCC_IS_FILE(ptr_dcc->type) && (ptr_dcc->start_resume > 0))
+ if (IRC_DCC_IS_FILE(dcc->type) && (dcc->start_resume > 0))
{
- ptr_dcc->status = IRC_DCC_CONNECTING;
- irc_server_sendf (ptr_dcc->server,
- (strchr (ptr_dcc->filename, ' ')) ?
+ dcc->status = IRC_DCC_CONNECTING;
+ irc_server_sendf (dcc->server,
+ (strchr (dcc->filename, ' ')) ?
"PRIVMSG %s :\01DCC RESUME \"%s\" %d %u\01\n" :
"PRIVMSG %s :\01DCC RESUME %s %d %u\01",
- ptr_dcc->nick, ptr_dcc->filename,
- ptr_dcc->port, ptr_dcc->start_resume);
+ dcc->nick, dcc->filename,
+ dcc->port, dcc->start_resume);
irc_dcc_redraw (GUI_HOTLIST_MSG);
}
else
- irc_dcc_recv_connect_init (ptr_dcc);
+ irc_dcc_recv_connect_init (dcc);
}
/*
@@ -720,7 +720,7 @@ irc_dcc_alloc ()
struct t_irc_dcc *new_dcc;
/* create new DCC struct */
- if ((new_dcc = (struct t_irc_dcc *) malloc (sizeof (struct t_irc_dcc))) == NULL)
+ if ((new_dcc = (struct t_irc_dcc *)malloc (sizeof (struct t_irc_dcc))) == NULL)
return NULL;
/* default values */
@@ -937,7 +937,8 @@ irc_dcc_add (struct t_irc_server *server, int type, unsigned long addr, int port
*/
void
-irc_dcc_send_request (struct 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;
@@ -976,8 +977,8 @@ irc_dcc_send_request (struct t_irc_server *server, int type, char *nick, char *f
free (dir1);
return;
}
- filename2 = (char *) malloc (strlen (dir2) +
- strlen (filename) + 4);
+ filename2 = (char *)malloc (strlen (dir2) +
+ strlen (filename) + 4);
if (!filename2)
{
gui_chat_printf_error (server->buffer,
@@ -1177,12 +1178,12 @@ irc_dcc_send_request (struct t_irc_server *server, int type, char *nick, char *f
*/
int
-irc_dcc_chat_send (struct t_irc_dcc *ptr_dcc, char *buffer, int size_buf)
+irc_dcc_chat_send (struct t_irc_dcc *dcc, char *buffer, int size_buf)
{
- if (!ptr_dcc)
+ if (!dcc)
return -1;
- return send (ptr_dcc->sock, buffer, size_buf, 0);
+ return send (dcc->sock, buffer, size_buf, 0);
}
/*
@@ -1190,17 +1191,17 @@ irc_dcc_chat_send (struct t_irc_dcc *ptr_dcc, char *buffer, int size_buf)
*/
void
-irc_dcc_chat_sendf (struct t_irc_dcc *ptr_dcc, char *fmt, ...)
+irc_dcc_chat_sendf (struct t_irc_dcc *dcc, char *format, ...)
{
va_list args;
static char buffer[4096];
int size_buf;
- if (!ptr_dcc || (ptr_dcc->sock < 0))
+ if (!dcc || (dcc->sock < 0))
return;
- va_start (args, fmt);
- size_buf = vsnprintf (buffer, sizeof (buffer) - 1, fmt, args);
+ va_start (args, format);
+ size_buf = vsnprintf (buffer, sizeof (buffer) - 1, format, args);
va_end (args);
if ((size_buf == 0) || (strcmp (buffer, "\r\n") == 0))
@@ -1211,18 +1212,18 @@ irc_dcc_chat_sendf (struct t_irc_dcc *ptr_dcc, char *fmt, ...)
size_buf = strlen (buffer);
#ifdef DEBUG
buffer[size_buf - 2] = '\0';
- gui_chat_printf (ptr_dcc->server->buffer,
+ gui_chat_printf (dcc->server->buffer,
"[DEBUG] Sending to remote host (DCC CHAT) >>> %s\n",
buffer);
buffer[size_buf - 2] = '\r';
#endif
- if (irc_dcc_chat_send (ptr_dcc, buffer, strlen (buffer)) <= 0)
+ if (irc_dcc_chat_send (dcc, buffer, strlen (buffer)) <= 0)
{
- gui_chat_printf_error (ptr_dcc->server->buffer,
+ gui_chat_printf_error (dcc->server->buffer,
_("%s error sending data to \"%s\" via DCC "
"CHAT\n"),
- WEECHAT_ERROR, ptr_dcc->nick);
- irc_dcc_close (ptr_dcc, IRC_DCC_FAILED);
+ WEECHAT_ERROR, dcc->nick);
+ irc_dcc_close (dcc, IRC_DCC_FAILED);
}
}
@@ -1231,7 +1232,7 @@ irc_dcc_chat_sendf (struct t_irc_dcc *ptr_dcc, char *fmt, ...)
*/
void
-irc_dcc_chat_recv (struct t_irc_dcc *ptr_dcc)
+irc_dcc_chat_recv (struct t_irc_dcc *dcc)
{
fd_set read_fd;
static struct timeval timeout;
@@ -1240,7 +1241,7 @@ irc_dcc_chat_recv (struct t_irc_dcc *ptr_dcc)
int num_read;
FD_ZERO (&read_fd);
- FD_SET (ptr_dcc->sock, &read_fd);
+ FD_SET (dcc->sock, &read_fd);
timeout.tv_sec = 0;
timeout.tv_usec = 0;
@@ -1248,29 +1249,29 @@ irc_dcc_chat_recv (struct t_irc_dcc *ptr_dcc)
if (select (FD_SETSIZE, &read_fd, NULL, NULL, &timeout) <= 0)
return;
- if (!FD_ISSET (ptr_dcc->sock, &read_fd))
+ if (!FD_ISSET (dcc->sock, &read_fd))
return;
/* there's something to read on socket! */
- num_read = recv (ptr_dcc->sock, buffer, sizeof (buffer) - 2, 0);
+ num_read = recv (dcc->sock, buffer, sizeof (buffer) - 2, 0);
if (num_read > 0)
{
buffer[num_read] = '\0';
buf2 = NULL;
ptr_buf = buffer;
- if (ptr_dcc->unterminated_message)
+ if (dcc->unterminated_message)
{
- buf2 = (char *) malloc (strlen (ptr_dcc->unterminated_message) +
- strlen (buffer) + 1);
+ buf2 = (char *)malloc (strlen (dcc->unterminated_message) +
+ strlen (buffer) + 1);
if (buf2)
{
- strcpy (buf2, ptr_dcc->unterminated_message);
+ strcpy (buf2, dcc->unterminated_message);
strcat (buf2, buffer);
}
ptr_buf = buf2;
- free (ptr_dcc->unterminated_message);
- ptr_dcc->unterminated_message = NULL;
+ free (dcc->unterminated_message);
+ dcc->unterminated_message = NULL;
}
while (ptr_buf && ptr_buf[0])
@@ -1292,7 +1293,7 @@ irc_dcc_chat_recv (struct t_irc_dcc *ptr_dcc)
}
else
{
- ptr_dcc->unterminated_message = strdup (ptr_buf);
+ dcc->unterminated_message = strdup (ptr_buf);
ptr_buf = NULL;
next_ptr_buf = NULL;
}
@@ -1300,28 +1301,28 @@ irc_dcc_chat_recv (struct t_irc_dcc *ptr_dcc)
if (ptr_buf)
{
- if (irc_protocol_is_highlight (ptr_buf, ptr_dcc->server->nick))
+ if (irc_protocol_is_highlight (ptr_buf, dcc->server->nick))
{
- irc_display_nick (ptr_dcc->channel->buffer, NULL,
- ptr_dcc->nick,
+ irc_display_nick (dcc->channel->buffer, NULL,
+ dcc->nick,
GUI_MSG_TYPE_NICK | GUI_MSG_TYPE_HIGHLIGHT,
1,
GUI_COLOR(GUI_COLOR_CHAT_HIGHLIGHT), 0);
if ((cfg_look_infobar_delay_highlight > 0)
- && (ptr_dcc->channel->buffer != gui_current_window->buffer))
+ && (dcc->channel->buffer != gui_current_window->buffer))
{
gui_infobar_printf (cfg_look_infobar_delay_highlight,
GUI_COLOR_INFOBAR_HIGHLIGHT,
_("Private %s> %s"),
- ptr_dcc->nick, ptr_buf);
+ dcc->nick, ptr_buf);
}
}
else
- irc_display_nick (ptr_dcc->channel->buffer, NULL,
- ptr_dcc->nick,
+ irc_display_nick (dcc->channel->buffer, NULL,
+ dcc->nick,
GUI_MSG_TYPE_NICK, 1,
GUI_COLOR(GUI_COLOR_CHAT_NICK_OTHER), 0);
- gui_chat_printf_type (ptr_dcc->channel->buffer,
+ gui_chat_printf_type (dcc->channel->buffer,
GUI_MSG_TYPE_MSG,
NULL, -1,
"%s%s\n",
@@ -1337,7 +1338,7 @@ irc_dcc_chat_recv (struct t_irc_dcc *ptr_dcc)
}
else
{
- irc_dcc_close (ptr_dcc, IRC_DCC_ABORTED);
+ irc_dcc_close (dcc, IRC_DCC_ABORTED);
irc_dcc_redraw (GUI_HOTLIST_MSG);
}
}
@@ -1348,22 +1349,22 @@ irc_dcc_chat_recv (struct t_irc_dcc *ptr_dcc)
*/
int
-irc_dcc_file_create_pipe (struct t_irc_dcc *ptr_dcc)
+irc_dcc_file_create_pipe (struct t_irc_dcc *dcc)
{
int child_pipe[2];
if (pipe (child_pipe) < 0)
{
- gui_chat_printf_error (ptr_dcc->server->buffer,
+ gui_chat_printf_error (dcc->server->buffer,
_("%s DCC: unable to create pipe\n"),
WEECHAT_ERROR);
- irc_dcc_close (ptr_dcc, IRC_DCC_FAILED);
+ irc_dcc_close (dcc, IRC_DCC_FAILED);
irc_dcc_redraw (GUI_HOTLIST_MSG);
return 0;
}
- ptr_dcc->child_read = child_pipe[0];
- ptr_dcc->child_write = child_pipe[1];
+ dcc->child_read = child_pipe[0];
+ dcc->child_write = child_pipe[1];
return 1;
}
@@ -1372,13 +1373,13 @@ irc_dcc_file_create_pipe (struct t_irc_dcc *ptr_dcc)
*/
void
-irc_dcc_file_write_pipe (struct t_irc_dcc *ptr_dcc, int status, int error)
+irc_dcc_file_write_pipe (struct t_irc_dcc *dcc, int status, int error)
{
char buffer[1 + 1 + 12 + 1]; /* status + error + pos + \0 */
snprintf (buffer, sizeof (buffer), "%c%c%012lu",
- status + '0', error + '0', ptr_dcc->pos);
- write (ptr_dcc->child_write, buffer, sizeof (buffer));
+ status + '0', error + '0', dcc->pos);
+ write (dcc->child_write, buffer, sizeof (buffer));
}
/*
@@ -1386,7 +1387,7 @@ irc_dcc_file_write_pipe (struct t_irc_dcc *ptr_dcc, int status, int error)
*/
void
-irc_dcc_file_send_child (struct t_irc_dcc *ptr_dcc)
+irc_dcc_file_send_child (struct t_irc_dcc *dcc)
{
int num_read, num_sent;
static char buffer[IRC_DCC_MAX_BLOCKSIZE];
@@ -1397,28 +1398,28 @@ irc_dcc_file_send_child (struct t_irc_dcc *ptr_dcc)
while (1)
{
/* read DCC ACK (sent by receiver) */
- if (ptr_dcc->pos > ptr_dcc->ack)
+ if (dcc->pos > dcc->ack)
{
/* we should receive ACK for packets sent previously */
while (1)
{
- num_read = recv (ptr_dcc->sock, (char *) &ack, 4, MSG_PEEK);
+ num_read = recv (dcc->sock, (char *) &ack, 4, MSG_PEEK);
if ((num_read < 1) &&
((num_read != -1) || (errno != EAGAIN)))
{
- irc_dcc_file_write_pipe (ptr_dcc, IRC_DCC_FAILED, IRC_DCC_ERROR_SEND_BLOCK);
+ irc_dcc_file_write_pipe (dcc, IRC_DCC_FAILED, IRC_DCC_ERROR_SEND_BLOCK);
return;
}
if (num_read == 4)
{
- recv (ptr_dcc->sock, (char *) &ack, 4, 0);
- ptr_dcc->ack = ntohl (ack);
+ recv (dcc->sock, (char *) &ack, 4, 0);
+ dcc->ack = ntohl (ack);
/* DCC send ok? */
- if ((ptr_dcc->pos >= ptr_dcc->size)
- && (ptr_dcc->ack >= ptr_dcc->size))
+ if ((dcc->pos >= dcc->size)
+ && (dcc->ack >= dcc->size))
{
- irc_dcc_file_write_pipe (ptr_dcc, IRC_DCC_DONE, IRC_DCC_NO_ERROR);
+ irc_dcc_file_write_pipe (dcc, IRC_DCC_DONE, IRC_DCC_NO_ERROR);
return;
}
}
@@ -1428,17 +1429,17 @@ irc_dcc_file_send_child (struct t_irc_dcc *ptr_dcc)
}
/* send a block to receiver */
- if ((ptr_dcc->pos < ptr_dcc->size) &&
- (ptr_dcc->fast_send || (ptr_dcc->pos <= ptr_dcc->ack)))
+ if ((dcc->pos < dcc->size) &&
+ (dcc->fast_send || (dcc->pos <= dcc->ack)))
{
- lseek (ptr_dcc->file, ptr_dcc->pos, SEEK_SET);
- num_read = read (ptr_dcc->file, buffer, ptr_dcc->blocksize);
+ lseek (dcc->file, dcc->pos, SEEK_SET);
+ num_read = read (dcc->file, buffer, dcc->blocksize);
if (num_read < 1)
{
- irc_dcc_file_write_pipe (ptr_dcc, IRC_DCC_FAILED, IRC_DCC_ERROR_READ_LOCAL);
+ irc_dcc_file_write_pipe (dcc, IRC_DCC_FAILED, IRC_DCC_ERROR_READ_LOCAL);
return;
}
- num_sent = send (ptr_dcc->sock, buffer, num_read, 0);
+ num_sent = send (dcc->sock, buffer, num_read, 0);
if (num_sent < 0)
{
/* socket is temporarily not available (receiver can't receive
@@ -1447,18 +1448,18 @@ irc_dcc_file_send_child (struct t_irc_dcc *ptr_dcc)
usleep (1000);
else
{
- irc_dcc_file_write_pipe (ptr_dcc, IRC_DCC_FAILED, IRC_DCC_ERROR_SEND_BLOCK);
+ irc_dcc_file_write_pipe (dcc, IRC_DCC_FAILED, IRC_DCC_ERROR_SEND_BLOCK);
return;
}
}
if (num_sent > 0)
{
- ptr_dcc->pos += (unsigned long) num_sent;
+ dcc->pos += (unsigned long) num_sent;
new_time = time (NULL);
if (last_sent != new_time)
{
last_sent = new_time;
- irc_dcc_file_write_pipe (ptr_dcc, IRC_DCC_ACTIVE, IRC_DCC_NO_ERROR);
+ irc_dcc_file_write_pipe (dcc, IRC_DCC_ACTIVE, IRC_DCC_NO_ERROR);
}
}
}
@@ -1472,7 +1473,7 @@ irc_dcc_file_send_child (struct t_irc_dcc *ptr_dcc)
*/
void
-irc_dcc_file_recv_child (struct t_irc_dcc *ptr_dcc)
+irc_dcc_file_recv_child (struct t_irc_dcc *dcc)
{
int num_read;
static char buffer[IRC_DCC_MAX_BLOCKSIZE];
@@ -1480,19 +1481,19 @@ irc_dcc_file_recv_child (struct t_irc_dcc *ptr_dcc)
time_t last_sent, new_time;
/* first connect to sender (blocking) */
- if (!irc_dcc_connect_to_sender (ptr_dcc))
+ if (!irc_dcc_connect_to_sender (dcc))
{
- irc_dcc_file_write_pipe (ptr_dcc, IRC_DCC_FAILED, IRC_DCC_ERROR_CONNECT_SENDER);
+ irc_dcc_file_write_pipe (dcc, IRC_DCC_FAILED, IRC_DCC_ERROR_CONNECT_SENDER);
return;
}
/* connection is ok, change DCC status (inform parent process) */
- irc_dcc_file_write_pipe (ptr_dcc, IRC_DCC_ACTIVE, IRC_DCC_NO_ERROR);
+ irc_dcc_file_write_pipe (dcc, IRC_DCC_ACTIVE, IRC_DCC_NO_ERROR);
last_sent = time (NULL);
while (1)
{
- num_read = recv (ptr_dcc->sock, buffer, sizeof (buffer), 0);
+ num_read = recv (dcc->sock, buffer, sizeof (buffer), 0);
if (num_read == -1)
{
/* socket is temporarily not available (sender is not fast ?!) */
@@ -1500,7 +1501,7 @@ irc_dcc_file_recv_child (struct t_irc_dcc *ptr_dcc)
usleep (1000);
else
{
- irc_dcc_file_write_pipe (ptr_dcc, IRC_DCC_FAILED, IRC_DCC_ERROR_RECV_BLOCK);
+ irc_dcc_file_write_pipe (dcc, IRC_DCC_FAILED, IRC_DCC_ERROR_RECV_BLOCK);
return;
}
}
@@ -1508,26 +1509,26 @@ irc_dcc_file_recv_child (struct t_irc_dcc *ptr_dcc)
{
if (num_read == 0)
{
- irc_dcc_file_write_pipe (ptr_dcc, IRC_DCC_FAILED, IRC_DCC_ERROR_RECV_BLOCK);
+ irc_dcc_file_write_pipe (dcc, IRC_DCC_FAILED, IRC_DCC_ERROR_RECV_BLOCK);
return;
}
- if (write (ptr_dcc->file, buffer, num_read) == -1)
+ if (write (dcc->file, buffer, num_read) == -1)
{
- irc_dcc_file_write_pipe (ptr_dcc, IRC_DCC_FAILED, IRC_DCC_ERROR_WRITE_LOCAL);
+ irc_dcc_file_write_pipe (dcc, IRC_DCC_FAILED, IRC_DCC_ERROR_WRITE_LOCAL);
return;
}
- ptr_dcc->pos += (unsigned long) num_read;
- pos = htonl (ptr_dcc->pos);
+ dcc->pos += (unsigned long) num_read;
+ pos = htonl (dcc->pos);
/* we don't check return code, not a problem if an ACK send failed */
- send (ptr_dcc->sock, (char *) &pos, 4, 0);
+ send (dcc->sock, (char *) &pos, 4, 0);
/* file received ok? */
- if (ptr_dcc->pos >= ptr_dcc->size)
+ if (dcc->pos >= dcc->size)
{
- irc_dcc_file_write_pipe (ptr_dcc, IRC_DCC_DONE, IRC_DCC_NO_ERROR);
+ irc_dcc_file_write_pipe (dcc, IRC_DCC_DONE, IRC_DCC_NO_ERROR);
return;
}
@@ -1535,7 +1536,7 @@ irc_dcc_file_recv_child (struct t_irc_dcc *ptr_dcc)
if (last_sent != new_time)
{
last_sent = new_time;
- irc_dcc_file_write_pipe (ptr_dcc, IRC_DCC_ACTIVE, IRC_DCC_NO_ERROR);
+ irc_dcc_file_write_pipe (dcc, IRC_DCC_ACTIVE, IRC_DCC_NO_ERROR);
}
}
}
@@ -1546,7 +1547,7 @@ irc_dcc_file_recv_child (struct t_irc_dcc *ptr_dcc)
*/
void
-irc_dcc_file_child_read (struct t_irc_dcc *ptr_dcc)
+irc_dcc_file_child_read (struct t_irc_dcc *dcc)
{
fd_set read_fd;
static struct timeval timeout;
@@ -1555,7 +1556,7 @@ irc_dcc_file_child_read (struct t_irc_dcc *ptr_dcc)
char *error;
FD_ZERO (&read_fd);
- FD_SET (ptr_dcc->child_read, &read_fd);
+ FD_SET (dcc->child_read, &read_fd);
timeout.tv_sec = 0;
timeout.tv_usec = 0;
@@ -1563,55 +1564,55 @@ irc_dcc_file_child_read (struct t_irc_dcc *ptr_dcc)
if (select (FD_SETSIZE, &read_fd, NULL, NULL, &timeout) <= 0)
return;
- if (!FD_ISSET (ptr_dcc->child_read, &read_fd))
+ if (!FD_ISSET (dcc->child_read, &read_fd))
return;
/* there's something to read in pipe! */
- num_read = read (ptr_dcc->child_read, bufpipe, sizeof (bufpipe));
+ num_read = read (dcc->child_read, bufpipe, sizeof (bufpipe));
if (num_read > 0)
{
error = NULL;
- ptr_dcc->pos = strtol (bufpipe + 2, &error, 10);
- ptr_dcc->last_activity = time (NULL);
- irc_dcc_calculate_speed (ptr_dcc, 0);
+ dcc->pos = strtol (bufpipe + 2, &error, 10);
+ dcc->last_activity = time (NULL);
+ irc_dcc_calculate_speed (dcc, 0);
/* read error code */
switch (bufpipe[1] - '0')
{
/* errors for sender */
case IRC_DCC_ERROR_READ_LOCAL:
- gui_chat_printf_error (ptr_dcc->server->buffer,
+ gui_chat_printf_error (dcc->server->buffer,
_("%s DCC: unable to read local "
"file\n"),
WEECHAT_ERROR);
break;
case IRC_DCC_ERROR_SEND_BLOCK:
- gui_chat_printf_error (ptr_dcc->server->buffer,
+ gui_chat_printf_error (dcc->server->buffer,
_("%s DCC: unable to send block to "
"receiver\n"),
WEECHAT_ERROR);
break;
case IRC_DCC_ERROR_READ_ACK:
- gui_chat_printf_error (ptr_dcc->server->buffer,
+ gui_chat_printf_error (dcc->server->buffer,
_("%s DCC: unable to read ACK from "
"receiver\n"),
WEECHAT_ERROR);
break;
/* errors for receiver */
case IRC_DCC_ERROR_CONNECT_SENDER:
- gui_chat_printf_error (ptr_dcc->server->buffer,
+ gui_chat_printf_error (dcc->server->buffer,
_("%s DCC: unable to connect to "
"sender\n"),
WEECHAT_ERROR);
break;
case IRC_DCC_ERROR_RECV_BLOCK:
- gui_chat_printf_error (ptr_dcc->server->buffer,
+ gui_chat_printf_error (dcc->server->buffer,
_("%s DCC: unable to receive block "
"from sender\n"),
WEECHAT_ERROR);
break;
case IRC_DCC_ERROR_WRITE_LOCAL:
- gui_chat_printf_error (ptr_dcc->server->buffer,
+ gui_chat_printf_error (dcc->server->buffer,
_("%s DCC: unable to write local "
"file\n"),
WEECHAT_ERROR);
@@ -1622,23 +1623,23 @@ irc_dcc_file_child_read (struct t_irc_dcc *ptr_dcc)
switch (bufpipe[0] - '0')
{
case IRC_DCC_ACTIVE:
- if (ptr_dcc->status == IRC_DCC_CONNECTING)
+ if (dcc->status == IRC_DCC_CONNECTING)
{
/* connection was successful by child, init transfert times */
- ptr_dcc->status = IRC_DCC_ACTIVE;
- ptr_dcc->start_transfer = time (NULL);
- ptr_dcc->last_check_time = time (NULL);
+ dcc->status = IRC_DCC_ACTIVE;
+ dcc->start_transfer = time (NULL);
+ dcc->last_check_time = time (NULL);
irc_dcc_redraw (GUI_HOTLIST_MSG);
}
else
irc_dcc_redraw (GUI_HOTLIST_LOW);
break;
case IRC_DCC_DONE:
- irc_dcc_close (ptr_dcc, IRC_DCC_DONE);
+ irc_dcc_close (dcc, IRC_DCC_DONE);
irc_dcc_redraw (GUI_HOTLIST_MSG);
break;
case IRC_DCC_FAILED:
- irc_dcc_close (ptr_dcc, IRC_DCC_FAILED);
+ irc_dcc_close (dcc, IRC_DCC_FAILED);
irc_dcc_redraw (GUI_HOTLIST_MSG);
break;
}
@@ -1650,34 +1651,34 @@ irc_dcc_file_child_read (struct t_irc_dcc *ptr_dcc)
*/
void
-irc_dcc_file_send_fork (struct t_irc_dcc *ptr_dcc)
+irc_dcc_file_send_fork (struct t_irc_dcc *dcc)
{
pid_t pid;
- if (!irc_dcc_file_create_pipe (ptr_dcc))
+ if (!irc_dcc_file_create_pipe (dcc))
return;
- ptr_dcc->file = open (ptr_dcc->local_filename, O_RDONLY | O_NONBLOCK, 0644);
+ dcc->file = open (dcc->local_filename, O_RDONLY | O_NONBLOCK, 0644);
switch (pid = fork ())
{
/* fork failed */
case -1:
- gui_chat_printf_error (ptr_dcc->server->buffer,
+ gui_chat_printf_error (dcc->server->buffer,
_("%s DCC: unable to fork\n"),
WEECHAT_ERROR);
- irc_dcc_close (ptr_dcc, IRC_DCC_FAILED);
+ irc_dcc_close (dcc, IRC_DCC_FAILED);
irc_dcc_redraw (GUI_HOTLIST_MSG);
return;
/* child process */
case 0:
setuid (getuid ());
- irc_dcc_file_send_child (ptr_dcc);
+ irc_dcc_file_send_child (dcc);
_exit (EXIT_SUCCESS);
}
/* parent process */
- ptr_dcc->child_pid = pid;
+ dcc->child_pid = pid;
}
/*
@@ -1685,18 +1686,18 @@ irc_dcc_file_send_fork (struct t_irc_dcc *ptr_dcc)
*/
void
-irc_dcc_file_recv_fork (struct t_irc_dcc *ptr_dcc)
+irc_dcc_file_recv_fork (struct t_irc_dcc *dcc)
{
pid_t pid;
- if (!irc_dcc_file_create_pipe (ptr_dcc))
+ if (!irc_dcc_file_create_pipe (dcc))
return;
- if (ptr_dcc->start_resume > 0)
- ptr_dcc->file = open (ptr_dcc->local_filename,
+ if (dcc->start_resume > 0)
+ dcc->file = open (dcc->local_filename,
O_APPEND | O_WRONLY | O_NONBLOCK);
else
- ptr_dcc->file = open (ptr_dcc->local_filename,
+ dcc->file = open (dcc->local_filename,
O_CREAT | O_TRUNC | O_WRONLY | O_NONBLOCK,
0644);
@@ -1704,21 +1705,21 @@ irc_dcc_file_recv_fork (struct t_irc_dcc *ptr_dcc)
{
/* fork failed */
case -1:
- gui_chat_printf_error (ptr_dcc->server->buffer,
+ gui_chat_printf_error (dcc->server->buffer,
_("%s DCC: unable to fork\n"),
WEECHAT_ERROR);
- irc_dcc_close (ptr_dcc, IRC_DCC_FAILED);
+ irc_dcc_close (dcc, IRC_DCC_FAILED);
irc_dcc_redraw (GUI_HOTLIST_MSG);
return;
/* child process */
case 0:
setuid (getuid ());
- irc_dcc_file_recv_child (ptr_dcc);
+ irc_dcc_file_recv_child (dcc);
_exit (EXIT_SUCCESS);
}
/* parent process */
- ptr_dcc->child_pid = pid;
+ dcc->child_pid = pid;
}
/*
@@ -1728,134 +1729,134 @@ irc_dcc_file_recv_fork (struct t_irc_dcc *ptr_dcc)
void
irc_dcc_handle ()
{
- struct t_irc_dcc *ptr_dcc;
+ struct t_irc_dcc *dcc;
fd_set read_fd;
static struct timeval timeout;
int sock;
struct sockaddr_in addr;
socklen_t length;
- for (ptr_dcc = irc_dcc_list; ptr_dcc; ptr_dcc = ptr_dcc->next_dcc)
+ for (dcc = irc_dcc_list; dcc; dcc = dcc->next_dcc)
{
/* check DCC timeout */
- if (IRC_DCC_IS_FILE(ptr_dcc->type) && !IRC_DCC_ENDED(ptr_dcc->status))
+ if (IRC_DCC_IS_FILE(dcc->type) && !IRC_DCC_ENDED(dcc->status))
{
if ((irc_cfg_dcc_timeout != 0)
- && (time (NULL) > ptr_dcc->last_activity + irc_cfg_dcc_timeout))
+ && (time (NULL) > dcc->last_activity + irc_cfg_dcc_timeout))
{
- gui_chat_printf_error (ptr_dcc->server->buffer,
+ gui_chat_printf_error (dcc->server->buffer,
_("%s DCC: timeout\n"),
WEECHAT_ERROR);
- irc_dcc_close (ptr_dcc, IRC_DCC_FAILED);
+ irc_dcc_close (dcc, IRC_DCC_FAILED);
irc_dcc_redraw (GUI_HOTLIST_MSG);
continue;
}
}
- if (ptr_dcc->status == IRC_DCC_CONNECTING)
+ if (dcc->status == IRC_DCC_CONNECTING)
{
- if (ptr_dcc->type == IRC_DCC_FILE_SEND)
+ if (dcc->type == IRC_DCC_FILE_SEND)
{
FD_ZERO (&read_fd);
- FD_SET (ptr_dcc->sock, &read_fd);
+ FD_SET (dcc->sock, &read_fd);
timeout.tv_sec = 0;
timeout.tv_usec = 0;
/* something to read on socket? */
if (select (FD_SETSIZE, &read_fd, NULL, NULL, &timeout) > 0)
{
- if (FD_ISSET (ptr_dcc->sock, &read_fd))
+ if (FD_ISSET (dcc->sock, &read_fd))
{
- ptr_dcc->last_activity = time (NULL);
+ dcc->last_activity = time (NULL);
length = sizeof (addr);
- sock = accept (ptr_dcc->sock,
+ sock = accept (dcc->sock,
(struct sockaddr *) &addr, &length);
- close (ptr_dcc->sock);
- ptr_dcc->sock = -1;
+ close (dcc->sock);
+ dcc->sock = -1;
if (sock < 0)
{
- gui_chat_printf_error (ptr_dcc->server->buffer,
+ gui_chat_printf_error (dcc->server->buffer,
_("%s DCC: unable to "
"create socket for "
"sending file\n"),
WEECHAT_ERROR);
- irc_dcc_close (ptr_dcc, IRC_DCC_FAILED);
+ irc_dcc_close (dcc, IRC_DCC_FAILED);
irc_dcc_redraw (GUI_HOTLIST_MSG);
continue;
}
- ptr_dcc->sock = sock;
- if (fcntl (ptr_dcc->sock, F_SETFL, O_NONBLOCK) == -1)
+ dcc->sock = sock;
+ if (fcntl (dcc->sock, F_SETFL, O_NONBLOCK) == -1)
{
- gui_chat_printf_error (ptr_dcc->server->buffer,
+ gui_chat_printf_error (dcc->server->buffer,
_("%s DCC: unable to set "
"'nonblock' option for "
"socket\n"),
WEECHAT_ERROR);
- irc_dcc_close (ptr_dcc, IRC_DCC_FAILED);
+ irc_dcc_close (dcc, IRC_DCC_FAILED);
irc_dcc_redraw (GUI_HOTLIST_MSG);
continue;
}
- ptr_dcc->addr = ntohl (addr.sin_addr.s_addr);
- ptr_dcc->status = IRC_DCC_ACTIVE;
- ptr_dcc->start_transfer = time (NULL);
+ dcc->addr = ntohl (addr.sin_addr.s_addr);
+ dcc->status = IRC_DCC_ACTIVE;
+ dcc->start_transfer = time (NULL);
irc_dcc_redraw (GUI_HOTLIST_MSG);
- irc_dcc_file_send_fork (ptr_dcc);
+ irc_dcc_file_send_fork (dcc);
}
}
}
- if (ptr_dcc->type == IRC_DCC_FILE_RECV)
+ if (dcc->type == IRC_DCC_FILE_RECV)
{
- if (ptr_dcc->child_read != -1)
- irc_dcc_file_child_read (ptr_dcc);
+ if (dcc->child_read != -1)
+ irc_dcc_file_child_read (dcc);
}
}
- if (ptr_dcc->status == IRC_DCC_WAITING)
+ if (dcc->status == IRC_DCC_WAITING)
{
- if (ptr_dcc->type == IRC_DCC_CHAT_SEND)
+ if (dcc->type == IRC_DCC_CHAT_SEND)
{
FD_ZERO (&read_fd);
- FD_SET (ptr_dcc->sock, &read_fd);
+ FD_SET (dcc->sock, &read_fd);
timeout.tv_sec = 0;
timeout.tv_usec = 0;
/* something to read on socket? */
if (select (FD_SETSIZE, &read_fd, NULL, NULL, &timeout) > 0)
{
- if (FD_ISSET (ptr_dcc->sock, &read_fd))
+ if (FD_ISSET (dcc->sock, &read_fd))
{
length = sizeof (addr);
- sock = accept (ptr_dcc->sock, (struct sockaddr *) &addr, &length);
- close (ptr_dcc->sock);
- ptr_dcc->sock = -1;
+ sock = accept (dcc->sock, (struct sockaddr *) &addr, &length);
+ close (dcc->sock);
+ dcc->sock = -1;
if (sock < 0)
{
- irc_dcc_close (ptr_dcc, IRC_DCC_FAILED);
+ irc_dcc_close (dcc, IRC_DCC_FAILED);
irc_dcc_redraw (GUI_HOTLIST_MSG);
continue;
}
- ptr_dcc->sock = sock;
- if (fcntl (ptr_dcc->sock, F_SETFL, O_NONBLOCK) == -1)
+ dcc->sock = sock;
+ if (fcntl (dcc->sock, F_SETFL, O_NONBLOCK) == -1)
{
- irc_dcc_close (ptr_dcc, IRC_DCC_FAILED);
+ irc_dcc_close (dcc, IRC_DCC_FAILED);
irc_dcc_redraw (GUI_HOTLIST_MSG);
continue;
}
- ptr_dcc->addr = ntohl (addr.sin_addr.s_addr);
- ptr_dcc->status = IRC_DCC_ACTIVE;
+ dcc->addr = ntohl (addr.sin_addr.s_addr);
+ dcc->status = IRC_DCC_ACTIVE;
irc_dcc_redraw (GUI_HOTLIST_MSG);
- irc_dcc_channel_for_chat (ptr_dcc);
+ irc_dcc_channel_for_chat (dcc);
}
}
}
}
- if (ptr_dcc->status == IRC_DCC_ACTIVE)
+ if (dcc->status == IRC_DCC_ACTIVE)
{
- if (IRC_DCC_IS_CHAT(ptr_dcc->type))
- irc_dcc_chat_recv (ptr_dcc);
+ if (IRC_DCC_IS_CHAT(dcc->type))
+ irc_dcc_chat_recv (dcc);
else
- irc_dcc_file_child_read (ptr_dcc);
+ irc_dcc_file_child_read (dcc);
}
}
}
diff --git a/src/plugins/irc/irc-dcc.h b/src/plugins/irc/irc-dcc.h
index af8f0baf7..f36bb0c51 100644
--- a/src/plugins/irc/irc-dcc.h
+++ b/src/plugins/irc/irc-dcc.h
@@ -110,20 +110,26 @@ 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 void irc_dcc_redraw (int highlight);
+extern void irc_dcc_free (struct t_irc_dcc *dcc);
+extern void irc_dcc_close (struct t_irc_dcc *dcc, int status);
+extern void irc_dcc_chat_remove_channel (struct t_irc_channel *channel);
+extern void irc_dcc_accept (struct t_irc_dcc *dcc);
+extern void irc_dcc_accept_resume (struct t_irc_server *server, char *filename,
+ int port, unsigned long pos_start);
+extern void irc_dcc_start_resume (struct t_irc_server *server, char *filename,
+ int port, unsigned long pos_start);
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 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);
+extern void irc_dcc_send_request (struct t_irc_server *server, int type,
+ char *nick, char *filename);
+extern void irc_dcc_chat_sendf (struct t_irc_dcc *dcc, char *format, ...);
+extern void irc_dcc_file_send_fork (struct t_irc_dcc *dcc);
+extern void irc_dcc_file_recv_fork (struct t_irc_dcc *dcc);
extern void irc_dcc_handle ();
extern void irc_dcc_end ();
extern void irc_dcc_print_log ();
diff --git a/src/plugins/irc/irc-display.h b/src/plugins/irc/irc-display.h
index 778eea778..06aa927c0 100644
--- a/src/plugins/irc/irc-display.h
+++ b/src/plugins/irc/irc-display.h
@@ -20,12 +20,16 @@
#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);
+extern void irc_display_hide_password (char *string, int look_for_nickserv);
+extern void irc_display_nick (struct t_gui_buffer *buffer,
+ struct t_irc_nick *nick, char *nickname,
+ int type, int display_around, char *force_color,
+ int no_nickmode);
+extern void irc_display_away (struct t_irc_server *server, char *string1,
+ char *string2);
+extern void irc_display_mode (struct t_gui_buffer *buffer, char *channel_name,
+ char *nick_name, char set_flag, char *symbol,
+ char *nick_host, char *message, char *param);
+extern void irc_display_server (struct t_irc_server *server, int with_detail);
#endif /* irc-display.h */
diff --git a/src/plugins/irc/irc-mode.c b/src/plugins/irc/irc-mode.c
index 97efeb434..433c7e06d 100644
--- a/src/plugins/irc/irc-mode.c
+++ b/src/plugins/irc/irc-mode.c
@@ -239,8 +239,8 @@ irc_mode_user_add (struct t_irc_server *server, char mode)
{
if (!strchr (server->nick_modes, mode))
{
- server->nick_modes = (char *) realloc (server->nick_modes,
- strlen (server->nick_modes) + 1 + 1);
+ server->nick_modes = (char *)realloc (server->nick_modes,
+ strlen (server->nick_modes) + 1 + 1);
strcat (server->nick_modes, str_mode);
//gui_status_draw (gui_current_window->buffer, 1);
//gui_input_draw (gui_current_window->buffer, 1);
@@ -248,7 +248,7 @@ irc_mode_user_add (struct t_irc_server *server, char mode)
}
else
{
- server->nick_modes = (char *) malloc (2);
+ server->nick_modes = (char *)malloc (2);
strcpy (server->nick_modes, str_mode);
//gui_status_draw (gui_current_window->buffer, 1);
//gui_input_draw (gui_current_window->buffer, 1);
@@ -272,8 +272,8 @@ irc_mode_user_remove (struct t_irc_server *server, char mode)
{
new_size = strlen (server->nick_modes);
memmove (pos, pos + 1, strlen (pos + 1) + 1);
- server->nick_modes = (char *) realloc (server->nick_modes,
- new_size);
+ server->nick_modes = (char *)realloc (server->nick_modes,
+ new_size);
//gui_status_draw (gui_current_window->buffer, 1);
//gui_input_draw (gui_current_window->buffer, 1);
}
diff --git a/src/plugins/irc/irc-mode.h b/src/plugins/irc/irc-mode.h
index 5e1b958ee..c53612f55 100644
--- a/src/plugins/irc/irc-mode.h
+++ b/src/plugins/irc/irc-mode.h
@@ -22,9 +22,10 @@
#include "irc-server.h"
-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);
+extern void irc_mode_channel_set (struct t_irc_server *server,
+ struct t_irc_channel *channel, char *modes);
+extern void irc_mode_user_set (struct t_irc_server *server, char *modes);
+extern int irc_mode_nick_prefix_allowed (struct t_irc_server *server,
+ char prefix);
#endif /* irc-mode.h */
diff --git a/src/plugins/irc/irc-nick.c b/src/plugins/irc/irc-nick.c
index f1c6a6290..d51fde31f 100644
--- a/src/plugins/irc/irc-nick.c
+++ b/src/plugins/irc/irc-nick.c
@@ -49,7 +49,8 @@ irc_nick_find_color (struct t_irc_nick *nick)
{
color += (int)(nick->nick[i]);
}
- color = (color % weechat_config_integer (weechat_config_get ("look_color_nicks_number")));
+ color = (color %
+ weechat_config_integer (weechat_config_get_weechat ("look_color_nicks_number")));
return color;
}
@@ -164,7 +165,7 @@ irc_nick_new (struct t_irc_server *server, struct t_irc_channel *channel,
}
// alloc memory for new nick
- if ((new_nick = (struct t_irc_nick *) malloc (sizeof (struct t_irc_nick))) == NULL)
+ if ((new_nick = (struct t_irc_nick *)malloc (sizeof (struct t_irc_nick))) == NULL)
return NULL;
// initialize new nick
diff --git a/src/plugins/irc/irc-nick.h b/src/plugins/irc/irc-nick.h
index 698e01437..f0bc5ecd5 100644
--- a/src/plugins/irc/irc-nick.h
+++ b/src/plugins/irc/irc-nick.h
@@ -50,19 +50,30 @@ 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 char *irc_nick_as_prefix (struct t_irc_nick *, char *, char *);
-extern void irc_nick_print_log (struct t_irc_nick *);
+extern int irc_nick_find_color (struct t_irc_nick *nick);
+extern void irc_nick_get_gui_infos (struct t_irc_nick *nick, int *sort_index,
+ char *prefix, int *color_prefix);
+extern 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);
+extern void irc_nick_change (struct t_irc_server *server,
+ struct t_irc_channel *channel,
+ struct t_irc_nick *nick, char *new_nick);
+extern void irc_nick_free (struct t_irc_channel *channel,
+ struct t_irc_nick *nick);
+extern void irc_nick_free_all (struct t_irc_channel *channel);
+extern struct t_irc_nick *irc_nick_search (struct t_irc_channel *channel,
+ char *nickname);
+extern void irc_nick_count (struct t_irc_channel *channel, int *total,
+ int *count_op, int *count_halfop, int *count_voice,
+ int *count_normal);
+extern void irc_nick_set_away (struct t_irc_channel *channel,
+ struct t_irc_nick *nick, int is_away);
+extern char *irc_nick_as_prefix (struct t_irc_nick *nick, char *nickname,
+ char *force_color);
+extern void irc_nick_print_log (struct t_irc_nick *nick);
#endif /* irc-nick.h */
diff --git a/src/plugins/irc/irc-protocol.c b/src/plugins/irc/irc-protocol.c
index f9169391f..3e657977f 100644
--- a/src/plugins/irc/irc-protocol.c
+++ b/src/plugins/irc/irc-protocol.c
@@ -1177,7 +1177,7 @@ irc_protocol_cmd_notice (struct t_irc_server *server, char *irc_message, char *h
(void) irc_message;
look_infobar_delay_highlight = weechat_config_integer (
- weechat_config_get ("look_infobar_delay_highlight"));
+ weechat_config_get_weechat ("look_infobar_delay_highlight"));
host2 = NULL;
if (host)
@@ -1485,7 +1485,7 @@ irc_protocol_cmd_part (struct t_irc_server *server, char *irc_message, char *hos
}
if (ptr_channel->close)
{
- weechat_buffer_close (ptr_channel->buffer);
+ weechat_buffer_close (ptr_channel->buffer, 1);
ptr_channel->buffer = NULL;
irc_channel_free (server, ptr_channel);
ptr_channel = NULL;
@@ -1608,7 +1608,7 @@ irc_protocol_reply_version (struct t_irc_server *server, struct t_irc_channel *c
pos = NULL;
}
- buf = (struct utsname *) malloc (sizeof (struct utsname));
+ buf = (struct utsname *)malloc (sizeof (struct utsname));
if (buf && (uname (buf) >= 0))
{
irc_server_sendf (server,
@@ -1679,7 +1679,7 @@ irc_protocol_cmd_privmsg (struct t_irc_server *server, char *irc_message, char *
}
look_infobar_delay_highlight = weechat_config_integer (
- weechat_config_get ("look_infobar_delay_highlight"));
+ weechat_config_get_weechat ("look_infobar_delay_highlight"));
pos = strchr (host, '!');
if (pos)
@@ -3817,10 +3817,10 @@ irc_protocol_cmd_324 (struct t_irc_server *server, char *irc_message, char *host
if (pos_modes[0])
{
if (ptr_channel->modes)
- ptr_channel->modes = (char *) realloc (ptr_channel->modes,
- strlen (pos_modes) + 1);
+ ptr_channel->modes = (char *)realloc (ptr_channel->modes,
+ strlen (pos_modes) + 1);
else
- ptr_channel->modes = (char *) malloc (strlen (pos_modes) + 1);
+ ptr_channel->modes = (char *)malloc (strlen (pos_modes) + 1);
strcpy (ptr_channel->modes, pos_modes);
irc_mode_channel_set (server, ptr_channel, pos_modes);
}
@@ -4715,7 +4715,7 @@ irc_protocol_cmd_352 (struct t_irc_server *server, char *irc_message, char *host
if (ptr_nick->host)
free (ptr_nick->host);
length = strlen (pos_user) + 1 + strlen (pos_host) + 1;
- ptr_nick->host = (char *) malloc (length);
+ ptr_nick->host = (char *)malloc (length);
if (ptr_nick->host)
snprintf (ptr_nick->host, length, "%s@%s", pos_user, pos_host);
irc_nick_set_away (ptr_channel, ptr_nick,
diff --git a/src/plugins/irc/irc-protocol.h b/src/plugins/irc/irc-protocol.h
index 55e02ba40..d76911657 100644
--- a/src/plugins/irc/irc-protocol.h
+++ b/src/plugins/irc/irc-protocol.h
@@ -22,8 +22,9 @@
#include "irc-server.h"
-typedef int (t_irc_recv_func)(struct t_irc_server *, char *, char *, char *,
- char *, int, int);
+typedef int (t_irc_recv_func)(struct t_irc_server *server, char *irc_message,
+ char *host, char *nick, char *arguments,
+ int ignore, int highlight);
struct t_irc_protocol_msg
{
@@ -34,65 +35,65 @@ struct t_irc_protocol_msg
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);
+extern int irc_protocol_cmd_error (struct t_irc_server *server, char *irc_message, char *host, char *nick, char *arguments, int ignore, int highlight);
+extern int irc_protocol_cmd_invite (struct t_irc_server *server, char *irc_message, char *host, char *nick, char *arguments, int ignore, int highlight);
+extern int irc_protocol_cmd_join (struct t_irc_server *server, char *irc_message, char *host, char *nick, char *arguments, int ignore, int highlight);
+extern int irc_protocol_cmd_kick (struct t_irc_server *server, char *irc_message, char *host, char *nick, char *arguments, int ignore, int highlight);
+extern int irc_protocol_cmd_kill (struct t_irc_server *server, char *irc_message, char *host, char *nick, char *arguments, int ignore, int highlight);
+extern int irc_protocol_cmd_mode (struct t_irc_server *server, char *irc_message, char *host, char *nick, char *arguments, int ignore, int highlight);
+extern int irc_protocol_cmd_nick (struct t_irc_server *server, char *irc_message, char *host, char *nick, char *arguments, int ignore, int highlight);
+extern int irc_protocol_cmd_notice (struct t_irc_server *server, char *irc_message, char *host, char *nick, char *arguments, int ignore, int highlight);
+extern int irc_protocol_cmd_part (struct t_irc_server *server, char *irc_message, char *host, char *nick, char *arguments, int ignore, int highlight);
+extern int irc_protocol_cmd_ping (struct t_irc_server *server, char *irc_message, char *host, char *nick, char *arguments, int ignore, int highlight);
+extern int irc_protocol_cmd_pong (struct t_irc_server *server, char *irc_message, char *host, char *nick, char *arguments, int ignore, int highlight);
+extern int irc_protocol_cmd_privmsg (struct t_irc_server *server, char *irc_message, char *host, char *nick, char *arguments, int ignore, int highlight);
+extern int irc_protocol_cmd_quit (struct t_irc_server *server, char *irc_message, char *host, char *nick, char *arguments, int ignore, int highlight);
+extern int irc_protocol_cmd_server_mode_reason (struct t_irc_server *server, char *irc_message, char *host, char *nick, char *arguments, int ignore, int highlight);
+extern int irc_protocol_cmd_server_msg (struct t_irc_server *server, char *irc_message, char *host, char *nick, char *arguments, int ignore, int highlight);
+extern int irc_protocol_cmd_server_reply (struct t_irc_server *server, char *irc_message, char *host, char *nick, char *arguments, int ignore, int highlight);
+extern int irc_protocol_cmd_topic (struct t_irc_server *server, char *irc_message, char *host, char *nick, char *arguments, int ignore, int highlight);
+extern int irc_protocol_cmd_wallops (struct t_irc_server *server, char *irc_message, char *host, char *nick, char *arguments, int ignore, int highlight);
+extern int irc_protocol_cmd_001 (struct t_irc_server *server, char *irc_message, char *host, char *nick, char *arguments, int ignore, int highlight);
+extern int irc_protocol_cmd_005 (struct t_irc_server *server, char *irc_message, char *host, char *nick, char *arguments, int ignore, int highlight);
+extern int irc_protocol_cmd_221 (struct t_irc_server *server, char *irc_message, char *host, char *nick, char *arguments, int ignore, int highlight);
+extern int irc_protocol_cmd_301 (struct t_irc_server *server, char *irc_message, char *host, char *nick, char *arguments, int ignore, int highlight);
+extern int irc_protocol_cmd_302 (struct t_irc_server *server, char *irc_message, char *host, char *nick, char *arguments, int ignore, int highlight);
+extern int irc_protocol_cmd_303 (struct t_irc_server *server, char *irc_message, char *host, char *nick, char *arguments, int ignore, int highlight);
+extern int irc_protocol_cmd_305 (struct t_irc_server *server, char *irc_message, char *host, char *nick, char *arguments, int ignore, int highlight);
+extern int irc_protocol_cmd_306 (struct t_irc_server *server, char *irc_message, char *host, char *nick, char *arguments, int ignore, int highlight);
+extern int irc_protocol_cmd_whois_nick_msg (struct t_irc_server *server, char *irc_message, char *host, char *nick, char *arguments, int ignore, int highlight);
+extern int irc_protocol_cmd_310 (struct t_irc_server *server, char *irc_message, char *host, char *nick, char *arguments, int ignore, int highlight);
+extern int irc_protocol_cmd_311 (struct t_irc_server *server, char *irc_message, char *host, char *nick, char *arguments, int ignore, int highlight);
+extern int irc_protocol_cmd_312 (struct t_irc_server *server, char *irc_message, char *host, char *nick, char *arguments, int ignore, int highlight);
+extern int irc_protocol_cmd_314 (struct t_irc_server *server, char *irc_message, char *host, char *nick, char *arguments, int ignore, int highlight);
+extern int irc_protocol_cmd_315 (struct t_irc_server *server, char *irc_message, char *host, char *nick, char *arguments, int ignore, int highlight);
+extern int irc_protocol_cmd_317 (struct t_irc_server *server, char *irc_message, char *host, char *nick, char *arguments, int ignore, int highlight);
+extern int irc_protocol_cmd_319 (struct t_irc_server *server, char *irc_message, char *host, char *nick, char *arguments, int ignore, int highlight);
+extern int irc_protocol_cmd_321 (struct t_irc_server *server, char *irc_message, char *host, char *nick, char *arguments, int ignore, int highlight);
+extern int irc_protocol_cmd_322 (struct t_irc_server *server, char *irc_message, char *host, char *nick, char *arguments, int ignore, int highlight);
+extern int irc_protocol_cmd_323 (struct t_irc_server *server, char *irc_message, char *host, char *nick, char *arguments, int ignore, int highlight);
+extern int irc_protocol_cmd_324 (struct t_irc_server *server, char *irc_message, char *host, char *nick, char *arguments, int ignore, int highlight);
+extern int irc_protocol_cmd_327 (struct t_irc_server *server, char *irc_message, char *host, char *nick, char *arguments, int ignore, int highlight);
+extern int irc_protocol_cmd_329 (struct t_irc_server *server, char *irc_message, char *host, char *nick, char *arguments, int ignore, int highlight);
+extern int irc_protocol_cmd_331 (struct t_irc_server *server, char *irc_message, char *host, char *nick, char *arguments, int ignore, int highlight);
+extern int irc_protocol_cmd_332 (struct t_irc_server *server, char *irc_message, char *host, char *nick, char *arguments, int ignore, int highlight);
+extern int irc_protocol_cmd_333 (struct t_irc_server *server, char *irc_message, char *host, char *nick, char *arguments, int ignore, int highlight);
+extern int irc_protocol_cmd_338 (struct t_irc_server *server, char *irc_message, char *host, char *nick, char *arguments, int ignore, int highlight);
+extern int irc_protocol_cmd_341 (struct t_irc_server *server, char *irc_message, char *host, char *nick, char *arguments, int ignore, int highlight);
+extern int irc_protocol_cmd_344 (struct t_irc_server *server, char *irc_message, char *host, char *nick, char *arguments, int ignore, int highlight);
+extern int irc_protocol_cmd_345 (struct t_irc_server *server, char *irc_message, char *host, char *nick, char *arguments, int ignore, int highlight);
+extern int irc_protocol_cmd_348 (struct t_irc_server *server, char *irc_message, char *host, char *nick, char *arguments, int ignore, int highlight);
+extern int irc_protocol_cmd_349 (struct t_irc_server *server, char *irc_message, char *host, char *nick, char *arguments, int ignore, int highlight);
+extern int irc_protocol_cmd_351 (struct t_irc_server *server, char *irc_message, char *host, char *nick, char *arguments, int ignore, int highlight);
+extern int irc_protocol_cmd_352 (struct t_irc_server *server, char *irc_message, char *host, char *nick, char *arguments, int ignore, int highlight);
+extern int irc_protocol_cmd_353 (struct t_irc_server *server, char *irc_message, char *host, char *nick, char *arguments, int ignore, int highlight);
+extern int irc_protocol_cmd_365 (struct t_irc_server *server, char *irc_message, char *host, char *nick, char *arguments, int ignore, int highlight);
+extern int irc_protocol_cmd_366 (struct t_irc_server *server, char *irc_message, char *host, char *nick, char *arguments, int ignore, int highlight);
+extern int irc_protocol_cmd_367 (struct t_irc_server *server, char *irc_message, char *host, char *nick, char *arguments, int ignore, int highlight);
+extern int irc_protocol_cmd_368 (struct t_irc_server *server, char *irc_message, char *host, char *nick, char *arguments, int ignore, int highlight);
+extern int irc_protocol_cmd_432 (struct t_irc_server *server, char *irc_message, char *host, char *nick, char *arguments, int ignore, int highlight);
+extern int irc_protocol_cmd_433 (struct t_irc_server *server, char *irc_message, char *host, char *nick, char *arguments, int ignore, int highlight);
+extern int irc_protocol_cmd_438 (struct t_irc_server *server, char *irc_message, char *host, char *nick, char *arguments, int ignore, int highlight);
+extern int irc_protocol_cmd_671 (struct t_irc_server *server, char *irc_message, char *host, char *nick, char *arguments, int ignore, int highlight);
#endif /* irc-protocol.h */
diff --git a/src/plugins/irc/irc-server.c b/src/plugins/irc/irc-server.c
index 9461f4baf..0b9ac0906 100644
--- a/src/plugins/irc/irc-server.c
+++ b/src/plugins/irc/irc-server.c
@@ -235,7 +235,7 @@ irc_server_init_with_url (struct t_irc_server *server, char *irc_url)
server->autojoin = strdup (pos_channel);
else
{
- server->autojoin = (char *) malloc (strlen (pos_channel) + 2);
+ server->autojoin = (char *)malloc (strlen (pos_channel) + 2);
strcpy (server->autojoin, "#");
strcat (server->autojoin, pos_channel);
}
@@ -249,10 +249,10 @@ irc_server_init_with_url (struct t_irc_server *server, char *irc_url)
/* some default values */
if (server->port < 0)
server->port = IRC_SERVER_DEFAULT_PORT;
- server->nick2 = (char *) malloc (strlen (server->nick1) + 2);
+ server->nick2 = (char *)malloc (strlen (server->nick1) + 2);
strcpy (server->nick2, server->nick1);
server->nick2 = strcat (server->nick2, "1");
- server->nick3 = (char *) malloc (strlen (server->nick1) + 2);
+ server->nick3 = (char *)malloc (strlen (server->nick1) + 2);
strcpy (server->nick3, server->nick1);
server->nick3 = strcat (server->nick3, "2");
@@ -266,7 +266,7 @@ irc_server_init_with_url (struct t_irc_server *server, char *irc_url)
void
irc_server_init_with_config_options (struct t_irc_server *server,
- void *section,
+ struct t_config_section *section,
int config_reload)
{
struct t_config_option *ptr_option;
@@ -423,7 +423,7 @@ irc_server_alloc ()
struct t_irc_server *new_server;
/* alloc memory for new server */
- if ((new_server = (struct t_irc_server *) malloc (sizeof (struct t_irc_server))) == NULL)
+ if ((new_server = (struct t_irc_server *)malloc (sizeof (struct t_irc_server))) == NULL)
{
weechat_printf (NULL,
_("%sirc: error when allocating new server"),
@@ -952,7 +952,7 @@ irc_server_send_one_msg (struct t_irc_server *server, char *message)
*/
void
-irc_server_sendf (struct t_irc_server *server, char *fmt, ...)
+irc_server_sendf (struct t_irc_server *server, char *format, ...)
{
va_list args;
static char buffer[4096];
@@ -962,8 +962,8 @@ irc_server_sendf (struct t_irc_server *server, char *fmt, ...)
if (!server)
return;
- va_start (args, fmt);
- vsnprintf (buffer, sizeof (buffer) - 1, fmt, args);
+ va_start (args, format);
+ vsnprintf (buffer, sizeof (buffer) - 1, format, args);
va_end (args);
ptr_buf = buffer;
@@ -1044,7 +1044,7 @@ irc_server_msgq_add_msg (struct t_irc_server *server, char *msg)
if (!server->unterminated_message && !msg[0])
return;
- message = (struct t_irc_message *) malloc (sizeof (struct t_irc_message));
+ message = (struct t_irc_message *)malloc (sizeof (struct t_irc_message));
if (!message)
{
weechat_printf (server->buffer,
@@ -1056,8 +1056,8 @@ irc_server_msgq_add_msg (struct t_irc_server *server, char *msg)
message->server = server;
if (server->unterminated_message)
{
- message->data = (char *) malloc (strlen (server->unterminated_message) +
- strlen (msg) + 1);
+ message->data = (char *)malloc (strlen (server->unterminated_message) +
+ strlen (msg) + 1);
if (!message->data)
{
weechat_printf (server->buffer,
@@ -1102,9 +1102,9 @@ irc_server_msgq_add_unterminated (struct t_irc_server *server, char *string)
if (server->unterminated_message)
{
server->unterminated_message =
- (char *) realloc (server->unterminated_message,
- strlen (server->unterminated_message) +
- strlen (string) + 1);
+ (char *)realloc (server->unterminated_message,
+ strlen (server->unterminated_message) +
+ strlen (string) + 1);
if (!server->unterminated_message)
{
weechat_printf (server->buffer,
@@ -1292,11 +1292,11 @@ irc_server_msgq_flush ()
}
/*
- * irc_server_recv: receive data from an irc server
+ * irc_server_recv_cb: receive data from an irc server
*/
int
-irc_server_recv (void *arg_server)
+irc_server_recv_cb (void *arg_server)
{
struct t_irc_server *server;
@@ -1335,12 +1335,12 @@ irc_server_recv (void *arg_server)
}
/*
- * irc_server_timer: timer called each second to perform some operations
- * on servers
+ * irc_server_timer_cb: timer called each second to perform some operations
+ * on servers
*/
void
-irc_server_timer (void *empty)
+irc_server_timer_cb (void *empty)
{
struct t_irc_server *ptr_server;
time_t new_time;
@@ -1540,7 +1540,8 @@ irc_server_child_read (void *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"));
+ config_proxy_use = weechat_config_boolean (
+ weechat_config_get_weechat ("proxy_use"));
switch (buffer[0])
{
/* connection OK */
@@ -1568,7 +1569,7 @@ irc_server_child_read (void *arg_server)
weechat_unhook (server->hook_fd);
server->hook_fd = weechat_hook_fd (server->sock,
1, 0, 0,
- irc_server_recv,
+ irc_server_recv_cb,
server);
break;
/* adress not found */
@@ -1630,7 +1631,7 @@ irc_server_child_read (void *arg_server)
*/
void
-irc_server_convbase64_8x3_to_6x4 (char *from, char* to)
+irc_server_convbase64_8x3_to_6x4 (char *from, char *to)
{
unsigned char base64_table[] = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";
@@ -1700,8 +1701,10 @@ irc_server_pass_httpproxy (int sock, char *address, int port)
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"));
+ config_proxy_username = weechat_config_string (
+ weechat_config_get_weechat ("proxy_username"));
+ config_proxy_username = weechat_config_string (
+ weechat_config_get_weechat ("proxy_password"));
if (config_proxy_username && config_proxy_username[0])
{
@@ -1854,8 +1857,10 @@ irc_server_pass_socks5proxy (int sock, char *address, int port)
socks5.version = 5;
socks5.nmethods = 1;
- config_proxy_username = weechat_config_string (weechat_config_get ("proxy_username"));
- config_proxy_username = weechat_config_string (weechat_config_get ("proxy_password"));
+ config_proxy_username = weechat_config_string (
+ weechat_config_get_weechat ("proxy_username"));
+ config_proxy_username = weechat_config_string (
+ weechat_config_get_weechat ("proxy_password"));
if (config_proxy_username && config_proxy_username[0])
socks5.method = 2; /* with authentication */
@@ -1913,7 +1918,7 @@ irc_server_pass_socks5proxy (int sock, char *address, int port)
/* authentication successful then giving address/port to connect */
addr_len = strlen(address);
addr_buffer_len = 4 + 1 + addr_len + 2;
- addr_buffer = (unsigned char *) malloc (addr_buffer_len * sizeof(*addr_buffer));
+ addr_buffer = (unsigned char *)malloc (addr_buffer_len * sizeof(*addr_buffer));
if (!addr_buffer)
return 1;
addr_buffer[0] = 5; /* version 5 */
@@ -1985,7 +1990,8 @@ irc_server_pass_proxy (int sock, char *address, int port, char *username)
int rc;
char *config_proxy_type;
- config_proxy_type = weechat_config_string (weechat_config_get ("proxy_type"));
+ config_proxy_type = weechat_config_string (
+ weechat_config_get_weechat ("proxy_type"));
rc = 1;
if (config_proxy_type)
@@ -2015,10 +2021,14 @@ irc_server_child (struct t_irc_server *server)
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"));
+ config_proxy_use = weechat_config_boolean (
+ weechat_config_get_weechat ("proxy_use"));
+ config_proxy_ipv6 = weechat_config_integer (
+ weechat_config_get_weechat ("proxy_ipv6"));
+ config_proxy_port = weechat_config_integer (
+ weechat_config_get_weechat ("proxy_port"));
+ config_proxy_address = weechat_config_string (
+ weechat_config_get_weechat ("proxy_address"));
if (config_proxy_use)
{
@@ -2155,11 +2165,16 @@ irc_server_connect (struct t_irc_server *server, int disable_autojoin)
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"));
+ config_proxy_use = weechat_config_boolean (
+ weechat_config_get_weechat ("proxy_use"));
+ config_proxy_ipv6 = weechat_config_boolean (
+ weechat_config_get_weechat ("proxy_ipv6"));
+ config_proxy_type = weechat_config_string (
+ weechat_config_get_weechat ("proxy_type"));
+ config_proxy_address = weechat_config_string (
+ weechat_config_get_weechat ("proxy_address"));
+ config_proxy_port = weechat_config_integer (
+ weechat_config_get_weechat ("proxy_port"));
if (!server->buffer)
{
@@ -2167,6 +2182,7 @@ irc_server_connect (struct t_irc_server *server, int disable_autojoin)
if (!server->buffer)
return 0;
weechat_buffer_set (server->buffer, "display", "1");
+ weechat_hook_signal_send ("logger_backlog", server->buffer);
}
#ifndef HAVE_GNUTLS
@@ -2477,17 +2493,17 @@ irc_server_autojoin_channels (struct t_irc_server *server)
*/
struct t_irc_server *
-irc_server_search (char *servername)
+irc_server_search (char *server_name)
{
struct t_irc_server *ptr_server;
- if (!servername)
+ if (!server_name)
return NULL;
for (ptr_server = irc_servers; ptr_server;
ptr_server = ptr_server->next_server)
{
- if (strcmp (ptr_server->name, servername) == 0)
+ if (strcmp (ptr_server->name, server_name) == 0)
return ptr_server;
}
return NULL;
@@ -2538,27 +2554,6 @@ irc_server_get_number_buffer (struct t_irc_server *server,
}
/*
- * irc_server_name_already_exists: return 1 if server name already exists
- * otherwise return 0
- */
-
-int
-irc_server_name_already_exists (char *name)
-{
- struct t_irc_server *ptr_server;
-
- if (!name)
- return 0;
-
- for (ptr_server = irc_servers; ptr_server; ptr_server = ptr_server->next_server)
- {
- if (strcmp (ptr_server->name, name) == 0)
- return 1;
- }
- return 0;
-}
-
-/*
* irc_server_get_channel_count: return number of channels for server
*/
diff --git a/src/plugins/irc/irc-server.h b/src/plugins/irc/irc-server.h
index c610f53f9..2c70d9b43 100644
--- a/src/plugins/irc/irc-server.h
+++ b/src/plugins/irc/irc-server.h
@@ -132,54 +132,70 @@ 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 *,
- int);
+extern void irc_server_init (struct t_irc_server *server);
+extern int irc_server_init_with_url (struct t_irc_server *server, char *irc_url);
+extern void irc_server_init_with_config_options (struct t_irc_server *server,
+ struct t_config_section *section,
+ int config_reload);
extern struct t_irc_server *irc_server_alloc ();
-extern void irc_server_outqueue_free_all (struct t_irc_server *);
-extern void irc_server_free_data (struct t_irc_server *);
-extern void irc_server_free (struct t_irc_server *);
+extern void irc_server_outqueue_free_all (struct t_irc_server *server);
+extern void irc_server_free_data (struct t_irc_server *server);
+extern void irc_server_free (struct t_irc_server *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 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, char *nick1,
+ char *nick2, char *nick3,
+ char *username, char *realname,
+ char *hostname, char *command,
+ int command_delay, char *autojoin,
+ int autorejoin,
+ char *notify_levels);
+extern struct t_irc_server *irc_server_duplicate (struct t_irc_server *server,
+ char *new_name);
+extern int irc_server_rename (struct t_irc_server *server, char *new_name);
+extern int irc_server_send (struct t_irc_server *server, char *buffer,
+ int size_buf);
+extern void irc_server_outqueue_send (struct t_irc_server *server);
+extern void irc_server_sendf (struct t_irc_server *server, char *format, ...);
+extern void irc_server_parse_message (char *message, char **host,
+ char **command, char **args);
+extern int irc_server_recv_cb (void *arg_server);
+extern void irc_server_timer_cb (void *empty);
+extern void irc_server_timer_check_away (void *empty);
+extern int irc_server_child_read (void *arg_server);
+extern void irc_server_convbase64_8x3_to_6x4 (char *from, char *to);
+extern void irc_server_base64encode (char *from, char *to);
+extern int irc_server_pass_httpproxy (int sock, char *address, int port);
+extern int irc_server_resolve (char *hostname, char *ip, int *version);
+extern int irc_server_pass_socks4proxy (int sock, char *address, int port,
+ char *username);
+extern int irc_server_pass_socks5proxy (int sock, char *address, int port);
+extern int irc_server_pass_proxy (int sock, char *address, int port,
+ char *username);
+extern int irc_server_connect (struct t_irc_server *server,
+ int disable_autojoin);
+extern void irc_server_reconnect (struct t_irc_server *server);
+extern void irc_server_auto_connect (int auto_connect, int temp_server);
+extern void irc_server_disconnect (struct t_irc_server *server, int reconnect);
extern void irc_server_disconnect_all ();
extern void irc_server_autojoin_channels ();
-extern struct t_irc_server *irc_server_search (char *);
+extern struct t_irc_server *irc_server_search (char *server_name);
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_get_number_buffer (struct t_irc_server *server,
+ int *server_pos, int *server_total);
+extern int irc_server_get_channel_count (struct t_irc_server *server);
+extern int irc_server_get_pv_count (struct t_irc_server *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_set_away (struct t_irc_server *server, char *nick,
+ int is_away);
+extern int irc_server_get_default_notify_level (struct t_irc_server *server);
+extern void irc_server_set_default_notify_level (struct t_irc_server *server,
+ int notify);
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 ab99c55dc..cc808eb0f 100644
--- a/src/plugins/irc/irc.c
+++ b/src/plugins/irc/irc.c
@@ -180,19 +180,7 @@ weechat_plugin_init (struct t_weechat_plugin *plugin)
weechat_hook_signal ("quit", &irc_quit_cb, NULL);
/* hook completions */
- weechat_hook_completion ("irc_server", &irc_completion_server_cb, NULL);
- weechat_hook_completion ("irc_server_nicks",
- &irc_completion_server_nicks_cb, NULL);
- weechat_hook_completion ("irc_servers", &irc_completion_servers_cb, NULL);
- weechat_hook_completion ("irc_channel", &irc_completion_channel_cb, NULL);
- weechat_hook_completion ("irc_channel_nicks",
- &irc_completion_channel_nicks_cb, NULL);
- weechat_hook_completion ("irc_channel_nicks_hosts",
- &irc_completion_channel_nicks_hosts_cb, NULL);
- weechat_hook_completion ("irc_channel_topic",
- &irc_completion_channel_topic_cb, NULL);
- weechat_hook_completion ("irc_channels", &irc_completion_channels_cb, NULL);
- weechat_hook_completion ("irc_msg_part", &irc_completion_msg_part_cb, NULL);
+ irc_completion_init ();
//irc_server_auto_connect (1, 0);