1
0
mirror of https://github.com/weechat/weechat.git synced 2026-07-09 19:23:13 +02:00

Add "const" keyword for some "char *" function arguments (core and plugins API)

This commit is contained in:
Sebastien Helleu
2008-06-03 10:56:51 +02:00
parent 2b1d7df86c
commit 3a53257032
123 changed files with 1598 additions and 1487 deletions
+7 -7
View File
@@ -40,7 +40,7 @@
struct t_irc_channel *
irc_channel_new (struct t_irc_server *server, int channel_type,
char *channel_name, int switch_to_channel)
const char *channel_name, int switch_to_channel)
{
struct t_irc_channel *new_channel;
struct t_gui_buffer *new_buffer;
@@ -188,7 +188,7 @@ irc_channel_free_all (struct t_irc_server *server)
*/
struct t_irc_channel *
irc_channel_search (struct t_irc_server *server, char *channel_name)
irc_channel_search (struct t_irc_server *server, const char *channel_name)
{
struct t_irc_channel *ptr_channel;
@@ -209,7 +209,7 @@ irc_channel_search (struct t_irc_server *server, char *channel_name)
*/
struct t_irc_channel *
irc_channel_search_any (struct t_irc_server *server, char *channel_name)
irc_channel_search_any (struct t_irc_server *server, const char *channel_name)
{
struct t_irc_channel *ptr_channel;
@@ -232,7 +232,7 @@ irc_channel_search_any (struct t_irc_server *server, char *channel_name)
struct t_irc_channel *
irc_channel_search_any_without_buffer (struct t_irc_server *server,
char *channel_name)
const char *channel_name)
{
struct t_irc_channel *ptr_channel;
@@ -254,7 +254,7 @@ irc_channel_search_any_without_buffer (struct t_irc_server *server,
*/
int
irc_channel_is_channel (char *string)
irc_channel_is_channel (const char *string)
{
char first_char[2];
@@ -311,7 +311,7 @@ irc_channel_check_away (struct t_irc_server *server,
*/
void
irc_channel_set_away (struct t_irc_channel *channel, char *nick, int is_away)
irc_channel_set_away (struct t_irc_channel *channel, const char *nick, int is_away)
{
(void) channel;
(void) nick;
@@ -404,7 +404,7 @@ irc_channel_set_notify_level (struct t_irc_server *server,
*/
void
irc_channel_add_nick_speaking (struct t_irc_channel *channel, char *nick)
irc_channel_add_nick_speaking (struct t_irc_channel *channel, const char *nick)
{
int size, to_remove, i;
+7 -7
View File
@@ -56,22 +56,22 @@ struct t_irc_channel
extern struct t_irc_channel *irc_channel_new (struct t_irc_server *server,
int channel_type,
char *channel_name,
const 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);
const char *channel_name);
extern struct t_irc_channel *irc_channel_search_any (struct t_irc_server *server,
char *channel_name);
const char *channel_name);
extern struct t_irc_channel *irc_channel_search_any_without_buffer (struct t_irc_server *server,
char *channel_name);
extern int irc_channel_is_channel (char *string);
const char *channel_name);
extern int irc_channel_is_channel (const 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,
extern void irc_channel_set_away (struct t_irc_channel *channel, const char *nick,
int is_away);
extern int irc_channel_get_notify_level (struct t_irc_server *server,
struct t_irc_channel *channel);
@@ -79,7 +79,7 @@ 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);
const char *nick);
extern void irc_channel_print_log (struct t_irc_channel *channel);
#endif /* irc-channel.h */
+3 -3
View File
@@ -58,7 +58,7 @@ char *irc_color_to_weechat[IRC_NUM_COLORS] =
*/
char *
irc_color_decode (char *string, int keep_colors)
irc_color_decode (const char *string, int keep_colors)
{
unsigned char *out, *ptr_string;
int out_length, length, out_pos;
@@ -184,7 +184,7 @@ irc_color_decode (char *string, int keep_colors)
*/
char *
irc_color_decode_for_user_entry (char *string)
irc_color_decode_for_user_entry (const char *string)
{
unsigned char *out, *ptr_string;
int out_length, out_pos, length;
@@ -252,7 +252,7 @@ irc_color_decode_for_user_entry (char *string)
*/
char *
irc_color_encode (char *string, int keep_colors)
irc_color_encode (const char *string, int keep_colors)
{
unsigned char *out, *ptr_string;
int out_length, out_pos, length;
+3 -3
View File
@@ -53,8 +53,8 @@
#define IRC_COLOR_UNDERLINE_CHAR '\x1F'
#define IRC_COLOR_UNDERLINE_STR "\x1F"
extern char *irc_color_decode (char *string, int keep_colors);
extern char *irc_color_decode_for_user_entry (char *string);
extern char *irc_color_encode (char *string, int keep_colors);
extern char *irc_color_decode (const char *string, int keep_colors);
extern char *irc_color_decode_for_user_entry (const char *string);
extern char *irc_color_encode (const char *string, int keep_colors);
#endif /* irc-color.h */
+15 -13
View File
@@ -71,7 +71,7 @@ irc_command_admin (void *data, struct t_gui_buffer *buffer, int argc,
void
irc_command_me_channel (struct t_irc_server *server,
struct t_irc_channel *channel,
char *arguments)
const char *arguments)
{
char *string;
@@ -97,7 +97,7 @@ irc_command_me_channel (struct t_irc_server *server,
*/
void
irc_command_me_all_channels (struct t_irc_server *server, char *arguments)
irc_command_me_all_channels (struct t_irc_server *server, const char *arguments)
{
struct t_irc_channel *ptr_channel;
@@ -114,8 +114,8 @@ irc_command_me_all_channels (struct t_irc_server *server, char *arguments)
*/
void
irc_command_mode_nicks (struct t_irc_server *server, char *channel,
char *set, char *mode, int argc, char **argv)
irc_command_mode_nicks (struct t_irc_server *server, const char *channel,
const char *set, const char *mode, int argc, char **argv)
{
int i, length;
char *command;
@@ -248,7 +248,7 @@ irc_command_amsg (void *data, struct t_gui_buffer *buffer, int argc,
*/
void
irc_command_away_server (struct t_irc_server *server, char *arguments)
irc_command_away_server (struct t_irc_server *server, const char *arguments)
{
char *string, buffer[4096];
time_t time_now, elapsed;
@@ -1098,9 +1098,10 @@ irc_command_die (void *data, struct t_gui_buffer *buffer, int argc,
*/
void
irc_command_quit_server (struct t_irc_server *server, char *arguments)
irc_command_quit_server (struct t_irc_server *server, const char *arguments)
{
char *ptr_arg, *buf, *version;
const char *ptr_arg;
char *buf, *version;
if (!server)
return;
@@ -1348,7 +1349,7 @@ irc_command_ison (void *data, struct t_gui_buffer *buffer, int argc,
*/
void
irc_command_join_server (struct t_irc_server *server, char *arguments)
irc_command_join_server (struct t_irc_server *server, const char *arguments)
{
if (irc_channel_is_channel (arguments))
irc_server_sendf (server, "JOIN %s", arguments);
@@ -1708,7 +1709,7 @@ irc_command_me (void *data, struct t_gui_buffer *buffer, int argc, char **argv,
*/
void
irc_command_mode_server (struct t_irc_server *server, char *arguments)
irc_command_mode_server (struct t_irc_server *server, const char *arguments)
{
irc_server_sendf (server, "MODE %s", arguments);
}
@@ -1967,7 +1968,7 @@ irc_command_names (void *data, struct t_gui_buffer *buffer, int argc,
*/
void
irc_send_nick_server (struct t_irc_server *server, char *nickname)
irc_send_nick_server (struct t_irc_server *server, const char *nickname)
{
if (!server)
return;
@@ -2133,10 +2134,11 @@ irc_command_oper (void *data, struct t_gui_buffer *buffer, int argc,
*/
void
irc_command_part_channel (struct t_irc_server *server, char *channel_name,
char *part_message)
irc_command_part_channel (struct t_irc_server *server, const char *channel_name,
const char *part_message)
{
char *ptr_arg, *buf, *version;
const char *ptr_arg;
char *buf, *version;
ptr_arg = (part_message) ? part_message :
(weechat_config_string (irc_config_network_default_msg_part)
+6 -6
View File
@@ -30,16 +30,16 @@ struct t_irc_server;
extern void irc_command_away_server (struct t_irc_server *server,
char *arguments);
const char *arguments);
extern void irc_command_join_server (struct t_irc_server *server,
char *arguments);
const char *arguments);
extern void irc_command_mode_server (struct t_irc_server *server,
char *arguments);
const char *arguments);
extern void irc_command_part_channel (struct t_irc_server *server,
char *channel_name,
char *part_message);
const char *channel_name,
const char *part_message);
extern void irc_command_quit_server (struct t_irc_server *server,
char *arguments);
const char *arguments);
extern void irc_command_init ();
#endif /* irc-command.h */
+9 -9
View File
@@ -38,7 +38,7 @@
*/
int
irc_completion_server_cb (void *data, char *completion,
irc_completion_server_cb (void *data, const char *completion,
struct t_gui_buffer *buffer, struct t_weelist *list)
{
IRC_GET_SERVER(buffer);
@@ -59,7 +59,7 @@ irc_completion_server_cb (void *data, char *completion,
*/
int
irc_completion_server_nicks_cb (void *data, char *completion,
irc_completion_server_nicks_cb (void *data, const char *completion,
struct t_gui_buffer *buffer,
struct t_weelist *list)
{
@@ -101,7 +101,7 @@ irc_completion_server_nicks_cb (void *data, char *completion,
*/
int
irc_completion_servers_cb (void *data, char *completion,
irc_completion_servers_cb (void *data, const char *completion,
struct t_gui_buffer *buffer, struct t_weelist *list)
{
struct t_irc_server *ptr_server;
@@ -125,7 +125,7 @@ irc_completion_servers_cb (void *data, char *completion,
*/
int
irc_completion_channel_cb (void *data, char *completion,
irc_completion_channel_cb (void *data, const char *completion,
struct t_gui_buffer *buffer, struct t_weelist *list)
{
IRC_GET_SERVER_CHANNEL(buffer);
@@ -146,7 +146,7 @@ irc_completion_channel_cb (void *data, char *completion,
*/
int
irc_completion_channel_nicks_cb (void *data, char *completion,
irc_completion_channel_nicks_cb (void *data, const char *completion,
struct t_gui_buffer *buffer,
struct t_weelist *list)
{
@@ -206,7 +206,7 @@ irc_completion_channel_nicks_cb (void *data, char *completion,
*/
int
irc_completion_channel_nicks_hosts_cb (void *data, char *completion,
irc_completion_channel_nicks_hosts_cb (void *data, const char *completion,
struct t_gui_buffer *buffer,
struct t_weelist *list)
{
@@ -259,7 +259,7 @@ irc_completion_channel_nicks_hosts_cb (void *data, char *completion,
*/
int
irc_completion_channel_topic_cb (void *data, char *completion,
irc_completion_channel_topic_cb (void *data, const char *completion,
struct t_gui_buffer *buffer,
struct t_weelist *list)
{
@@ -289,7 +289,7 @@ irc_completion_channel_topic_cb (void *data, char *completion,
*/
int
irc_completion_channels_cb (void *data, char *completion,
irc_completion_channels_cb (void *data, const char *completion,
struct t_gui_buffer *buffer, struct t_weelist *list)
{
struct t_irc_server *ptr_server;
@@ -318,7 +318,7 @@ irc_completion_channels_cb (void *data, char *completion,
*/
int
irc_completion_msg_part_cb (void *data, char *completion,
irc_completion_msg_part_cb (void *data, const char *completion,
struct t_gui_buffer *buffer, struct t_weelist *list)
{
/* make C compiler happy */
+5 -5
View File
@@ -92,7 +92,7 @@ struct t_config_option *irc_config_server_default[IRC_CONFIG_NUM_SERVER_OPTIONS]
*/
int
irc_config_search_server_option (char *option_name)
irc_config_search_server_option (const char *option_name)
{
int i;
@@ -111,7 +111,7 @@ irc_config_search_server_option (char *option_name)
}
struct t_irc_server *
irc_config_get_server_from_option_name (char *name)
irc_config_get_server_from_option_name (const char *name)
{
struct t_irc_server *ptr_server;
char *pos_option, *server_name;
@@ -492,7 +492,7 @@ irc_config_reload (void *data, struct t_config_file *config_file)
void
irc_config_server_write_default (void *data, struct t_config_file *config_file,
char *section_name)
const char *section_name)
{
/* make C compiler happy */
(void) data;
@@ -511,7 +511,7 @@ struct t_config_option *
irc_config_server_new_option (struct t_config_file *config_file,
struct t_config_section *section,
int index_option,
char *option_name, char *value,
const char *option_name, const char *value,
void *callback_change,
void *callback_change_data,
void *callback_delete,
@@ -688,7 +688,7 @@ irc_config_server_new_option (struct t_config_file *config_file,
int
irc_config_server_create_option (void *data, struct t_config_file *config_file,
struct t_config_section *section,
char *option_name, char *value)
const char *option_name, const char *value)
{
struct t_config_option *ptr_option;
struct t_irc_server *ptr_server;
+5 -5
View File
@@ -54,7 +54,7 @@ irc_debug_buffer_close_cb (void *data, struct t_gui_buffer *buffer)
void
irc_debug_printf (struct t_irc_server *server, int send, int modified,
char *message)
const char *message)
{
char *buf;
@@ -100,8 +100,8 @@ irc_debug_printf (struct t_irc_server *server, int send, int modified,
*/
int
irc_debug_signal_debug_cb (void *data, char *signal, char *type_data,
void *signal_data)
irc_debug_signal_debug_cb (void *data, const char *signal,
const char *type_data, void *signal_data)
{
/* make C compiler happy */
(void) data;
@@ -127,8 +127,8 @@ irc_debug_signal_debug_cb (void *data, char *signal, char *type_data,
*/
int
irc_debug_signal_debug_dump_cb (void *data, char *signal, char *type_data,
void *signal_data)
irc_debug_signal_debug_dump_cb (void *data, const char *signal,
const char *type_data, void *signal_data)
{
/* make C compiler happy */
(void) data;
+1 -1
View File
@@ -28,7 +28,7 @@
struct t_irc_server;
extern void irc_debug_printf (struct t_irc_server *server, int send,
int modified, char *message);
int modified, const char *message);
extern void irc_debug_init ();
#endif /* irc-debug.h */
+4 -3
View File
@@ -90,7 +90,7 @@ irc_display_hide_password (char *string, int look_for_nickserv)
*/
void
irc_display_away (struct t_irc_server *server, char *string1, char *string2)
irc_display_away (struct t_irc_server *server, const char *string1, const char *string2)
{
struct t_irc_channel *ptr_channel;
@@ -118,8 +118,9 @@ irc_display_away (struct t_irc_server *server, char *string1, char *string2)
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)
const char *channel_name, const char *nick_name,
char set_flag, const char *symbol, const char *nick_host,
const char *message, const char *param)
{
weechat_printf (buffer,
"%s[%s%s%s/%s%c%s%s] %s%s %s%s%s%s%s",
+10 -8
View File
@@ -22,14 +22,16 @@
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);
struct t_irc_nick *nick, const char *nickname,
int type, int display_around,
const char *force_color, int no_nickmode);
extern void irc_display_away (struct t_irc_server *server, const char *string1,
const char *string2);
extern void irc_display_mode (struct t_gui_buffer *buffer,
const char *channel_name, const char *nick_name,
char set_flag, const char *symbol,
const char *nick_host, const char *message,
const char *param);
extern void irc_display_server (struct t_irc_server *server, int with_detail);
#endif /* irc-display.h */
+14 -7
View File
@@ -36,7 +36,7 @@
*/
void
irc_input_user_message_display (struct t_gui_buffer *buffer, char *text)
irc_input_user_message_display (struct t_gui_buffer *buffer, const char *text)
{
struct t_irc_nick *ptr_nick;
char *text_decoded;
@@ -84,13 +84,15 @@ irc_input_user_message_display (struct t_gui_buffer *buffer, char *text)
/*
* irc_input_send_user_message: send a PRIVMSG message, and split it
* if > 512 bytes
* warning: this function makes temporarirly
* changes in "text"
*/
void
irc_input_send_user_message (struct t_gui_buffer *buffer, char *text)
{
int max_length;
char *pos, *pos_next, *pos_max, *next, saved_char, *last_space;
char *pos, *pos_max, *last_space, *pos_next, *next, saved_char;
IRC_GET_SERVER_CHANNEL(buffer);
@@ -151,9 +153,10 @@ irc_input_send_user_message (struct t_gui_buffer *buffer, char *text)
*/
int
irc_input_data_cb (void *data, struct t_gui_buffer *buffer, char *input_data)
irc_input_data_cb (void *data, struct t_gui_buffer *buffer,
const char *input_data)
{
char *data_with_colors;
char *data_with_colors, *msg;
/* make C compiler happy */
(void) data;
@@ -164,9 +167,13 @@ irc_input_data_cb (void *data, struct t_gui_buffer *buffer, char *input_data)
{
data_with_colors = irc_color_encode (input_data,
weechat_config_boolean (irc_config_network_colors_send));
irc_input_send_user_message (buffer,
(data_with_colors) ? data_with_colors : input_data);
msg = strdup ((data_with_colors) ? data_with_colors : input_data);
if (msg)
{
irc_input_send_user_message (buffer, msg);
free (msg);
}
if (data_with_colors)
free (data_with_colors);
+1 -1
View File
@@ -21,6 +21,6 @@
#define __WEECHAT_IRC_INPUT_H 1
extern int irc_input_data_cb (void *data, struct t_gui_buffer *buffer,
char *input_data);
const char *input_data);
#endif /* irc-input.h */
+5 -5
View File
@@ -35,7 +35,7 @@
*/
void
irc_mode_channel_set_nick (struct t_irc_channel *channel, char *nick,
irc_mode_channel_set_nick (struct t_irc_channel *channel, const char *nick,
char set_flag, int flag)
{
struct t_irc_nick *ptr_nick;
@@ -53,13 +53,13 @@ irc_mode_channel_set_nick (struct t_irc_channel *channel, char *nick,
*/
char
irc_mode_channel_get_flag (char *str, char *pos)
irc_mode_channel_get_flag (const char *string, const char *pos)
{
char set_flag;
set_flag = '+';
pos--;
while (pos >= str)
while (pos >= string)
{
if (pos[0] == '-')
return '-';
@@ -76,7 +76,7 @@ irc_mode_channel_get_flag (char *str, char *pos)
void
irc_mode_channel_set (struct t_irc_server *server,
struct t_irc_channel *channel, char *modes)
struct t_irc_channel *channel, const char *modes)
{
char *pos_args, *str_modes, set_flag, **argv, *pos, *ptr_arg;
int argc, current_arg;
@@ -269,7 +269,7 @@ irc_mode_user_remove (struct t_irc_server *server, char mode)
*/
void
irc_mode_user_set (struct t_irc_server *server, char *modes)
irc_mode_user_set (struct t_irc_server *server, const char *modes)
{
char set_flag;
+3 -2
View File
@@ -24,8 +24,9 @@ struct t_irc_server;
struct t_irc_channel;
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);
struct t_irc_channel *channel,
const char *modes);
extern void irc_mode_user_set (struct t_irc_server *server, const char *modes);
extern int irc_mode_nick_prefix_allowed (struct t_irc_server *server,
char prefix);
+5 -4
View File
@@ -155,7 +155,7 @@ irc_nick_get_gui_infos (struct t_irc_nick *nick,
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,
const char *nick_name, int is_chanowner, int is_chanadmin,
int is_chanadmin2, int is_op, int is_halfop, int has_voice,
int is_chanuser)
{
@@ -251,7 +251,7 @@ irc_nick_new (struct t_irc_server *server, struct t_irc_channel *channel,
void
irc_nick_change (struct t_irc_server *server, struct t_irc_channel *channel,
struct t_irc_nick *nick, char *new_nick)
struct t_irc_nick *nick, const char *new_nick)
{
int nick_is_me, prefix_color;
struct t_gui_nick_group *ptr_group;
@@ -402,7 +402,7 @@ irc_nick_free_all (struct t_irc_channel *channel)
*/
struct t_irc_nick *
irc_nick_search (struct t_irc_channel *channel, char *nickname)
irc_nick_search (struct t_irc_channel *channel, const char *nickname)
{
struct t_irc_nick *ptr_nick;
@@ -500,7 +500,8 @@ irc_nick_set_away (struct t_irc_channel *channel, struct t_irc_nick *nick,
*/
char *
irc_nick_as_prefix (struct t_irc_nick *nick, char *nickname, char *force_color)
irc_nick_as_prefix (struct t_irc_nick *nick, const char *nickname,
const char *force_color)
{
static char result[256];
char prefix[2], str_prefix_color[64];
+5 -5
View File
@@ -58,27 +58,27 @@ struct t_irc_nick
extern struct t_irc_nick *irc_nick_new (struct t_irc_server *server,
struct t_irc_channel *channel,
char *nick_name, int is_chanowner,
const 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);
struct t_irc_nick *nick, const char *new_nick);
extern void irc_nick_set (struct t_irc_channel *channel,
struct t_irc_nick *nick, int set, int flag);
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);
const 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 char *irc_nick_as_prefix (struct t_irc_nick *nick, const char *nickname,
const char *force_color);
extern void irc_nick_print_log (struct t_irc_nick *nick);
#endif /* irc-nick.h */
+67 -65
View File
@@ -48,7 +48,7 @@
*/
char *
irc_protocol_get_nick_from_host (char *host)
irc_protocol_get_nick_from_host (const char *host)
{
static char nick[128];
char *pos;
@@ -75,7 +75,7 @@ irc_protocol_get_nick_from_host (char *host)
*/
char *
irc_protocol_get_address_from_host (char *host)
irc_protocol_get_address_from_host (const char *host)
{
static char address[256];
char *pos;
@@ -99,7 +99,7 @@ irc_protocol_get_address_from_host (char *host)
*/
char *
irc_protocol_tags (char *command, char *tags)
irc_protocol_tags (const char *command, const char *tags)
{
static char string[256];
@@ -132,7 +132,7 @@ irc_protocol_tags (char *command, char *tags)
char *
irc_protocol_replace_vars (struct t_irc_server *server,
struct t_irc_channel *channel, char *string)
struct t_irc_channel *channel, const char *string)
{
char *var_nick, *var_channel, *var_server;
char empty_string[1] = { '\0' };
@@ -171,7 +171,7 @@ irc_protocol_replace_vars (struct t_irc_server *server,
*/
int
irc_protocol_cmd_error (struct t_irc_server *server, char *command,
irc_protocol_cmd_error (struct t_irc_server *server, const char *command,
int argc, char **argv, char **argv_eol)
{
int first_arg;
@@ -216,7 +216,7 @@ irc_protocol_cmd_error (struct t_irc_server *server, char *command,
*/
int
irc_protocol_cmd_invite (struct t_irc_server *server, char *command,
irc_protocol_cmd_invite (struct t_irc_server *server, const char *command,
int argc, char **argv, char **argv_eol)
{
/* INVITE message looks like:
@@ -251,7 +251,7 @@ irc_protocol_cmd_invite (struct t_irc_server *server, char *command,
*/
int
irc_protocol_cmd_join (struct t_irc_server *server, char *command,
irc_protocol_cmd_join (struct t_irc_server *server, const char *command,
int argc, char **argv, char **argv_eol)
{
struct t_irc_channel *ptr_channel;
@@ -325,7 +325,7 @@ irc_protocol_cmd_join (struct t_irc_server *server, char *command,
*/
int
irc_protocol_cmd_kick (struct t_irc_server *server, char *command,
irc_protocol_cmd_kick (struct t_irc_server *server, const char *command,
int argc, char **argv, char **argv_eol)
{
char *pos_comment;
@@ -414,7 +414,7 @@ irc_protocol_cmd_kick (struct t_irc_server *server, char *command,
*/
int
irc_protocol_cmd_kill (struct t_irc_server *server, char *command,
irc_protocol_cmd_kill (struct t_irc_server *server, const char *command,
int argc, char **argv, char **argv_eol)
{
char *pos_comment;
@@ -481,7 +481,7 @@ irc_protocol_cmd_kill (struct t_irc_server *server, char *command,
*/
int
irc_protocol_cmd_mode (struct t_irc_server *server, char *command,
irc_protocol_cmd_mode (struct t_irc_server *server, const char *command,
int argc, char **argv, char **argv_eol)
{
char *pos_modes;
@@ -543,7 +543,7 @@ irc_protocol_cmd_mode (struct t_irc_server *server, char *command,
*/
int
irc_protocol_cmd_nick (struct t_irc_server *server, char *command,
irc_protocol_cmd_nick (struct t_irc_server *server, const char *command,
int argc, char **argv, char **argv_eol)
{
struct t_irc_channel *ptr_channel;
@@ -632,7 +632,7 @@ irc_protocol_cmd_nick (struct t_irc_server *server, char *command,
*/
int
irc_protocol_cmd_notice (struct t_irc_server *server, char *command,
irc_protocol_cmd_notice (struct t_irc_server *server, const char *command,
int argc, char **argv, char **argv_eol)
{
char *nick, *host, *pos_args, *pos_end, *pos_usec;
@@ -820,7 +820,7 @@ irc_protocol_cmd_notice (struct t_irc_server *server, char *command,
*/
int
irc_protocol_cmd_part (struct t_irc_server *server, char *command,
irc_protocol_cmd_part (struct t_irc_server *server, const char *command,
int argc, char **argv, char **argv_eol)
{
char *nick, *host, *pos_comment, *join_string;
@@ -929,7 +929,7 @@ irc_protocol_cmd_part (struct t_irc_server *server, char *command,
*/
int
irc_protocol_cmd_ping (struct t_irc_server *server, char *command,
irc_protocol_cmd_ping (struct t_irc_server *server, const char *command,
int argc, char **argv, char **argv_eol)
{
/* PING message looks like:
@@ -952,7 +952,7 @@ irc_protocol_cmd_ping (struct t_irc_server *server, char *command,
*/
int
irc_protocol_cmd_pong (struct t_irc_server *server, char *command,
irc_protocol_cmd_pong (struct t_irc_server *server, const char *command,
int argc, char **argv, char **argv_eol)
{
struct timeval tv;
@@ -990,8 +990,8 @@ irc_protocol_cmd_pong (struct t_irc_server *server, char *command,
void
irc_protocol_reply_version (struct t_irc_server *server,
struct t_irc_channel *channel, char *nick,
char *message, char *str_version)
struct t_irc_channel *channel, const char *nick,
const char *message, const char *str_version)
{
char *pos, *version, *date;
struct t_gui_buffer *ptr_buffer;
@@ -1043,7 +1043,7 @@ irc_protocol_reply_version (struct t_irc_server *server,
}
weechat_hook_signal_send ("irc_ctcp",
WEECHAT_HOOK_SIGNAL_STRING,
message);
(void *)message);
}
/*
@@ -1051,7 +1051,7 @@ irc_protocol_reply_version (struct t_irc_server *server,
*/
int
irc_protocol_cmd_privmsg (struct t_irc_server *server, char *command,
irc_protocol_cmd_privmsg (struct t_irc_server *server, const char *command,
int argc, char **argv, char **argv_eol)
{
char *nick, *host, *pos_args, *pos_end_01, *pos, *pos_message;
@@ -1911,7 +1911,7 @@ irc_protocol_cmd_privmsg (struct t_irc_server *server, char *command,
*/
int
irc_protocol_cmd_quit (struct t_irc_server *server, char *command,
irc_protocol_cmd_quit (struct t_irc_server *server, const char *command,
int argc, char **argv, char **argv_eol)
{
char *nick, *host, *pos_comment;
@@ -1988,7 +1988,7 @@ irc_protocol_cmd_quit (struct t_irc_server *server, char *command,
*/
int
irc_protocol_cmd_server_mode_reason (struct t_irc_server *server, char *command,
irc_protocol_cmd_server_mode_reason (struct t_irc_server *server, const char *command,
int argc, char **argv, char **argv_eol)
{
char *pos_mode, *pos_args;
@@ -2022,7 +2022,7 @@ irc_protocol_cmd_server_mode_reason (struct t_irc_server *server, char *command,
*/
int
irc_protocol_cmd_numeric (struct t_irc_server *server, char *command,
irc_protocol_cmd_numeric (struct t_irc_server *server, const char *command,
int argc, char **argv, char **argv_eol)
{
char *pos_args;
@@ -2056,7 +2056,7 @@ irc_protocol_cmd_numeric (struct t_irc_server *server, char *command,
*/
int
irc_protocol_cmd_topic (struct t_irc_server *server, char *command,
irc_protocol_cmd_topic (struct t_irc_server *server, const char *command,
int argc, char **argv, char **argv_eol)
{
char *pos_topic, *topic_color;
@@ -2135,7 +2135,7 @@ irc_protocol_cmd_topic (struct t_irc_server *server, char *command,
*/
int
irc_protocol_cmd_wallops (struct t_irc_server *server, char *command,
irc_protocol_cmd_wallops (struct t_irc_server *server, const char *command,
int argc, char **argv, char **argv_eol)
{
/* WALLOPS message looks like:
@@ -2165,7 +2165,7 @@ irc_protocol_cmd_wallops (struct t_irc_server *server, char *command,
*/
int
irc_protocol_cmd_001 (struct t_irc_server *server, char *command,
irc_protocol_cmd_001 (struct t_irc_server *server, const char *command,
int argc, char **argv, char **argv_eol)
{
char **commands, **ptr_cmd, *vars_replaced;
@@ -2233,7 +2233,7 @@ irc_protocol_cmd_001 (struct t_irc_server *server, char *command,
*/
int
irc_protocol_cmd_005 (struct t_irc_server *server, char *command,
irc_protocol_cmd_005 (struct t_irc_server *server, const char *command,
int argc, char **argv, char **argv_eol)
{
char *pos, *pos2;
@@ -2278,7 +2278,7 @@ irc_protocol_cmd_005 (struct t_irc_server *server, char *command,
*/
int
irc_protocol_cmd_221 (struct t_irc_server *server, char *command,
irc_protocol_cmd_221 (struct t_irc_server *server, const char *command,
int argc, char **argv, char **argv_eol)
{
/* 221 message looks like:
@@ -2309,7 +2309,7 @@ irc_protocol_cmd_221 (struct t_irc_server *server, char *command,
*/
int
irc_protocol_cmd_301 (struct t_irc_server *server, char *command,
irc_protocol_cmd_301 (struct t_irc_server *server, const char *command,
int argc, char **argv, char **argv_eol)
{
char *pos_away_msg;
@@ -2361,7 +2361,7 @@ irc_protocol_cmd_301 (struct t_irc_server *server, char *command,
*/
int
irc_protocol_cmd_303 (struct t_irc_server *server, char *command,
irc_protocol_cmd_303 (struct t_irc_server *server, const char *command,
int argc, char **argv, char **argv_eol)
{
/* 301 message looks like:
@@ -2388,7 +2388,7 @@ irc_protocol_cmd_303 (struct t_irc_server *server, char *command,
*/
int
irc_protocol_cmd_305 (struct t_irc_server *server, char *command,
irc_protocol_cmd_305 (struct t_irc_server *server, const char *command,
int argc, char **argv, char **argv_eol)
{
/* 305 message looks like:
@@ -2430,7 +2430,7 @@ irc_protocol_cmd_305 (struct t_irc_server *server, char *command,
*/
int
irc_protocol_cmd_306 (struct t_irc_server *server, char *command,
irc_protocol_cmd_306 (struct t_irc_server *server, const char *command,
int argc, char **argv, char **argv_eol)
{
/* 306 message looks like:
@@ -2478,7 +2478,7 @@ irc_protocol_cmd_306 (struct t_irc_server *server, char *command,
*/
int
irc_protocol_cmd_whois_nick_msg (struct t_irc_server *server, char *command,
irc_protocol_cmd_whois_nick_msg (struct t_irc_server *server, const char *command,
int argc, char **argv, char **argv_eol)
{
/* messages look like:
@@ -2506,7 +2506,7 @@ irc_protocol_cmd_whois_nick_msg (struct t_irc_server *server, char *command,
*/
int
irc_protocol_cmd_311 (struct t_irc_server *server, char *command,
irc_protocol_cmd_311 (struct t_irc_server *server, const char *command,
int argc, char **argv, char **argv_eol)
{
/* 311 message looks like:
@@ -2538,7 +2538,7 @@ irc_protocol_cmd_311 (struct t_irc_server *server, char *command,
*/
int
irc_protocol_cmd_312 (struct t_irc_server *server, char *command,
irc_protocol_cmd_312 (struct t_irc_server *server, const char *command,
int argc, char **argv, char **argv_eol)
{
/* 312 message looks like:
@@ -2570,7 +2570,7 @@ irc_protocol_cmd_312 (struct t_irc_server *server, char *command,
*/
int
irc_protocol_cmd_314 (struct t_irc_server *server, char *command,
irc_protocol_cmd_314 (struct t_irc_server *server, const char *command,
int argc, char **argv, char **argv_eol)
{
/* 314 message looks like:
@@ -2601,7 +2601,7 @@ irc_protocol_cmd_314 (struct t_irc_server *server, char *command,
*/
int
irc_protocol_cmd_315 (struct t_irc_server *server, char *command,
irc_protocol_cmd_315 (struct t_irc_server *server, const char *command,
int argc, char **argv, char **argv_eol)
{
/* 315 message looks like:
@@ -2639,7 +2639,7 @@ irc_protocol_cmd_315 (struct t_irc_server *server, char *command,
*/
int
irc_protocol_cmd_317 (struct t_irc_server *server, char *command,
irc_protocol_cmd_317 (struct t_irc_server *server, const char *command,
int argc, char **argv, char **argv_eol)
{
int idle_time, day, hour, min, sec;
@@ -2731,7 +2731,7 @@ irc_protocol_cmd_317 (struct t_irc_server *server, char *command,
*/
int
irc_protocol_cmd_321 (struct t_irc_server *server, char *command,
irc_protocol_cmd_321 (struct t_irc_server *server, const char *command,
int argc, char **argv, char **argv_eol)
{
char *pos_args;
@@ -2761,7 +2761,7 @@ irc_protocol_cmd_321 (struct t_irc_server *server, char *command,
*/
int
irc_protocol_cmd_322 (struct t_irc_server *server, char *command,
irc_protocol_cmd_322 (struct t_irc_server *server, const char *command,
int argc, char **argv, char **argv_eol)
{
char *pos_topic;
@@ -2801,7 +2801,7 @@ irc_protocol_cmd_322 (struct t_irc_server *server, char *command,
*/
int
irc_protocol_cmd_323 (struct t_irc_server *server, char *command,
irc_protocol_cmd_323 (struct t_irc_server *server, const char *command,
int argc, char **argv, char **argv_eol)
{
char *pos_args;
@@ -2832,7 +2832,7 @@ irc_protocol_cmd_323 (struct t_irc_server *server, char *command,
*/
int
irc_protocol_cmd_324 (struct t_irc_server *server, char *command,
irc_protocol_cmd_324 (struct t_irc_server *server, const char *command,
int argc, char **argv, char **argv_eol)
{
struct t_irc_channel *ptr_channel;
@@ -2875,7 +2875,7 @@ irc_protocol_cmd_324 (struct t_irc_server *server, char *command,
*/
int
irc_protocol_cmd_327 (struct t_irc_server *server, char *command,
irc_protocol_cmd_327 (struct t_irc_server *server, const char *command,
int argc, char **argv, char **argv_eol)
{
char *pos_realname;
@@ -2930,7 +2930,7 @@ irc_protocol_cmd_327 (struct t_irc_server *server, char *command,
*/
int
irc_protocol_cmd_329 (struct t_irc_server *server, char *command,
irc_protocol_cmd_329 (struct t_irc_server *server, const char *command,
int argc, char **argv, char **argv_eol)
{
struct t_irc_channel *ptr_channel;
@@ -2979,7 +2979,7 @@ irc_protocol_cmd_329 (struct t_irc_server *server, char *command,
*/
int
irc_protocol_cmd_331 (struct t_irc_server *server, char *command,
irc_protocol_cmd_331 (struct t_irc_server *server, const char *command,
int argc, char **argv, char **argv_eol)
{
struct t_irc_channel *ptr_channel;
@@ -3010,7 +3010,7 @@ irc_protocol_cmd_331 (struct t_irc_server *server, char *command,
*/
int
irc_protocol_cmd_332 (struct t_irc_server *server, char *command,
irc_protocol_cmd_332 (struct t_irc_server *server, const char *command,
int argc, char **argv, char **argv_eol)
{
char *pos_topic;
@@ -3053,7 +3053,7 @@ irc_protocol_cmd_332 (struct t_irc_server *server, char *command,
*/
int
irc_protocol_cmd_333 (struct t_irc_server *server, char *command,
irc_protocol_cmd_333 (struct t_irc_server *server, const char *command,
int argc, char **argv, char **argv_eol)
{
struct t_irc_channel *ptr_channel;
@@ -3102,7 +3102,7 @@ irc_protocol_cmd_333 (struct t_irc_server *server, char *command,
*/
int
irc_protocol_cmd_338 (struct t_irc_server *server, char *command,
irc_protocol_cmd_338 (struct t_irc_server *server, const char *command,
int argc, char **argv, char **argv_eol)
{
/* 338 message looks like:
@@ -3132,7 +3132,7 @@ irc_protocol_cmd_338 (struct t_irc_server *server, char *command,
*/
int
irc_protocol_cmd_341 (struct t_irc_server *server, char *command,
irc_protocol_cmd_341 (struct t_irc_server *server, const char *command,
int argc, char **argv, char **argv_eol)
{
/* 341 message looks like:
@@ -3165,7 +3165,7 @@ irc_protocol_cmd_341 (struct t_irc_server *server, char *command,
*/
int
irc_protocol_cmd_344 (struct t_irc_server *server, char *command,
irc_protocol_cmd_344 (struct t_irc_server *server, const char *command,
int argc, char **argv, char **argv_eol)
{
/* 344 message looks like:
@@ -3192,7 +3192,7 @@ irc_protocol_cmd_344 (struct t_irc_server *server, char *command,
*/
int
irc_protocol_cmd_345 (struct t_irc_server *server, char *command,
irc_protocol_cmd_345 (struct t_irc_server *server, const char *command,
int argc, char **argv, char **argv_eol)
{
/* 345 message looks like:
@@ -3218,7 +3218,7 @@ irc_protocol_cmd_345 (struct t_irc_server *server, char *command,
*/
int
irc_protocol_cmd_348 (struct t_irc_server *server, char *command,
irc_protocol_cmd_348 (struct t_irc_server *server, const char *command,
int argc, char **argv, char **argv_eol)
{
struct t_irc_channel *ptr_channel;
@@ -3285,7 +3285,7 @@ irc_protocol_cmd_348 (struct t_irc_server *server, char *command,
*/
int
irc_protocol_cmd_349 (struct t_irc_server *server, char *command,
irc_protocol_cmd_349 (struct t_irc_server *server, const char *command,
int argc, char **argv, char **argv_eol)
{
char *pos_args;
@@ -3322,7 +3322,7 @@ irc_protocol_cmd_349 (struct t_irc_server *server, char *command,
*/
int
irc_protocol_cmd_351 (struct t_irc_server *server, char *command,
irc_protocol_cmd_351 (struct t_irc_server *server, const char *command,
int argc, char **argv, char **argv_eol)
{
/* 351 message looks like:
@@ -3359,7 +3359,7 @@ irc_protocol_cmd_351 (struct t_irc_server *server, char *command,
*/
int
irc_protocol_cmd_352 (struct t_irc_server *server, char *command,
irc_protocol_cmd_352 (struct t_irc_server *server, const char *command,
int argc, char **argv, char **argv_eol)
{
char *pos_attr, *pos_hopcount, *pos_realname;
@@ -3441,7 +3441,7 @@ irc_protocol_cmd_352 (struct t_irc_server *server, char *command,
*/
int
irc_protocol_cmd_353 (struct t_irc_server *server, char *command,
irc_protocol_cmd_353 (struct t_irc_server *server, const char *command,
int argc, char **argv, char **argv_eol)
{
char *pos_channel, *pos_nick, *color;
@@ -3568,7 +3568,7 @@ irc_protocol_cmd_353 (struct t_irc_server *server, char *command,
*/
int
irc_protocol_cmd_366 (struct t_irc_server *server, char *command,
irc_protocol_cmd_366 (struct t_irc_server *server, const char *command,
int argc, char **argv, char **argv_eol)
{
struct t_irc_channel *ptr_channel;
@@ -3699,7 +3699,7 @@ irc_protocol_cmd_366 (struct t_irc_server *server, char *command,
*/
int
irc_protocol_cmd_367 (struct t_irc_server *server, char *command,
irc_protocol_cmd_367 (struct t_irc_server *server, const char *command,
int argc, char **argv, char **argv_eol)
{
struct t_irc_channel *ptr_channel;
@@ -3771,7 +3771,7 @@ irc_protocol_cmd_367 (struct t_irc_server *server, char *command,
*/
int
irc_protocol_cmd_368 (struct t_irc_server *server, char *command,
irc_protocol_cmd_368 (struct t_irc_server *server, const char *command,
int argc, char **argv, char **argv_eol)
{
char *pos_args;
@@ -3808,7 +3808,7 @@ irc_protocol_cmd_368 (struct t_irc_server *server, char *command,
*/
int
irc_protocol_cmd_432 (struct t_irc_server *server, char *command,
irc_protocol_cmd_432 (struct t_irc_server *server, const char *command,
int argc, char **argv, char **argv_eol)
{
int i, nick_found, nick_to_use;
@@ -3864,7 +3864,7 @@ irc_protocol_cmd_432 (struct t_irc_server *server, char *command,
*/
int
irc_protocol_cmd_433 (struct t_irc_server *server, char *command,
irc_protocol_cmd_433 (struct t_irc_server *server, const char *command,
int argc, char **argv, char **argv_eol)
{
int i, nick_found, nick_to_use;
@@ -3922,7 +3922,7 @@ irc_protocol_cmd_433 (struct t_irc_server *server, char *command,
*/
int
irc_protocol_cmd_438 (struct t_irc_server *server, char *command,
irc_protocol_cmd_438 (struct t_irc_server *server, const char *command,
int argc, char **argv, char **argv_eol)
{
/* 438 message looks like:
@@ -3959,7 +3959,7 @@ irc_protocol_cmd_438 (struct t_irc_server *server, char *command,
*/
int
irc_protocol_is_numeric_command (char *str)
irc_protocol_is_numeric_command (const char *str)
{
while (str && str[0])
{
@@ -3979,14 +3979,16 @@ irc_protocol_is_numeric_command (char *str)
*/
void
irc_protocol_recv_command (struct t_irc_server *server, char *entire_line,
char *host, char *command, char *arguments)
irc_protocol_recv_command (struct t_irc_server *server, const char *entire_line,
const char *host, const char *command,
const char *arguments)
{
int i, cmd_found, return_code, argc, decode_color;
char *pos, *nick;
char *dup_entire_line, *dup_host, *dup_arguments, *irc_message;
t_irc_recv_func *cmd_recv_func;
char *cmd_name, **argv, **argv_eol;
const char *cmd_name;
char **argv, **argv_eol;
struct t_irc_protocol_msg irc_protocol_messages[] =
{ { "error", N_("error received from IRC server"), 1, &irc_protocol_cmd_error },
{ "invite", N_("invite a nick on a channel"), 1, &irc_protocol_cmd_invite },
+4 -3
View File
@@ -44,7 +44,7 @@
struct t_irc_server;
typedef int (t_irc_recv_func)(struct t_irc_server *server, char *comand,
typedef int (t_irc_recv_func)(struct t_irc_server *server, const char *comand,
int argc, char **argv, char **argv_eol);
struct t_irc_protocol_msg
@@ -56,7 +56,8 @@ struct t_irc_protocol_msg
};
extern void irc_protocol_recv_command (struct t_irc_server *server,
char *entire_line, char *host,
char *command, char *arguments);
const char *entire_line,
const char *host, const char *command,
const char *arguments);
#endif /* irc-protocol.h */
+54 -42
View File
@@ -53,7 +53,7 @@ struct t_irc_message *irc_msgq_last_msg = NULL;
*/
void
irc_server_set_addresses (struct t_irc_server *server, char *addresses)
irc_server_set_addresses (struct t_irc_server *server, const char *addresses)
{
int i;
char *pos, *error;
@@ -113,7 +113,7 @@ irc_server_set_addresses (struct t_irc_server *server, char *addresses)
*/
void
irc_server_set_nicks (struct t_irc_server *server, char *nicks)
irc_server_set_nicks (struct t_irc_server *server, const char *nicks)
{
/* free data */
if (server->nicks)
@@ -224,7 +224,7 @@ irc_server_set_with_option (struct t_irc_server *server,
*/
void
irc_server_set_nick (struct t_irc_server *server, char *nick)
irc_server_set_nick (struct t_irc_server *server, const char *nick)
{
struct t_irc_channel *ptr_channel;
@@ -323,7 +323,7 @@ irc_server_init (struct t_irc_server *server)
*/
struct t_irc_server *
irc_server_alloc (char *name)
irc_server_alloc (const char *name)
{
struct t_irc_server *new_server;
@@ -363,41 +363,51 @@ irc_server_alloc (char *name)
*/
int
irc_server_alloc_with_url (char *irc_url)
irc_server_alloc_with_url (const char *irc_url)
{
char *url, *pos_server, *pos_channel, *pos, *pos2;
char *irc_url2, *url, *pos_server, *pos_channel, *pos, *pos2;
char *password, *nick1, *nicks, *autojoin;
int ipv6, ssl, length;
struct t_irc_server *ptr_server;
irc_url2 = strdup (irc_url);
if (!irc_url2)
return 0;
ipv6 = 0;
ssl = 0;
password = NULL;
nick1 = NULL;
autojoin = NULL;
if (weechat_strncasecmp (irc_url, "irc6://", 7) == 0)
if (weechat_strncasecmp (irc_url2, "irc6://", 7) == 0)
{
pos = irc_url + 7;
pos = irc_url2 + 7;
ipv6 = 1;
}
else if (weechat_strncasecmp (irc_url, "ircs://", 7) == 0)
else if (weechat_strncasecmp (irc_url2, "ircs://", 7) == 0)
{
pos = irc_url + 7;
pos = irc_url2 + 7;
ssl = 1;
}
else if ((weechat_strncasecmp (irc_url, "irc6s://", 8) == 0)
|| (weechat_strncasecmp (irc_url, "ircs6://", 8) == 0))
else if ((weechat_strncasecmp (irc_url2, "irc6s://", 8) == 0)
|| (weechat_strncasecmp (irc_url2, "ircs6://", 8) == 0))
{
pos = irc_url + 8;
pos = irc_url2 + 8;
ipv6 = 1;
ssl = 1;
}
else if (weechat_strncasecmp (irc_url, "irc://", 6) == 0)
else if (weechat_strncasecmp (irc_url2, "irc://", 6) == 0)
{
pos = irc_url + 6;
pos = irc_url2 + 6;
}
else
{
free (irc_url2);
return 0;
}
free (irc_url2);
url = strdup (pos);
pos_server = strchr (url, '@');
@@ -487,8 +497,8 @@ irc_server_alloc_with_url (char *irc_url)
*/
void
irc_server_outqueue_add (struct t_irc_server *server, char *msg1, char *msg2,
int modified)
irc_server_outqueue_add (struct t_irc_server *server, const char *msg1,
const char *msg2, int modified)
{
struct t_irc_outqueue *new_outqueue;
@@ -657,12 +667,12 @@ irc_server_free_all ()
*/
struct t_irc_server *
irc_server_new (char *name, int autoconnect, int autoreconnect,
int autoreconnect_delay, int temp_server, char *addresses,
int ipv6, int ssl, char *password, char *nicks,
char *username, char *realname, char *local_hostname,
char *command, int command_delay, char *autojoin,
int autorejoin, char *notify_levels)
irc_server_new (const char *name, int autoconnect, int autoreconnect,
int autoreconnect_delay, int temp_server, const char *addresses,
int ipv6, int ssl, const char *password, const char *nicks,
const char *username, const char *realname, const char *local_hostname,
const char *command, int command_delay, const char *autojoin,
int autorejoin, const char *notify_levels)
{
struct t_irc_server *new_server;
@@ -725,7 +735,7 @@ irc_server_new (char *name, int autoconnect, int autoreconnect,
*/
struct t_irc_server *
irc_server_duplicate (struct t_irc_server *server, char *new_name)
irc_server_duplicate (struct t_irc_server *server, const char *new_name)
{
struct t_irc_server *new_server;
@@ -762,7 +772,7 @@ irc_server_duplicate (struct t_irc_server *server, char *new_name)
*/
int
irc_server_rename (struct t_irc_server *server, char *new_name)
irc_server_rename (struct t_irc_server *server, const char *new_name)
{
int length;
char *option_name, *name, *pos_option;
@@ -820,7 +830,7 @@ irc_server_rename (struct t_irc_server *server, char *new_name)
*/
int
irc_server_send (struct t_irc_server *server, char *buffer, int size_buf)
irc_server_send (struct t_irc_server *server, const char *buffer, int size_buf)
{
int rc;
@@ -912,10 +922,10 @@ irc_server_outqueue_send (struct t_irc_server *server)
*/
void
irc_server_parse_message (char *message, char **nick, char **host,
irc_server_parse_message (const char *message, char **nick, char **host,
char **command, char **channel, char **arguments)
{
char *pos, *pos2, *pos3, *pos4;
const char *pos, *pos2, *pos3, *pos4;
if (nick)
*nick = NULL;
@@ -1029,10 +1039,11 @@ irc_server_parse_message (char *message, char **nick, char **host,
*/
int
irc_server_send_one_msg (struct t_irc_server *server, char *message)
irc_server_send_one_msg (struct t_irc_server *server, const char *message)
{
static char buffer[4096];
char *new_msg, *ptr_msg, *pos, *nick, *command, *channel;
const char *ptr_msg;
char *new_msg, *pos, *nick, *command, *channel;
char *ptr_chan_nick, *msg_encoded;
char str_modifier[64], modifier_data[256];
int rc, queue, first_message;
@@ -1160,7 +1171,7 @@ irc_server_send_one_msg (struct t_irc_server *server, char *message)
*/
void
irc_server_sendf (struct t_irc_server *server, char *format, ...)
irc_server_sendf (struct t_irc_server *server, const char *format, ...)
{
va_list args;
static char buffer[4096];
@@ -1189,7 +1200,7 @@ irc_server_sendf (struct t_irc_server *server, char *format, ...)
*/
void
irc_server_msgq_add_msg (struct t_irc_server *server, char *msg)
irc_server_msgq_add_msg (struct t_irc_server *server, const char *msg)
{
struct t_irc_message *message;
@@ -1246,7 +1257,7 @@ irc_server_msgq_add_msg (struct t_irc_server *server, char *msg)
*/
void
irc_server_msgq_add_unterminated (struct t_irc_server *server, char *string)
irc_server_msgq_add_unterminated (struct t_irc_server *server, const char *string)
{
if (!string[0])
return;
@@ -1285,7 +1296,7 @@ irc_server_msgq_add_unterminated (struct t_irc_server *server, char *string)
*/
void
irc_server_msgq_add_buffer (struct t_irc_server *server, char *buffer)
irc_server_msgq_add_buffer (struct t_irc_server *server, const char *buffer)
{
char *pos_cr, *pos_lf;
@@ -2135,7 +2146,7 @@ irc_server_autojoin_channels (struct t_irc_server *server)
*/
struct t_irc_server *
irc_server_search (char *server_name)
irc_server_search (const char *server_name)
{
struct t_irc_server *ptr_server;
@@ -2286,7 +2297,7 @@ irc_server_check_away ()
*/
void
irc_server_set_away (struct t_irc_server *server, char *nick, int is_away)
irc_server_set_away (struct t_irc_server *server, const char *nick, int is_away)
{
struct t_irc_channel *ptr_channel;
@@ -2364,8 +2375,8 @@ irc_server_set_default_notify_level (struct t_irc_server *server, int notify)
*/
int
irc_server_xfer_send_ready_cb (void *data, char *signal, char *type_data,
void *signal_data)
irc_server_xfer_send_ready_cb (void *data, const char *signal,
const char *type_data, void *signal_data)
{
struct t_plugin_infolist *infolist;
struct t_irc_server *server, *ptr_server;
@@ -2437,8 +2448,8 @@ irc_server_xfer_send_ready_cb (void *data, char *signal, char *type_data,
*/
int
irc_server_xfer_resume_ready_cb (void *data, char *signal, char *type_data,
void *signal_data)
irc_server_xfer_resume_ready_cb (void *data, const char *signal,
const char *type_data, void *signal_data)
{
struct t_plugin_infolist *infolist;
struct t_irc_server *server, *ptr_server;
@@ -2493,8 +2504,9 @@ irc_server_xfer_resume_ready_cb (void *data, char *signal, char *type_data,
*/
int
irc_server_xfer_send_accept_resume_cb (void *data, char *signal,
char *type_data, void *signal_data)
irc_server_xfer_send_accept_resume_cb (void *data, const char *signal,
const char *type_data,
void *signal_data)
{
struct t_plugin_infolist *infolist;
struct t_irc_server *server, *ptr_server;
+23 -23
View File
@@ -137,41 +137,41 @@ extern struct t_irc_message *irc_recv_msgq, *irc_msgq_last_msg;
extern void irc_server_set_addresses (struct t_irc_server *server,
char *addresses);
extern void irc_server_set_nicks (struct t_irc_server *server, char *nicks);
const char *addresses);
extern void irc_server_set_nicks (struct t_irc_server *server, const char *nicks);
extern void irc_server_set_with_option (struct t_irc_server *server,
int index_option,
struct t_config_option *option);
extern void irc_server_init (struct t_irc_server *server);
extern struct t_irc_server *irc_server_alloc (char *name);
extern int irc_server_alloc_with_url (char *irc_url);
extern struct t_irc_server *irc_server_new (char *name, int autoconnect,
extern struct t_irc_server *irc_server_alloc (const char *name);
extern int irc_server_alloc_with_url (const char *irc_url);
extern struct t_irc_server *irc_server_new (const char *name, int autoconnect,
int autoreconnect,
int autoreconnect_delay,
int temp_server, char *addresses,
int temp_server, const char *addresses,
int ipv6, int ssl,
char *password, char *nicks,
char *username, char *realname,
char *hostname, char *command,
int command_delay, char *autojoin,
const char *password, const char *nicks,
const char *username, const char *realname,
const char *hostname, const char *command,
int command_delay, const char *autojoin,
int autorejoin,
char *notify_levels);
const 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 void irc_server_set_nick (struct t_irc_server *server, char *nick);
extern struct t_irc_server *irc_server_search (char *server_name);
const char *new_name);
extern int irc_server_rename (struct t_irc_server *server, const char *new_name);
extern void irc_server_set_nick (struct t_irc_server *server, const char *nick);
extern struct t_irc_server *irc_server_search (const char *server_name);
extern void irc_server_free_all ();
extern int irc_server_connect (struct t_irc_server *server,
int disable_autojoin);
extern void irc_server_auto_connect (int auto_connect, int temp_server);
extern void irc_server_autojoin_channels ();
extern int irc_server_timer_cb (void *data);
extern void irc_server_sendf (struct t_irc_server *server, char *format, ...);
extern void irc_server_sendf (struct t_irc_server *server, const char *format, ...);
extern void irc_server_outqueue_free_all (struct t_irc_server *server);
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_set_away (struct t_irc_server *server, char *nick,
extern void irc_server_set_away (struct t_irc_server *server, const char *nick,
int is_away);
extern void irc_server_remove_away ();
extern void irc_server_check_away ();
@@ -180,12 +180,12 @@ extern void irc_server_disconnect (struct t_irc_server *server, int reconnect);
extern void irc_server_disconnect_all ();
extern void irc_server_free (struct t_irc_server *server);
extern void irc_server_free_data (struct t_irc_server *server);
extern int irc_server_xfer_send_ready_cb (void *data, char *signal,
char *type_data, void *signal_data);
extern int irc_server_xfer_resume_ready_cb (void *data, char *signal,
char *type_data, void *signal_data);
extern int irc_server_xfer_send_accept_resume_cb (void *data, char *signal,
char *type_data,
extern int irc_server_xfer_send_ready_cb (void *data, const char *signal,
const char *type_data, void *signal_data);
extern int irc_server_xfer_resume_ready_cb (void *data, const char *signal,
const char *type_data, void *signal_data);
extern int irc_server_xfer_send_accept_resume_cb (void *data, const char *signal,
const char *type_data,
void *signal_data);
extern void irc_server_print_log ();
+1 -1
View File
@@ -51,7 +51,7 @@ struct t_hook *irc_hook_timer_check_away = NULL;
*/
int
irc_signal_quit_cb (void *data, char *signal, char *type_data,
irc_signal_quit_cb (void *data, const char *signal, const char *type_data,
void *signal_data)
{
struct t_irc_server *ptr_server;