mirror of
https://github.com/weechat/weechat.git
synced 2026-06-29 14:26:39 +02:00
added /upgrade command, added ETA for DCC files
This commit is contained in:
@@ -1,10 +1,12 @@
|
||||
WeeChat - Wee Enhanced Environment for Chat
|
||||
===========================================
|
||||
|
||||
ChangeLog - 2005-11-29
|
||||
ChangeLog - 2005-12-06
|
||||
|
||||
|
||||
Version 0.1.7 (under dev!):
|
||||
* added /upgrade command
|
||||
* added ETA (Estimated Time of Arrival) for DCC files
|
||||
* /nick command is now allowed when not connected to server
|
||||
* added server/channel arg to /buffer command for jumping to buffer
|
||||
* fixed display bug in chat window when a message length equals to window
|
||||
|
||||
@@ -35,7 +35,7 @@
|
||||
|
||||
@title WeeChat - User guide
|
||||
@subtitle Fast, light and extensible IRC client
|
||||
@subtitle Documentation for WeeChat v0.1.7-cvs - November, 29 2005
|
||||
@subtitle Documentation for WeeChat v0.1.7-cvs - December, 6 2005
|
||||
|
||||
@author FlashCode <@email{flashcode@@flashtux.org, flashcode AT flashtux.org}>
|
||||
|
||||
@@ -1045,6 +1045,10 @@ channel: name of channel for unignore@*
|
||||
For each argument, '*' means all.@*
|
||||
Without argument, /unignore command lists all defined ignore.@*
|
||||
@*
|
||||
@item upgrade
|
||||
@*
|
||||
upgrade WeeChat without disconnecting from servers@*
|
||||
@*
|
||||
@item uptime [-o]
|
||||
@*
|
||||
show WeeChat uptime@*
|
||||
|
||||
@@ -36,7 +36,7 @@
|
||||
|
||||
@title WeeChat - Gui@'on de usuario.
|
||||
@subtitle Cliente IRC r@'apido, peque@~no y extensible
|
||||
@subtitle Documentaci@'on para WeeChat v0.1.7-cvs - 29 de noviembre de 2005
|
||||
@subtitle Documentaci@'on para WeeChat v0.1.7-cvs - 6 de diciembre de 2005
|
||||
|
||||
@author FlashCode <@email{flashcode@@flashtux.org, flashcode AT flashtux.org}>
|
||||
|
||||
@@ -1045,6 +1045,10 @@ channel: name of channel for unignore@*
|
||||
For each argument, '*' means all.@*
|
||||
Without argument, /unignore command lists all defined ignore.@*
|
||||
@*
|
||||
@item upgrade
|
||||
@*
|
||||
upgrade WeeChat without disconnecting from servers@*
|
||||
@*
|
||||
@item uptime [-o]
|
||||
@*
|
||||
show WeeChat uptime@*
|
||||
|
||||
@@ -36,7 +36,7 @@
|
||||
|
||||
@title WeeChat - Guide utilisateur
|
||||
@subtitle Client IRC rapide, l@'eger et extensible
|
||||
@subtitle Documentation pour WeeChat v0.1.7-cvs - 29 novembre 2005
|
||||
@subtitle Documentation pour WeeChat v0.1.7-cvs - 6 decembre 2005
|
||||
|
||||
@author FlashCode <@email{flashcode@@flashtux.org, flashcode AT flashtux.org}>
|
||||
|
||||
@@ -1046,6 +1046,10 @@ commande: commande IRC@*
|
||||
Pour chaque param@`etre, '*' signifie tou(te)s.@*
|
||||
Sans param@`etre, /ignore liste les ignore d@'efinis.@*
|
||||
@*
|
||||
@item upgrade
|
||||
@*
|
||||
mettre @`a jour WeeChat sans se d@'econnecter des serveurs@*
|
||||
@*
|
||||
@item uptime [-o]
|
||||
@*
|
||||
montrer l'uptime de WeeChat@*
|
||||
|
||||
@@ -36,7 +36,7 @@
|
||||
|
||||
@title WeeChat - Guia do Utilizador
|
||||
@subtitle Cliente de IRC rapido, leve e extencivel
|
||||
@subtitle Documenta@,{c}@~ao do WeeChat v0.1.7-cvs - 29 de novembro de 2005
|
||||
@subtitle Documenta@,{c}@~ao do WeeChat v0.1.7-cvs - 6 de dezembro de 2005
|
||||
|
||||
@author FlashCode <@email{flashcode@@flashtux.org, flashcode AT flashtux.org}>
|
||||
|
||||
@@ -1043,6 +1043,10 @@ channel: name of channel for unignore@*
|
||||
For each argument, '*' means all.@*
|
||||
Without argument, /unignore command lists all defined ignore.@*
|
||||
@*
|
||||
@item upgrade
|
||||
@*
|
||||
upgrade WeeChat without disconnecting from servers@*
|
||||
@*
|
||||
@item uptime [-o]
|
||||
@*
|
||||
show WeeChat uptime@*
|
||||
|
||||
@@ -34,6 +34,8 @@
|
||||
./src/common/hotlist.h
|
||||
./src/common/log.c
|
||||
./src/common/log.h
|
||||
./src/common/session.c
|
||||
./src/common/session.h
|
||||
./src/common/utf8.c
|
||||
./src/common/utf8.h
|
||||
./src/common/weechat.c
|
||||
|
||||
+1018
-673
File diff suppressed because it is too large
Load Diff
@@ -37,5 +37,7 @@ lib_weechat_main_a_SOURCES = weechat.c \
|
||||
log.h \
|
||||
fifo.c \
|
||||
fifo.h \
|
||||
session.c \
|
||||
session.h \
|
||||
utf8.c \
|
||||
utf8.h
|
||||
|
||||
+103
-10
@@ -24,6 +24,7 @@
|
||||
#include "config.h"
|
||||
#endif
|
||||
|
||||
#include <unistd.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
|
||||
@@ -31,6 +32,7 @@
|
||||
#include "command.h"
|
||||
#include "weelist.h"
|
||||
#include "weeconfig.h"
|
||||
#include "session.h"
|
||||
#include "../irc/irc.h"
|
||||
#include "../gui/gui.h"
|
||||
#include "../plugins/plugins.h"
|
||||
@@ -77,8 +79,7 @@ t_weechat_command weechat_commands[] =
|
||||
{ "history", N_("show buffer command history"),
|
||||
N_("[clear | value]"),
|
||||
N_("clear: clear history\n"
|
||||
"value: number of history entries to show"
|
||||
),
|
||||
"value: number of history entries to show"),
|
||||
0, 1, weechat_cmd_history, NULL },
|
||||
{ "ignore", N_("ignore IRC messages and/or hosts"),
|
||||
N_("[mask [[type | command] [channel [server]]]]"),
|
||||
@@ -143,6 +144,10 @@ t_weechat_command weechat_commands[] =
|
||||
"For each argument, '*' means all.\n"
|
||||
"Without argument, /unignore command lists all defined ignore."),
|
||||
0, 4, weechat_cmd_unignore, NULL },
|
||||
{ "upgrade", N_("upgrade WeeChat without disconnecting from servers"),
|
||||
"",
|
||||
"",
|
||||
0, 0, weechat_cmd_upgrade, NULL },
|
||||
{ "uptime", N_("show WeeChat uptime"),
|
||||
N_("[-o]"),
|
||||
N_("-o: send uptime on current channel as an IRC message"),
|
||||
@@ -760,7 +765,7 @@ user_command (t_irc_server *server, t_gui_buffer *buffer, char *command)
|
||||
command_with_colors2 = (command_with_colors) ?
|
||||
(char *)gui_color_decode ((unsigned char *)command_with_colors, 1) : NULL;
|
||||
|
||||
if (CHANNEL(buffer)->type == CHAT_PRIVATE)
|
||||
if (CHANNEL(buffer)->type == CHANNEL_TYPE_PRIVATE)
|
||||
{
|
||||
gui_printf_type (CHANNEL(buffer)->buffer,
|
||||
MSG_TYPE_NICK,
|
||||
@@ -937,11 +942,17 @@ weechat_cmd_buffer_display_info (t_gui_buffer *buffer)
|
||||
if (buffer->dcc)
|
||||
gui_printf (NULL, "%sDCC\n",
|
||||
GUI_COLOR(COLOR_WIN_CHAT_CHANNEL));
|
||||
else if (BUFFER_IS_SERVER (buffer))
|
||||
gui_printf (NULL, _("%sServer: %s%s\n"),
|
||||
GUI_COLOR(COLOR_WIN_CHAT),
|
||||
GUI_COLOR(COLOR_WIN_CHAT_SERVER),
|
||||
SERVER(buffer)->name);
|
||||
else if (BUFFER_IS_SERVER(buffer))
|
||||
{
|
||||
if (SERVER(buffer))
|
||||
gui_printf (NULL, _("%sServer: %s%s\n"),
|
||||
GUI_COLOR(COLOR_WIN_CHAT),
|
||||
GUI_COLOR(COLOR_WIN_CHAT_SERVER),
|
||||
SERVER(buffer)->name);
|
||||
else
|
||||
gui_printf (NULL, _("%snot connected\n"),
|
||||
GUI_COLOR(COLOR_WIN_CHAT));
|
||||
}
|
||||
else if (BUFFER_IS_CHANNEL (buffer))
|
||||
gui_printf (NULL, _("%sChannel: %s%s %s(server: %s%s%s)\n"),
|
||||
GUI_COLOR(COLOR_WIN_CHAT),
|
||||
@@ -961,7 +972,8 @@ weechat_cmd_buffer_display_info (t_gui_buffer *buffer)
|
||||
SERVER(buffer)->name,
|
||||
GUI_COLOR(COLOR_WIN_CHAT));
|
||||
else
|
||||
gui_printf (NULL, _("not connected\n"));
|
||||
gui_printf (NULL, _("%sunknown\n"),
|
||||
GUI_COLOR(COLOR_WIN_CHAT));
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -1384,7 +1396,7 @@ weechat_cmd_debug (int argc, char **argv)
|
||||
|
||||
if (ascii_strcasecmp (argv[0], "dump") == 0)
|
||||
{
|
||||
wee_dump (0);
|
||||
weechat_dump (0);
|
||||
}
|
||||
else if (ascii_strcasecmp (argv[0], "windows") == 0)
|
||||
{
|
||||
@@ -2794,6 +2806,87 @@ weechat_cmd_unignore (int argc, char **argv)
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*
|
||||
* weechat_cmd_upgrade: upgrade WeeChat
|
||||
*/
|
||||
|
||||
int
|
||||
weechat_cmd_upgrade (int argc, char **argv)
|
||||
{
|
||||
t_irc_server *ptr_server;
|
||||
int filename_length;
|
||||
char *filename;
|
||||
char *exec_args[5] = { NULL, "-a", "--session", NULL, NULL };
|
||||
|
||||
/* make gcc happy */
|
||||
(void) argc;
|
||||
(void) argv;
|
||||
|
||||
for (ptr_server = irc_servers; ptr_server;
|
||||
ptr_server = ptr_server->next_server)
|
||||
{
|
||||
if (ptr_server->child_pid != 0)
|
||||
{
|
||||
irc_display_prefix (NULL, gui_current_window->buffer, PREFIX_ERROR);
|
||||
gui_printf_nolog (NULL,
|
||||
_("%s can't upgrade: connection to at least "
|
||||
"one server is pending"),
|
||||
WEECHAT_ERROR);
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
||||
filename_length = strlen (weechat_home) + strlen (WEECHAT_SESSION_NAME) + 2;
|
||||
filename = (char *) malloc (filename_length * sizeof (char));
|
||||
if (!filename)
|
||||
return -2;
|
||||
snprintf (filename, filename_length, "%s%s" WEECHAT_SESSION_NAME,
|
||||
weechat_home, DIR_SEPARATOR);
|
||||
|
||||
irc_display_prefix (NULL, NULL, PREFIX_INFO);
|
||||
gui_printf_nolog (NULL, _("Upgrading WeeChat...\n"));
|
||||
|
||||
if (!session_save (filename))
|
||||
{
|
||||
free (filename);
|
||||
irc_display_prefix (NULL, NULL, PREFIX_ERROR);
|
||||
gui_printf_nolog (NULL,
|
||||
_("%s unable to save session in file\n"),
|
||||
WEECHAT_ERROR);
|
||||
return -1;
|
||||
}
|
||||
|
||||
exec_args[0] = strdup (weechat_argv0);
|
||||
exec_args[3] = strdup (filename);
|
||||
|
||||
/* unload plugins, save config, then upgrade */
|
||||
#ifdef PLUGINS
|
||||
plugin_end ();
|
||||
#endif
|
||||
(void) config_write (NULL);
|
||||
gui_end ();
|
||||
|
||||
execvp (exec_args[0], exec_args);
|
||||
|
||||
/* this code should not be reached if execvp is ok */
|
||||
#ifdef PLUGINS
|
||||
plugin_init (1);
|
||||
#endif
|
||||
|
||||
fprintf (stderr, _("%s exec failed (program: \"%s\"), exiting WeeChat\n"),
|
||||
WEECHAT_ERROR,
|
||||
exec_args[0]);
|
||||
|
||||
free (exec_args[0]);
|
||||
free (exec_args[3]);
|
||||
free (filename);
|
||||
|
||||
weechat_shutdown (EXIT_FAILURE, 0);
|
||||
|
||||
/* never executed */
|
||||
return -1;
|
||||
}
|
||||
|
||||
/*
|
||||
* weechat_cmd_uptime: display WeeChat uptime
|
||||
*/
|
||||
|
||||
@@ -81,6 +81,7 @@ extern int weechat_cmd_server (int, char **);
|
||||
extern int weechat_cmd_set (char *);
|
||||
extern int weechat_cmd_unalias (char *);
|
||||
extern int weechat_cmd_unignore (int, char **);
|
||||
extern int weechat_cmd_upgrade (int, char **);
|
||||
extern int weechat_cmd_uptime (int, char **);
|
||||
extern int weechat_cmd_window (int, char **);
|
||||
|
||||
|
||||
@@ -250,7 +250,7 @@ completion_build_list (t_completion *completion, void *channel)
|
||||
"*");
|
||||
if (channel)
|
||||
{
|
||||
if (((t_irc_channel *)channel)->type == CHAT_CHANNEL)
|
||||
if (((t_irc_channel *)channel)->type == CHANNEL_TYPE_CHANNEL)
|
||||
{
|
||||
for (ptr_nick = ((t_irc_channel *)channel)->nicks; ptr_nick;
|
||||
ptr_nick = ptr_nick->next_nick)
|
||||
@@ -260,7 +260,7 @@ completion_build_list (t_completion *completion, void *channel)
|
||||
ptr_nick->nick);
|
||||
}
|
||||
}
|
||||
if (((t_irc_channel *)channel)->type == CHAT_PRIVATE)
|
||||
if (((t_irc_channel *)channel)->type == CHANNEL_TYPE_PRIVATE)
|
||||
{
|
||||
weelist_add (&completion->completion_list,
|
||||
&completion->last_completion,
|
||||
@@ -302,7 +302,7 @@ completion_build_list (t_completion *completion, void *channel)
|
||||
weelist_add(&completion->completion_list,
|
||||
&completion->last_completion,
|
||||
"*");
|
||||
if (((t_irc_channel *)channel)->type == CHAT_CHANNEL)
|
||||
if (((t_irc_channel *)channel)->type == CHANNEL_TYPE_CHANNEL)
|
||||
weelist_add(&completion->completion_list,
|
||||
&completion->last_completion,
|
||||
((t_irc_channel *)channel)->name);
|
||||
@@ -822,7 +822,7 @@ completion_find_context (t_completion *completion, void *channel, char *buffer,
|
||||
}
|
||||
|
||||
if (!completion->completion_list && channel &&
|
||||
(((t_irc_channel *)channel)->type == CHAT_PRIVATE)
|
||||
(((t_irc_channel *)channel)->type == CHANNEL_TYPE_PRIVATE)
|
||||
&& (completion->context == COMPLETION_NICK))
|
||||
{
|
||||
/* nick completion in private (only other nick and self) */
|
||||
@@ -1017,7 +1017,7 @@ completion_nick (t_completion *completion, t_irc_channel *channel)
|
||||
if (!channel)
|
||||
return;
|
||||
|
||||
if (((t_irc_channel *)channel)->type == CHAT_PRIVATE)
|
||||
if (((t_irc_channel *)channel)->type == CHANNEL_TYPE_PRIVATE)
|
||||
{
|
||||
completion_command_arg (completion, channel, 1);
|
||||
return;
|
||||
|
||||
+9
-8
@@ -70,8 +70,9 @@ fifo_create ()
|
||||
gui_printf (NULL,
|
||||
_("%s unable to create FIFO pipe for remote control (%s)\n"),
|
||||
WEECHAT_ERROR, weechat_fifo_filename);
|
||||
wee_log_printf (_("%s unable to create FIFO pipe for remote control (%s)\n"),
|
||||
WEECHAT_ERROR, weechat_fifo_filename);
|
||||
weechat_log_printf (_("%s unable to create FIFO pipe for "
|
||||
"remote control (%s)\n"),
|
||||
WEECHAT_ERROR, weechat_fifo_filename);
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -81,12 +82,12 @@ fifo_create ()
|
||||
gui_printf (NULL,
|
||||
_("%s unable to open FIFO pipe (%s) for reading\n"),
|
||||
WEECHAT_ERROR, weechat_fifo_filename);
|
||||
wee_log_printf (_("%s unable to open FIFO pipe (%s) for reading\n"),
|
||||
WEECHAT_ERROR, weechat_fifo_filename);
|
||||
weechat_log_printf (_("%s unable to open FIFO pipe (%s) for reading\n"),
|
||||
WEECHAT_ERROR, weechat_fifo_filename);
|
||||
return;
|
||||
}
|
||||
|
||||
wee_log_printf (_("FIFO pipe is open\n"));
|
||||
weechat_log_printf (_("FIFO pipe is open\n"));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -249,8 +250,8 @@ fifo_read ()
|
||||
gui_printf (NULL,
|
||||
_("%s error reading FIFO pipe, closing it\n"),
|
||||
WEECHAT_ERROR);
|
||||
wee_log_printf (_("%s error reading FIFO pipe, closing it\n"),
|
||||
WEECHAT_ERROR);
|
||||
weechat_log_printf (_("%s error reading FIFO pipe, closing it\n"),
|
||||
WEECHAT_ERROR);
|
||||
fifo_remove ();
|
||||
}
|
||||
else
|
||||
@@ -291,5 +292,5 @@ fifo_remove ()
|
||||
weechat_fifo_filename = NULL;
|
||||
}
|
||||
|
||||
wee_log_printf (_("FIFO pipe is closed\n"));
|
||||
weechat_log_printf (_("FIFO pipe is closed\n"));
|
||||
}
|
||||
|
||||
+50
-42
@@ -66,19 +66,63 @@ history_hide_password (char *string)
|
||||
}
|
||||
|
||||
/*
|
||||
* history_add: add a text/command to history
|
||||
* history_buffer_add: add a text/command to buffer's history
|
||||
*/
|
||||
|
||||
void
|
||||
history_add (void *buffer, char *string)
|
||||
history_buffer_add (void *buffer, char *string)
|
||||
{
|
||||
t_history *new_history, *ptr_history;
|
||||
|
||||
if ( !((t_gui_buffer *)(buffer))->history
|
||||
|| ( ((t_gui_buffer *)(buffer))->history
|
||||
&& ascii_strcasecmp (((t_gui_buffer *)(buffer))->history->text, string) != 0))
|
||||
{
|
||||
new_history = (t_history *)malloc (sizeof (t_history));
|
||||
if (new_history)
|
||||
{
|
||||
new_history->text = strdup (string);
|
||||
if (cfg_log_hide_nickserv_pwd)
|
||||
history_hide_password (new_history->text);
|
||||
|
||||
if (((t_gui_buffer *)(buffer))->history)
|
||||
((t_gui_buffer *)(buffer))->history->prev_history = new_history;
|
||||
else
|
||||
((t_gui_buffer *)(buffer))->last_history = new_history;
|
||||
new_history->next_history = ((t_gui_buffer *)(buffer))->history;
|
||||
new_history->prev_history = NULL;
|
||||
((t_gui_buffer *)buffer)->history = new_history;
|
||||
((t_gui_buffer *)buffer)->num_history++;
|
||||
|
||||
/* remove one command if necessary */
|
||||
if ((cfg_history_max_commands > 0)
|
||||
&& (((t_gui_buffer *)(buffer))->num_history > cfg_history_max_commands))
|
||||
{
|
||||
ptr_history = ((t_gui_buffer *)buffer)->last_history->prev_history;
|
||||
((t_gui_buffer *)buffer)->last_history->prev_history->next_history = NULL;
|
||||
if (((t_gui_buffer *)buffer)->last_history->text)
|
||||
free (((t_gui_buffer *)buffer)->last_history->text);
|
||||
free (((t_gui_buffer *)buffer)->last_history);
|
||||
((t_gui_buffer *)buffer)->last_history = ptr_history;
|
||||
((t_gui_buffer *)(buffer))->num_history++;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* history_global_add: add a text/command to buffer's history
|
||||
*/
|
||||
|
||||
void
|
||||
history_global_add (char *string)
|
||||
{
|
||||
t_history *new_history, *ptr_history;
|
||||
|
||||
if ( !history_global
|
||||
|| ( history_global
|
||||
&& ascii_strcasecmp (history_global->text, string) != 0))
|
||||
if (!history_global
|
||||
|| (history_global
|
||||
&& ascii_strcasecmp (history_global->text, string) != 0))
|
||||
{
|
||||
/* add history to global history */
|
||||
new_history = (t_history *)malloc (sizeof (t_history));
|
||||
if (new_history)
|
||||
{
|
||||
@@ -109,42 +153,6 @@ history_add (void *buffer, char *string)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if ( !((t_gui_buffer *)(buffer))->history
|
||||
|| ( ((t_gui_buffer *)(buffer))->history
|
||||
&& ascii_strcasecmp (((t_gui_buffer *)(buffer))->history->text, string) != 0))
|
||||
{
|
||||
/* add history to local history */
|
||||
new_history = (t_history *)malloc (sizeof (t_history));
|
||||
if (new_history)
|
||||
{
|
||||
new_history->text = strdup (string);
|
||||
if (cfg_log_hide_nickserv_pwd)
|
||||
history_hide_password (new_history->text);
|
||||
|
||||
if (((t_gui_buffer *)(buffer))->history)
|
||||
((t_gui_buffer *)(buffer))->history->prev_history = new_history;
|
||||
else
|
||||
((t_gui_buffer *)(buffer))->last_history = new_history;
|
||||
new_history->next_history = ((t_gui_buffer *)(buffer))->history;
|
||||
new_history->prev_history = NULL;
|
||||
((t_gui_buffer *)buffer)->history = new_history;
|
||||
((t_gui_buffer *)(buffer))->num_history++;
|
||||
|
||||
/* remove one command if necessary */
|
||||
if ((cfg_history_max_commands > 0)
|
||||
&& (((t_gui_buffer *)(buffer))->num_history > cfg_history_max_commands))
|
||||
{
|
||||
ptr_history = ((t_gui_buffer *)buffer)->last_history->prev_history;
|
||||
((t_gui_buffer *)buffer)->last_history->prev_history->next_history = NULL;
|
||||
if (((t_gui_buffer *)buffer)->last_history->text)
|
||||
free (((t_gui_buffer *)buffer)->last_history->text);
|
||||
free (((t_gui_buffer *)buffer)->last_history);
|
||||
((t_gui_buffer *)buffer)->last_history = ptr_history;
|
||||
((t_gui_buffer *)(buffer))->num_history++;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
|
||||
@@ -34,7 +34,8 @@ extern t_history *history_global;
|
||||
extern t_history *history_global_last;
|
||||
extern t_history *history_global_ptr;
|
||||
|
||||
extern void history_add (void *, char *);
|
||||
extern void history_buffer_add (void *, char *);
|
||||
extern void history_global_add (char *);
|
||||
extern void history_global_free ();
|
||||
extern void history_buffer_free (void *);
|
||||
|
||||
|
||||
+2
-2
@@ -120,7 +120,7 @@ log_start (t_gui_buffer *buffer)
|
||||
buffer->log_filename = (char *) malloc (length);
|
||||
if (!buffer->log_filename)
|
||||
{
|
||||
wee_log_printf (_("Not enough memory to write log file for a buffer\n"));
|
||||
weechat_log_printf (_("Not enough memory to write log file for a buffer\n"));
|
||||
return;
|
||||
}
|
||||
if (cfg_log_path[0] == '~')
|
||||
@@ -148,7 +148,7 @@ log_start (t_gui_buffer *buffer)
|
||||
buffer->log_file = fopen (buffer->log_filename, "a");
|
||||
if (!buffer->log_file)
|
||||
{
|
||||
wee_log_printf (_("Unable to write log file for a buffer\n"));
|
||||
weechat_log_printf (_("Unable to write log file for a buffer\n"));
|
||||
free (buffer->log_filename);
|
||||
return;
|
||||
}
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,169 @@
|
||||
/*
|
||||
* Copyright (c) 2003-2005 by FlashCode <flashcode@flashtux.org>
|
||||
* See README for License detail, AUTHORS for developers list.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*/
|
||||
|
||||
|
||||
#ifndef __WEECHAT_SESSION_H
|
||||
#define __WEECHAT_SESSION_H 1
|
||||
|
||||
#define WEECHAT_SESSION_NAME "weechat_session.bin"
|
||||
|
||||
#define SESSION_SIGNATURE "== WeeChat Upgrade file v1.0 - binary, do not edit! =="
|
||||
|
||||
/* For developers: please add new values ONLY AT THE END of enums */
|
||||
|
||||
enum t_session_type
|
||||
{
|
||||
SESSION_TYPE_INT = 0,
|
||||
SESSION_TYPE_STR,
|
||||
SESSION_TYPE_BUF
|
||||
};
|
||||
|
||||
enum t_session_object
|
||||
{
|
||||
SESSION_OBJ_END = 0,
|
||||
SESSION_OBJ_SERVER,
|
||||
SESSION_OBJ_CHANNEL,
|
||||
SESSION_OBJ_NICK,
|
||||
SESSION_OBJ_DCC,
|
||||
SESSION_OBJ_HISTORY,
|
||||
SESSION_OBJ_BUFFER,
|
||||
SESSION_OBJ_LINE,
|
||||
};
|
||||
|
||||
enum t_session_server
|
||||
{
|
||||
SESSION_SERV_END = 0,
|
||||
SESSION_SERV_NAME,
|
||||
SESSION_SERV_AUTOCONNECT,
|
||||
SESSION_SERV_AUTORECONNECT,
|
||||
SESSION_SERV_AUTORECONNECT_DELAY,
|
||||
SESSION_SERV_COMMAND_LINE,
|
||||
SESSION_SERV_ADDRESS,
|
||||
SESSION_SERV_PORT,
|
||||
SESSION_SERV_IPV6,
|
||||
SESSION_SERV_SSL,
|
||||
SESSION_SERV_PASSWORD,
|
||||
SESSION_SERV_NICK1,
|
||||
SESSION_SERV_NICK2,
|
||||
SESSION_SERV_NICK3,
|
||||
SESSION_SERV_USERNAME,
|
||||
SESSION_SERV_REALNAME,
|
||||
SESSION_SERV_COMMAND,
|
||||
SESSION_SERV_COMMAND_DELAY,
|
||||
SESSION_SERV_AUTOJOIN,
|
||||
SESSION_SERV_AUTOREJOIN,
|
||||
SESSION_SERV_NOTIFY_LEVELS,
|
||||
SESSION_SERV_CHILD_PID,
|
||||
SESSION_SERV_CHILD_READ,
|
||||
SESSION_SERV_CHILD_WRITE,
|
||||
SESSION_SERV_SOCK,
|
||||
SESSION_SERV_IS_CONNECTED,
|
||||
SESSION_SERV_SSL_CONNECTED,
|
||||
SESSION_SERV_GNUTLS_SESS,
|
||||
SESSION_SERV_UNTERMINATED_MESSAGE,
|
||||
SESSION_SERV_NICK,
|
||||
SESSION_SERV_RECONNECT_START,
|
||||
SESSION_SERV_RECONNECT_JOIN,
|
||||
SESSION_SERV_IS_AWAY,
|
||||
SESSION_SERV_AWAY_TIME,
|
||||
SESSION_SERV_LAG,
|
||||
SESSION_SERV_LAG_CHECK_TIME,
|
||||
SESSION_SERV_LAG_NEXT_CHECK
|
||||
};
|
||||
|
||||
enum t_session_channel
|
||||
{
|
||||
SESSION_CHAN_END = 0,
|
||||
SESSION_CHAN_TYPE,
|
||||
SESSION_CHAN_NAME,
|
||||
SESSION_CHAN_TOPIC,
|
||||
SESSION_CHAN_MODES,
|
||||
SESSION_CHAN_LIMIT,
|
||||
SESSION_CHAN_KEY,
|
||||
SESSION_CHAN_NICKS_COUNT,
|
||||
SESSION_CHAN_CHECKING_AWAY
|
||||
};
|
||||
|
||||
enum t_session_nick
|
||||
{
|
||||
SESSION_NICK_END = 0,
|
||||
SESSION_NICK_NICK,
|
||||
SESSION_NICK_FLAGS,
|
||||
SESSION_NICK_COLOR
|
||||
};
|
||||
|
||||
enum t_session_dcc
|
||||
{
|
||||
SESSION_DCC_END = 0,
|
||||
SESSION_DCC_SERVER,
|
||||
SESSION_DCC_CHANNEL,
|
||||
SESSION_DCC_TYPE,
|
||||
SESSION_DCC_STATUS,
|
||||
SESSION_DCC_START_TIME,
|
||||
SESSION_DCC_START_TRANSFER,
|
||||
SESSION_DCC_ADDR,
|
||||
SESSION_DCC_PORT,
|
||||
SESSION_DCC_NICK,
|
||||
SESSION_DCC_SOCK,
|
||||
SESSION_DCC_UNTERMINATED_MESSAGE,
|
||||
SESSION_DCC_FILE,
|
||||
SESSION_DCC_FILENAME,
|
||||
SESSION_DCC_LOCAL_FILENAME,
|
||||
SESSION_DCC_FILENAME_SUFFIX,
|
||||
SESSION_DCC_SIZE,
|
||||
SESSION_DCC_POS,
|
||||
SESSION_DCC_ACK,
|
||||
SESSION_DCC_START_RESUME,
|
||||
SESSION_DCC_LAST_CHECK_TIME,
|
||||
SESSION_DCC_LAST_CHECK_POS,
|
||||
SESSION_DCC_LAST_ACTIVITY,
|
||||
SESSION_DCC_BYTES_PER_SEC,
|
||||
SESSION_DCC_ETA
|
||||
};
|
||||
|
||||
enum t_session_history
|
||||
{
|
||||
SESSION_HIST_END = 0,
|
||||
SESSION_HIST_TEXT
|
||||
};
|
||||
|
||||
enum t_session_buffer
|
||||
{
|
||||
SESSION_BUFF_END = 0,
|
||||
SESSION_BUFF_SERVER,
|
||||
SESSION_BUFF_CHANNEL,
|
||||
SESSION_BUFF_DCC
|
||||
};
|
||||
|
||||
enum t_session_line
|
||||
{
|
||||
SESSION_LINE_END = 0,
|
||||
SESSION_LINE_LENGTH,
|
||||
SESSION_LINE_LENGTH_ALIGN,
|
||||
SESSION_LINE_LOG_WRITE,
|
||||
SESSION_LINE_WITH_MESSAGE,
|
||||
SESSION_LINE_WITH_HIGHLIGHT,
|
||||
SESSION_LINE_DATA,
|
||||
SESSION_LINE_OFS_AFTER_DATE
|
||||
};
|
||||
|
||||
int session_save (char *filename);
|
||||
int session_load (char *filename);
|
||||
|
||||
#endif /* session.h */
|
||||
+205
-148
@@ -65,6 +65,7 @@
|
||||
#include "command.h"
|
||||
#include "fifo.h"
|
||||
#include "utf8.h"
|
||||
#include "session.h"
|
||||
#include "../irc/irc.h"
|
||||
#include "../gui/gui.h"
|
||||
|
||||
@@ -73,6 +74,8 @@
|
||||
#endif
|
||||
|
||||
|
||||
char *weechat_argv0 = NULL; /* WeeChat binary file name (argv[0]) */
|
||||
char *weechat_session = NULL; /* WeeChat session file (for /upgrade command) */
|
||||
time_t weechat_start_time; /* WeeChat start time (used by /uptime command) */
|
||||
int quit_weechat; /* = 1 if quit request from user... why ? :'( */
|
||||
int sigsegv = 0; /* SIGSEGV received? */
|
||||
@@ -163,11 +166,11 @@ ascii_strncasecmp (char *string1, char *string2, int max)
|
||||
}
|
||||
|
||||
/*
|
||||
* wee_log_printf: displays a message in WeeChat log (~/.weechat/weechat.log)
|
||||
* weechat_log_printf: displays a message in WeeChat log (~/.weechat/weechat.log)
|
||||
*/
|
||||
|
||||
void
|
||||
wee_log_printf (char *message, ...)
|
||||
weechat_log_printf (char *message, ...)
|
||||
{
|
||||
static char buffer[4096];
|
||||
char *ptr_buffer;
|
||||
@@ -214,7 +217,7 @@ weechat_convert_encoding (char *from_code, char *to_code, char *string)
|
||||
{
|
||||
char *outbuf;
|
||||
|
||||
#ifdef HAVE_ICONV
|
||||
#ifdef HAVE_ICONV
|
||||
iconv_t cd;
|
||||
char *inbuf;
|
||||
ICONV_CONST char *ptr_inbuf;
|
||||
@@ -249,12 +252,12 @@ weechat_convert_encoding (char *from_code, char *to_code, char *string)
|
||||
}
|
||||
else
|
||||
outbuf = strdup (string);
|
||||
#else
|
||||
#else
|
||||
/* make gcc happy */
|
||||
(void) from_code;
|
||||
(void) to_code;
|
||||
outbuf = strdup (string);
|
||||
#endif /* HAVE_ICONV */
|
||||
#endif /* HAVE_ICONV */
|
||||
|
||||
return outbuf;
|
||||
}
|
||||
@@ -263,7 +266,8 @@ weechat_convert_encoding (char *from_code, char *to_code, char *string)
|
||||
* get_timeval_diff: calculates difference between two times (return in milliseconds)
|
||||
*/
|
||||
|
||||
long get_timeval_diff(struct timeval *tv1, struct timeval *tv2)
|
||||
long
|
||||
get_timeval_diff (struct timeval *tv1, struct timeval *tv2)
|
||||
{
|
||||
long diff_sec, diff_usec;
|
||||
|
||||
@@ -279,10 +283,40 @@ long get_timeval_diff(struct timeval *tv1, struct timeval *tv2)
|
||||
}
|
||||
|
||||
/*
|
||||
* wee_display_config_options: display config options
|
||||
* weechat_display_usage: display WeeChat usage
|
||||
*/
|
||||
|
||||
void wee_display_config_options ()
|
||||
void
|
||||
weechat_display_usage (char *exec_name)
|
||||
{
|
||||
printf ("\n");
|
||||
printf (_("%s (c) Copyright 2003-2005, compiled on %s %s\n"
|
||||
"Developed by FlashCode <flashcode@flashtux.org> - %s"),
|
||||
PACKAGE_STRING, __DATE__, __TIME__, WEECHAT_WEBSITE);
|
||||
printf ("\n\n");
|
||||
printf (_("Usage: %s [options ...]\n" \
|
||||
" or: %s [irc[6][s]://[nickname[:password]@]irc.example.org[:port][/channel][,channel[...]]"),
|
||||
exec_name, exec_name);
|
||||
printf ("\n\n");
|
||||
printf (_(" -a, --no-connect disable auto-connect to servers at startup\n"
|
||||
" -c, --config display config file options\n"
|
||||
" -f, --key-functions display WeeChat internal functions for keys\n"
|
||||
" -h, --help this help\n"
|
||||
" -i, --irc-commands display IRC commands\n"
|
||||
" -k, --keys display WeeChat default keys\n"
|
||||
" -l, --license display WeeChat license\n"
|
||||
" -p, --no-plugin don't load any plugin at startup\n"
|
||||
" -v, --version display WeeChat version\n"
|
||||
" -w, --weechat-commands display WeeChat commands\n"));
|
||||
printf("\n");
|
||||
}
|
||||
|
||||
/*
|
||||
* weechat_display_config_options: display config options
|
||||
*/
|
||||
|
||||
void
|
||||
weechat_display_config_options ()
|
||||
{
|
||||
int i, j, k;
|
||||
|
||||
@@ -353,10 +387,11 @@ void wee_display_config_options ()
|
||||
}
|
||||
|
||||
/*
|
||||
* wee_display_commands: display WeeChat and/or IRC commands
|
||||
* weechat_display_commands: display WeeChat and/or IRC commands
|
||||
*/
|
||||
|
||||
void wee_display_commands (int weechat_cmd, int irc_cmd)
|
||||
void
|
||||
weechat_display_commands (int weechat_cmd, int irc_cmd)
|
||||
{
|
||||
int i;
|
||||
|
||||
@@ -406,10 +441,11 @@ void wee_display_commands (int weechat_cmd, int irc_cmd)
|
||||
}
|
||||
|
||||
/*
|
||||
* wee_display_key_functions: display WeeChat key functions
|
||||
* weechat_display_key_functions: display WeeChat key functions
|
||||
*/
|
||||
|
||||
void wee_display_key_functions ()
|
||||
void
|
||||
weechat_display_key_functions ()
|
||||
{
|
||||
int i;
|
||||
|
||||
@@ -426,11 +462,11 @@ void wee_display_key_functions ()
|
||||
}
|
||||
|
||||
/*
|
||||
* wee_display_keys: display WeeChat default keys
|
||||
* weechat_display_keys: display WeeChat default keys
|
||||
*/
|
||||
|
||||
void
|
||||
wee_display_keys ()
|
||||
weechat_display_keys ()
|
||||
{
|
||||
t_gui_key *ptr_key;
|
||||
char *expanded_name;
|
||||
@@ -449,15 +485,17 @@ wee_display_keys ()
|
||||
}
|
||||
|
||||
/*
|
||||
* wee_parse_args: parse command line args
|
||||
* weechat_parse_args: parse command line args
|
||||
*/
|
||||
|
||||
void
|
||||
wee_parse_args (int argc, char *argv[])
|
||||
weechat_parse_args (int argc, char *argv[])
|
||||
{
|
||||
int i;
|
||||
t_irc_server server_tmp;
|
||||
|
||||
weechat_argv0 = strdup (argv[0]);
|
||||
weechat_session = NULL;
|
||||
server_cmd_line = 0;
|
||||
auto_connect = 1;
|
||||
auto_load_plugins = 1;
|
||||
@@ -470,54 +508,65 @@ wee_parse_args (int argc, char *argv[])
|
||||
else if ((strcmp (argv[i], "-c") == 0)
|
||||
|| (strcmp (argv[i], "--config") == 0))
|
||||
{
|
||||
wee_display_config_options ();
|
||||
wee_shutdown (EXIT_SUCCESS, 0);
|
||||
weechat_display_config_options ();
|
||||
weechat_shutdown (EXIT_SUCCESS, 0);
|
||||
}
|
||||
else if ((strcmp (argv[i], "-f") == 0)
|
||||
|| (strcmp (argv[i], "--key-functions") == 0))
|
||||
{
|
||||
wee_display_key_functions ();
|
||||
wee_shutdown (EXIT_SUCCESS, 0);
|
||||
weechat_display_key_functions ();
|
||||
weechat_shutdown (EXIT_SUCCESS, 0);
|
||||
}
|
||||
else if ((strcmp (argv[i], "-h") == 0)
|
||||
|| (strcmp (argv[i], "--help") == 0))
|
||||
{
|
||||
printf ("\n" WEE_USAGE1, argv[0], argv[0]);
|
||||
printf ("%s", WEE_USAGE2);
|
||||
wee_shutdown (EXIT_SUCCESS, 0);
|
||||
weechat_display_usage (argv[0]);
|
||||
weechat_shutdown (EXIT_SUCCESS, 0);
|
||||
}
|
||||
else if ((strcmp (argv[i], "-i") == 0)
|
||||
|| (strcmp (argv[i], "--irc-commands") == 0))
|
||||
{
|
||||
wee_display_commands (0, 1);
|
||||
wee_shutdown (EXIT_SUCCESS, 0);
|
||||
weechat_display_commands (0, 1);
|
||||
weechat_shutdown (EXIT_SUCCESS, 0);
|
||||
}
|
||||
else if ((strcmp (argv[i], "-k") == 0)
|
||||
|| (strcmp (argv[i], "--keys") == 0))
|
||||
{
|
||||
wee_display_keys ();
|
||||
wee_shutdown (EXIT_SUCCESS, 0);
|
||||
weechat_display_keys ();
|
||||
weechat_shutdown (EXIT_SUCCESS, 0);
|
||||
}
|
||||
else if ((strcmp (argv[i], "-l") == 0)
|
||||
|| (strcmp (argv[i], "--license") == 0))
|
||||
{
|
||||
printf ("\n%s%s", WEE_LICENSE);
|
||||
wee_shutdown (EXIT_SUCCESS, 0);
|
||||
weechat_shutdown (EXIT_SUCCESS, 0);
|
||||
}
|
||||
else if ((strcmp (argv[i], "-p") == 0)
|
||||
|| (strcmp (argv[i], "--no-plugin") == 0))
|
||||
auto_load_plugins = 0;
|
||||
else if (strcmp (argv[i], "--session") == 0)
|
||||
{
|
||||
if (i + 1 < argc)
|
||||
weechat_session = strdup (argv[++i]);
|
||||
else
|
||||
{
|
||||
fprintf (stderr,
|
||||
_("%s missing argument for --session option\n"),
|
||||
WEECHAT_ERROR);
|
||||
weechat_shutdown (EXIT_FAILURE, 0);
|
||||
}
|
||||
}
|
||||
else if ((strcmp (argv[i], "-v") == 0)
|
||||
|| (strcmp (argv[i], "--version") == 0))
|
||||
{
|
||||
printf (PACKAGE_VERSION "\n");
|
||||
wee_shutdown (EXIT_SUCCESS, 0);
|
||||
weechat_shutdown (EXIT_SUCCESS, 0);
|
||||
}
|
||||
else if ((strcmp (argv[i], "-w") == 0)
|
||||
|| (strcmp (argv[i], "--weechat-commands") == 0))
|
||||
{
|
||||
wee_display_commands (1, 0);
|
||||
wee_shutdown (EXIT_SUCCESS, 0);
|
||||
weechat_display_commands (1, 0);
|
||||
weechat_shutdown (EXIT_SUCCESS, 0);
|
||||
}
|
||||
else if ((ascii_strncasecmp (argv[i], "irc", 3) == 0))
|
||||
{
|
||||
@@ -552,13 +601,13 @@ wee_parse_args (int argc, char *argv[])
|
||||
}
|
||||
|
||||
/*
|
||||
* wee_create_dir: create a directory
|
||||
* return: 1 if ok (or directory already exists)
|
||||
* 0 if error
|
||||
* weechat_create_dir: create a directory
|
||||
* return: 1 if ok (or directory already exists)
|
||||
* 0 if error
|
||||
*/
|
||||
|
||||
int
|
||||
wee_create_dir (char *directory)
|
||||
weechat_create_dir (char *directory)
|
||||
{
|
||||
if (mkdir (directory, 0755) < 0)
|
||||
{
|
||||
@@ -574,26 +623,21 @@ wee_create_dir (char *directory)
|
||||
}
|
||||
|
||||
/*
|
||||
* wee_create_home_dirs: create (if not found):
|
||||
* - WeeChat home directory ("~/.weechat")
|
||||
* - "perl" directory (and "autoload")
|
||||
* - "ruby" directory (and "autoload")
|
||||
* - "python" directory (and "autoload")
|
||||
* weechat_create_home_dirs: create WeeChat directories (if not found)
|
||||
*/
|
||||
|
||||
void
|
||||
wee_create_home_dirs ()
|
||||
weechat_create_home_dirs ()
|
||||
{
|
||||
char *ptr_home, *dir_name;
|
||||
int dir_length;
|
||||
|
||||
/* TODO: rewrite this code for Windows version */
|
||||
|
||||
ptr_home = getenv ("HOME");
|
||||
if (!ptr_home)
|
||||
{
|
||||
fprintf (stderr, _("%s unable to get HOME directory\n"),
|
||||
WEECHAT_ERROR);
|
||||
wee_shutdown (EXIT_FAILURE, 0);
|
||||
weechat_shutdown (EXIT_FAILURE, 0);
|
||||
}
|
||||
dir_length = strlen (ptr_home) + 10;
|
||||
weechat_home =
|
||||
@@ -602,17 +646,17 @@ wee_create_home_dirs ()
|
||||
{
|
||||
fprintf (stderr, _("%s not enough memory for home directory\n"),
|
||||
WEECHAT_ERROR);
|
||||
wee_shutdown (EXIT_FAILURE, 0);
|
||||
weechat_shutdown (EXIT_FAILURE, 0);
|
||||
}
|
||||
snprintf (weechat_home, dir_length, "%s%s.weechat", ptr_home,
|
||||
DIR_SEPARATOR);
|
||||
|
||||
/* create home directory "~/.weechat" ; error is fatal */
|
||||
if (!wee_create_dir (weechat_home))
|
||||
if (!weechat_create_dir (weechat_home))
|
||||
{
|
||||
fprintf (stderr, _("%s unable to create ~/.weechat directory\n"),
|
||||
WEECHAT_ERROR);
|
||||
wee_shutdown (EXIT_FAILURE, 0);
|
||||
weechat_shutdown (EXIT_FAILURE, 0);
|
||||
}
|
||||
|
||||
dir_length = strlen (weechat_home) + 64;
|
||||
@@ -621,7 +665,7 @@ wee_create_home_dirs ()
|
||||
/* create "~/.weechat/logs" */
|
||||
snprintf (dir_name, dir_length, "%s%s%s", weechat_home, DIR_SEPARATOR,
|
||||
"logs");
|
||||
if (!wee_create_dir (dir_name))
|
||||
if (!weechat_create_dir (dir_name))
|
||||
{
|
||||
fprintf (stderr, _("%s unable to create ~/.weechat/logs directory\n"),
|
||||
WEECHAT_WARNING);
|
||||
@@ -632,11 +676,11 @@ wee_create_home_dirs ()
|
||||
}
|
||||
|
||||
/*
|
||||
* wee_init_vars: initialize some variables
|
||||
* weechat_init_vars: initialize some variables
|
||||
*/
|
||||
|
||||
void
|
||||
wee_init_vars ()
|
||||
weechat_init_vars ()
|
||||
{
|
||||
/* start time, used by /uptime command */
|
||||
weechat_start_time = time (NULL);
|
||||
@@ -654,11 +698,11 @@ wee_init_vars ()
|
||||
}
|
||||
|
||||
/*
|
||||
* wee_init_log: initialize log file
|
||||
* weechat_init_log: initialize log file
|
||||
*/
|
||||
|
||||
void
|
||||
wee_init_log ()
|
||||
weechat_init_log ()
|
||||
{
|
||||
int filename_length;
|
||||
char *filename;
|
||||
@@ -674,6 +718,29 @@ wee_init_log ()
|
||||
free (filename);
|
||||
}
|
||||
|
||||
/*
|
||||
* weechat_config_read: read WeeChat config file
|
||||
*/
|
||||
|
||||
void
|
||||
weechat_config_read ()
|
||||
{
|
||||
switch (config_read ())
|
||||
{
|
||||
case 0: /* read ok */
|
||||
break;
|
||||
case -1: /* config file not found */
|
||||
if (config_create_default () < 0)
|
||||
exit (EXIT_FAILURE);
|
||||
if (config_read () != 0)
|
||||
exit (EXIT_FAILURE);
|
||||
break;
|
||||
default: /* other error (fatal) */
|
||||
server_free_all ();
|
||||
exit (EXIT_FAILURE);
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* weechat_welcome_message: display WeeChat welcome message - yeah!
|
||||
*/
|
||||
@@ -720,29 +787,19 @@ weechat_welcome_message ()
|
||||
"%s-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-\n",
|
||||
GUI_COLOR(COLOR_WIN_CHAT_NICK));
|
||||
|
||||
wee_log_printf ("%s (%s %s %s)\n",
|
||||
PACKAGE_STRING, _("compiled on"), __DATE__, __TIME__);
|
||||
weechat_log_printf ("%s (%s %s %s)\n",
|
||||
PACKAGE_STRING, _("compiled on"), __DATE__, __TIME__);
|
||||
}
|
||||
|
||||
/*
|
||||
* wee_gui_shutdown: shutdown WeeChat GUI
|
||||
* weechat_shutdown: shutdown WeeChat
|
||||
*/
|
||||
|
||||
void
|
||||
wee_gui_shutdown ()
|
||||
{
|
||||
dcc_end ();
|
||||
server_free_all ();
|
||||
gui_end ();
|
||||
}
|
||||
|
||||
/*
|
||||
* wee_shutdown: shutdown WeeChat
|
||||
*/
|
||||
|
||||
void
|
||||
wee_shutdown (int return_code, int crash)
|
||||
weechat_shutdown (int return_code, int crash)
|
||||
{
|
||||
if (weechat_argv0)
|
||||
free (weechat_argv0);
|
||||
fifo_remove ();
|
||||
if (weechat_home)
|
||||
free (weechat_home);
|
||||
@@ -764,15 +821,16 @@ wee_shutdown (int return_code, int crash)
|
||||
}
|
||||
|
||||
/*
|
||||
* wee_dump writes dump to WeeChat log file
|
||||
* weechat_dump writes dump to WeeChat log file
|
||||
*/
|
||||
|
||||
void
|
||||
wee_dump (int crash)
|
||||
weechat_dump (int crash)
|
||||
{
|
||||
t_irc_server *ptr_server;
|
||||
t_irc_channel *ptr_channel;
|
||||
t_irc_nick *ptr_nick;
|
||||
t_irc_dcc *ptr_dcc;
|
||||
t_gui_window *ptr_window;
|
||||
t_gui_buffer *ptr_buffer;
|
||||
|
||||
@@ -783,92 +841,100 @@ wee_dump (int crash)
|
||||
if (crash)
|
||||
{
|
||||
sigsegv = 1;
|
||||
wee_log_printf ("Very bad, WeeChat is crashing (SIGSEGV received)...\n");
|
||||
weechat_log_printf ("Very bad, WeeChat is crashing (SIGSEGV received)...\n");
|
||||
}
|
||||
|
||||
wee_log_printf ("\n");
|
||||
weechat_log_printf ("\n");
|
||||
if (crash)
|
||||
{
|
||||
wee_log_printf ("****** WeeChat CRASH DUMP ******\n");
|
||||
wee_log_printf ("****** Please send this file to WeeChat developers ******\n");
|
||||
wee_log_printf ("****** and explain when this crash happened ******\n");
|
||||
weechat_log_printf ("****** WeeChat CRASH DUMP ******\n");
|
||||
weechat_log_printf ("****** Please send this file to WeeChat developers ******\n");
|
||||
weechat_log_printf ("****** and explain when this crash happened ******\n");
|
||||
}
|
||||
else
|
||||
{
|
||||
wee_log_printf ("****** WeeChat dump request ******\n");
|
||||
weechat_log_printf ("****** WeeChat dump request ******\n");
|
||||
}
|
||||
|
||||
for (ptr_server = irc_servers; ptr_server; ptr_server = ptr_server->next_server)
|
||||
{
|
||||
wee_log_printf ("\n");
|
||||
weechat_log_printf ("\n");
|
||||
server_print_log (ptr_server);
|
||||
|
||||
for (ptr_channel = ptr_server->channels; ptr_channel;
|
||||
ptr_channel = ptr_channel->next_channel)
|
||||
{
|
||||
wee_log_printf ("\n");
|
||||
weechat_log_printf ("\n");
|
||||
channel_print_log (ptr_channel);
|
||||
|
||||
for (ptr_nick = ptr_channel->nicks; ptr_nick;
|
||||
ptr_nick = ptr_nick->next_nick)
|
||||
{
|
||||
wee_log_printf ("\n");
|
||||
weechat_log_printf ("\n");
|
||||
nick_print_log (ptr_nick);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
wee_log_printf ("\n");
|
||||
wee_log_printf ("[windows/buffers]\n");
|
||||
wee_log_printf (" => windows:\n");
|
||||
weechat_log_printf ("\n");
|
||||
for (ptr_dcc = dcc_list; ptr_dcc; ptr_dcc = ptr_dcc->next_dcc)
|
||||
{
|
||||
dcc_print_log (ptr_dcc);
|
||||
}
|
||||
|
||||
weechat_log_printf ("\n");
|
||||
weechat_log_printf ("[windows/buffers]\n");
|
||||
weechat_log_printf (" => windows:\n");
|
||||
for (ptr_window = gui_windows; ptr_window; ptr_window = ptr_window->next_window)
|
||||
{
|
||||
wee_log_printf (" 0x%X\n", ptr_window);
|
||||
weechat_log_printf (" 0x%X\n", ptr_window);
|
||||
}
|
||||
wee_log_printf (" => buffers:\n");
|
||||
weechat_log_printf (" => buffers:\n");
|
||||
for (ptr_buffer = gui_buffers; ptr_buffer; ptr_buffer = ptr_buffer->next_buffer)
|
||||
{
|
||||
wee_log_printf (" 0x%X\n", ptr_buffer);
|
||||
weechat_log_printf (" 0x%X\n", ptr_buffer);
|
||||
}
|
||||
wee_log_printf (" => current window = 0x%X\n", gui_current_window);
|
||||
weechat_log_printf (" => current window = 0x%X\n", gui_current_window);
|
||||
|
||||
for (ptr_window = gui_windows; ptr_window; ptr_window = ptr_window->next_window)
|
||||
{
|
||||
wee_log_printf ("\n");
|
||||
weechat_log_printf ("\n");
|
||||
gui_window_print_log (ptr_window);
|
||||
}
|
||||
|
||||
for (ptr_buffer = gui_buffers; ptr_buffer; ptr_buffer = ptr_buffer->next_buffer)
|
||||
{
|
||||
wee_log_printf ("\n");
|
||||
weechat_log_printf ("\n");
|
||||
gui_buffer_print_log (ptr_buffer);
|
||||
}
|
||||
|
||||
wee_log_printf ("\n");
|
||||
weechat_log_printf ("\n");
|
||||
ignore_print_log ();
|
||||
|
||||
wee_log_printf ("\n");
|
||||
wee_log_printf ("****** End of dump ******\n");
|
||||
wee_log_printf ("\n");
|
||||
weechat_log_printf ("\n");
|
||||
weechat_log_printf ("****** End of dump ******\n");
|
||||
weechat_log_printf ("\n");
|
||||
}
|
||||
|
||||
/*
|
||||
* my_sigsegv: SIGSEGV handler: save crash log to ~/.weechat/weechat.log and exit
|
||||
* weechat_sigsegv: SIGSEGV handler: save crash log to ~/.weechat/weechat.log and exit
|
||||
*/
|
||||
|
||||
void
|
||||
my_sigsegv ()
|
||||
weechat_sigsegv ()
|
||||
{
|
||||
wee_dump (1);
|
||||
wee_gui_shutdown ();
|
||||
weechat_dump (1);
|
||||
dcc_end ();
|
||||
server_free_all ();
|
||||
gui_end ();
|
||||
fprintf (stderr, "\n");
|
||||
fprintf (stderr, "*** Very bad! WeeChat has crashed (SIGSEGV received)\n");
|
||||
fprintf (stderr, "*** Full crash dump was saved to ~/.weechat/weechat.log file\n");
|
||||
fprintf (stderr, "*** Please send this file to WeeChat developers.\n");
|
||||
fprintf (stderr, "*** (be careful, private info may be in this file since\n");
|
||||
fprintf (stderr, "*** part of chats are displayed, so remove lines if needed)\n\n");
|
||||
wee_shutdown (EXIT_FAILURE, 1);
|
||||
weechat_shutdown (EXIT_FAILURE, 1);
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -878,63 +944,54 @@ my_sigsegv ()
|
||||
int
|
||||
main (int argc, char *argv[])
|
||||
{
|
||||
#ifdef ENABLE_NLS
|
||||
setlocale (LC_ALL, ""); /* initialize gettext */
|
||||
#ifdef ENABLE_NLS
|
||||
setlocale (LC_ALL, ""); /* initialize gettext */
|
||||
bindtextdomain (PACKAGE, LOCALEDIR);
|
||||
textdomain (PACKAGE);
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_LANGINFO_CODESET
|
||||
local_charset = strdup (nl_langinfo (CODESET));
|
||||
#endif
|
||||
|
||||
signal (SIGINT, SIG_IGN); /* ignore SIGINT signal */
|
||||
signal (SIGQUIT, SIG_IGN); /* ignore SIGQUIT signal */
|
||||
signal (SIGPIPE, SIG_IGN); /* ignore SIGPIPE signal */
|
||||
signal (SIGSEGV, my_sigsegv); /* crash dump when SIGSEGV is received */
|
||||
gui_pre_init (&argc, &argv); /* pre-initiliaze interface */
|
||||
wee_init_vars (); /* initialize some variables */
|
||||
gui_key_init (); /* init keyboard (default key bindings) */
|
||||
wee_parse_args (argc, argv); /* parse command line args */
|
||||
wee_create_home_dirs (); /* create WeeChat directories */
|
||||
wee_init_log (); /* init log file */
|
||||
command_index_build (); /* build commands index for completion */
|
||||
|
||||
switch (config_read ()) /* read configuration */
|
||||
{
|
||||
case 0: /* config file OK */
|
||||
break;
|
||||
case -1: /* config file not found */
|
||||
if (config_create_default () < 0)
|
||||
return EXIT_FAILURE;
|
||||
if (config_read () != 0)
|
||||
return EXIT_FAILURE;
|
||||
break;
|
||||
default: /* other error (fatal) */
|
||||
server_free_all ();
|
||||
return EXIT_FAILURE;
|
||||
}
|
||||
|
||||
utf8_init (); /* init UTF-8 in WeeChat */
|
||||
gui_init (); /* init WeeChat interface */
|
||||
weechat_welcome_message (); /* display WeeChat welcome message */
|
||||
#ifdef PLUGINS
|
||||
plugin_init (auto_load_plugins);/* init plugin interface(s) */
|
||||
#endif
|
||||
/* auto-connect to servers */
|
||||
server_auto_connect (auto_connect, server_cmd_line);
|
||||
fifo_create (); /* create FIFO pipe for remote control */
|
||||
|
||||
gui_main_loop (); /* WeeChat main loop */
|
||||
#ifdef HAVE_LANGINFO_CODESET
|
||||
local_charset = strdup (nl_langinfo (CODESET));
|
||||
#endif
|
||||
|
||||
signal (SIGINT, SIG_IGN); /* ignore SIGINT signal */
|
||||
signal (SIGQUIT, SIG_IGN); /* ignore SIGQUIT signal */
|
||||
signal (SIGPIPE, SIG_IGN); /* ignore SIGPIPE signal */
|
||||
signal (SIGSEGV, weechat_sigsegv); /* crash dump when SIGSEGV received */
|
||||
gui_pre_init (&argc, &argv); /* pre-initiliaze interface */
|
||||
weechat_init_vars (); /* initialize some variables */
|
||||
gui_key_init (); /* init keyb. (default key bindings)*/
|
||||
weechat_parse_args (argc, argv); /* parse command line args */
|
||||
weechat_create_home_dirs (); /* create WeeChat directories */
|
||||
weechat_init_log (); /* init log file */
|
||||
command_index_build (); /* build cmd index for completion */
|
||||
weechat_config_read (); /* read configuration */
|
||||
utf8_init (); /* init UTF-8 in WeeChat */
|
||||
gui_init (); /* init WeeChat interface */
|
||||
weechat_welcome_message (); /* display WeeChat welcome message */
|
||||
#ifdef PLUGINS
|
||||
plugin_init (auto_load_plugins); /* init plugin interface(s) */
|
||||
#endif
|
||||
|
||||
server_auto_connect (auto_connect, /* auto-connect to servers */
|
||||
server_cmd_line);
|
||||
fifo_create (); /* FIFO pipe for remote control */
|
||||
|
||||
if (weechat_session)
|
||||
session_load (weechat_session); /* load previous session if asked */
|
||||
|
||||
gui_main_loop (); /* WeeChat main loop */
|
||||
|
||||
#ifdef PLUGINS
|
||||
plugin_end (); /* end plugin interface(s) */
|
||||
plugin_end (); /* end plugin interface(s) */
|
||||
#endif
|
||||
server_disconnect_all (); /* disconnect from all servers */
|
||||
(void) config_write (NULL); /* save config file */
|
||||
command_index_free (); /* free commands index */
|
||||
wee_gui_shutdown (); /* shut down WeeChat GUI */
|
||||
wee_shutdown (EXIT_SUCCESS, 0); /* quit WeeChat (oh no, why?) */
|
||||
server_disconnect_all (); /* disconnect from all servers */
|
||||
(void) config_write (NULL); /* save config file */
|
||||
command_index_free (); /* free commands index */
|
||||
dcc_end (); /* remove all DCC */
|
||||
server_free_all (); /* free all servers */
|
||||
gui_end (); /* shut down WeeChat GUI */
|
||||
weechat_shutdown (EXIT_SUCCESS, 0); /* quit WeeChat (oh no, why?) */
|
||||
|
||||
return EXIT_SUCCESS; /* make gcc happy (never executed) */
|
||||
return EXIT_SUCCESS; /* make gcc happy (never executed) */
|
||||
}
|
||||
|
||||
+4
-21
@@ -82,24 +82,6 @@
|
||||
"along with this program; if not, write to the Free Software\n" \
|
||||
"Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA\n\n"
|
||||
|
||||
#define WEE_USAGE1 \
|
||||
PACKAGE_STRING " (c) Copyright 2003-2005, compiled on " __DATE__ " " __TIME__ \
|
||||
"\nDeveloped by FlashCode <flashcode@flashtux.org> - " WEECHAT_WEBSITE "\n\n" \
|
||||
"Usage: %s [options ...]\n" \
|
||||
" or: %s [irc[6][s]://[nickname[:password]@]irc.example.org[:port][/channel][,channel[...]]\n\n"
|
||||
|
||||
#define WEE_USAGE2 \
|
||||
" -a, --no-connect disable auto-connect to servers at startup\n" \
|
||||
" -c, --config display config file options\n" \
|
||||
" -f, --key-functions display WeeChat internal functions for keys\n" \
|
||||
" -h, --help this help\n" \
|
||||
" -i, --irc-commands display IRC commands\n" \
|
||||
" -k, --keys display WeeChat default keys\n" \
|
||||
" -l, --license display WeeChat license\n" \
|
||||
" -p, --no-plugin don't load any plugin at startup\n" \
|
||||
" -v, --version display WeeChat version\n" \
|
||||
" -w, --weechat-commands display WeeChat commands\n\n"
|
||||
|
||||
/* directory separator, depending on OS */
|
||||
|
||||
#ifdef _WIN32
|
||||
@@ -112,6 +94,7 @@
|
||||
|
||||
/* global variables and functions */
|
||||
|
||||
extern char *weechat_argv0;
|
||||
extern time_t weechat_start_time;
|
||||
extern int quit_weechat;
|
||||
extern char *weechat_home;
|
||||
@@ -123,10 +106,10 @@ extern gnutls_certificate_credentials gnutls_xcred;
|
||||
|
||||
extern int ascii_strcasecmp (char *, char *);
|
||||
extern int ascii_strncasecmp (char *, char *, int);
|
||||
extern void wee_log_printf (char *, ...);
|
||||
extern void wee_dump (int);
|
||||
extern void weechat_log_printf (char *, ...);
|
||||
extern void weechat_dump (int);
|
||||
extern char *weechat_convert_encoding (char *, char *, char *);
|
||||
extern long get_timeval_diff (struct timeval *, struct timeval *);
|
||||
extern void wee_shutdown (int, int);
|
||||
extern void weechat_shutdown (int, int);
|
||||
|
||||
#endif /* weechat.h */
|
||||
|
||||
@@ -1612,10 +1612,8 @@ config_read ()
|
||||
int server_found;
|
||||
char line[1024], *ptr_line, *pos, *pos2;
|
||||
|
||||
filename_length = strlen (weechat_home) +
|
||||
strlen (WEECHAT_CONFIG_NAME) + 2;
|
||||
filename =
|
||||
(char *) malloc (filename_length * sizeof (char));
|
||||
filename_length = strlen (weechat_home) + strlen (WEECHAT_CONFIG_NAME) + 2;
|
||||
filename = (char *) malloc (filename_length * sizeof (char));
|
||||
if (!filename)
|
||||
return -2;
|
||||
snprintf (filename, filename_length, "%s%s" WEECHAT_CONFIG_NAME,
|
||||
@@ -1914,7 +1912,7 @@ config_create_default ()
|
||||
}
|
||||
|
||||
printf (_("%s: creating default config file...\n"), PACKAGE_NAME);
|
||||
wee_log_printf (_("Creating default config file\n"));
|
||||
weechat_log_printf (_("Creating default config file\n"));
|
||||
|
||||
current_time = time (NULL);
|
||||
fprintf (file, _("#\n# %s configuration file, created by "
|
||||
@@ -2115,7 +2113,7 @@ config_write (char *config_name)
|
||||
return -1;
|
||||
}
|
||||
|
||||
wee_log_printf (_("Saving config to disk\n"));
|
||||
weechat_log_printf (_("Saving config to disk\n"));
|
||||
|
||||
current_time = time (NULL);
|
||||
fprintf (file, _("#\n# %s configuration file, created by "
|
||||
|
||||
@@ -1594,7 +1594,16 @@ gui_draw_buffer_chat (t_gui_buffer *buffer, int erase)
|
||||
num_unit = 2;
|
||||
else
|
||||
num_unit = 3;
|
||||
sprintf (format, " (%s %%s/s)", unit_format[num_unit]);
|
||||
wprintw (ptr_win->win_chat, " (");
|
||||
if (ptr_dcc->status == DCC_ACTIVE)
|
||||
{
|
||||
wprintw (ptr_win->win_chat, _("ETA"));
|
||||
wprintw (ptr_win->win_chat, ": %.2lu:%.2lu:%.2lu - ",
|
||||
ptr_dcc->eta / 3600,
|
||||
(ptr_dcc->eta / 60) % 60,
|
||||
ptr_dcc->eta % 60);
|
||||
}
|
||||
sprintf (format, "%s %%s/s)", unit_format[num_unit]);
|
||||
buf = weechat_convert_encoding ((local_utf8) ?
|
||||
cfg_look_charset_decode_iso : cfg_look_charset_decode_utf,
|
||||
(cfg_look_charset_internal && cfg_look_charset_internal[0]) ?
|
||||
@@ -1824,31 +1833,31 @@ gui_draw_buffer_nick (t_gui_buffer *buffer, int erase)
|
||||
}
|
||||
else
|
||||
{
|
||||
if (ptr_nick->is_chanowner)
|
||||
if (ptr_nick->flags & NICK_CHANOWNER)
|
||||
{
|
||||
gui_window_set_weechat_color (ptr_win->win_nick, COLOR_WIN_NICK_CHANOWNER);
|
||||
mvwprintw (ptr_win->win_nick, y, x, "~");
|
||||
x++;
|
||||
}
|
||||
else if (ptr_nick->is_chanadmin)
|
||||
else if (ptr_nick->flags & NICK_CHANADMIN)
|
||||
{
|
||||
gui_window_set_weechat_color (ptr_win->win_nick, COLOR_WIN_NICK_CHANADMIN);
|
||||
mvwprintw (ptr_win->win_nick, y, x, "&");
|
||||
x++;
|
||||
}
|
||||
else if (ptr_nick->is_op)
|
||||
else if (ptr_nick->flags & NICK_OP)
|
||||
{
|
||||
gui_window_set_weechat_color (ptr_win->win_nick, COLOR_WIN_NICK_OP);
|
||||
mvwprintw (ptr_win->win_nick, y, x, "@");
|
||||
x++;
|
||||
}
|
||||
else if (ptr_nick->is_halfop)
|
||||
else if (ptr_nick->flags & NICK_HALFOP)
|
||||
{
|
||||
gui_window_set_weechat_color (ptr_win->win_nick, COLOR_WIN_NICK_HALFOP);
|
||||
mvwprintw (ptr_win->win_nick, y, x, "%%");
|
||||
x++;
|
||||
}
|
||||
else if (ptr_nick->has_voice)
|
||||
else if (ptr_nick->flags & NICK_VOICE)
|
||||
{
|
||||
gui_window_set_weechat_color (ptr_win->win_nick, COLOR_WIN_NICK_VOICE);
|
||||
mvwprintw (ptr_win->win_nick, y, x, "+");
|
||||
@@ -1861,7 +1870,7 @@ gui_draw_buffer_nick (t_gui_buffer *buffer, int erase)
|
||||
x++;
|
||||
}
|
||||
gui_window_set_weechat_color (ptr_win->win_nick,
|
||||
((cfg_irc_away_check > 0) && (ptr_nick->is_away)) ?
|
||||
((cfg_irc_away_check > 0) && (ptr_nick->flags & NICK_AWAY)) ?
|
||||
COLOR_WIN_NICK_AWAY : COLOR_WIN_NICK);
|
||||
mvwprintw (ptr_win->win_nick, y, x, format, ptr_nick->nick);
|
||||
|
||||
@@ -2004,7 +2013,7 @@ gui_draw_buffer_status (t_gui_buffer *buffer, int erase)
|
||||
gui_window_set_weechat_color (ptr_win->win_status,
|
||||
COLOR_WIN_STATUS_CHANNEL);
|
||||
if ((!CHANNEL(ptr_win->buffer)->nicks)
|
||||
&& (CHANNEL(ptr_win->buffer)->type != CHAT_PRIVATE))
|
||||
&& (CHANNEL(ptr_win->buffer)->type != CHANNEL_TYPE_PRIVATE))
|
||||
wprintw (ptr_win->win_status, "(%s)",
|
||||
CHANNEL(ptr_win->buffer)->name);
|
||||
else
|
||||
@@ -2013,7 +2022,7 @@ gui_draw_buffer_status (t_gui_buffer *buffer, int erase)
|
||||
if (ptr_win->buffer == CHANNEL(ptr_win->buffer)->buffer)
|
||||
{
|
||||
/* display channel modes */
|
||||
if (CHANNEL(ptr_win->buffer)->type == CHAT_CHANNEL)
|
||||
if (CHANNEL(ptr_win->buffer)->type == CHANNEL_TYPE_CHANNEL)
|
||||
{
|
||||
gui_window_set_weechat_color (ptr_win->win_status,
|
||||
COLOR_WIN_STATUS_DELIMITERS);
|
||||
@@ -2050,7 +2059,7 @@ gui_draw_buffer_status (t_gui_buffer *buffer, int erase)
|
||||
}
|
||||
|
||||
/* display DCC if private is DCC CHAT */
|
||||
if ((CHANNEL(ptr_win->buffer)->type == CHAT_PRIVATE)
|
||||
if ((CHANNEL(ptr_win->buffer)->type == CHANNEL_TYPE_PRIVATE)
|
||||
&& (CHANNEL(ptr_win->buffer)->dcc_chat))
|
||||
{
|
||||
gui_window_set_weechat_color (ptr_win->win_status,
|
||||
|
||||
+12
-10
@@ -88,29 +88,30 @@ gui_action_clipboard_paste (t_gui_window *window)
|
||||
void
|
||||
gui_action_return (t_gui_window *window)
|
||||
{
|
||||
t_gui_buffer *ptr_buffer;
|
||||
char *command;
|
||||
|
||||
if (window->buffer->has_input)
|
||||
{
|
||||
if (window->buffer->input_buffer_size > 0)
|
||||
{
|
||||
window->buffer->input_buffer[window->buffer->input_buffer_size] = '\0';
|
||||
history_add (window->buffer, window->buffer->input_buffer);
|
||||
command = strdup (window->buffer->input_buffer);
|
||||
if (!command)
|
||||
return;
|
||||
history_buffer_add (window->buffer, window->buffer->input_buffer);
|
||||
history_global_add (window->buffer->input_buffer);
|
||||
window->buffer->input_buffer[0] = '\0';
|
||||
window->buffer->input_buffer_size = 0;
|
||||
window->buffer->input_buffer_length = 0;
|
||||
window->buffer->input_buffer_pos = 0;
|
||||
window->buffer->input_buffer_1st_display = 0;
|
||||
window->buffer->completion.position = -1;
|
||||
window->buffer->ptr_history = NULL;
|
||||
ptr_buffer = window->buffer;
|
||||
gui_draw_buffer_input (window->buffer, 0);
|
||||
user_command (SERVER(window->buffer),
|
||||
window->buffer,
|
||||
window->buffer->input_buffer);
|
||||
if (ptr_buffer == window->buffer)
|
||||
{
|
||||
ptr_buffer->input_buffer[0] = '\0';
|
||||
gui_draw_buffer_input (ptr_buffer, 0);
|
||||
}
|
||||
command);
|
||||
free (command);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -694,7 +695,8 @@ gui_action_up (t_gui_window *window)
|
||||
if (window->buffer->input_buffer_size > 0)
|
||||
{
|
||||
window->buffer->input_buffer[window->buffer->input_buffer_size] = '\0';
|
||||
history_add (window->buffer, window->buffer->input_buffer);
|
||||
history_buffer_add (window->buffer, window->buffer->input_buffer);
|
||||
history_global_add (window->buffer->input_buffer);
|
||||
}
|
||||
}
|
||||
else
|
||||
|
||||
+81
-82
@@ -137,8 +137,8 @@ gui_window_new (t_gui_window *parent, int x, int y, int width, int height,
|
||||
t_gui_window_tree *ptr_tree, *child1, *child2, *ptr_leaf;
|
||||
|
||||
#ifdef DEBUG
|
||||
wee_log_printf ("Creating new window (x:%d, y:%d, width:%d, height:%d)\n",
|
||||
x, y, width, height);
|
||||
weechat_log_printf ("Creating new window (x:%d, y:%d, width:%d, height:%d)\n",
|
||||
x, y, width, height);
|
||||
#endif
|
||||
|
||||
if (parent)
|
||||
@@ -353,7 +353,7 @@ gui_buffer_new (t_gui_window *window, void *server, void *channel, int dcc,
|
||||
t_gui_buffer *new_buffer, *ptr_buffer;
|
||||
|
||||
#ifdef DEBUG
|
||||
wee_log_printf ("Creating new buffer\n");
|
||||
weechat_log_printf ("Creating new buffer\n");
|
||||
#endif
|
||||
|
||||
/* use first buffer if no server was assigned to this buffer */
|
||||
@@ -665,11 +665,11 @@ gui_buffer_free (t_gui_buffer *buffer, int switch_to_another)
|
||||
}
|
||||
|
||||
/*
|
||||
* gui_new_line: create new line for a buffer
|
||||
* gui_line_new: create new line for a buffer
|
||||
*/
|
||||
|
||||
t_gui_line *
|
||||
gui_new_line (t_gui_buffer *buffer)
|
||||
gui_line_new (t_gui_buffer *buffer)
|
||||
{
|
||||
t_gui_line *new_line, *ptr_line;
|
||||
|
||||
@@ -693,7 +693,7 @@ gui_new_line (t_gui_buffer *buffer)
|
||||
}
|
||||
else
|
||||
{
|
||||
wee_log_printf (_("Not enough memory for new line\n"));
|
||||
weechat_log_printf (_("Not enough memory for new line\n"));
|
||||
return NULL;
|
||||
}
|
||||
|
||||
@@ -708,7 +708,6 @@ gui_new_line (t_gui_buffer *buffer)
|
||||
buffer->lines = ptr_line;
|
||||
ptr_line->prev_line = NULL;
|
||||
buffer->num_lines--;
|
||||
//if (buffer->first_line_displayed)
|
||||
gui_draw_buffer_chat (buffer, 1);
|
||||
}
|
||||
|
||||
@@ -774,7 +773,7 @@ gui_add_to_line (t_gui_buffer *buffer, int type, char *message)
|
||||
if (buffer->line_complete)
|
||||
{
|
||||
buffer->line_complete = 0;
|
||||
if (!gui_new_line (buffer))
|
||||
if (!gui_line_new (buffer))
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -880,8 +879,8 @@ gui_printf_internal (t_gui_buffer *buffer, int display_time, int type, char *mes
|
||||
|
||||
if (buffer == NULL)
|
||||
{
|
||||
wee_log_printf ("WARNING: gui_printf_internal without buffer! This is a bug, "
|
||||
"please send to developers - thanks\n");
|
||||
weechat_log_printf ("WARNING: gui_printf_internal without buffer! This is a bug, "
|
||||
"please send to developers - thanks\n");
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -1045,7 +1044,7 @@ gui_infobar_printf (int time_displayed, int color, char *message, ...)
|
||||
gui_draw_buffer_infobar (gui_current_window->buffer, 1);
|
||||
}
|
||||
else
|
||||
wee_log_printf (_("Not enough memory for infobar message\n"));
|
||||
weechat_log_printf (_("Not enough memory for infobar message\n"));
|
||||
}
|
||||
|
||||
if (buf2)
|
||||
@@ -1616,45 +1615,45 @@ gui_buffer_move_to_number (t_gui_window *window, int number)
|
||||
void
|
||||
gui_window_print_log (t_gui_window *window)
|
||||
{
|
||||
wee_log_printf ("[window (addr:0x%X)]\n", window);
|
||||
wee_log_printf (" win_x . . . . . . . : %d\n", window->win_x);
|
||||
wee_log_printf (" win_y . . . . . . . : %d\n", window->win_y);
|
||||
wee_log_printf (" win_width . . . . . : %d\n", window->win_width);
|
||||
wee_log_printf (" win_height. . . . . : %d\n", window->win_height);
|
||||
wee_log_printf (" win_width_pct . . . : %d\n", window->win_width_pct);
|
||||
wee_log_printf (" win_height_pct. . . : %d\n", window->win_height_pct);
|
||||
wee_log_printf (" win_chat_x. . . . . : %d\n", window->win_chat_x);
|
||||
wee_log_printf (" win_chat_y. . . . . : %d\n", window->win_chat_y);
|
||||
wee_log_printf (" win_chat_width. . . : %d\n", window->win_chat_width);
|
||||
wee_log_printf (" win_chat_height . . : %d\n", window->win_chat_height);
|
||||
wee_log_printf (" win_chat_cursor_x . : %d\n", window->win_chat_cursor_x);
|
||||
wee_log_printf (" win_chat_cursor_y . : %d\n", window->win_chat_cursor_y);
|
||||
wee_log_printf (" win_nick_x. . . . . : %d\n", window->win_nick_x);
|
||||
wee_log_printf (" win_nick_y. . . . . : %d\n", window->win_nick_y);
|
||||
wee_log_printf (" win_nick_width. . . : %d\n", window->win_nick_width);
|
||||
wee_log_printf (" win_nick_height . . : %d\n", window->win_nick_height);
|
||||
wee_log_printf (" win_nick_start. . . : %d\n", window->win_nick_start);
|
||||
wee_log_printf (" win_title . . . . . : 0x%X\n", window->win_title);
|
||||
wee_log_printf (" win_chat. . . . . . : 0x%X\n", window->win_chat);
|
||||
wee_log_printf (" win_nick. . . . . . : 0x%X\n", window->win_nick);
|
||||
wee_log_printf (" win_status. . . . . : 0x%X\n", window->win_status);
|
||||
wee_log_printf (" win_infobar . . . . : 0x%X\n", window->win_infobar);
|
||||
wee_log_printf (" win_input . . . . . : 0x%X\n", window->win_input);
|
||||
wee_log_printf (" win_separator . . . : 0x%X\n", window->win_separator);
|
||||
wee_log_printf (" textview_chat . . . : 0x%X\n", window->textview_chat);
|
||||
wee_log_printf (" textbuffer_chat . . : 0x%X\n", window->textbuffer_chat);
|
||||
wee_log_printf (" texttag_chat. . . . : 0x%X\n", window->texttag_chat);
|
||||
wee_log_printf (" textview_nicklist . : 0x%X\n", window->textview_nicklist);
|
||||
wee_log_printf (" textbuffer_nicklist : 0x%X\n", window->textbuffer_nicklist);
|
||||
wee_log_printf (" dcc_first . . . . . : 0x%X\n", window->dcc_first);
|
||||
wee_log_printf (" dcc_selected. . . . : 0x%X\n", window->dcc_selected);
|
||||
wee_log_printf (" dcc_last_displayed. : 0x%X\n", window->dcc_last_displayed);
|
||||
wee_log_printf (" buffer. . . . . . . : 0x%X\n", window->buffer);
|
||||
wee_log_printf (" first_line_displayed: %d\n", window->first_line_displayed);
|
||||
wee_log_printf (" start_line. . . . . : 0x%X\n", window->start_line);
|
||||
wee_log_printf (" start_line_pos. . . : %d\n", window->start_line_pos);
|
||||
wee_log_printf (" prev_window . . . . : 0x%X\n", window->prev_window);
|
||||
wee_log_printf (" next_window . . . . : 0x%X\n", window->next_window);
|
||||
weechat_log_printf ("[window (addr:0x%X)]\n", window);
|
||||
weechat_log_printf (" win_x . . . . . . . : %d\n", window->win_x);
|
||||
weechat_log_printf (" win_y . . . . . . . : %d\n", window->win_y);
|
||||
weechat_log_printf (" win_width . . . . . : %d\n", window->win_width);
|
||||
weechat_log_printf (" win_height. . . . . : %d\n", window->win_height);
|
||||
weechat_log_printf (" win_width_pct . . . : %d\n", window->win_width_pct);
|
||||
weechat_log_printf (" win_height_pct. . . : %d\n", window->win_height_pct);
|
||||
weechat_log_printf (" win_chat_x. . . . . : %d\n", window->win_chat_x);
|
||||
weechat_log_printf (" win_chat_y. . . . . : %d\n", window->win_chat_y);
|
||||
weechat_log_printf (" win_chat_width. . . : %d\n", window->win_chat_width);
|
||||
weechat_log_printf (" win_chat_height . . : %d\n", window->win_chat_height);
|
||||
weechat_log_printf (" win_chat_cursor_x . : %d\n", window->win_chat_cursor_x);
|
||||
weechat_log_printf (" win_chat_cursor_y . : %d\n", window->win_chat_cursor_y);
|
||||
weechat_log_printf (" win_nick_x. . . . . : %d\n", window->win_nick_x);
|
||||
weechat_log_printf (" win_nick_y. . . . . : %d\n", window->win_nick_y);
|
||||
weechat_log_printf (" win_nick_width. . . : %d\n", window->win_nick_width);
|
||||
weechat_log_printf (" win_nick_height . . : %d\n", window->win_nick_height);
|
||||
weechat_log_printf (" win_nick_start. . . : %d\n", window->win_nick_start);
|
||||
weechat_log_printf (" win_title . . . . . : 0x%X\n", window->win_title);
|
||||
weechat_log_printf (" win_chat. . . . . . : 0x%X\n", window->win_chat);
|
||||
weechat_log_printf (" win_nick. . . . . . : 0x%X\n", window->win_nick);
|
||||
weechat_log_printf (" win_status. . . . . : 0x%X\n", window->win_status);
|
||||
weechat_log_printf (" win_infobar . . . . : 0x%X\n", window->win_infobar);
|
||||
weechat_log_printf (" win_input . . . . . : 0x%X\n", window->win_input);
|
||||
weechat_log_printf (" win_separator . . . : 0x%X\n", window->win_separator);
|
||||
weechat_log_printf (" textview_chat . . . : 0x%X\n", window->textview_chat);
|
||||
weechat_log_printf (" textbuffer_chat . . : 0x%X\n", window->textbuffer_chat);
|
||||
weechat_log_printf (" texttag_chat. . . . : 0x%X\n", window->texttag_chat);
|
||||
weechat_log_printf (" textview_nicklist . : 0x%X\n", window->textview_nicklist);
|
||||
weechat_log_printf (" textbuffer_nicklist : 0x%X\n", window->textbuffer_nicklist);
|
||||
weechat_log_printf (" dcc_first . . . . . : 0x%X\n", window->dcc_first);
|
||||
weechat_log_printf (" dcc_selected. . . . : 0x%X\n", window->dcc_selected);
|
||||
weechat_log_printf (" dcc_last_displayed. : 0x%X\n", window->dcc_last_displayed);
|
||||
weechat_log_printf (" buffer. . . . . . . : 0x%X\n", window->buffer);
|
||||
weechat_log_printf (" first_line_displayed: %d\n", window->first_line_displayed);
|
||||
weechat_log_printf (" start_line. . . . . : 0x%X\n", window->start_line);
|
||||
weechat_log_printf (" start_line_pos. . . : %d\n", window->start_line_pos);
|
||||
weechat_log_printf (" prev_window . . . . : 0x%X\n", window->prev_window);
|
||||
weechat_log_printf (" next_window . . . . : 0x%X\n", window->next_window);
|
||||
|
||||
}
|
||||
|
||||
@@ -1668,35 +1667,35 @@ gui_buffer_print_log (t_gui_buffer *buffer)
|
||||
t_gui_line *ptr_line;
|
||||
int num;
|
||||
|
||||
wee_log_printf ("[buffer (addr:0x%X)]\n", buffer);
|
||||
wee_log_printf (" num_displayed. . . . : %d\n", buffer->num_displayed);
|
||||
wee_log_printf (" number . . . . . . . : %d\n", buffer->number);
|
||||
wee_log_printf (" server . . . . . . . : 0x%X\n", buffer->server);
|
||||
wee_log_printf (" all_servers. . . . . : %d\n", buffer->all_servers);
|
||||
wee_log_printf (" channel. . . . . . . : 0x%X\n", buffer->channel);
|
||||
wee_log_printf (" dcc. . . . . . . . . : %d\n", buffer->dcc);
|
||||
wee_log_printf (" lines. . . . . . . . : 0x%X\n", buffer->lines);
|
||||
wee_log_printf (" last_line. . . . . . : 0x%X\n", buffer->last_line);
|
||||
wee_log_printf (" last_read_line . . . : 0x%X\n", buffer->last_read_line);
|
||||
wee_log_printf (" num_lines. . . . . . : %d\n", buffer->num_lines);
|
||||
wee_log_printf (" line_complete. . . . : %d\n", buffer->line_complete);
|
||||
wee_log_printf (" notify_level . . . . : %d\n", buffer->notify_level);
|
||||
wee_log_printf (" log_filename . . . . : '%s'\n", buffer->log_filename);
|
||||
wee_log_printf (" log_file . . . . . . : 0x%X\n", buffer->log_file);
|
||||
wee_log_printf (" has_input. . . . . . : %d\n", buffer->has_input);
|
||||
wee_log_printf (" input_buffer . . . . : '%s'\n", buffer->input_buffer);
|
||||
wee_log_printf (" input_buffer_alloc . : %d\n", buffer->input_buffer_alloc);
|
||||
wee_log_printf (" input_buffer_size. . : %d\n", buffer->input_buffer_size);
|
||||
wee_log_printf (" input_buffer_length. : %d\n", buffer->input_buffer_length);
|
||||
wee_log_printf (" input_buffer_pos . . : %d\n", buffer->input_buffer_pos);
|
||||
wee_log_printf (" input_buffer_1st_disp: %d\n", buffer->input_buffer_1st_display);
|
||||
wee_log_printf (" history. . . . . . . : 0x%X\n", buffer->history);
|
||||
wee_log_printf (" last_history . . . . : 0x%X\n", buffer->last_history);
|
||||
wee_log_printf (" ptr_history. . . . . : 0x%X\n", buffer->ptr_history);
|
||||
wee_log_printf (" prev_buffer. . . . . : 0x%X\n", buffer->prev_buffer);
|
||||
wee_log_printf (" next_buffer. . . . . : 0x%X\n", buffer->next_buffer);
|
||||
wee_log_printf ("\n");
|
||||
wee_log_printf (" => last 100 lines:\n");
|
||||
weechat_log_printf ("[buffer (addr:0x%X)]\n", buffer);
|
||||
weechat_log_printf (" num_displayed. . . . : %d\n", buffer->num_displayed);
|
||||
weechat_log_printf (" number . . . . . . . : %d\n", buffer->number);
|
||||
weechat_log_printf (" server . . . . . . . : 0x%X\n", buffer->server);
|
||||
weechat_log_printf (" all_servers. . . . . : %d\n", buffer->all_servers);
|
||||
weechat_log_printf (" channel. . . . . . . : 0x%X\n", buffer->channel);
|
||||
weechat_log_printf (" dcc. . . . . . . . . : %d\n", buffer->dcc);
|
||||
weechat_log_printf (" lines. . . . . . . . : 0x%X\n", buffer->lines);
|
||||
weechat_log_printf (" last_line. . . . . . : 0x%X\n", buffer->last_line);
|
||||
weechat_log_printf (" last_read_line . . . : 0x%X\n", buffer->last_read_line);
|
||||
weechat_log_printf (" num_lines. . . . . . : %d\n", buffer->num_lines);
|
||||
weechat_log_printf (" line_complete. . . . : %d\n", buffer->line_complete);
|
||||
weechat_log_printf (" notify_level . . . . : %d\n", buffer->notify_level);
|
||||
weechat_log_printf (" log_filename . . . . : '%s'\n", buffer->log_filename);
|
||||
weechat_log_printf (" log_file . . . . . . : 0x%X\n", buffer->log_file);
|
||||
weechat_log_printf (" has_input. . . . . . : %d\n", buffer->has_input);
|
||||
weechat_log_printf (" input_buffer . . . . : '%s'\n", buffer->input_buffer);
|
||||
weechat_log_printf (" input_buffer_alloc . : %d\n", buffer->input_buffer_alloc);
|
||||
weechat_log_printf (" input_buffer_size. . : %d\n", buffer->input_buffer_size);
|
||||
weechat_log_printf (" input_buffer_length. : %d\n", buffer->input_buffer_length);
|
||||
weechat_log_printf (" input_buffer_pos . . : %d\n", buffer->input_buffer_pos);
|
||||
weechat_log_printf (" input_buffer_1st_disp: %d\n", buffer->input_buffer_1st_display);
|
||||
weechat_log_printf (" history. . . . . . . : 0x%X\n", buffer->history);
|
||||
weechat_log_printf (" last_history . . . . : 0x%X\n", buffer->last_history);
|
||||
weechat_log_printf (" ptr_history. . . . . : 0x%X\n", buffer->ptr_history);
|
||||
weechat_log_printf (" prev_buffer. . . . . : 0x%X\n", buffer->prev_buffer);
|
||||
weechat_log_printf (" next_buffer. . . . . : 0x%X\n", buffer->next_buffer);
|
||||
weechat_log_printf ("\n");
|
||||
weechat_log_printf (" => last 100 lines:\n");
|
||||
|
||||
num = 0;
|
||||
ptr_line = buffer->last_line;
|
||||
@@ -1713,9 +1712,9 @@ gui_buffer_print_log (t_gui_buffer *buffer)
|
||||
while (ptr_line)
|
||||
{
|
||||
num--;
|
||||
wee_log_printf (" line N-%05d: %s\n",
|
||||
num,
|
||||
(ptr_line->data) ? ptr_line->data : "(empty)");
|
||||
weechat_log_printf (" line N-%05d: %s\n",
|
||||
num,
|
||||
(ptr_line->data) ? ptr_line->data : "(empty)");
|
||||
|
||||
ptr_line = ptr_line->next_line;
|
||||
}
|
||||
|
||||
@@ -431,8 +431,8 @@ gui_key_bind (char *key, char *command)
|
||||
|
||||
if (!key || !command)
|
||||
{
|
||||
wee_log_printf (_("%s unable to bind key \"%s\"\n"),
|
||||
WEECHAT_ERROR, key);
|
||||
weechat_log_printf (_("%s unable to bind key \"%s\"\n"),
|
||||
WEECHAT_ERROR, key);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
@@ -442,8 +442,8 @@ gui_key_bind (char *key, char *command)
|
||||
ptr_function = gui_key_function_search_by_name (command);
|
||||
if (!ptr_function)
|
||||
{
|
||||
wee_log_printf (_("%s unable to bind key \"%s\" (invalid function name: \"%s\")\n"),
|
||||
WEECHAT_ERROR, key, command);
|
||||
weechat_log_printf (_("%s unable to bind key \"%s\" (invalid function name: \"%s\")\n"),
|
||||
WEECHAT_ERROR, key, command);
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
@@ -455,8 +455,8 @@ gui_key_bind (char *key, char *command)
|
||||
ptr_function);
|
||||
if (!new_key)
|
||||
{
|
||||
wee_log_printf (_("%s not enough memory for key binding\n"),
|
||||
WEECHAT_ERROR);
|
||||
weechat_log_printf (_("%s not enough memory for key binding\n"),
|
||||
WEECHAT_ERROR);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
||||
+3
-3
@@ -140,8 +140,8 @@ enum t_weechat_color
|
||||
#define CHANNEL(buffer) ((t_irc_channel *)(buffer->channel))
|
||||
|
||||
#define BUFFER_IS_SERVER(buffer) ((SERVER(buffer) || (buffer->all_servers)) && !CHANNEL(buffer))
|
||||
#define BUFFER_IS_CHANNEL(buffer) (CHANNEL(buffer) && (CHANNEL(buffer)->type == CHAT_CHANNEL))
|
||||
#define BUFFER_IS_PRIVATE(buffer) (CHANNEL(buffer) && (CHANNEL(buffer)->type == CHAT_PRIVATE))
|
||||
#define BUFFER_IS_CHANNEL(buffer) (CHANNEL(buffer) && (CHANNEL(buffer)->type == CHANNEL_TYPE_CHANNEL))
|
||||
#define BUFFER_IS_PRIVATE(buffer) (CHANNEL(buffer) && (CHANNEL(buffer)->type == CHANNEL_TYPE_PRIVATE))
|
||||
|
||||
#define BUFFER_HAS_NICKLIST(buffer) (BUFFER_IS_CHANNEL(buffer))
|
||||
|
||||
@@ -409,7 +409,7 @@ extern void gui_infobar_printf (int, int, char *, ...);
|
||||
extern void gui_window_free (t_gui_window *);
|
||||
extern void gui_infobar_remove ();
|
||||
extern void gui_buffer_free (t_gui_buffer *, int);
|
||||
extern t_gui_line *gui_new_line (t_gui_buffer *);
|
||||
extern t_gui_line *gui_line_new (t_gui_buffer *);
|
||||
extern int gui_word_strlen (t_gui_window *, char *);
|
||||
extern int gui_word_real_pos (t_gui_window *, char *, int);
|
||||
extern void gui_printf_internal (t_gui_buffer *, int, int, char *, ...);
|
||||
|
||||
+24
-25
@@ -41,8 +41,7 @@ char *channel_modes = "iklmnst";
|
||||
*/
|
||||
|
||||
t_irc_channel *
|
||||
channel_new (t_irc_server *server, int channel_type, char *channel_name,
|
||||
int switch_to_buffer)
|
||||
channel_new (t_irc_server *server, int channel_type, char *channel_name)
|
||||
{
|
||||
t_irc_channel *new_channel;
|
||||
|
||||
@@ -58,8 +57,9 @@ channel_new (t_irc_server *server, int channel_type, char *channel_name,
|
||||
new_channel->dcc_chat = NULL;
|
||||
new_channel->name = strdup (channel_name);
|
||||
new_channel->topic = NULL;
|
||||
memset (new_channel->modes, ' ', sizeof (new_channel->modes));
|
||||
new_channel->modes[sizeof (new_channel->modes) - 1] = '\0';
|
||||
new_channel->modes = (char *) malloc (NUM_CHANNEL_MODES + 1);
|
||||
memset (new_channel->modes, ' ', NUM_CHANNEL_MODES);
|
||||
new_channel->modes[NUM_CHANNEL_MODES] = '\0';
|
||||
new_channel->limit = 0;
|
||||
new_channel->key = NULL;
|
||||
new_channel->nicks_count = 0;
|
||||
@@ -75,8 +75,6 @@ channel_new (t_irc_server *server, int channel_type, char *channel_name,
|
||||
else
|
||||
server->channels = new_channel;
|
||||
server->last_channel = new_channel;
|
||||
|
||||
gui_buffer_new (gui_current_window, server, new_channel, 0, switch_to_buffer);
|
||||
|
||||
/* all is ok, return address of new channel */
|
||||
return new_channel;
|
||||
@@ -182,11 +180,11 @@ channel_remove_away (t_irc_channel *channel)
|
||||
{
|
||||
t_irc_nick *ptr_nick;
|
||||
|
||||
if (channel->type == CHAT_CHANNEL)
|
||||
if (channel->type == CHANNEL_TYPE_CHANNEL)
|
||||
{
|
||||
for (ptr_nick = channel->nicks; ptr_nick; ptr_nick = ptr_nick->next_nick)
|
||||
{
|
||||
ptr_nick->is_away = 0;
|
||||
NICK_SET_FLAG(ptr_nick, 0, NICK_AWAY);
|
||||
}
|
||||
gui_draw_buffer_nick (channel->buffer, 0);
|
||||
}
|
||||
@@ -199,7 +197,7 @@ channel_remove_away (t_irc_channel *channel)
|
||||
void
|
||||
channel_check_away (t_irc_server *server, t_irc_channel *channel)
|
||||
{
|
||||
if (channel->type == CHAT_CHANNEL)
|
||||
if (channel->type == CHANNEL_TYPE_CHANNEL)
|
||||
{
|
||||
channel->checking_away++;
|
||||
server_sendf (server, "WHO %s\r\n", channel->name);
|
||||
@@ -215,7 +213,7 @@ channel_set_away (t_irc_channel *channel, char *nick, int is_away)
|
||||
{
|
||||
t_irc_nick *ptr_nick;
|
||||
|
||||
if (channel->type == CHAT_CHANNEL)
|
||||
if (channel->type == CHANNEL_TYPE_CHANNEL)
|
||||
{
|
||||
ptr_nick = nick_search (channel, nick);
|
||||
if (ptr_nick)
|
||||
@@ -234,10 +232,11 @@ channel_create_dcc (t_irc_dcc *ptr_dcc)
|
||||
|
||||
ptr_channel = channel_search (ptr_dcc->server, ptr_dcc->nick);
|
||||
if (!ptr_channel)
|
||||
ptr_channel = channel_new (ptr_dcc->server, CHAT_PRIVATE,
|
||||
ptr_dcc->nick, 0);
|
||||
ptr_channel = channel_new (ptr_dcc->server, CHANNEL_TYPE_PRIVATE,
|
||||
ptr_dcc->nick);
|
||||
if (!ptr_channel)
|
||||
return 0;
|
||||
gui_buffer_new (gui_current_window, ptr_dcc->server, ptr_channel, 0, 0);
|
||||
|
||||
if (ptr_channel->dcc_chat &&
|
||||
(!DCC_ENDED(((t_irc_dcc *)(ptr_channel->dcc_chat))->status)))
|
||||
@@ -406,17 +405,17 @@ channel_set_notify_level (t_irc_server *server, t_irc_channel *channel, int noti
|
||||
void
|
||||
channel_print_log (t_irc_channel *channel)
|
||||
{
|
||||
wee_log_printf ("=> channel %s (addr:0x%X)]\n", channel->name, channel);
|
||||
wee_log_printf (" type . . . . : %d\n", channel->type);
|
||||
wee_log_printf (" dcc_chat . . : 0x%X\n", channel->dcc_chat);
|
||||
wee_log_printf (" topic. . . . : '%s'\n", channel->topic);
|
||||
wee_log_printf (" modes. . . . : '%s'\n", channel->modes);
|
||||
wee_log_printf (" limit. . . . : %d\n", channel->limit);
|
||||
wee_log_printf (" key. . . . . : '%s'\n", channel->key);
|
||||
wee_log_printf (" checking_away: %d\n", channel->checking_away);
|
||||
wee_log_printf (" nicks. . . . : 0x%X\n", channel->nicks);
|
||||
wee_log_printf (" last_nick. . : 0x%X\n", channel->last_nick);
|
||||
wee_log_printf (" buffer . . . : 0x%X\n", channel->buffer);
|
||||
wee_log_printf (" prev_channel : 0x%X\n", channel->prev_channel);
|
||||
wee_log_printf (" next_channel : 0x%X\n", channel->next_channel);
|
||||
weechat_log_printf ("=> channel %s (addr:0x%X)]\n", channel->name, channel);
|
||||
weechat_log_printf (" type . . . . : %d\n", channel->type);
|
||||
weechat_log_printf (" dcc_chat . . : 0x%X\n", channel->dcc_chat);
|
||||
weechat_log_printf (" topic. . . . : '%s'\n", channel->topic);
|
||||
weechat_log_printf (" modes. . . . : '%s'\n", channel->modes);
|
||||
weechat_log_printf (" limit. . . . : %d\n", channel->limit);
|
||||
weechat_log_printf (" key. . . . . : '%s'\n", channel->key);
|
||||
weechat_log_printf (" checking_away: %d\n", channel->checking_away);
|
||||
weechat_log_printf (" nicks. . . . : 0x%X\n", channel->nicks);
|
||||
weechat_log_printf (" last_nick. . : 0x%X\n", channel->last_nick);
|
||||
weechat_log_printf (" buffer . . . : 0x%X\n", channel->buffer);
|
||||
weechat_log_printf (" prev_channel : 0x%X\n", channel->prev_channel);
|
||||
weechat_log_printf (" next_channel : 0x%X\n", channel->next_channel);
|
||||
}
|
||||
|
||||
+106
-11
@@ -148,6 +148,9 @@ dcc_find_filename (t_irc_dcc *ptr_dcc)
|
||||
{
|
||||
char *ptr_home, *filename2;
|
||||
|
||||
if (!DCC_IS_FILE(ptr_dcc->type))
|
||||
return;
|
||||
|
||||
ptr_home = getenv ("HOME");
|
||||
ptr_dcc->local_filename = (char *) malloc (strlen (cfg_dcc_download_path) +
|
||||
strlen (ptr_dcc->nick) +
|
||||
@@ -223,20 +226,32 @@ void
|
||||
dcc_calculate_speed (t_irc_dcc *ptr_dcc, int ended)
|
||||
{
|
||||
time_t local_time, elapsed;
|
||||
unsigned long bytes_per_sec_total;
|
||||
|
||||
local_time = time (NULL);
|
||||
if (ended || local_time > ptr_dcc->last_check_time)
|
||||
{
|
||||
|
||||
if (ended)
|
||||
{
|
||||
/* calculate bytes per second (global) */
|
||||
elapsed = local_time - ptr_dcc->start_transfer;
|
||||
if (elapsed == 0)
|
||||
elapsed = 1;
|
||||
ptr_dcc->bytes_per_sec = (ptr_dcc->pos - ptr_dcc->start_resume) / elapsed;
|
||||
ptr_dcc->eta = 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
/* calculate ETA */
|
||||
elapsed = local_time - ptr_dcc->start_transfer;
|
||||
if (elapsed == 0)
|
||||
elapsed = 1;
|
||||
bytes_per_sec_total = (ptr_dcc->pos - ptr_dcc->start_resume) / elapsed;
|
||||
if (bytes_per_sec_total == 0)
|
||||
bytes_per_sec_total = 1;
|
||||
ptr_dcc->eta = (ptr_dcc->size - ptr_dcc->pos) / bytes_per_sec_total;
|
||||
|
||||
/* calculate bytes per second (since last check time) */
|
||||
elapsed = local_time - ptr_dcc->last_check_time;
|
||||
if (elapsed == 0)
|
||||
elapsed = 1;
|
||||
@@ -605,6 +620,54 @@ dcc_start_resume (t_irc_server *server, char *filename, int port,
|
||||
WEECHAT_ERROR, filename, port, pos_start);
|
||||
}
|
||||
|
||||
/*
|
||||
* dcc_alloc: allocate a new DCC file
|
||||
*/
|
||||
|
||||
t_irc_dcc *
|
||||
dcc_alloc ()
|
||||
{
|
||||
t_irc_dcc *new_dcc;
|
||||
|
||||
/* create new DCC struct */
|
||||
if ((new_dcc = (t_irc_dcc *) malloc (sizeof (t_irc_dcc))) == NULL)
|
||||
return NULL;
|
||||
|
||||
/* default values */
|
||||
new_dcc->server = NULL;
|
||||
new_dcc->channel = NULL;
|
||||
new_dcc->type = 0;
|
||||
new_dcc->status = 0;
|
||||
new_dcc->start_time = 0;
|
||||
new_dcc->start_transfer = 0;
|
||||
new_dcc->addr = 0;
|
||||
new_dcc->port = 0;
|
||||
new_dcc->nick = NULL;
|
||||
new_dcc->sock = -1;
|
||||
new_dcc->unterminated_message = NULL;
|
||||
new_dcc->file = -1;
|
||||
new_dcc->filename = NULL;
|
||||
new_dcc->local_filename = NULL;
|
||||
new_dcc->filename_suffix = -1;
|
||||
new_dcc->size = 0;
|
||||
new_dcc->pos = 0;
|
||||
new_dcc->ack = 0;
|
||||
new_dcc->start_resume = 0;
|
||||
new_dcc->last_check_time = 0;
|
||||
new_dcc->last_check_pos = 0;
|
||||
new_dcc->last_activity = 0;
|
||||
new_dcc->bytes_per_sec = 0;
|
||||
new_dcc->eta = 0;
|
||||
|
||||
new_dcc->prev_dcc = NULL;
|
||||
new_dcc->next_dcc = dcc_list;
|
||||
if (dcc_list)
|
||||
dcc_list->prev_dcc = new_dcc;
|
||||
dcc_list = new_dcc;
|
||||
|
||||
return new_dcc;
|
||||
}
|
||||
|
||||
/*
|
||||
* dcc_add: add a DCC file to queue
|
||||
*/
|
||||
@@ -615,8 +678,8 @@ dcc_add (t_irc_server *server, int type, unsigned long addr, int port, char *nic
|
||||
{
|
||||
t_irc_dcc *new_dcc;
|
||||
|
||||
/* create new DCC struct */
|
||||
if ((new_dcc = (t_irc_dcc *) malloc (sizeof (t_irc_dcc))) == NULL)
|
||||
new_dcc = dcc_alloc ();
|
||||
if (!new_dcc)
|
||||
{
|
||||
irc_display_prefix (server, server->buffer, PREFIX_ERROR);
|
||||
gui_printf (server->buffer,
|
||||
@@ -650,17 +713,13 @@ dcc_add (t_irc_server *server, int type, unsigned long addr, int port, char *nic
|
||||
new_dcc->start_resume = 0;
|
||||
new_dcc->last_check_time = time (NULL);
|
||||
new_dcc->last_check_pos = 0;
|
||||
new_dcc->bytes_per_sec = 0;
|
||||
new_dcc->last_activity = time (NULL);
|
||||
new_dcc->bytes_per_sec = 0;
|
||||
new_dcc->eta = 0;
|
||||
if (local_filename)
|
||||
new_dcc->local_filename = strdup (local_filename);
|
||||
else
|
||||
dcc_find_filename (new_dcc);
|
||||
new_dcc->prev_dcc = NULL;
|
||||
new_dcc->next_dcc = dcc_list;
|
||||
if (dcc_list)
|
||||
dcc_list->prev_dcc = new_dcc;
|
||||
dcc_list = new_dcc;
|
||||
|
||||
gui_current_window->dcc_first = NULL;
|
||||
gui_current_window->dcc_selected = NULL;
|
||||
@@ -1424,9 +1483,45 @@ dcc_end ()
|
||||
if (ptr_dcc->sock != -1)
|
||||
{
|
||||
if (ptr_dcc->status == DCC_ACTIVE)
|
||||
wee_log_printf (_("Aborting active DCC: \"%s\" from %s\n"),
|
||||
ptr_dcc->filename, ptr_dcc->nick);
|
||||
weechat_log_printf (_("Aborting active DCC: \"%s\" from %s\n"),
|
||||
ptr_dcc->filename, ptr_dcc->nick);
|
||||
dcc_close (ptr_dcc, DCC_FAILED);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* dcc_print_log: print DCC infos in log (usually for crash dump)
|
||||
*/
|
||||
|
||||
void
|
||||
dcc_print_log (t_irc_dcc *dcc)
|
||||
{
|
||||
weechat_log_printf ("[DCC (addr:0x%X)]\n", dcc);
|
||||
weechat_log_printf (" server. . . . . . . : 0x%X\n", dcc->server);
|
||||
weechat_log_printf (" channel . . . . . . : 0x%X\n", dcc->channel);
|
||||
weechat_log_printf (" type. . . . . . . . : %d\n", dcc->type);
|
||||
weechat_log_printf (" status. . . . . . . : %d\n", dcc->status);
|
||||
weechat_log_printf (" start_time. . . . . : %ld\n", dcc->start_time);
|
||||
weechat_log_printf (" start_transfer. . . : %ld\n", dcc->start_transfer);
|
||||
weechat_log_printf (" addr. . . . . . . . : %lu\n", dcc->addr);
|
||||
weechat_log_printf (" port. . . . . . . . : %d\n", dcc->port);
|
||||
weechat_log_printf (" nick. . . . . . . . : '%s'\n", dcc->nick);
|
||||
weechat_log_printf (" sock. . . . . . . . : %d\n", dcc->sock);
|
||||
weechat_log_printf (" unterminated_message: '%s'\n", dcc->unterminated_message);
|
||||
weechat_log_printf (" file. . . . . . . . : %d\n", dcc->file);
|
||||
weechat_log_printf (" filename. . . . . . : '%s'\n", dcc->filename);
|
||||
weechat_log_printf (" local_filename. . . : '%s'\n", dcc->local_filename);
|
||||
weechat_log_printf (" filename_suffix . . : %d\n", dcc->filename_suffix);
|
||||
weechat_log_printf (" size. . . . . . . . : %lu\n", dcc->size);
|
||||
weechat_log_printf (" pos . . . . . . . . : %lu\n", dcc->pos);
|
||||
weechat_log_printf (" ack . . . . . . . . : %lu\n", dcc->ack);
|
||||
weechat_log_printf (" start_resume. . . . : %lu\n", dcc->start_resume);
|
||||
weechat_log_printf (" last_check_time . . : %ld\n", dcc->last_check_time);
|
||||
weechat_log_printf (" last_check_pos. . . : %lu\n", dcc->last_check_pos);
|
||||
weechat_log_printf (" last_activity . . . : %ld\n", dcc->last_activity);
|
||||
weechat_log_printf (" bytes_per_sec . . . : %lu\n", dcc->bytes_per_sec);
|
||||
weechat_log_printf (" eta . . . . . . . . : %lu\n", dcc->eta);
|
||||
weechat_log_printf (" prev_dcc. . . . . . : 0x%X\n", dcc->prev_dcc);
|
||||
weechat_log_printf (" next_dcc. . . . . . : 0x%X\n", dcc->next_dcc);
|
||||
}
|
||||
|
||||
@@ -97,19 +97,19 @@ irc_display_nick (t_gui_buffer *buffer, t_irc_nick *nick, char *nickname,
|
||||
(nick) ? "<" : ">");
|
||||
if (nick && cfg_look_nickmode)
|
||||
{
|
||||
if (nick->is_chanowner)
|
||||
if (nick->flags & NICK_CHANOWNER)
|
||||
gui_printf_type (buffer, type, "%s~",
|
||||
GUI_COLOR(COLOR_WIN_NICK_OP));
|
||||
else if (nick->is_chanadmin)
|
||||
else if (nick->flags & NICK_CHANADMIN)
|
||||
gui_printf_type (buffer, type, "%s&",
|
||||
GUI_COLOR(COLOR_WIN_NICK_OP));
|
||||
else if (nick->is_op)
|
||||
else if (nick->flags & NICK_OP)
|
||||
gui_printf_type (buffer, type, "%s@",
|
||||
GUI_COLOR(COLOR_WIN_NICK_OP));
|
||||
else if (nick->is_halfop)
|
||||
else if (nick->flags & NICK_HALFOP)
|
||||
gui_printf_type (buffer, type, "%s%%",
|
||||
GUI_COLOR(COLOR_WIN_NICK_HALFOP));
|
||||
else if (nick->has_voice)
|
||||
else if (nick->flags & NICK_VOICE)
|
||||
gui_printf_type (buffer, type, "%s+",
|
||||
GUI_COLOR(COLOR_WIN_NICK_VOICE));
|
||||
else
|
||||
|
||||
@@ -459,18 +459,18 @@ ignore_print_log ()
|
||||
{
|
||||
t_irc_ignore *ptr_ignore;
|
||||
|
||||
wee_log_printf ("[ignore list]\n");
|
||||
weechat_log_printf ("[ignore list]\n");
|
||||
|
||||
for (ptr_ignore = irc_ignore; ptr_ignore;
|
||||
ptr_ignore = ptr_ignore->next_ignore)
|
||||
{
|
||||
wee_log_printf ("\n");
|
||||
wee_log_printf (" -> ignore at 0x%X:\n", ptr_ignore);
|
||||
wee_log_printf (" mask. . . . . . . : %s\n", ptr_ignore->mask);
|
||||
wee_log_printf (" type. . . . . . . : %s\n", ptr_ignore->type);
|
||||
wee_log_printf (" channel_name. . . : %s\n", ptr_ignore->channel_name);
|
||||
wee_log_printf (" server_name . . . : %s\n", ptr_ignore->server_name);
|
||||
wee_log_printf (" prev_ignore . . . : 0x%X\n", ptr_ignore->prev_ignore);
|
||||
wee_log_printf (" next_ignore . . . : 0x%X\n", ptr_ignore->next_ignore);
|
||||
weechat_log_printf ("\n");
|
||||
weechat_log_printf (" -> ignore at 0x%X:\n", ptr_ignore);
|
||||
weechat_log_printf (" mask. . . . . . . : %s\n", ptr_ignore->mask);
|
||||
weechat_log_printf (" type. . . . . . . : %s\n", ptr_ignore->type);
|
||||
weechat_log_printf (" channel_name. . . : %s\n", ptr_ignore->channel_name);
|
||||
weechat_log_printf (" server_name . . . : %s\n", ptr_ignore->server_name);
|
||||
weechat_log_printf (" prev_ignore . . . : 0x%X\n", ptr_ignore->prev_ignore);
|
||||
weechat_log_printf (" next_ignore . . . : 0x%X\n", ptr_ignore->next_ignore);
|
||||
}
|
||||
}
|
||||
|
||||
+33
-39
@@ -59,15 +59,15 @@ nick_find_color (t_irc_nick *nick)
|
||||
int
|
||||
nick_score_for_sort (t_irc_nick *nick)
|
||||
{
|
||||
if (nick->is_chanowner)
|
||||
if (nick->flags & NICK_CHANOWNER)
|
||||
return -32;
|
||||
if (nick->is_chanadmin)
|
||||
if (nick->flags & NICK_CHANADMIN)
|
||||
return -16;
|
||||
if (nick->is_op)
|
||||
if (nick->flags & NICK_OP)
|
||||
return -8;
|
||||
if (nick->is_halfop)
|
||||
if (nick->flags & NICK_HALFOP)
|
||||
return -4;
|
||||
if (nick->has_voice)
|
||||
if (nick->flags & NICK_VOICE)
|
||||
return -2;
|
||||
return 0;
|
||||
}
|
||||
@@ -168,7 +168,7 @@ nick_insert_sorted (t_irc_channel *channel, t_irc_nick *nick)
|
||||
*/
|
||||
|
||||
t_irc_nick *
|
||||
nick_new (t_irc_channel *channel, char *nick_name,
|
||||
nick_new (t_irc_server *server, t_irc_channel *channel, char *nick_name,
|
||||
int is_chanowner, int is_chanadmin, int is_op, int is_halfop,
|
||||
int has_voice)
|
||||
{
|
||||
@@ -178,35 +178,31 @@ nick_new (t_irc_channel *channel, char *nick_name,
|
||||
if ((new_nick = nick_search (channel, nick_name)))
|
||||
{
|
||||
/* update nick */
|
||||
new_nick->is_chanowner = is_chanowner;
|
||||
new_nick->is_chanadmin = is_chanadmin;
|
||||
new_nick->is_op = is_op;
|
||||
new_nick->is_halfop = is_halfop;
|
||||
new_nick->has_voice = has_voice;
|
||||
NICK_SET_FLAG(new_nick, is_chanowner, NICK_CHANOWNER);
|
||||
NICK_SET_FLAG(new_nick, is_chanadmin, NICK_CHANADMIN);
|
||||
NICK_SET_FLAG(new_nick, is_op, NICK_OP);
|
||||
NICK_SET_FLAG(new_nick, is_halfop, NICK_HALFOP);
|
||||
NICK_SET_FLAG(new_nick, has_voice, NICK_VOICE);
|
||||
return new_nick;
|
||||
}
|
||||
|
||||
/* alloc memory for new nick */
|
||||
if ((new_nick = (t_irc_nick *) malloc (sizeof (t_irc_nick))) == NULL)
|
||||
{
|
||||
gui_printf (channel->buffer,
|
||||
_("%s cannot allocate new nick\n"), WEECHAT_ERROR);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
||||
/* initialize new nick */
|
||||
new_nick->nick = strdup (nick_name);
|
||||
new_nick->is_chanowner = is_chanowner;
|
||||
new_nick->is_chanadmin = is_chanadmin;
|
||||
new_nick->is_op = is_op;
|
||||
new_nick->is_halfop = is_halfop;
|
||||
new_nick->has_voice = has_voice;
|
||||
new_nick->is_away = 0;
|
||||
if (ascii_strcasecmp (new_nick->nick, SERVER(channel->buffer)->nick) == 0)
|
||||
new_nick->flags = 0;
|
||||
NICK_SET_FLAG(new_nick, is_chanowner, NICK_CHANOWNER);
|
||||
NICK_SET_FLAG(new_nick, is_chanadmin, NICK_CHANADMIN);
|
||||
NICK_SET_FLAG(new_nick, is_op, NICK_OP);
|
||||
NICK_SET_FLAG(new_nick, is_halfop, NICK_HALFOP);
|
||||
NICK_SET_FLAG(new_nick, has_voice, NICK_VOICE);
|
||||
if (ascii_strcasecmp (new_nick->nick, server->nick) == 0)
|
||||
new_nick->color = COLOR_WIN_NICK_SELF;
|
||||
else
|
||||
new_nick->color = nick_find_color (new_nick);
|
||||
|
||||
|
||||
nick_insert_sorted (channel, new_nick);
|
||||
|
||||
channel->nicks_count++;
|
||||
@@ -347,15 +343,17 @@ nick_count (t_irc_channel *channel, int *total, int *count_op,
|
||||
ptr_nick = ptr_nick->next_nick)
|
||||
{
|
||||
(*total)++;
|
||||
if ((ptr_nick->is_chanowner) || (ptr_nick->is_chanadmin) || (ptr_nick->is_op))
|
||||
if ((ptr_nick->flags & NICK_CHANOWNER) ||
|
||||
(ptr_nick->flags & NICK_CHANADMIN) ||
|
||||
(ptr_nick->flags & NICK_OP))
|
||||
(*count_op)++;
|
||||
else
|
||||
{
|
||||
if (ptr_nick->is_halfop)
|
||||
if (ptr_nick->flags & NICK_HALFOP)
|
||||
(*count_halfop)++;
|
||||
else
|
||||
{
|
||||
if (ptr_nick->has_voice)
|
||||
if (ptr_nick->flags & NICK_VOICE)
|
||||
(*count_voice)++;
|
||||
else
|
||||
(*count_normal)++;
|
||||
@@ -391,9 +389,10 @@ nick_get_max_length (t_irc_channel *channel)
|
||||
void
|
||||
nick_set_away (t_irc_channel *channel, t_irc_nick *nick, int is_away)
|
||||
{
|
||||
if (nick->is_away != is_away)
|
||||
if (((is_away) && (!(nick->flags & NICK_AWAY))) ||
|
||||
((!is_away) && (nick->flags & NICK_AWAY)))
|
||||
{
|
||||
nick->is_away = is_away;
|
||||
NICK_SET_FLAG(nick, is_away, NICK_AWAY);
|
||||
gui_draw_buffer_nick (channel->buffer, 0);
|
||||
}
|
||||
}
|
||||
@@ -405,14 +404,9 @@ nick_set_away (t_irc_channel *channel, t_irc_nick *nick, int is_away)
|
||||
void
|
||||
nick_print_log (t_irc_nick *nick)
|
||||
{
|
||||
wee_log_printf ("=> nick %s (addr:0x%X)]\n", nick->nick, nick);
|
||||
wee_log_printf (" is_chanowner . : %d\n", nick->is_chanowner);
|
||||
wee_log_printf (" is_chanadmin . : %d\n", nick->is_chanadmin);
|
||||
wee_log_printf (" is_op. . . . . : %d\n", nick->is_op);
|
||||
wee_log_printf (" is_halfop. . . : %d\n", nick->is_halfop);
|
||||
wee_log_printf (" has_voice. . . : %d\n", nick->has_voice);
|
||||
wee_log_printf (" is_away. . . . : %d\n", nick->is_away);
|
||||
wee_log_printf (" color. . . . . : %d\n", nick->color);
|
||||
wee_log_printf (" prev_nick. . . : 0x%X\n", nick->prev_nick);
|
||||
wee_log_printf (" next_nick. . . : 0x%X\n", nick->next_nick);
|
||||
weechat_log_printf ("=> nick %s (addr:0x%X)]\n", nick->nick, nick);
|
||||
weechat_log_printf (" flags. . . . . : %d\n", nick->flags);
|
||||
weechat_log_printf (" color. . . . . : %d\n", nick->color);
|
||||
weechat_log_printf (" prev_nick. . . : 0x%X\n", nick->prev_nick);
|
||||
weechat_log_printf (" next_nick. . . : 0x%X\n", nick->next_nick);
|
||||
}
|
||||
|
||||
+32
-28
@@ -396,7 +396,7 @@ irc_cmd_recv_join (t_irc_server *server, char *host, char *nick, char *arguments
|
||||
ptr_channel = channel_search (server, arguments);
|
||||
if (!ptr_channel)
|
||||
{
|
||||
ptr_channel = channel_new (server, CHAT_CHANNEL, arguments, 1);
|
||||
ptr_channel = channel_new (server, CHANNEL_TYPE_CHANNEL, arguments);
|
||||
if (!ptr_channel)
|
||||
{
|
||||
irc_display_prefix (server, server->buffer, PREFIX_ERROR);
|
||||
@@ -405,6 +405,7 @@ irc_cmd_recv_join (t_irc_server *server, char *host, char *nick, char *arguments
|
||||
WEECHAT_ERROR, arguments);
|
||||
return -1;
|
||||
}
|
||||
gui_buffer_new (gui_current_window, server, ptr_channel, 0, 1);
|
||||
}
|
||||
|
||||
if (!command_ignored)
|
||||
@@ -423,7 +424,7 @@ irc_cmd_recv_join (t_irc_server *server, char *host, char *nick, char *arguments
|
||||
GUI_COLOR(COLOR_WIN_CHAT_CHANNEL),
|
||||
arguments);
|
||||
}
|
||||
(void) nick_new (ptr_channel, nick, 0, 0, 0, 0, 0);
|
||||
(void) nick_new (server, ptr_channel, nick, 0, 0, 0, 0, 0);
|
||||
gui_draw_buffer_nick (ptr_channel->buffer, 1);
|
||||
gui_draw_buffer_status (ptr_channel->buffer, 1);
|
||||
return 0;
|
||||
@@ -705,7 +706,7 @@ void irc_get_channel_modes (t_irc_server *server, t_irc_channel *ptr_channel,
|
||||
ptr_nick = nick_search (ptr_channel, parm);
|
||||
if (ptr_nick)
|
||||
{
|
||||
ptr_nick->is_halfop = (set_flag == '+') ? 1 : 0;
|
||||
NICK_SET_FLAG(ptr_nick, (set_flag == '+'), NICK_HALFOP);
|
||||
nick_resort (ptr_channel, ptr_nick);
|
||||
gui_draw_buffer_nick (ptr_channel->buffer, 1);
|
||||
}
|
||||
@@ -728,8 +729,8 @@ void irc_get_channel_modes (t_irc_server *server, t_irc_channel *ptr_channel,
|
||||
_("sets invite-only channel flag") :
|
||||
_("removes invite-only channel flag"),
|
||||
NULL);
|
||||
SET_CHANNEL_MODE(ptr_channel, (set_flag == '+'),
|
||||
CHANNEL_MODE_INVITE);
|
||||
CHANNEL_SET_MODE(ptr_channel, (set_flag == '+'),
|
||||
CHANNEL_MODE_INVITE);
|
||||
break;
|
||||
case 'k':
|
||||
pos = NULL;
|
||||
@@ -748,8 +749,8 @@ void irc_get_channel_modes (t_irc_server *server, t_irc_channel *ptr_channel,
|
||||
(set_flag == '+') ?
|
||||
((parm) ? parm : NULL) :
|
||||
NULL);
|
||||
SET_CHANNEL_MODE(ptr_channel, (set_flag == '+'),
|
||||
CHANNEL_MODE_KEY);
|
||||
CHANNEL_SET_MODE(ptr_channel, (set_flag == '+'),
|
||||
CHANNEL_MODE_KEY);
|
||||
if (ptr_channel->key)
|
||||
free (ptr_channel->key);
|
||||
ptr_channel->key = strdup (parm);
|
||||
@@ -780,8 +781,8 @@ void irc_get_channel_modes (t_irc_server *server, t_irc_channel *ptr_channel,
|
||||
(set_flag == '+') ?
|
||||
((parm) ? parm : NULL) :
|
||||
NULL);
|
||||
SET_CHANNEL_MODE(ptr_channel, (set_flag == '+'),
|
||||
CHANNEL_MODE_LIMIT);
|
||||
CHANNEL_SET_MODE(ptr_channel, (set_flag == '+'),
|
||||
CHANNEL_MODE_LIMIT);
|
||||
ptr_channel->limit = atoi (parm);
|
||||
|
||||
/* look for next parameter */
|
||||
@@ -801,8 +802,8 @@ void irc_get_channel_modes (t_irc_server *server, t_irc_channel *ptr_channel,
|
||||
_("sets moderated channel flag") :
|
||||
_("removes moderated channel flag"),
|
||||
NULL);
|
||||
SET_CHANNEL_MODE(ptr_channel, (set_flag == '+'),
|
||||
CHANNEL_MODE_MODERATED);
|
||||
CHANNEL_SET_MODE(ptr_channel, (set_flag == '+'),
|
||||
CHANNEL_MODE_MODERATED);
|
||||
break;
|
||||
case 'n':
|
||||
if (nick_host)
|
||||
@@ -812,8 +813,8 @@ void irc_get_channel_modes (t_irc_server *server, t_irc_channel *ptr_channel,
|
||||
_("sets messages from channel only flag") :
|
||||
_("removes messages from channel only flag"),
|
||||
NULL);
|
||||
SET_CHANNEL_MODE(ptr_channel, (set_flag == '+'),
|
||||
CHANNEL_MODE_NO_MSG_OUT);
|
||||
CHANNEL_SET_MODE(ptr_channel, (set_flag == '+'),
|
||||
CHANNEL_MODE_NO_MSG_OUT);
|
||||
break;
|
||||
case 'o':
|
||||
pos = NULL;
|
||||
@@ -835,7 +836,7 @@ void irc_get_channel_modes (t_irc_server *server, t_irc_channel *ptr_channel,
|
||||
ptr_nick = nick_search (ptr_channel, parm);
|
||||
if (ptr_nick)
|
||||
{
|
||||
ptr_nick->is_op = (set_flag == '+') ? 1 : 0;
|
||||
NICK_SET_FLAG(ptr_nick, (set_flag == '+'), NICK_OP);
|
||||
nick_resort (ptr_channel, ptr_nick);
|
||||
gui_draw_buffer_nick (ptr_channel->buffer, 1);
|
||||
}
|
||||
@@ -858,8 +859,8 @@ void irc_get_channel_modes (t_irc_server *server, t_irc_channel *ptr_channel,
|
||||
_("sets private channel flag") :
|
||||
_("removes private channel flag"),
|
||||
NULL);
|
||||
SET_CHANNEL_MODE(ptr_channel, (set_flag == '+'),
|
||||
CHANNEL_MODE_SECRET);
|
||||
CHANNEL_SET_MODE(ptr_channel, (set_flag == '+'),
|
||||
CHANNEL_MODE_SECRET);
|
||||
break;
|
||||
case 'q':
|
||||
pos = NULL;
|
||||
@@ -894,8 +895,8 @@ void irc_get_channel_modes (t_irc_server *server, t_irc_channel *ptr_channel,
|
||||
_("sets secret channel flag") :
|
||||
_("removes secret channel flag"),
|
||||
NULL);
|
||||
SET_CHANNEL_MODE(ptr_channel, (set_flag == '+'),
|
||||
CHANNEL_MODE_SECRET);
|
||||
CHANNEL_SET_MODE(ptr_channel, (set_flag == '+'),
|
||||
CHANNEL_MODE_SECRET);
|
||||
break;
|
||||
case 't':
|
||||
if (nick_host)
|
||||
@@ -905,8 +906,8 @@ void irc_get_channel_modes (t_irc_server *server, t_irc_channel *ptr_channel,
|
||||
_("sets topic protection") :
|
||||
_("removes topic protection"),
|
||||
NULL);
|
||||
SET_CHANNEL_MODE(ptr_channel, (set_flag == '+'),
|
||||
CHANNEL_MODE_TOPIC);
|
||||
CHANNEL_SET_MODE(ptr_channel, (set_flag == '+'),
|
||||
CHANNEL_MODE_TOPIC);
|
||||
break;
|
||||
case 'v':
|
||||
pos = NULL;
|
||||
@@ -929,7 +930,7 @@ void irc_get_channel_modes (t_irc_server *server, t_irc_channel *ptr_channel,
|
||||
ptr_nick = nick_search (ptr_channel, parm);
|
||||
if (ptr_nick)
|
||||
{
|
||||
ptr_nick->has_voice = (set_flag == '+') ? 1 : 0;
|
||||
NICK_SET_FLAG(ptr_nick, (set_flag == '+'), NICK_VOICE);
|
||||
nick_resort (ptr_channel, ptr_nick);
|
||||
gui_draw_buffer_nick (ptr_channel->buffer, 1);
|
||||
}
|
||||
@@ -1222,7 +1223,7 @@ irc_cmd_recv_notice (t_irc_server *server, char *host, char *nick, char *argumen
|
||||
ptr_channel = channel_search (server, nick);
|
||||
if (!ptr_channel)
|
||||
{
|
||||
ptr_channel = channel_new (server, CHAT_PRIVATE, nick, 0);
|
||||
ptr_channel = channel_new (server, CHANNEL_TYPE_PRIVATE, nick);
|
||||
if (!ptr_channel)
|
||||
{
|
||||
irc_display_prefix (server, server->buffer, PREFIX_ERROR);
|
||||
@@ -1231,6 +1232,7 @@ irc_cmd_recv_notice (t_irc_server *server, char *host, char *nick, char *argumen
|
||||
WEECHAT_ERROR, nick);
|
||||
return -1;
|
||||
}
|
||||
gui_buffer_new (gui_current_window, server, ptr_channel, 0, 0);
|
||||
}
|
||||
if (!ptr_channel->topic)
|
||||
ptr_channel->topic = strdup ((host2) ? host2 : "");
|
||||
@@ -2034,7 +2036,7 @@ irc_cmd_recv_privmsg (t_irc_server *server, char *host, char *nick, char *argume
|
||||
{
|
||||
if (!ptr_channel)
|
||||
{
|
||||
ptr_channel = channel_new (server, CHAT_PRIVATE, nick, 0);
|
||||
ptr_channel = channel_new (server, CHANNEL_TYPE_PRIVATE, nick);
|
||||
if (!ptr_channel)
|
||||
{
|
||||
irc_display_prefix (server, server->buffer, PREFIX_ERROR);
|
||||
@@ -2043,6 +2045,7 @@ irc_cmd_recv_privmsg (t_irc_server *server, char *host, char *nick, char *argume
|
||||
WEECHAT_ERROR, nick);
|
||||
return -1;
|
||||
}
|
||||
gui_buffer_new (gui_current_window, server, ptr_channel, 0, 0);
|
||||
}
|
||||
if (!ptr_channel->topic)
|
||||
ptr_channel->topic = strdup (host2);
|
||||
@@ -2124,7 +2127,7 @@ irc_cmd_recv_privmsg (t_irc_server *server, char *host, char *nick, char *argume
|
||||
{
|
||||
if (!ptr_channel)
|
||||
{
|
||||
ptr_channel = channel_new (server, CHAT_PRIVATE, nick, 0);
|
||||
ptr_channel = channel_new (server, CHANNEL_TYPE_PRIVATE, nick);
|
||||
if (!ptr_channel)
|
||||
{
|
||||
irc_display_prefix (server, server->buffer, PREFIX_ERROR);
|
||||
@@ -2133,6 +2136,7 @@ irc_cmd_recv_privmsg (t_irc_server *server, char *host, char *nick, char *argume
|
||||
WEECHAT_ERROR, nick);
|
||||
return -1;
|
||||
}
|
||||
gui_buffer_new (gui_current_window, server, ptr_channel, 0, 0);
|
||||
}
|
||||
if (!ptr_channel->topic)
|
||||
ptr_channel->topic = strdup (host2);
|
||||
@@ -2206,7 +2210,7 @@ irc_cmd_recv_quit (t_irc_server *server, char *host, char *nick, char *arguments
|
||||
for (ptr_channel = server->channels; ptr_channel;
|
||||
ptr_channel = ptr_channel->next_channel)
|
||||
{
|
||||
if (ptr_channel->type == CHAT_PRIVATE)
|
||||
if (ptr_channel->type == CHANNEL_TYPE_PRIVATE)
|
||||
ptr_nick = NULL;
|
||||
else
|
||||
ptr_nick = nick_search (ptr_channel, nick);
|
||||
@@ -2454,7 +2458,7 @@ irc_cmd_recv_004 (t_irc_server *server, char *host, char *nick, char *arguments)
|
||||
for (ptr_channel = server->channels; ptr_channel;
|
||||
ptr_channel = ptr_channel->next_channel)
|
||||
{
|
||||
if (ptr_channel->type == CHAT_CHANNEL)
|
||||
if (ptr_channel->type == CHANNEL_TYPE_CHANNEL)
|
||||
{
|
||||
if (ptr_channel->key)
|
||||
server_sendf (server, "JOIN %s %s\r\n",
|
||||
@@ -4309,8 +4313,8 @@ irc_cmd_recv_353 (t_irc_server *server, char *host, char *nick, char *arguments)
|
||||
pos[0] = '\0';
|
||||
pos++;
|
||||
}
|
||||
if (!nick_new (ptr_channel, pos_nick, is_chanowner, is_chanadmin,
|
||||
is_op, is_halfop, has_voice))
|
||||
if (!nick_new (server, ptr_channel, pos_nick, is_chanowner,
|
||||
is_chanadmin, is_op, is_halfop, has_voice))
|
||||
{
|
||||
irc_display_prefix (server, server->buffer, PREFIX_ERROR);
|
||||
gui_printf_nolog (server->buffer,
|
||||
|
||||
+7
-5
@@ -107,7 +107,7 @@ irc_cmd_send_ame (t_irc_server *server, char *arguments)
|
||||
for (ptr_channel = ptr_server->channels; ptr_channel;
|
||||
ptr_channel = ptr_channel->next_channel)
|
||||
{
|
||||
if (ptr_channel->type == CHAT_CHANNEL)
|
||||
if (ptr_channel->type == CHANNEL_TYPE_CHANNEL)
|
||||
{
|
||||
server_sendf (ptr_server, "PRIVMSG %s :\01ACTION %s\01\r\n",
|
||||
ptr_channel->name,
|
||||
@@ -156,7 +156,7 @@ irc_cmd_send_amsg (t_irc_server *server, char *arguments)
|
||||
for (ptr_channel = ptr_server->channels; ptr_channel;
|
||||
ptr_channel = ptr_channel->next_channel)
|
||||
{
|
||||
if (ptr_channel->type == CHAT_CHANNEL)
|
||||
if (ptr_channel->type == CHANNEL_TYPE_CHANNEL)
|
||||
{
|
||||
server_sendf (ptr_server, "PRIVMSG %s :%s\r\n",
|
||||
ptr_channel->name, arguments);
|
||||
@@ -965,7 +965,7 @@ irc_send_me_all_channels (t_irc_server *server, char *arguments)
|
||||
for (ptr_channel = server->channels; ptr_channel;
|
||||
ptr_channel = ptr_channel->next_channel)
|
||||
{
|
||||
if (ptr_channel->type == CHAT_CHANNEL)
|
||||
if (ptr_channel->type == CHANNEL_TYPE_CHANNEL)
|
||||
irc_send_me (server, ptr_channel, arguments);
|
||||
}
|
||||
return 0;
|
||||
@@ -1145,7 +1145,7 @@ irc_cmd_send_msg (t_irc_server *server, char *arguments)
|
||||
ptr_channel = channel_search (server, arguments);
|
||||
if (!ptr_channel)
|
||||
{
|
||||
ptr_channel = channel_new (server, CHAT_PRIVATE, arguments, 1);
|
||||
ptr_channel = channel_new (server, CHANNEL_TYPE_PRIVATE, arguments);
|
||||
if (!ptr_channel)
|
||||
{
|
||||
irc_display_prefix (NULL, server->buffer, PREFIX_ERROR);
|
||||
@@ -1154,6 +1154,7 @@ irc_cmd_send_msg (t_irc_server *server, char *arguments)
|
||||
WEECHAT_ERROR, arguments);
|
||||
return -1;
|
||||
}
|
||||
gui_buffer_new (gui_current_window, server, ptr_channel, 0, 1);
|
||||
gui_draw_buffer_title (ptr_channel->buffer, 1);
|
||||
}
|
||||
|
||||
@@ -1485,7 +1486,7 @@ irc_cmd_send_query (t_irc_server *server, char *arguments)
|
||||
ptr_channel = channel_search (server, arguments);
|
||||
if (!ptr_channel)
|
||||
{
|
||||
ptr_channel = channel_new (server, CHAT_PRIVATE, arguments, 1);
|
||||
ptr_channel = channel_new (server, CHANNEL_TYPE_PRIVATE, arguments);
|
||||
if (!ptr_channel)
|
||||
{
|
||||
irc_display_prefix (NULL, server->buffer, PREFIX_ERROR);
|
||||
@@ -1494,6 +1495,7 @@ irc_cmd_send_query (t_irc_server *server, char *arguments)
|
||||
WEECHAT_ERROR, arguments);
|
||||
return -1;
|
||||
}
|
||||
gui_buffer_new (gui_current_window, server, ptr_channel, 0, 1);
|
||||
gui_draw_buffer_title (ptr_channel->buffer, 1);
|
||||
}
|
||||
else
|
||||
|
||||
+68
-71
@@ -91,9 +91,7 @@ server_init (t_irc_server *server)
|
||||
server->child_write = -1;
|
||||
server->sock = -1;
|
||||
server->is_connected = 0;
|
||||
#ifdef HAVE_GNUTLS
|
||||
server->ssl_connected = 0;
|
||||
#endif
|
||||
server->unterminated_message = NULL;
|
||||
server->nick = NULL;
|
||||
server->reconnect_start = 0;
|
||||
@@ -365,14 +363,14 @@ server_new (char *name, int autoconnect, int autoreconnect, int autoreconnect_de
|
||||
return NULL;
|
||||
|
||||
#ifdef DEBUG
|
||||
wee_log_printf ("Creating new server (name:%s, address:%s, port:%d, pwd:%s, "
|
||||
"nick1:%s, nick2:%s, nick3:%s, username:%s, realname:%s, "
|
||||
"command:%s, autojoin:%s, autorejoin:%s, notify_levels:%s)\n",
|
||||
name, address, port, (password) ? password : "",
|
||||
(nick1) ? nick1 : "", (nick2) ? nick2 : "", (nick3) ? nick3 : "",
|
||||
(username) ? username : "", (realname) ? realname : "",
|
||||
(command) ? command : "", (autojoin) ? autojoin : "",
|
||||
(autorejoin) ? "on" : "off", (notify_levels) ? notify_levels : "");
|
||||
weechat_log_printf ("Creating new server (name:%s, address:%s, port:%d, pwd:%s, "
|
||||
"nick1:%s, nick2:%s, nick3:%s, username:%s, realname:%s, "
|
||||
"command:%s, autojoin:%s, autorejoin:%s, notify_levels:%s)\n",
|
||||
name, address, port, (password) ? password : "",
|
||||
(nick1) ? nick1 : "", (nick2) ? nick2 : "", (nick3) ? nick3 : "",
|
||||
(username) ? username : "", (realname) ? realname : "",
|
||||
(command) ? command : "", (autojoin) ? autojoin : "",
|
||||
(autorejoin) ? "on" : "off", (notify_levels) ? notify_levels : "");
|
||||
#endif
|
||||
|
||||
if ((new_server = server_alloc ()))
|
||||
@@ -801,9 +799,7 @@ server_close_connection (t_irc_server *server)
|
||||
|
||||
/* server is now disconnected */
|
||||
server->is_connected = 0;
|
||||
#ifdef HAVE_GNUTLS
|
||||
server->ssl_connected = 0;
|
||||
#endif
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -1399,12 +1395,12 @@ server_connect (t_irc_server *server)
|
||||
(server->ssl) ? " (SSL)" : "",
|
||||
cfg_proxy_type_values[cfg_proxy_type], cfg_proxy_address, cfg_proxy_port,
|
||||
(cfg_proxy_ipv6) ? " (IPv6)" : "");
|
||||
wee_log_printf (_("Connecting to server %s:%d%s%s via %s proxy %s:%d%s...\n"),
|
||||
server->address, server->port,
|
||||
(server->ipv6) ? " (IPv6)" : "",
|
||||
(server->ssl) ? " (SSL)" : "",
|
||||
cfg_proxy_type_values[cfg_proxy_type], cfg_proxy_address, cfg_proxy_port,
|
||||
(cfg_proxy_ipv6) ? " (IPv6)" : "");
|
||||
weechat_log_printf (_("Connecting to server %s:%d%s%s via %s proxy %s:%d%s...\n"),
|
||||
server->address, server->port,
|
||||
(server->ipv6) ? " (IPv6)" : "",
|
||||
(server->ssl) ? " (SSL)" : "",
|
||||
cfg_proxy_type_values[cfg_proxy_type], cfg_proxy_address, cfg_proxy_port,
|
||||
(cfg_proxy_ipv6) ? " (IPv6)" : "");
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -1413,18 +1409,18 @@ server_connect (t_irc_server *server)
|
||||
PACKAGE_NAME, server->address, server->port,
|
||||
(server->ipv6) ? " (IPv6)" : "",
|
||||
(server->ssl) ? " (SSL)" : "");
|
||||
wee_log_printf (_("Connecting to server %s:%d%s%s...\n"),
|
||||
server->address, server->port,
|
||||
(server->ipv6) ? " (IPv6)" : "",
|
||||
(server->ssl) ? " (SSL)" : "");
|
||||
weechat_log_printf (_("Connecting to server %s:%d%s%s...\n"),
|
||||
server->address, server->port,
|
||||
(server->ipv6) ? " (IPv6)" : "",
|
||||
(server->ssl) ? " (SSL)" : "");
|
||||
}
|
||||
|
||||
/* close any opened connection and kill child process if running */
|
||||
server_close_connection (server);
|
||||
|
||||
/* init SSL if asked */
|
||||
#ifdef HAVE_GNUTLS
|
||||
server->ssl_connected = 0;
|
||||
#ifdef HAVE_GNUTLS
|
||||
if (server->ssl)
|
||||
{
|
||||
if (gnutls_init (&server->gnutls_sess, GNUTLS_CLIENT) != 0)
|
||||
@@ -1706,7 +1702,7 @@ server_remove_away ()
|
||||
{
|
||||
for (ptr_channel = ptr_server->channels; ptr_channel; ptr_channel = ptr_channel->next_channel)
|
||||
{
|
||||
if (ptr_channel->type == CHAT_CHANNEL)
|
||||
if (ptr_channel->type == CHANNEL_TYPE_CHANNEL)
|
||||
channel_remove_away (ptr_channel);
|
||||
}
|
||||
}
|
||||
@@ -1729,7 +1725,7 @@ server_check_away ()
|
||||
{
|
||||
for (ptr_channel = ptr_server->channels; ptr_channel; ptr_channel = ptr_channel->next_channel)
|
||||
{
|
||||
if (ptr_channel->type == CHAT_CHANNEL)
|
||||
if (ptr_channel->type == CHANNEL_TYPE_CHANNEL)
|
||||
channel_check_away (ptr_server, ptr_channel);
|
||||
}
|
||||
}
|
||||
@@ -1749,7 +1745,7 @@ server_set_away (t_irc_server *server, char *nick, int is_away)
|
||||
{
|
||||
if (server->is_connected)
|
||||
{
|
||||
if (ptr_channel->type == CHAT_CHANNEL)
|
||||
if (ptr_channel->type == CHANNEL_TYPE_CHANNEL)
|
||||
channel_set_away (ptr_channel, nick, is_away);
|
||||
}
|
||||
}
|
||||
@@ -1762,49 +1758,50 @@ server_set_away (t_irc_server *server, char *nick, int is_away)
|
||||
void
|
||||
server_print_log (t_irc_server *server)
|
||||
{
|
||||
wee_log_printf ("[server %s (addr:0x%X)]\n", server->name, server);
|
||||
wee_log_printf (" autoconnect . . . . : %d\n", server->autoconnect);
|
||||
wee_log_printf (" autoreconnect . . . : %d\n", server->autoreconnect);
|
||||
wee_log_printf (" autoreconnect_delay : %d\n", server->autoreconnect_delay);
|
||||
wee_log_printf (" command_line. . . . : %d\n", server->command_line);
|
||||
wee_log_printf (" address . . . . . . : '%s'\n", server->address);
|
||||
wee_log_printf (" port. . . . . . . . : %d\n", server->port);
|
||||
wee_log_printf (" ipv6. . . . . . . . : %d\n", server->ipv6);
|
||||
wee_log_printf (" ssl . . . . . . . . : %d\n", server->ssl);
|
||||
wee_log_printf (" password. . . . . . : '%s'\n",
|
||||
(server->password && server->password[0]) ? "(hidden)" : server->password);
|
||||
wee_log_printf (" nick1 . . . . . . . : '%s'\n", server->nick1);
|
||||
wee_log_printf (" nick2 . . . . . . . : '%s'\n", server->nick2);
|
||||
wee_log_printf (" nick3 . . . . . . . : '%s'\n", server->nick3);
|
||||
wee_log_printf (" username. . . . . . : '%s'\n", server->username);
|
||||
wee_log_printf (" realname. . . . . . : '%s'\n", server->realname);
|
||||
wee_log_printf (" command . . . . . . : '%s'\n",
|
||||
(server->command && server->command[0]) ? "(hidden)" : server->command);
|
||||
wee_log_printf (" command_delay . . . : %d\n", server->command_delay);
|
||||
wee_log_printf (" autojoin. . . . . . : '%s'\n", server->autojoin);
|
||||
wee_log_printf (" autorejoin. . . . . : %d\n", server->autorejoin);
|
||||
wee_log_printf (" notify_levels . . . : %s\n", server->notify_levels);
|
||||
wee_log_printf (" child_pid . . . . . : %d\n", server->child_pid);
|
||||
wee_log_printf (" child_read . . . . : %d\n", server->child_read);
|
||||
wee_log_printf (" child_write . . . . : %d\n", server->child_write);
|
||||
wee_log_printf (" sock. . . . . . . . : %d\n", server->sock);
|
||||
wee_log_printf (" is_connected. . . . : %d\n", server->is_connected);
|
||||
#ifdef HAVE_GNUTLS
|
||||
wee_log_printf(" ssl_connected . . . : %d\n", server->ssl_connected);
|
||||
#endif
|
||||
wee_log_printf (" unterminated_message: '%s'\n", server->unterminated_message);
|
||||
wee_log_printf (" nick. . . . . . . . : '%s'\n", server->nick);
|
||||
wee_log_printf (" reconnect_start . . : %ld\n", server->reconnect_start);
|
||||
wee_log_printf (" reconnect_join. . . : %d\n", server->reconnect_join);
|
||||
wee_log_printf (" is_away . . . . . . : %d\n", server->is_away);
|
||||
wee_log_printf (" away_time . . . . . : %ld\n", server->away_time);
|
||||
wee_log_printf (" lag . . . . . . . . : %d\n", server->lag);
|
||||
wee_log_printf (" lag_check_time. . . : tv_sec:%d, tv_usec:%d\n",
|
||||
server->lag_check_time.tv_sec, server->lag_check_time.tv_usec);
|
||||
wee_log_printf (" lag_next_check. . . : %ld\n", server->lag_next_check);
|
||||
wee_log_printf (" buffer. . . . . . . : 0x%X\n", server->buffer);
|
||||
wee_log_printf (" channels. . . . . . : 0x%X\n", server->channels);
|
||||
wee_log_printf (" last_channel. . . . : 0x%X\n", server->last_channel);
|
||||
wee_log_printf (" prev_server . . . . : 0x%X\n", server->prev_server);
|
||||
wee_log_printf (" next_server . . . . : 0x%X\n", server->next_server);
|
||||
weechat_log_printf ("[server %s (addr:0x%X)]\n", server->name, server);
|
||||
weechat_log_printf (" autoconnect . . . . : %d\n", server->autoconnect);
|
||||
weechat_log_printf (" autoreconnect . . . : %d\n", server->autoreconnect);
|
||||
weechat_log_printf (" autoreconnect_delay : %d\n", server->autoreconnect_delay);
|
||||
weechat_log_printf (" command_line. . . . : %d\n", server->command_line);
|
||||
weechat_log_printf (" address . . . . . . : '%s'\n", server->address);
|
||||
weechat_log_printf (" port. . . . . . . . : %d\n", server->port);
|
||||
weechat_log_printf (" ipv6. . . . . . . . : %d\n", server->ipv6);
|
||||
weechat_log_printf (" ssl . . . . . . . . : %d\n", server->ssl);
|
||||
weechat_log_printf (" password. . . . . . : '%s'\n",
|
||||
(server->password && server->password[0]) ?
|
||||
"(hidden)" : server->password);
|
||||
weechat_log_printf (" nick1 . . . . . . . : '%s'\n", server->nick1);
|
||||
weechat_log_printf (" nick2 . . . . . . . : '%s'\n", server->nick2);
|
||||
weechat_log_printf (" nick3 . . . . . . . : '%s'\n", server->nick3);
|
||||
weechat_log_printf (" username. . . . . . : '%s'\n", server->username);
|
||||
weechat_log_printf (" realname. . . . . . : '%s'\n", server->realname);
|
||||
weechat_log_printf (" command . . . . . . : '%s'\n",
|
||||
(server->command && server->command[0]) ?
|
||||
"(hidden)" : server->command);
|
||||
weechat_log_printf (" command_delay . . . : %d\n", server->command_delay);
|
||||
weechat_log_printf (" autojoin. . . . . . : '%s'\n", server->autojoin);
|
||||
weechat_log_printf (" autorejoin. . . . . : %d\n", server->autorejoin);
|
||||
weechat_log_printf (" notify_levels . . . : %s\n", server->notify_levels);
|
||||
weechat_log_printf (" child_pid . . . . . : %d\n", server->child_pid);
|
||||
weechat_log_printf (" child_read . . . . : %d\n", server->child_read);
|
||||
weechat_log_printf (" child_write . . . . : %d\n", server->child_write);
|
||||
weechat_log_printf (" sock. . . . . . . . : %d\n", server->sock);
|
||||
weechat_log_printf (" is_connected. . . . : %d\n", server->is_connected);
|
||||
weechat_log_printf (" ssl_connected . . . : %d\n", server->ssl_connected);
|
||||
weechat_log_printf (" unterminated_message: '%s'\n", server->unterminated_message);
|
||||
weechat_log_printf (" nick. . . . . . . . : '%s'\n", server->nick);
|
||||
weechat_log_printf (" reconnect_start . . : %ld\n", server->reconnect_start);
|
||||
weechat_log_printf (" reconnect_join. . . : %d\n", server->reconnect_join);
|
||||
weechat_log_printf (" is_away . . . . . . : %d\n", server->is_away);
|
||||
weechat_log_printf (" away_time . . . . . : %ld\n", server->away_time);
|
||||
weechat_log_printf (" lag . . . . . . . . : %d\n", server->lag);
|
||||
weechat_log_printf (" lag_check_time. . . : tv_sec:%d, tv_usec:%d\n",
|
||||
server->lag_check_time.tv_sec,
|
||||
server->lag_check_time.tv_usec);
|
||||
weechat_log_printf (" lag_next_check. . . : %ld\n", server->lag_next_check);
|
||||
weechat_log_printf (" buffer. . . . . . . : 0x%X\n", server->buffer);
|
||||
weechat_log_printf (" channels. . . . . . : 0x%X\n", server->channels);
|
||||
weechat_log_printf (" last_channel. . . . : 0x%X\n", server->last_channel);
|
||||
weechat_log_printf (" prev_server . . . . : 0x%X\n", server->prev_server);
|
||||
weechat_log_printf (" next_server . . . . : 0x%X\n", server->next_server);
|
||||
}
|
||||
|
||||
+63
-56
@@ -46,9 +46,41 @@
|
||||
#define PREFIX_ERROR "=!="
|
||||
#define PREFIX_PLUGIN "-P-"
|
||||
|
||||
#define DEFAULT_IRC_PORT 6667
|
||||
|
||||
/* nick types */
|
||||
|
||||
#define NICK_CHANOWNER 1
|
||||
#define NICK_CHANADMIN 2
|
||||
#define NICK_OP 4
|
||||
#define NICK_HALFOP 8
|
||||
#define NICK_VOICE 16
|
||||
#define NICK_AWAY 32
|
||||
#define NICK_SET_FLAG(nick, set, flag) \
|
||||
if (set) \
|
||||
nick->flags |= flag; \
|
||||
else \
|
||||
nick->flags &= 0xFFFF - flag;
|
||||
|
||||
typedef struct t_irc_nick t_irc_nick;
|
||||
|
||||
struct t_irc_nick
|
||||
{
|
||||
char *nick; /* nickname */
|
||||
int flags; /* chanowner/chanadmin (unrealircd), */
|
||||
/* op, halfop, voice, away */
|
||||
int color; /* color for nickname in chat window */
|
||||
t_irc_nick *prev_nick; /* link to previous nick on the channel */
|
||||
t_irc_nick *next_nick; /* link to next nick on the channel */
|
||||
};
|
||||
|
||||
/* channel types */
|
||||
|
||||
#define CHANNEL_PREFIX "#&+!"
|
||||
|
||||
/* channel modes */
|
||||
#define CHANNEL_TYPE_UNKNOWN -1
|
||||
#define CHANNEL_TYPE_CHANNEL 0
|
||||
#define CHANNEL_TYPE_PRIVATE 1
|
||||
|
||||
#define NUM_CHANNEL_MODES 7
|
||||
#define CHANNEL_MODE_INVITE 0
|
||||
@@ -58,69 +90,21 @@
|
||||
#define CHANNEL_MODE_NO_MSG_OUT 4
|
||||
#define CHANNEL_MODE_SECRET 5
|
||||
#define CHANNEL_MODE_TOPIC 6
|
||||
#define SET_CHANNEL_MODE(channel, set, mode) \
|
||||
#define CHANNEL_SET_MODE(channel, set, mode) \
|
||||
if (set) \
|
||||
channel->modes[mode] = channel_modes[mode]; \
|
||||
else \
|
||||
channel->modes[mode] = ' ';
|
||||
|
||||
#define DEFAULT_IRC_PORT 6667
|
||||
|
||||
/* DCC types & status */
|
||||
|
||||
#define DCC_CHAT_RECV 0 /* receiving DCC chat */
|
||||
#define DCC_CHAT_SEND 1 /* sending DCC chat */
|
||||
#define DCC_FILE_RECV 2 /* incoming DCC file */
|
||||
#define DCC_FILE_SEND 3 /* sending DCC file */
|
||||
|
||||
#define DCC_WAITING 0 /* waiting for host answer */
|
||||
#define DCC_CONNECTING 1 /* connecting to host */
|
||||
#define DCC_ACTIVE 2 /* sending/receiving data */
|
||||
#define DCC_DONE 3 /* transfer done */
|
||||
#define DCC_FAILED 4 /* DCC failed */
|
||||
#define DCC_ABORTED 5 /* DCC aborted by user */
|
||||
|
||||
#define DCC_IS_CHAT(type) ((type == DCC_CHAT_RECV) || (type == DCC_CHAT_SEND))
|
||||
#define DCC_IS_FILE(type) ((type == DCC_FILE_RECV) || (type == DCC_FILE_SEND))
|
||||
#define DCC_IS_RECV(type) ((type == DCC_CHAT_RECV) || (type == DCC_FILE_RECV))
|
||||
#define DCC_IS_SEND(type) ((type == DCC_CHAT_SEND) || (type == DCC_FILE_SEND))
|
||||
|
||||
#define DCC_ENDED(status) ((status == DCC_DONE) || (status == DCC_FAILED) || \
|
||||
(status == DCC_ABORTED))
|
||||
|
||||
/* nick types */
|
||||
|
||||
typedef struct t_irc_nick t_irc_nick;
|
||||
|
||||
struct t_irc_nick
|
||||
{
|
||||
char *nick; /* nickname */
|
||||
int is_chanowner; /* chan owner? (specific to unrealircd) */
|
||||
int is_chanadmin; /* chan admin? (specific to unrealircd) */
|
||||
int is_op; /* operator privileges? */
|
||||
int is_halfop; /* half operator privileges? */
|
||||
int has_voice; /* nick has voice? */
|
||||
int is_away; /* = 1 if nick is away, otherwise 0 */
|
||||
int color; /* color for nickname in chat window */
|
||||
t_irc_nick *prev_nick; /* link to previous nick on the channel */
|
||||
t_irc_nick *next_nick; /* link to next nick on the channel */
|
||||
};
|
||||
|
||||
/* channel types */
|
||||
|
||||
typedef struct t_irc_channel t_irc_channel;
|
||||
|
||||
#define CHAT_UNKNOWN -1
|
||||
#define CHAT_CHANNEL 0
|
||||
#define CHAT_PRIVATE 1
|
||||
|
||||
struct t_irc_channel
|
||||
{
|
||||
int type; /* channel type */
|
||||
void *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[NUM_CHANNEL_MODES+1];/* channel modes */
|
||||
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) */
|
||||
@@ -166,11 +150,10 @@ struct t_irc_server
|
||||
int child_write; /* to write into child pipe */
|
||||
int sock; /* socket for server (IPv4 or IPv6) */
|
||||
int is_connected; /* 1 if WeeChat is connected to server */
|
||||
#ifdef HAVE_GNUTLS
|
||||
int ssl_connected; /* = 1 if connected with SSL */
|
||||
#ifdef HAVE_GNUTLS
|
||||
gnutls_session gnutls_sess; /* gnutls session (only if SSL is used) */
|
||||
#endif
|
||||
|
||||
char *unterminated_message; /* beginning of a message in input buf */
|
||||
char *nick; /* current nickname */
|
||||
time_t reconnect_start; /* this time + delay = reconnect time */
|
||||
@@ -221,6 +204,26 @@ struct t_irc_message
|
||||
|
||||
/* DCC types */
|
||||
|
||||
#define DCC_CHAT_RECV 0 /* receiving DCC chat */
|
||||
#define DCC_CHAT_SEND 1 /* sending DCC chat */
|
||||
#define DCC_FILE_RECV 2 /* incoming DCC file */
|
||||
#define DCC_FILE_SEND 3 /* sending DCC file */
|
||||
|
||||
#define DCC_WAITING 0 /* waiting for host answer */
|
||||
#define DCC_CONNECTING 1 /* connecting to host */
|
||||
#define DCC_ACTIVE 2 /* sending/receiving data */
|
||||
#define DCC_DONE 3 /* transfer done */
|
||||
#define DCC_FAILED 4 /* DCC failed */
|
||||
#define DCC_ABORTED 5 /* DCC aborted by user */
|
||||
|
||||
#define DCC_IS_CHAT(type) ((type == DCC_CHAT_RECV) || (type == DCC_CHAT_SEND))
|
||||
#define DCC_IS_FILE(type) ((type == DCC_FILE_RECV) || (type == DCC_FILE_SEND))
|
||||
#define DCC_IS_RECV(type) ((type == DCC_CHAT_RECV) || (type == DCC_FILE_RECV))
|
||||
#define DCC_IS_SEND(type) ((type == DCC_CHAT_SEND) || (type == DCC_FILE_SEND))
|
||||
|
||||
#define DCC_ENDED(status) ((status == DCC_DONE) || (status == DCC_FAILED) || \
|
||||
(status == DCC_ABORTED))
|
||||
|
||||
typedef struct t_irc_dcc t_irc_dcc;
|
||||
|
||||
struct t_irc_dcc
|
||||
@@ -246,8 +249,9 @@ struct t_irc_dcc
|
||||
unsigned long start_resume; /* start of resume (in bytes) */
|
||||
time_t last_check_time; /* last time we looked at bytes sent/rcv*/
|
||||
unsigned long last_check_pos; /* bytes sent/recv at last check */
|
||||
unsigned long bytes_per_sec; /* bytes per second */
|
||||
time_t last_activity; /* time of last byte received/sent */
|
||||
unsigned long bytes_per_sec; /* bytes per second */
|
||||
unsigned long eta; /* estimated time of arrival */
|
||||
t_irc_dcc *prev_dcc; /* link to previous dcc file/chat */
|
||||
t_irc_dcc *next_dcc; /* link to next dcc file/chat */
|
||||
};
|
||||
@@ -327,7 +331,7 @@ extern int pass_proxy(int, char*, int, char*);
|
||||
|
||||
/* channel functions (irc-channel.c) */
|
||||
|
||||
extern t_irc_channel *channel_new (t_irc_server *, int, char *, int);
|
||||
extern t_irc_channel *channel_new (t_irc_server *, int, char *);
|
||||
extern void channel_free (t_irc_server *, t_irc_channel *);
|
||||
extern void channel_free_all (t_irc_server *);
|
||||
extern t_irc_channel *channel_search (t_irc_server *, char *);
|
||||
@@ -345,7 +349,8 @@ extern void channel_print_log (t_irc_channel *);
|
||||
/* nick functions (irc-nick.c) */
|
||||
|
||||
extern int nick_find_color (t_irc_nick *);
|
||||
extern t_irc_nick *nick_new (t_irc_channel *, char *, int, int, int, int, int);
|
||||
extern t_irc_nick *nick_new (t_irc_server *, t_irc_channel *, char *,
|
||||
int, int, int, int, int);
|
||||
extern void nick_resort (t_irc_channel *, t_irc_nick *);
|
||||
extern void nick_change (t_irc_channel *, t_irc_nick *, char *);
|
||||
extern void nick_free (t_irc_channel *, t_irc_nick *);
|
||||
@@ -364,12 +369,14 @@ extern void dcc_close (t_irc_dcc *, int);
|
||||
extern void dcc_accept (t_irc_dcc *);
|
||||
extern void dcc_accept_resume (t_irc_server *, char *, int, unsigned long);
|
||||
extern void dcc_start_resume (t_irc_server *, char *, int, unsigned long);
|
||||
extern t_irc_dcc *dcc_alloc ();
|
||||
extern t_irc_dcc *dcc_add (t_irc_server *, int, unsigned long, int, char *, int,
|
||||
char *, char *, unsigned long);
|
||||
extern void dcc_send_request (t_irc_server *, int, char *, char *);
|
||||
extern void dcc_chat_sendf (t_irc_dcc *, char *, ...);
|
||||
extern void dcc_handle ();
|
||||
extern void dcc_end ();
|
||||
extern void dcc_print_log (t_irc_dcc *);
|
||||
|
||||
/* IRC display (irc-diplay.c) */
|
||||
|
||||
|
||||
+3
-1
@@ -1,10 +1,12 @@
|
||||
WeeChat - Wee Enhanced Environment for Chat
|
||||
===========================================
|
||||
|
||||
ChangeLog - 2005-11-29
|
||||
ChangeLog - 2005-12-06
|
||||
|
||||
|
||||
Version 0.1.7 (under dev!):
|
||||
* added /upgrade command
|
||||
* added ETA (Estimated Time of Arrival) for DCC files
|
||||
* /nick command is now allowed when not connected to server
|
||||
* added server/channel arg to /buffer command for jumping to buffer
|
||||
* fixed display bug in chat window when a message length equals to window
|
||||
|
||||
@@ -35,7 +35,7 @@
|
||||
|
||||
@title WeeChat - User guide
|
||||
@subtitle Fast, light and extensible IRC client
|
||||
@subtitle Documentation for WeeChat v0.1.7-cvs - November, 29 2005
|
||||
@subtitle Documentation for WeeChat v0.1.7-cvs - December, 6 2005
|
||||
|
||||
@author FlashCode <@email{flashcode@@flashtux.org, flashcode AT flashtux.org}>
|
||||
|
||||
@@ -1045,6 +1045,10 @@ channel: name of channel for unignore@*
|
||||
For each argument, '*' means all.@*
|
||||
Without argument, /unignore command lists all defined ignore.@*
|
||||
@*
|
||||
@item upgrade
|
||||
@*
|
||||
upgrade WeeChat without disconnecting from servers@*
|
||||
@*
|
||||
@item uptime [-o]
|
||||
@*
|
||||
show WeeChat uptime@*
|
||||
|
||||
@@ -36,7 +36,7 @@
|
||||
|
||||
@title WeeChat - Gui@'on de usuario.
|
||||
@subtitle Cliente IRC r@'apido, peque@~no y extensible
|
||||
@subtitle Documentaci@'on para WeeChat v0.1.7-cvs - 29 de noviembre de 2005
|
||||
@subtitle Documentaci@'on para WeeChat v0.1.7-cvs - 6 de diciembre de 2005
|
||||
|
||||
@author FlashCode <@email{flashcode@@flashtux.org, flashcode AT flashtux.org}>
|
||||
|
||||
@@ -1045,6 +1045,10 @@ channel: name of channel for unignore@*
|
||||
For each argument, '*' means all.@*
|
||||
Without argument, /unignore command lists all defined ignore.@*
|
||||
@*
|
||||
@item upgrade
|
||||
@*
|
||||
upgrade WeeChat without disconnecting from servers@*
|
||||
@*
|
||||
@item uptime [-o]
|
||||
@*
|
||||
show WeeChat uptime@*
|
||||
|
||||
@@ -36,7 +36,7 @@
|
||||
|
||||
@title WeeChat - Guide utilisateur
|
||||
@subtitle Client IRC rapide, l@'eger et extensible
|
||||
@subtitle Documentation pour WeeChat v0.1.7-cvs - 29 novembre 2005
|
||||
@subtitle Documentation pour WeeChat v0.1.7-cvs - 6 decembre 2005
|
||||
|
||||
@author FlashCode <@email{flashcode@@flashtux.org, flashcode AT flashtux.org}>
|
||||
|
||||
@@ -1046,6 +1046,10 @@ commande: commande IRC@*
|
||||
Pour chaque param@`etre, '*' signifie tou(te)s.@*
|
||||
Sans param@`etre, /ignore liste les ignore d@'efinis.@*
|
||||
@*
|
||||
@item upgrade
|
||||
@*
|
||||
mettre @`a jour WeeChat sans se d@'econnecter des serveurs@*
|
||||
@*
|
||||
@item uptime [-o]
|
||||
@*
|
||||
montrer l'uptime de WeeChat@*
|
||||
|
||||
@@ -36,7 +36,7 @@
|
||||
|
||||
@title WeeChat - Guia do Utilizador
|
||||
@subtitle Cliente de IRC rapido, leve e extencivel
|
||||
@subtitle Documenta@,{c}@~ao do WeeChat v0.1.7-cvs - 29 de novembro de 2005
|
||||
@subtitle Documenta@,{c}@~ao do WeeChat v0.1.7-cvs - 6 de dezembro de 2005
|
||||
|
||||
@author FlashCode <@email{flashcode@@flashtux.org, flashcode AT flashtux.org}>
|
||||
|
||||
@@ -1043,6 +1043,10 @@ channel: name of channel for unignore@*
|
||||
For each argument, '*' means all.@*
|
||||
Without argument, /unignore command lists all defined ignore.@*
|
||||
@*
|
||||
@item upgrade
|
||||
@*
|
||||
upgrade WeeChat without disconnecting from servers@*
|
||||
@*
|
||||
@item uptime [-o]
|
||||
@*
|
||||
show WeeChat uptime@*
|
||||
|
||||
@@ -34,6 +34,8 @@
|
||||
./src/common/hotlist.h
|
||||
./src/common/log.c
|
||||
./src/common/log.h
|
||||
./src/common/session.c
|
||||
./src/common/session.h
|
||||
./src/common/utf8.c
|
||||
./src/common/utf8.h
|
||||
./src/common/weechat.c
|
||||
|
||||
+1062
-664
File diff suppressed because it is too large
Load Diff
+1009
-664
File diff suppressed because it is too large
Load Diff
+1033
-672
File diff suppressed because it is too large
Load Diff
+1018
-673
File diff suppressed because it is too large
Load Diff
@@ -37,5 +37,7 @@ lib_weechat_main_a_SOURCES = weechat.c \
|
||||
log.h \
|
||||
fifo.c \
|
||||
fifo.h \
|
||||
session.c \
|
||||
session.h \
|
||||
utf8.c \
|
||||
utf8.h
|
||||
|
||||
+103
-10
@@ -24,6 +24,7 @@
|
||||
#include "config.h"
|
||||
#endif
|
||||
|
||||
#include <unistd.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
|
||||
@@ -31,6 +32,7 @@
|
||||
#include "command.h"
|
||||
#include "weelist.h"
|
||||
#include "weeconfig.h"
|
||||
#include "session.h"
|
||||
#include "../irc/irc.h"
|
||||
#include "../gui/gui.h"
|
||||
#include "../plugins/plugins.h"
|
||||
@@ -77,8 +79,7 @@ t_weechat_command weechat_commands[] =
|
||||
{ "history", N_("show buffer command history"),
|
||||
N_("[clear | value]"),
|
||||
N_("clear: clear history\n"
|
||||
"value: number of history entries to show"
|
||||
),
|
||||
"value: number of history entries to show"),
|
||||
0, 1, weechat_cmd_history, NULL },
|
||||
{ "ignore", N_("ignore IRC messages and/or hosts"),
|
||||
N_("[mask [[type | command] [channel [server]]]]"),
|
||||
@@ -143,6 +144,10 @@ t_weechat_command weechat_commands[] =
|
||||
"For each argument, '*' means all.\n"
|
||||
"Without argument, /unignore command lists all defined ignore."),
|
||||
0, 4, weechat_cmd_unignore, NULL },
|
||||
{ "upgrade", N_("upgrade WeeChat without disconnecting from servers"),
|
||||
"",
|
||||
"",
|
||||
0, 0, weechat_cmd_upgrade, NULL },
|
||||
{ "uptime", N_("show WeeChat uptime"),
|
||||
N_("[-o]"),
|
||||
N_("-o: send uptime on current channel as an IRC message"),
|
||||
@@ -760,7 +765,7 @@ user_command (t_irc_server *server, t_gui_buffer *buffer, char *command)
|
||||
command_with_colors2 = (command_with_colors) ?
|
||||
(char *)gui_color_decode ((unsigned char *)command_with_colors, 1) : NULL;
|
||||
|
||||
if (CHANNEL(buffer)->type == CHAT_PRIVATE)
|
||||
if (CHANNEL(buffer)->type == CHANNEL_TYPE_PRIVATE)
|
||||
{
|
||||
gui_printf_type (CHANNEL(buffer)->buffer,
|
||||
MSG_TYPE_NICK,
|
||||
@@ -937,11 +942,17 @@ weechat_cmd_buffer_display_info (t_gui_buffer *buffer)
|
||||
if (buffer->dcc)
|
||||
gui_printf (NULL, "%sDCC\n",
|
||||
GUI_COLOR(COLOR_WIN_CHAT_CHANNEL));
|
||||
else if (BUFFER_IS_SERVER (buffer))
|
||||
gui_printf (NULL, _("%sServer: %s%s\n"),
|
||||
GUI_COLOR(COLOR_WIN_CHAT),
|
||||
GUI_COLOR(COLOR_WIN_CHAT_SERVER),
|
||||
SERVER(buffer)->name);
|
||||
else if (BUFFER_IS_SERVER(buffer))
|
||||
{
|
||||
if (SERVER(buffer))
|
||||
gui_printf (NULL, _("%sServer: %s%s\n"),
|
||||
GUI_COLOR(COLOR_WIN_CHAT),
|
||||
GUI_COLOR(COLOR_WIN_CHAT_SERVER),
|
||||
SERVER(buffer)->name);
|
||||
else
|
||||
gui_printf (NULL, _("%snot connected\n"),
|
||||
GUI_COLOR(COLOR_WIN_CHAT));
|
||||
}
|
||||
else if (BUFFER_IS_CHANNEL (buffer))
|
||||
gui_printf (NULL, _("%sChannel: %s%s %s(server: %s%s%s)\n"),
|
||||
GUI_COLOR(COLOR_WIN_CHAT),
|
||||
@@ -961,7 +972,8 @@ weechat_cmd_buffer_display_info (t_gui_buffer *buffer)
|
||||
SERVER(buffer)->name,
|
||||
GUI_COLOR(COLOR_WIN_CHAT));
|
||||
else
|
||||
gui_printf (NULL, _("not connected\n"));
|
||||
gui_printf (NULL, _("%sunknown\n"),
|
||||
GUI_COLOR(COLOR_WIN_CHAT));
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -1384,7 +1396,7 @@ weechat_cmd_debug (int argc, char **argv)
|
||||
|
||||
if (ascii_strcasecmp (argv[0], "dump") == 0)
|
||||
{
|
||||
wee_dump (0);
|
||||
weechat_dump (0);
|
||||
}
|
||||
else if (ascii_strcasecmp (argv[0], "windows") == 0)
|
||||
{
|
||||
@@ -2794,6 +2806,87 @@ weechat_cmd_unignore (int argc, char **argv)
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*
|
||||
* weechat_cmd_upgrade: upgrade WeeChat
|
||||
*/
|
||||
|
||||
int
|
||||
weechat_cmd_upgrade (int argc, char **argv)
|
||||
{
|
||||
t_irc_server *ptr_server;
|
||||
int filename_length;
|
||||
char *filename;
|
||||
char *exec_args[5] = { NULL, "-a", "--session", NULL, NULL };
|
||||
|
||||
/* make gcc happy */
|
||||
(void) argc;
|
||||
(void) argv;
|
||||
|
||||
for (ptr_server = irc_servers; ptr_server;
|
||||
ptr_server = ptr_server->next_server)
|
||||
{
|
||||
if (ptr_server->child_pid != 0)
|
||||
{
|
||||
irc_display_prefix (NULL, gui_current_window->buffer, PREFIX_ERROR);
|
||||
gui_printf_nolog (NULL,
|
||||
_("%s can't upgrade: connection to at least "
|
||||
"one server is pending"),
|
||||
WEECHAT_ERROR);
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
||||
filename_length = strlen (weechat_home) + strlen (WEECHAT_SESSION_NAME) + 2;
|
||||
filename = (char *) malloc (filename_length * sizeof (char));
|
||||
if (!filename)
|
||||
return -2;
|
||||
snprintf (filename, filename_length, "%s%s" WEECHAT_SESSION_NAME,
|
||||
weechat_home, DIR_SEPARATOR);
|
||||
|
||||
irc_display_prefix (NULL, NULL, PREFIX_INFO);
|
||||
gui_printf_nolog (NULL, _("Upgrading WeeChat...\n"));
|
||||
|
||||
if (!session_save (filename))
|
||||
{
|
||||
free (filename);
|
||||
irc_display_prefix (NULL, NULL, PREFIX_ERROR);
|
||||
gui_printf_nolog (NULL,
|
||||
_("%s unable to save session in file\n"),
|
||||
WEECHAT_ERROR);
|
||||
return -1;
|
||||
}
|
||||
|
||||
exec_args[0] = strdup (weechat_argv0);
|
||||
exec_args[3] = strdup (filename);
|
||||
|
||||
/* unload plugins, save config, then upgrade */
|
||||
#ifdef PLUGINS
|
||||
plugin_end ();
|
||||
#endif
|
||||
(void) config_write (NULL);
|
||||
gui_end ();
|
||||
|
||||
execvp (exec_args[0], exec_args);
|
||||
|
||||
/* this code should not be reached if execvp is ok */
|
||||
#ifdef PLUGINS
|
||||
plugin_init (1);
|
||||
#endif
|
||||
|
||||
fprintf (stderr, _("%s exec failed (program: \"%s\"), exiting WeeChat\n"),
|
||||
WEECHAT_ERROR,
|
||||
exec_args[0]);
|
||||
|
||||
free (exec_args[0]);
|
||||
free (exec_args[3]);
|
||||
free (filename);
|
||||
|
||||
weechat_shutdown (EXIT_FAILURE, 0);
|
||||
|
||||
/* never executed */
|
||||
return -1;
|
||||
}
|
||||
|
||||
/*
|
||||
* weechat_cmd_uptime: display WeeChat uptime
|
||||
*/
|
||||
|
||||
@@ -81,6 +81,7 @@ extern int weechat_cmd_server (int, char **);
|
||||
extern int weechat_cmd_set (char *);
|
||||
extern int weechat_cmd_unalias (char *);
|
||||
extern int weechat_cmd_unignore (int, char **);
|
||||
extern int weechat_cmd_upgrade (int, char **);
|
||||
extern int weechat_cmd_uptime (int, char **);
|
||||
extern int weechat_cmd_window (int, char **);
|
||||
|
||||
|
||||
@@ -250,7 +250,7 @@ completion_build_list (t_completion *completion, void *channel)
|
||||
"*");
|
||||
if (channel)
|
||||
{
|
||||
if (((t_irc_channel *)channel)->type == CHAT_CHANNEL)
|
||||
if (((t_irc_channel *)channel)->type == CHANNEL_TYPE_CHANNEL)
|
||||
{
|
||||
for (ptr_nick = ((t_irc_channel *)channel)->nicks; ptr_nick;
|
||||
ptr_nick = ptr_nick->next_nick)
|
||||
@@ -260,7 +260,7 @@ completion_build_list (t_completion *completion, void *channel)
|
||||
ptr_nick->nick);
|
||||
}
|
||||
}
|
||||
if (((t_irc_channel *)channel)->type == CHAT_PRIVATE)
|
||||
if (((t_irc_channel *)channel)->type == CHANNEL_TYPE_PRIVATE)
|
||||
{
|
||||
weelist_add (&completion->completion_list,
|
||||
&completion->last_completion,
|
||||
@@ -302,7 +302,7 @@ completion_build_list (t_completion *completion, void *channel)
|
||||
weelist_add(&completion->completion_list,
|
||||
&completion->last_completion,
|
||||
"*");
|
||||
if (((t_irc_channel *)channel)->type == CHAT_CHANNEL)
|
||||
if (((t_irc_channel *)channel)->type == CHANNEL_TYPE_CHANNEL)
|
||||
weelist_add(&completion->completion_list,
|
||||
&completion->last_completion,
|
||||
((t_irc_channel *)channel)->name);
|
||||
@@ -822,7 +822,7 @@ completion_find_context (t_completion *completion, void *channel, char *buffer,
|
||||
}
|
||||
|
||||
if (!completion->completion_list && channel &&
|
||||
(((t_irc_channel *)channel)->type == CHAT_PRIVATE)
|
||||
(((t_irc_channel *)channel)->type == CHANNEL_TYPE_PRIVATE)
|
||||
&& (completion->context == COMPLETION_NICK))
|
||||
{
|
||||
/* nick completion in private (only other nick and self) */
|
||||
@@ -1017,7 +1017,7 @@ completion_nick (t_completion *completion, t_irc_channel *channel)
|
||||
if (!channel)
|
||||
return;
|
||||
|
||||
if (((t_irc_channel *)channel)->type == CHAT_PRIVATE)
|
||||
if (((t_irc_channel *)channel)->type == CHANNEL_TYPE_PRIVATE)
|
||||
{
|
||||
completion_command_arg (completion, channel, 1);
|
||||
return;
|
||||
|
||||
@@ -70,8 +70,9 @@ fifo_create ()
|
||||
gui_printf (NULL,
|
||||
_("%s unable to create FIFO pipe for remote control (%s)\n"),
|
||||
WEECHAT_ERROR, weechat_fifo_filename);
|
||||
wee_log_printf (_("%s unable to create FIFO pipe for remote control (%s)\n"),
|
||||
WEECHAT_ERROR, weechat_fifo_filename);
|
||||
weechat_log_printf (_("%s unable to create FIFO pipe for "
|
||||
"remote control (%s)\n"),
|
||||
WEECHAT_ERROR, weechat_fifo_filename);
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -81,12 +82,12 @@ fifo_create ()
|
||||
gui_printf (NULL,
|
||||
_("%s unable to open FIFO pipe (%s) for reading\n"),
|
||||
WEECHAT_ERROR, weechat_fifo_filename);
|
||||
wee_log_printf (_("%s unable to open FIFO pipe (%s) for reading\n"),
|
||||
WEECHAT_ERROR, weechat_fifo_filename);
|
||||
weechat_log_printf (_("%s unable to open FIFO pipe (%s) for reading\n"),
|
||||
WEECHAT_ERROR, weechat_fifo_filename);
|
||||
return;
|
||||
}
|
||||
|
||||
wee_log_printf (_("FIFO pipe is open\n"));
|
||||
weechat_log_printf (_("FIFO pipe is open\n"));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -249,8 +250,8 @@ fifo_read ()
|
||||
gui_printf (NULL,
|
||||
_("%s error reading FIFO pipe, closing it\n"),
|
||||
WEECHAT_ERROR);
|
||||
wee_log_printf (_("%s error reading FIFO pipe, closing it\n"),
|
||||
WEECHAT_ERROR);
|
||||
weechat_log_printf (_("%s error reading FIFO pipe, closing it\n"),
|
||||
WEECHAT_ERROR);
|
||||
fifo_remove ();
|
||||
}
|
||||
else
|
||||
@@ -291,5 +292,5 @@ fifo_remove ()
|
||||
weechat_fifo_filename = NULL;
|
||||
}
|
||||
|
||||
wee_log_printf (_("FIFO pipe is closed\n"));
|
||||
weechat_log_printf (_("FIFO pipe is closed\n"));
|
||||
}
|
||||
|
||||
@@ -66,19 +66,63 @@ history_hide_password (char *string)
|
||||
}
|
||||
|
||||
/*
|
||||
* history_add: add a text/command to history
|
||||
* history_buffer_add: add a text/command to buffer's history
|
||||
*/
|
||||
|
||||
void
|
||||
history_add (void *buffer, char *string)
|
||||
history_buffer_add (void *buffer, char *string)
|
||||
{
|
||||
t_history *new_history, *ptr_history;
|
||||
|
||||
if ( !((t_gui_buffer *)(buffer))->history
|
||||
|| ( ((t_gui_buffer *)(buffer))->history
|
||||
&& ascii_strcasecmp (((t_gui_buffer *)(buffer))->history->text, string) != 0))
|
||||
{
|
||||
new_history = (t_history *)malloc (sizeof (t_history));
|
||||
if (new_history)
|
||||
{
|
||||
new_history->text = strdup (string);
|
||||
if (cfg_log_hide_nickserv_pwd)
|
||||
history_hide_password (new_history->text);
|
||||
|
||||
if (((t_gui_buffer *)(buffer))->history)
|
||||
((t_gui_buffer *)(buffer))->history->prev_history = new_history;
|
||||
else
|
||||
((t_gui_buffer *)(buffer))->last_history = new_history;
|
||||
new_history->next_history = ((t_gui_buffer *)(buffer))->history;
|
||||
new_history->prev_history = NULL;
|
||||
((t_gui_buffer *)buffer)->history = new_history;
|
||||
((t_gui_buffer *)buffer)->num_history++;
|
||||
|
||||
/* remove one command if necessary */
|
||||
if ((cfg_history_max_commands > 0)
|
||||
&& (((t_gui_buffer *)(buffer))->num_history > cfg_history_max_commands))
|
||||
{
|
||||
ptr_history = ((t_gui_buffer *)buffer)->last_history->prev_history;
|
||||
((t_gui_buffer *)buffer)->last_history->prev_history->next_history = NULL;
|
||||
if (((t_gui_buffer *)buffer)->last_history->text)
|
||||
free (((t_gui_buffer *)buffer)->last_history->text);
|
||||
free (((t_gui_buffer *)buffer)->last_history);
|
||||
((t_gui_buffer *)buffer)->last_history = ptr_history;
|
||||
((t_gui_buffer *)(buffer))->num_history++;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* history_global_add: add a text/command to buffer's history
|
||||
*/
|
||||
|
||||
void
|
||||
history_global_add (char *string)
|
||||
{
|
||||
t_history *new_history, *ptr_history;
|
||||
|
||||
if ( !history_global
|
||||
|| ( history_global
|
||||
&& ascii_strcasecmp (history_global->text, string) != 0))
|
||||
if (!history_global
|
||||
|| (history_global
|
||||
&& ascii_strcasecmp (history_global->text, string) != 0))
|
||||
{
|
||||
/* add history to global history */
|
||||
new_history = (t_history *)malloc (sizeof (t_history));
|
||||
if (new_history)
|
||||
{
|
||||
@@ -109,42 +153,6 @@ history_add (void *buffer, char *string)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if ( !((t_gui_buffer *)(buffer))->history
|
||||
|| ( ((t_gui_buffer *)(buffer))->history
|
||||
&& ascii_strcasecmp (((t_gui_buffer *)(buffer))->history->text, string) != 0))
|
||||
{
|
||||
/* add history to local history */
|
||||
new_history = (t_history *)malloc (sizeof (t_history));
|
||||
if (new_history)
|
||||
{
|
||||
new_history->text = strdup (string);
|
||||
if (cfg_log_hide_nickserv_pwd)
|
||||
history_hide_password (new_history->text);
|
||||
|
||||
if (((t_gui_buffer *)(buffer))->history)
|
||||
((t_gui_buffer *)(buffer))->history->prev_history = new_history;
|
||||
else
|
||||
((t_gui_buffer *)(buffer))->last_history = new_history;
|
||||
new_history->next_history = ((t_gui_buffer *)(buffer))->history;
|
||||
new_history->prev_history = NULL;
|
||||
((t_gui_buffer *)buffer)->history = new_history;
|
||||
((t_gui_buffer *)(buffer))->num_history++;
|
||||
|
||||
/* remove one command if necessary */
|
||||
if ((cfg_history_max_commands > 0)
|
||||
&& (((t_gui_buffer *)(buffer))->num_history > cfg_history_max_commands))
|
||||
{
|
||||
ptr_history = ((t_gui_buffer *)buffer)->last_history->prev_history;
|
||||
((t_gui_buffer *)buffer)->last_history->prev_history->next_history = NULL;
|
||||
if (((t_gui_buffer *)buffer)->last_history->text)
|
||||
free (((t_gui_buffer *)buffer)->last_history->text);
|
||||
free (((t_gui_buffer *)buffer)->last_history);
|
||||
((t_gui_buffer *)buffer)->last_history = ptr_history;
|
||||
((t_gui_buffer *)(buffer))->num_history++;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
|
||||
@@ -34,7 +34,8 @@ extern t_history *history_global;
|
||||
extern t_history *history_global_last;
|
||||
extern t_history *history_global_ptr;
|
||||
|
||||
extern void history_add (void *, char *);
|
||||
extern void history_buffer_add (void *, char *);
|
||||
extern void history_global_add (char *);
|
||||
extern void history_global_free ();
|
||||
extern void history_buffer_free (void *);
|
||||
|
||||
|
||||
@@ -120,7 +120,7 @@ log_start (t_gui_buffer *buffer)
|
||||
buffer->log_filename = (char *) malloc (length);
|
||||
if (!buffer->log_filename)
|
||||
{
|
||||
wee_log_printf (_("Not enough memory to write log file for a buffer\n"));
|
||||
weechat_log_printf (_("Not enough memory to write log file for a buffer\n"));
|
||||
return;
|
||||
}
|
||||
if (cfg_log_path[0] == '~')
|
||||
@@ -148,7 +148,7 @@ log_start (t_gui_buffer *buffer)
|
||||
buffer->log_file = fopen (buffer->log_filename, "a");
|
||||
if (!buffer->log_file)
|
||||
{
|
||||
wee_log_printf (_("Unable to write log file for a buffer\n"));
|
||||
weechat_log_printf (_("Unable to write log file for a buffer\n"));
|
||||
free (buffer->log_filename);
|
||||
return;
|
||||
}
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,169 @@
|
||||
/*
|
||||
* Copyright (c) 2003-2005 by FlashCode <flashcode@flashtux.org>
|
||||
* See README for License detail, AUTHORS for developers list.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*/
|
||||
|
||||
|
||||
#ifndef __WEECHAT_SESSION_H
|
||||
#define __WEECHAT_SESSION_H 1
|
||||
|
||||
#define WEECHAT_SESSION_NAME "weechat_session.bin"
|
||||
|
||||
#define SESSION_SIGNATURE "== WeeChat Upgrade file v1.0 - binary, do not edit! =="
|
||||
|
||||
/* For developers: please add new values ONLY AT THE END of enums */
|
||||
|
||||
enum t_session_type
|
||||
{
|
||||
SESSION_TYPE_INT = 0,
|
||||
SESSION_TYPE_STR,
|
||||
SESSION_TYPE_BUF
|
||||
};
|
||||
|
||||
enum t_session_object
|
||||
{
|
||||
SESSION_OBJ_END = 0,
|
||||
SESSION_OBJ_SERVER,
|
||||
SESSION_OBJ_CHANNEL,
|
||||
SESSION_OBJ_NICK,
|
||||
SESSION_OBJ_DCC,
|
||||
SESSION_OBJ_HISTORY,
|
||||
SESSION_OBJ_BUFFER,
|
||||
SESSION_OBJ_LINE,
|
||||
};
|
||||
|
||||
enum t_session_server
|
||||
{
|
||||
SESSION_SERV_END = 0,
|
||||
SESSION_SERV_NAME,
|
||||
SESSION_SERV_AUTOCONNECT,
|
||||
SESSION_SERV_AUTORECONNECT,
|
||||
SESSION_SERV_AUTORECONNECT_DELAY,
|
||||
SESSION_SERV_COMMAND_LINE,
|
||||
SESSION_SERV_ADDRESS,
|
||||
SESSION_SERV_PORT,
|
||||
SESSION_SERV_IPV6,
|
||||
SESSION_SERV_SSL,
|
||||
SESSION_SERV_PASSWORD,
|
||||
SESSION_SERV_NICK1,
|
||||
SESSION_SERV_NICK2,
|
||||
SESSION_SERV_NICK3,
|
||||
SESSION_SERV_USERNAME,
|
||||
SESSION_SERV_REALNAME,
|
||||
SESSION_SERV_COMMAND,
|
||||
SESSION_SERV_COMMAND_DELAY,
|
||||
SESSION_SERV_AUTOJOIN,
|
||||
SESSION_SERV_AUTOREJOIN,
|
||||
SESSION_SERV_NOTIFY_LEVELS,
|
||||
SESSION_SERV_CHILD_PID,
|
||||
SESSION_SERV_CHILD_READ,
|
||||
SESSION_SERV_CHILD_WRITE,
|
||||
SESSION_SERV_SOCK,
|
||||
SESSION_SERV_IS_CONNECTED,
|
||||
SESSION_SERV_SSL_CONNECTED,
|
||||
SESSION_SERV_GNUTLS_SESS,
|
||||
SESSION_SERV_UNTERMINATED_MESSAGE,
|
||||
SESSION_SERV_NICK,
|
||||
SESSION_SERV_RECONNECT_START,
|
||||
SESSION_SERV_RECONNECT_JOIN,
|
||||
SESSION_SERV_IS_AWAY,
|
||||
SESSION_SERV_AWAY_TIME,
|
||||
SESSION_SERV_LAG,
|
||||
SESSION_SERV_LAG_CHECK_TIME,
|
||||
SESSION_SERV_LAG_NEXT_CHECK
|
||||
};
|
||||
|
||||
enum t_session_channel
|
||||
{
|
||||
SESSION_CHAN_END = 0,
|
||||
SESSION_CHAN_TYPE,
|
||||
SESSION_CHAN_NAME,
|
||||
SESSION_CHAN_TOPIC,
|
||||
SESSION_CHAN_MODES,
|
||||
SESSION_CHAN_LIMIT,
|
||||
SESSION_CHAN_KEY,
|
||||
SESSION_CHAN_NICKS_COUNT,
|
||||
SESSION_CHAN_CHECKING_AWAY
|
||||
};
|
||||
|
||||
enum t_session_nick
|
||||
{
|
||||
SESSION_NICK_END = 0,
|
||||
SESSION_NICK_NICK,
|
||||
SESSION_NICK_FLAGS,
|
||||
SESSION_NICK_COLOR
|
||||
};
|
||||
|
||||
enum t_session_dcc
|
||||
{
|
||||
SESSION_DCC_END = 0,
|
||||
SESSION_DCC_SERVER,
|
||||
SESSION_DCC_CHANNEL,
|
||||
SESSION_DCC_TYPE,
|
||||
SESSION_DCC_STATUS,
|
||||
SESSION_DCC_START_TIME,
|
||||
SESSION_DCC_START_TRANSFER,
|
||||
SESSION_DCC_ADDR,
|
||||
SESSION_DCC_PORT,
|
||||
SESSION_DCC_NICK,
|
||||
SESSION_DCC_SOCK,
|
||||
SESSION_DCC_UNTERMINATED_MESSAGE,
|
||||
SESSION_DCC_FILE,
|
||||
SESSION_DCC_FILENAME,
|
||||
SESSION_DCC_LOCAL_FILENAME,
|
||||
SESSION_DCC_FILENAME_SUFFIX,
|
||||
SESSION_DCC_SIZE,
|
||||
SESSION_DCC_POS,
|
||||
SESSION_DCC_ACK,
|
||||
SESSION_DCC_START_RESUME,
|
||||
SESSION_DCC_LAST_CHECK_TIME,
|
||||
SESSION_DCC_LAST_CHECK_POS,
|
||||
SESSION_DCC_LAST_ACTIVITY,
|
||||
SESSION_DCC_BYTES_PER_SEC,
|
||||
SESSION_DCC_ETA
|
||||
};
|
||||
|
||||
enum t_session_history
|
||||
{
|
||||
SESSION_HIST_END = 0,
|
||||
SESSION_HIST_TEXT
|
||||
};
|
||||
|
||||
enum t_session_buffer
|
||||
{
|
||||
SESSION_BUFF_END = 0,
|
||||
SESSION_BUFF_SERVER,
|
||||
SESSION_BUFF_CHANNEL,
|
||||
SESSION_BUFF_DCC
|
||||
};
|
||||
|
||||
enum t_session_line
|
||||
{
|
||||
SESSION_LINE_END = 0,
|
||||
SESSION_LINE_LENGTH,
|
||||
SESSION_LINE_LENGTH_ALIGN,
|
||||
SESSION_LINE_LOG_WRITE,
|
||||
SESSION_LINE_WITH_MESSAGE,
|
||||
SESSION_LINE_WITH_HIGHLIGHT,
|
||||
SESSION_LINE_DATA,
|
||||
SESSION_LINE_OFS_AFTER_DATE
|
||||
};
|
||||
|
||||
int session_save (char *filename);
|
||||
int session_load (char *filename);
|
||||
|
||||
#endif /* session.h */
|
||||
+205
-148
@@ -65,6 +65,7 @@
|
||||
#include "command.h"
|
||||
#include "fifo.h"
|
||||
#include "utf8.h"
|
||||
#include "session.h"
|
||||
#include "../irc/irc.h"
|
||||
#include "../gui/gui.h"
|
||||
|
||||
@@ -73,6 +74,8 @@
|
||||
#endif
|
||||
|
||||
|
||||
char *weechat_argv0 = NULL; /* WeeChat binary file name (argv[0]) */
|
||||
char *weechat_session = NULL; /* WeeChat session file (for /upgrade command) */
|
||||
time_t weechat_start_time; /* WeeChat start time (used by /uptime command) */
|
||||
int quit_weechat; /* = 1 if quit request from user... why ? :'( */
|
||||
int sigsegv = 0; /* SIGSEGV received? */
|
||||
@@ -163,11 +166,11 @@ ascii_strncasecmp (char *string1, char *string2, int max)
|
||||
}
|
||||
|
||||
/*
|
||||
* wee_log_printf: displays a message in WeeChat log (~/.weechat/weechat.log)
|
||||
* weechat_log_printf: displays a message in WeeChat log (~/.weechat/weechat.log)
|
||||
*/
|
||||
|
||||
void
|
||||
wee_log_printf (char *message, ...)
|
||||
weechat_log_printf (char *message, ...)
|
||||
{
|
||||
static char buffer[4096];
|
||||
char *ptr_buffer;
|
||||
@@ -214,7 +217,7 @@ weechat_convert_encoding (char *from_code, char *to_code, char *string)
|
||||
{
|
||||
char *outbuf;
|
||||
|
||||
#ifdef HAVE_ICONV
|
||||
#ifdef HAVE_ICONV
|
||||
iconv_t cd;
|
||||
char *inbuf;
|
||||
ICONV_CONST char *ptr_inbuf;
|
||||
@@ -249,12 +252,12 @@ weechat_convert_encoding (char *from_code, char *to_code, char *string)
|
||||
}
|
||||
else
|
||||
outbuf = strdup (string);
|
||||
#else
|
||||
#else
|
||||
/* make gcc happy */
|
||||
(void) from_code;
|
||||
(void) to_code;
|
||||
outbuf = strdup (string);
|
||||
#endif /* HAVE_ICONV */
|
||||
#endif /* HAVE_ICONV */
|
||||
|
||||
return outbuf;
|
||||
}
|
||||
@@ -263,7 +266,8 @@ weechat_convert_encoding (char *from_code, char *to_code, char *string)
|
||||
* get_timeval_diff: calculates difference between two times (return in milliseconds)
|
||||
*/
|
||||
|
||||
long get_timeval_diff(struct timeval *tv1, struct timeval *tv2)
|
||||
long
|
||||
get_timeval_diff (struct timeval *tv1, struct timeval *tv2)
|
||||
{
|
||||
long diff_sec, diff_usec;
|
||||
|
||||
@@ -279,10 +283,40 @@ long get_timeval_diff(struct timeval *tv1, struct timeval *tv2)
|
||||
}
|
||||
|
||||
/*
|
||||
* wee_display_config_options: display config options
|
||||
* weechat_display_usage: display WeeChat usage
|
||||
*/
|
||||
|
||||
void wee_display_config_options ()
|
||||
void
|
||||
weechat_display_usage (char *exec_name)
|
||||
{
|
||||
printf ("\n");
|
||||
printf (_("%s (c) Copyright 2003-2005, compiled on %s %s\n"
|
||||
"Developed by FlashCode <flashcode@flashtux.org> - %s"),
|
||||
PACKAGE_STRING, __DATE__, __TIME__, WEECHAT_WEBSITE);
|
||||
printf ("\n\n");
|
||||
printf (_("Usage: %s [options ...]\n" \
|
||||
" or: %s [irc[6][s]://[nickname[:password]@]irc.example.org[:port][/channel][,channel[...]]"),
|
||||
exec_name, exec_name);
|
||||
printf ("\n\n");
|
||||
printf (_(" -a, --no-connect disable auto-connect to servers at startup\n"
|
||||
" -c, --config display config file options\n"
|
||||
" -f, --key-functions display WeeChat internal functions for keys\n"
|
||||
" -h, --help this help\n"
|
||||
" -i, --irc-commands display IRC commands\n"
|
||||
" -k, --keys display WeeChat default keys\n"
|
||||
" -l, --license display WeeChat license\n"
|
||||
" -p, --no-plugin don't load any plugin at startup\n"
|
||||
" -v, --version display WeeChat version\n"
|
||||
" -w, --weechat-commands display WeeChat commands\n"));
|
||||
printf("\n");
|
||||
}
|
||||
|
||||
/*
|
||||
* weechat_display_config_options: display config options
|
||||
*/
|
||||
|
||||
void
|
||||
weechat_display_config_options ()
|
||||
{
|
||||
int i, j, k;
|
||||
|
||||
@@ -353,10 +387,11 @@ void wee_display_config_options ()
|
||||
}
|
||||
|
||||
/*
|
||||
* wee_display_commands: display WeeChat and/or IRC commands
|
||||
* weechat_display_commands: display WeeChat and/or IRC commands
|
||||
*/
|
||||
|
||||
void wee_display_commands (int weechat_cmd, int irc_cmd)
|
||||
void
|
||||
weechat_display_commands (int weechat_cmd, int irc_cmd)
|
||||
{
|
||||
int i;
|
||||
|
||||
@@ -406,10 +441,11 @@ void wee_display_commands (int weechat_cmd, int irc_cmd)
|
||||
}
|
||||
|
||||
/*
|
||||
* wee_display_key_functions: display WeeChat key functions
|
||||
* weechat_display_key_functions: display WeeChat key functions
|
||||
*/
|
||||
|
||||
void wee_display_key_functions ()
|
||||
void
|
||||
weechat_display_key_functions ()
|
||||
{
|
||||
int i;
|
||||
|
||||
@@ -426,11 +462,11 @@ void wee_display_key_functions ()
|
||||
}
|
||||
|
||||
/*
|
||||
* wee_display_keys: display WeeChat default keys
|
||||
* weechat_display_keys: display WeeChat default keys
|
||||
*/
|
||||
|
||||
void
|
||||
wee_display_keys ()
|
||||
weechat_display_keys ()
|
||||
{
|
||||
t_gui_key *ptr_key;
|
||||
char *expanded_name;
|
||||
@@ -449,15 +485,17 @@ wee_display_keys ()
|
||||
}
|
||||
|
||||
/*
|
||||
* wee_parse_args: parse command line args
|
||||
* weechat_parse_args: parse command line args
|
||||
*/
|
||||
|
||||
void
|
||||
wee_parse_args (int argc, char *argv[])
|
||||
weechat_parse_args (int argc, char *argv[])
|
||||
{
|
||||
int i;
|
||||
t_irc_server server_tmp;
|
||||
|
||||
weechat_argv0 = strdup (argv[0]);
|
||||
weechat_session = NULL;
|
||||
server_cmd_line = 0;
|
||||
auto_connect = 1;
|
||||
auto_load_plugins = 1;
|
||||
@@ -470,54 +508,65 @@ wee_parse_args (int argc, char *argv[])
|
||||
else if ((strcmp (argv[i], "-c") == 0)
|
||||
|| (strcmp (argv[i], "--config") == 0))
|
||||
{
|
||||
wee_display_config_options ();
|
||||
wee_shutdown (EXIT_SUCCESS, 0);
|
||||
weechat_display_config_options ();
|
||||
weechat_shutdown (EXIT_SUCCESS, 0);
|
||||
}
|
||||
else if ((strcmp (argv[i], "-f") == 0)
|
||||
|| (strcmp (argv[i], "--key-functions") == 0))
|
||||
{
|
||||
wee_display_key_functions ();
|
||||
wee_shutdown (EXIT_SUCCESS, 0);
|
||||
weechat_display_key_functions ();
|
||||
weechat_shutdown (EXIT_SUCCESS, 0);
|
||||
}
|
||||
else if ((strcmp (argv[i], "-h") == 0)
|
||||
|| (strcmp (argv[i], "--help") == 0))
|
||||
{
|
||||
printf ("\n" WEE_USAGE1, argv[0], argv[0]);
|
||||
printf ("%s", WEE_USAGE2);
|
||||
wee_shutdown (EXIT_SUCCESS, 0);
|
||||
weechat_display_usage (argv[0]);
|
||||
weechat_shutdown (EXIT_SUCCESS, 0);
|
||||
}
|
||||
else if ((strcmp (argv[i], "-i") == 0)
|
||||
|| (strcmp (argv[i], "--irc-commands") == 0))
|
||||
{
|
||||
wee_display_commands (0, 1);
|
||||
wee_shutdown (EXIT_SUCCESS, 0);
|
||||
weechat_display_commands (0, 1);
|
||||
weechat_shutdown (EXIT_SUCCESS, 0);
|
||||
}
|
||||
else if ((strcmp (argv[i], "-k") == 0)
|
||||
|| (strcmp (argv[i], "--keys") == 0))
|
||||
{
|
||||
wee_display_keys ();
|
||||
wee_shutdown (EXIT_SUCCESS, 0);
|
||||
weechat_display_keys ();
|
||||
weechat_shutdown (EXIT_SUCCESS, 0);
|
||||
}
|
||||
else if ((strcmp (argv[i], "-l") == 0)
|
||||
|| (strcmp (argv[i], "--license") == 0))
|
||||
{
|
||||
printf ("\n%s%s", WEE_LICENSE);
|
||||
wee_shutdown (EXIT_SUCCESS, 0);
|
||||
weechat_shutdown (EXIT_SUCCESS, 0);
|
||||
}
|
||||
else if ((strcmp (argv[i], "-p") == 0)
|
||||
|| (strcmp (argv[i], "--no-plugin") == 0))
|
||||
auto_load_plugins = 0;
|
||||
else if (strcmp (argv[i], "--session") == 0)
|
||||
{
|
||||
if (i + 1 < argc)
|
||||
weechat_session = strdup (argv[++i]);
|
||||
else
|
||||
{
|
||||
fprintf (stderr,
|
||||
_("%s missing argument for --session option\n"),
|
||||
WEECHAT_ERROR);
|
||||
weechat_shutdown (EXIT_FAILURE, 0);
|
||||
}
|
||||
}
|
||||
else if ((strcmp (argv[i], "-v") == 0)
|
||||
|| (strcmp (argv[i], "--version") == 0))
|
||||
{
|
||||
printf (PACKAGE_VERSION "\n");
|
||||
wee_shutdown (EXIT_SUCCESS, 0);
|
||||
weechat_shutdown (EXIT_SUCCESS, 0);
|
||||
}
|
||||
else if ((strcmp (argv[i], "-w") == 0)
|
||||
|| (strcmp (argv[i], "--weechat-commands") == 0))
|
||||
{
|
||||
wee_display_commands (1, 0);
|
||||
wee_shutdown (EXIT_SUCCESS, 0);
|
||||
weechat_display_commands (1, 0);
|
||||
weechat_shutdown (EXIT_SUCCESS, 0);
|
||||
}
|
||||
else if ((ascii_strncasecmp (argv[i], "irc", 3) == 0))
|
||||
{
|
||||
@@ -552,13 +601,13 @@ wee_parse_args (int argc, char *argv[])
|
||||
}
|
||||
|
||||
/*
|
||||
* wee_create_dir: create a directory
|
||||
* return: 1 if ok (or directory already exists)
|
||||
* 0 if error
|
||||
* weechat_create_dir: create a directory
|
||||
* return: 1 if ok (or directory already exists)
|
||||
* 0 if error
|
||||
*/
|
||||
|
||||
int
|
||||
wee_create_dir (char *directory)
|
||||
weechat_create_dir (char *directory)
|
||||
{
|
||||
if (mkdir (directory, 0755) < 0)
|
||||
{
|
||||
@@ -574,26 +623,21 @@ wee_create_dir (char *directory)
|
||||
}
|
||||
|
||||
/*
|
||||
* wee_create_home_dirs: create (if not found):
|
||||
* - WeeChat home directory ("~/.weechat")
|
||||
* - "perl" directory (and "autoload")
|
||||
* - "ruby" directory (and "autoload")
|
||||
* - "python" directory (and "autoload")
|
||||
* weechat_create_home_dirs: create WeeChat directories (if not found)
|
||||
*/
|
||||
|
||||
void
|
||||
wee_create_home_dirs ()
|
||||
weechat_create_home_dirs ()
|
||||
{
|
||||
char *ptr_home, *dir_name;
|
||||
int dir_length;
|
||||
|
||||
/* TODO: rewrite this code for Windows version */
|
||||
|
||||
ptr_home = getenv ("HOME");
|
||||
if (!ptr_home)
|
||||
{
|
||||
fprintf (stderr, _("%s unable to get HOME directory\n"),
|
||||
WEECHAT_ERROR);
|
||||
wee_shutdown (EXIT_FAILURE, 0);
|
||||
weechat_shutdown (EXIT_FAILURE, 0);
|
||||
}
|
||||
dir_length = strlen (ptr_home) + 10;
|
||||
weechat_home =
|
||||
@@ -602,17 +646,17 @@ wee_create_home_dirs ()
|
||||
{
|
||||
fprintf (stderr, _("%s not enough memory for home directory\n"),
|
||||
WEECHAT_ERROR);
|
||||
wee_shutdown (EXIT_FAILURE, 0);
|
||||
weechat_shutdown (EXIT_FAILURE, 0);
|
||||
}
|
||||
snprintf (weechat_home, dir_length, "%s%s.weechat", ptr_home,
|
||||
DIR_SEPARATOR);
|
||||
|
||||
/* create home directory "~/.weechat" ; error is fatal */
|
||||
if (!wee_create_dir (weechat_home))
|
||||
if (!weechat_create_dir (weechat_home))
|
||||
{
|
||||
fprintf (stderr, _("%s unable to create ~/.weechat directory\n"),
|
||||
WEECHAT_ERROR);
|
||||
wee_shutdown (EXIT_FAILURE, 0);
|
||||
weechat_shutdown (EXIT_FAILURE, 0);
|
||||
}
|
||||
|
||||
dir_length = strlen (weechat_home) + 64;
|
||||
@@ -621,7 +665,7 @@ wee_create_home_dirs ()
|
||||
/* create "~/.weechat/logs" */
|
||||
snprintf (dir_name, dir_length, "%s%s%s", weechat_home, DIR_SEPARATOR,
|
||||
"logs");
|
||||
if (!wee_create_dir (dir_name))
|
||||
if (!weechat_create_dir (dir_name))
|
||||
{
|
||||
fprintf (stderr, _("%s unable to create ~/.weechat/logs directory\n"),
|
||||
WEECHAT_WARNING);
|
||||
@@ -632,11 +676,11 @@ wee_create_home_dirs ()
|
||||
}
|
||||
|
||||
/*
|
||||
* wee_init_vars: initialize some variables
|
||||
* weechat_init_vars: initialize some variables
|
||||
*/
|
||||
|
||||
void
|
||||
wee_init_vars ()
|
||||
weechat_init_vars ()
|
||||
{
|
||||
/* start time, used by /uptime command */
|
||||
weechat_start_time = time (NULL);
|
||||
@@ -654,11 +698,11 @@ wee_init_vars ()
|
||||
}
|
||||
|
||||
/*
|
||||
* wee_init_log: initialize log file
|
||||
* weechat_init_log: initialize log file
|
||||
*/
|
||||
|
||||
void
|
||||
wee_init_log ()
|
||||
weechat_init_log ()
|
||||
{
|
||||
int filename_length;
|
||||
char *filename;
|
||||
@@ -674,6 +718,29 @@ wee_init_log ()
|
||||
free (filename);
|
||||
}
|
||||
|
||||
/*
|
||||
* weechat_config_read: read WeeChat config file
|
||||
*/
|
||||
|
||||
void
|
||||
weechat_config_read ()
|
||||
{
|
||||
switch (config_read ())
|
||||
{
|
||||
case 0: /* read ok */
|
||||
break;
|
||||
case -1: /* config file not found */
|
||||
if (config_create_default () < 0)
|
||||
exit (EXIT_FAILURE);
|
||||
if (config_read () != 0)
|
||||
exit (EXIT_FAILURE);
|
||||
break;
|
||||
default: /* other error (fatal) */
|
||||
server_free_all ();
|
||||
exit (EXIT_FAILURE);
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* weechat_welcome_message: display WeeChat welcome message - yeah!
|
||||
*/
|
||||
@@ -720,29 +787,19 @@ weechat_welcome_message ()
|
||||
"%s-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-\n",
|
||||
GUI_COLOR(COLOR_WIN_CHAT_NICK));
|
||||
|
||||
wee_log_printf ("%s (%s %s %s)\n",
|
||||
PACKAGE_STRING, _("compiled on"), __DATE__, __TIME__);
|
||||
weechat_log_printf ("%s (%s %s %s)\n",
|
||||
PACKAGE_STRING, _("compiled on"), __DATE__, __TIME__);
|
||||
}
|
||||
|
||||
/*
|
||||
* wee_gui_shutdown: shutdown WeeChat GUI
|
||||
* weechat_shutdown: shutdown WeeChat
|
||||
*/
|
||||
|
||||
void
|
||||
wee_gui_shutdown ()
|
||||
{
|
||||
dcc_end ();
|
||||
server_free_all ();
|
||||
gui_end ();
|
||||
}
|
||||
|
||||
/*
|
||||
* wee_shutdown: shutdown WeeChat
|
||||
*/
|
||||
|
||||
void
|
||||
wee_shutdown (int return_code, int crash)
|
||||
weechat_shutdown (int return_code, int crash)
|
||||
{
|
||||
if (weechat_argv0)
|
||||
free (weechat_argv0);
|
||||
fifo_remove ();
|
||||
if (weechat_home)
|
||||
free (weechat_home);
|
||||
@@ -764,15 +821,16 @@ wee_shutdown (int return_code, int crash)
|
||||
}
|
||||
|
||||
/*
|
||||
* wee_dump writes dump to WeeChat log file
|
||||
* weechat_dump writes dump to WeeChat log file
|
||||
*/
|
||||
|
||||
void
|
||||
wee_dump (int crash)
|
||||
weechat_dump (int crash)
|
||||
{
|
||||
t_irc_server *ptr_server;
|
||||
t_irc_channel *ptr_channel;
|
||||
t_irc_nick *ptr_nick;
|
||||
t_irc_dcc *ptr_dcc;
|
||||
t_gui_window *ptr_window;
|
||||
t_gui_buffer *ptr_buffer;
|
||||
|
||||
@@ -783,92 +841,100 @@ wee_dump (int crash)
|
||||
if (crash)
|
||||
{
|
||||
sigsegv = 1;
|
||||
wee_log_printf ("Very bad, WeeChat is crashing (SIGSEGV received)...\n");
|
||||
weechat_log_printf ("Very bad, WeeChat is crashing (SIGSEGV received)...\n");
|
||||
}
|
||||
|
||||
wee_log_printf ("\n");
|
||||
weechat_log_printf ("\n");
|
||||
if (crash)
|
||||
{
|
||||
wee_log_printf ("****** WeeChat CRASH DUMP ******\n");
|
||||
wee_log_printf ("****** Please send this file to WeeChat developers ******\n");
|
||||
wee_log_printf ("****** and explain when this crash happened ******\n");
|
||||
weechat_log_printf ("****** WeeChat CRASH DUMP ******\n");
|
||||
weechat_log_printf ("****** Please send this file to WeeChat developers ******\n");
|
||||
weechat_log_printf ("****** and explain when this crash happened ******\n");
|
||||
}
|
||||
else
|
||||
{
|
||||
wee_log_printf ("****** WeeChat dump request ******\n");
|
||||
weechat_log_printf ("****** WeeChat dump request ******\n");
|
||||
}
|
||||
|
||||
for (ptr_server = irc_servers; ptr_server; ptr_server = ptr_server->next_server)
|
||||
{
|
||||
wee_log_printf ("\n");
|
||||
weechat_log_printf ("\n");
|
||||
server_print_log (ptr_server);
|
||||
|
||||
for (ptr_channel = ptr_server->channels; ptr_channel;
|
||||
ptr_channel = ptr_channel->next_channel)
|
||||
{
|
||||
wee_log_printf ("\n");
|
||||
weechat_log_printf ("\n");
|
||||
channel_print_log (ptr_channel);
|
||||
|
||||
for (ptr_nick = ptr_channel->nicks; ptr_nick;
|
||||
ptr_nick = ptr_nick->next_nick)
|
||||
{
|
||||
wee_log_printf ("\n");
|
||||
weechat_log_printf ("\n");
|
||||
nick_print_log (ptr_nick);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
wee_log_printf ("\n");
|
||||
wee_log_printf ("[windows/buffers]\n");
|
||||
wee_log_printf (" => windows:\n");
|
||||
weechat_log_printf ("\n");
|
||||
for (ptr_dcc = dcc_list; ptr_dcc; ptr_dcc = ptr_dcc->next_dcc)
|
||||
{
|
||||
dcc_print_log (ptr_dcc);
|
||||
}
|
||||
|
||||
weechat_log_printf ("\n");
|
||||
weechat_log_printf ("[windows/buffers]\n");
|
||||
weechat_log_printf (" => windows:\n");
|
||||
for (ptr_window = gui_windows; ptr_window; ptr_window = ptr_window->next_window)
|
||||
{
|
||||
wee_log_printf (" 0x%X\n", ptr_window);
|
||||
weechat_log_printf (" 0x%X\n", ptr_window);
|
||||
}
|
||||
wee_log_printf (" => buffers:\n");
|
||||
weechat_log_printf (" => buffers:\n");
|
||||
for (ptr_buffer = gui_buffers; ptr_buffer; ptr_buffer = ptr_buffer->next_buffer)
|
||||
{
|
||||
wee_log_printf (" 0x%X\n", ptr_buffer);
|
||||
weechat_log_printf (" 0x%X\n", ptr_buffer);
|
||||
}
|
||||
wee_log_printf (" => current window = 0x%X\n", gui_current_window);
|
||||
weechat_log_printf (" => current window = 0x%X\n", gui_current_window);
|
||||
|
||||
for (ptr_window = gui_windows; ptr_window; ptr_window = ptr_window->next_window)
|
||||
{
|
||||
wee_log_printf ("\n");
|
||||
weechat_log_printf ("\n");
|
||||
gui_window_print_log (ptr_window);
|
||||
}
|
||||
|
||||
for (ptr_buffer = gui_buffers; ptr_buffer; ptr_buffer = ptr_buffer->next_buffer)
|
||||
{
|
||||
wee_log_printf ("\n");
|
||||
weechat_log_printf ("\n");
|
||||
gui_buffer_print_log (ptr_buffer);
|
||||
}
|
||||
|
||||
wee_log_printf ("\n");
|
||||
weechat_log_printf ("\n");
|
||||
ignore_print_log ();
|
||||
|
||||
wee_log_printf ("\n");
|
||||
wee_log_printf ("****** End of dump ******\n");
|
||||
wee_log_printf ("\n");
|
||||
weechat_log_printf ("\n");
|
||||
weechat_log_printf ("****** End of dump ******\n");
|
||||
weechat_log_printf ("\n");
|
||||
}
|
||||
|
||||
/*
|
||||
* my_sigsegv: SIGSEGV handler: save crash log to ~/.weechat/weechat.log and exit
|
||||
* weechat_sigsegv: SIGSEGV handler: save crash log to ~/.weechat/weechat.log and exit
|
||||
*/
|
||||
|
||||
void
|
||||
my_sigsegv ()
|
||||
weechat_sigsegv ()
|
||||
{
|
||||
wee_dump (1);
|
||||
wee_gui_shutdown ();
|
||||
weechat_dump (1);
|
||||
dcc_end ();
|
||||
server_free_all ();
|
||||
gui_end ();
|
||||
fprintf (stderr, "\n");
|
||||
fprintf (stderr, "*** Very bad! WeeChat has crashed (SIGSEGV received)\n");
|
||||
fprintf (stderr, "*** Full crash dump was saved to ~/.weechat/weechat.log file\n");
|
||||
fprintf (stderr, "*** Please send this file to WeeChat developers.\n");
|
||||
fprintf (stderr, "*** (be careful, private info may be in this file since\n");
|
||||
fprintf (stderr, "*** part of chats are displayed, so remove lines if needed)\n\n");
|
||||
wee_shutdown (EXIT_FAILURE, 1);
|
||||
weechat_shutdown (EXIT_FAILURE, 1);
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -878,63 +944,54 @@ my_sigsegv ()
|
||||
int
|
||||
main (int argc, char *argv[])
|
||||
{
|
||||
#ifdef ENABLE_NLS
|
||||
setlocale (LC_ALL, ""); /* initialize gettext */
|
||||
#ifdef ENABLE_NLS
|
||||
setlocale (LC_ALL, ""); /* initialize gettext */
|
||||
bindtextdomain (PACKAGE, LOCALEDIR);
|
||||
textdomain (PACKAGE);
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_LANGINFO_CODESET
|
||||
local_charset = strdup (nl_langinfo (CODESET));
|
||||
#endif
|
||||
|
||||
signal (SIGINT, SIG_IGN); /* ignore SIGINT signal */
|
||||
signal (SIGQUIT, SIG_IGN); /* ignore SIGQUIT signal */
|
||||
signal (SIGPIPE, SIG_IGN); /* ignore SIGPIPE signal */
|
||||
signal (SIGSEGV, my_sigsegv); /* crash dump when SIGSEGV is received */
|
||||
gui_pre_init (&argc, &argv); /* pre-initiliaze interface */
|
||||
wee_init_vars (); /* initialize some variables */
|
||||
gui_key_init (); /* init keyboard (default key bindings) */
|
||||
wee_parse_args (argc, argv); /* parse command line args */
|
||||
wee_create_home_dirs (); /* create WeeChat directories */
|
||||
wee_init_log (); /* init log file */
|
||||
command_index_build (); /* build commands index for completion */
|
||||
|
||||
switch (config_read ()) /* read configuration */
|
||||
{
|
||||
case 0: /* config file OK */
|
||||
break;
|
||||
case -1: /* config file not found */
|
||||
if (config_create_default () < 0)
|
||||
return EXIT_FAILURE;
|
||||
if (config_read () != 0)
|
||||
return EXIT_FAILURE;
|
||||
break;
|
||||
default: /* other error (fatal) */
|
||||
server_free_all ();
|
||||
return EXIT_FAILURE;
|
||||
}
|
||||
|
||||
utf8_init (); /* init UTF-8 in WeeChat */
|
||||
gui_init (); /* init WeeChat interface */
|
||||
weechat_welcome_message (); /* display WeeChat welcome message */
|
||||
#ifdef PLUGINS
|
||||
plugin_init (auto_load_plugins);/* init plugin interface(s) */
|
||||
#endif
|
||||
/* auto-connect to servers */
|
||||
server_auto_connect (auto_connect, server_cmd_line);
|
||||
fifo_create (); /* create FIFO pipe for remote control */
|
||||
|
||||
gui_main_loop (); /* WeeChat main loop */
|
||||
#ifdef HAVE_LANGINFO_CODESET
|
||||
local_charset = strdup (nl_langinfo (CODESET));
|
||||
#endif
|
||||
|
||||
signal (SIGINT, SIG_IGN); /* ignore SIGINT signal */
|
||||
signal (SIGQUIT, SIG_IGN); /* ignore SIGQUIT signal */
|
||||
signal (SIGPIPE, SIG_IGN); /* ignore SIGPIPE signal */
|
||||
signal (SIGSEGV, weechat_sigsegv); /* crash dump when SIGSEGV received */
|
||||
gui_pre_init (&argc, &argv); /* pre-initiliaze interface */
|
||||
weechat_init_vars (); /* initialize some variables */
|
||||
gui_key_init (); /* init keyb. (default key bindings)*/
|
||||
weechat_parse_args (argc, argv); /* parse command line args */
|
||||
weechat_create_home_dirs (); /* create WeeChat directories */
|
||||
weechat_init_log (); /* init log file */
|
||||
command_index_build (); /* build cmd index for completion */
|
||||
weechat_config_read (); /* read configuration */
|
||||
utf8_init (); /* init UTF-8 in WeeChat */
|
||||
gui_init (); /* init WeeChat interface */
|
||||
weechat_welcome_message (); /* display WeeChat welcome message */
|
||||
#ifdef PLUGINS
|
||||
plugin_init (auto_load_plugins); /* init plugin interface(s) */
|
||||
#endif
|
||||
|
||||
server_auto_connect (auto_connect, /* auto-connect to servers */
|
||||
server_cmd_line);
|
||||
fifo_create (); /* FIFO pipe for remote control */
|
||||
|
||||
if (weechat_session)
|
||||
session_load (weechat_session); /* load previous session if asked */
|
||||
|
||||
gui_main_loop (); /* WeeChat main loop */
|
||||
|
||||
#ifdef PLUGINS
|
||||
plugin_end (); /* end plugin interface(s) */
|
||||
plugin_end (); /* end plugin interface(s) */
|
||||
#endif
|
||||
server_disconnect_all (); /* disconnect from all servers */
|
||||
(void) config_write (NULL); /* save config file */
|
||||
command_index_free (); /* free commands index */
|
||||
wee_gui_shutdown (); /* shut down WeeChat GUI */
|
||||
wee_shutdown (EXIT_SUCCESS, 0); /* quit WeeChat (oh no, why?) */
|
||||
server_disconnect_all (); /* disconnect from all servers */
|
||||
(void) config_write (NULL); /* save config file */
|
||||
command_index_free (); /* free commands index */
|
||||
dcc_end (); /* remove all DCC */
|
||||
server_free_all (); /* free all servers */
|
||||
gui_end (); /* shut down WeeChat GUI */
|
||||
weechat_shutdown (EXIT_SUCCESS, 0); /* quit WeeChat (oh no, why?) */
|
||||
|
||||
return EXIT_SUCCESS; /* make gcc happy (never executed) */
|
||||
return EXIT_SUCCESS; /* make gcc happy (never executed) */
|
||||
}
|
||||
|
||||
@@ -82,24 +82,6 @@
|
||||
"along with this program; if not, write to the Free Software\n" \
|
||||
"Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA\n\n"
|
||||
|
||||
#define WEE_USAGE1 \
|
||||
PACKAGE_STRING " (c) Copyright 2003-2005, compiled on " __DATE__ " " __TIME__ \
|
||||
"\nDeveloped by FlashCode <flashcode@flashtux.org> - " WEECHAT_WEBSITE "\n\n" \
|
||||
"Usage: %s [options ...]\n" \
|
||||
" or: %s [irc[6][s]://[nickname[:password]@]irc.example.org[:port][/channel][,channel[...]]\n\n"
|
||||
|
||||
#define WEE_USAGE2 \
|
||||
" -a, --no-connect disable auto-connect to servers at startup\n" \
|
||||
" -c, --config display config file options\n" \
|
||||
" -f, --key-functions display WeeChat internal functions for keys\n" \
|
||||
" -h, --help this help\n" \
|
||||
" -i, --irc-commands display IRC commands\n" \
|
||||
" -k, --keys display WeeChat default keys\n" \
|
||||
" -l, --license display WeeChat license\n" \
|
||||
" -p, --no-plugin don't load any plugin at startup\n" \
|
||||
" -v, --version display WeeChat version\n" \
|
||||
" -w, --weechat-commands display WeeChat commands\n\n"
|
||||
|
||||
/* directory separator, depending on OS */
|
||||
|
||||
#ifdef _WIN32
|
||||
@@ -112,6 +94,7 @@
|
||||
|
||||
/* global variables and functions */
|
||||
|
||||
extern char *weechat_argv0;
|
||||
extern time_t weechat_start_time;
|
||||
extern int quit_weechat;
|
||||
extern char *weechat_home;
|
||||
@@ -123,10 +106,10 @@ extern gnutls_certificate_credentials gnutls_xcred;
|
||||
|
||||
extern int ascii_strcasecmp (char *, char *);
|
||||
extern int ascii_strncasecmp (char *, char *, int);
|
||||
extern void wee_log_printf (char *, ...);
|
||||
extern void wee_dump (int);
|
||||
extern void weechat_log_printf (char *, ...);
|
||||
extern void weechat_dump (int);
|
||||
extern char *weechat_convert_encoding (char *, char *, char *);
|
||||
extern long get_timeval_diff (struct timeval *, struct timeval *);
|
||||
extern void wee_shutdown (int, int);
|
||||
extern void weechat_shutdown (int, int);
|
||||
|
||||
#endif /* weechat.h */
|
||||
|
||||
@@ -1612,10 +1612,8 @@ config_read ()
|
||||
int server_found;
|
||||
char line[1024], *ptr_line, *pos, *pos2;
|
||||
|
||||
filename_length = strlen (weechat_home) +
|
||||
strlen (WEECHAT_CONFIG_NAME) + 2;
|
||||
filename =
|
||||
(char *) malloc (filename_length * sizeof (char));
|
||||
filename_length = strlen (weechat_home) + strlen (WEECHAT_CONFIG_NAME) + 2;
|
||||
filename = (char *) malloc (filename_length * sizeof (char));
|
||||
if (!filename)
|
||||
return -2;
|
||||
snprintf (filename, filename_length, "%s%s" WEECHAT_CONFIG_NAME,
|
||||
@@ -1914,7 +1912,7 @@ config_create_default ()
|
||||
}
|
||||
|
||||
printf (_("%s: creating default config file...\n"), PACKAGE_NAME);
|
||||
wee_log_printf (_("Creating default config file\n"));
|
||||
weechat_log_printf (_("Creating default config file\n"));
|
||||
|
||||
current_time = time (NULL);
|
||||
fprintf (file, _("#\n# %s configuration file, created by "
|
||||
@@ -2115,7 +2113,7 @@ config_write (char *config_name)
|
||||
return -1;
|
||||
}
|
||||
|
||||
wee_log_printf (_("Saving config to disk\n"));
|
||||
weechat_log_printf (_("Saving config to disk\n"));
|
||||
|
||||
current_time = time (NULL);
|
||||
fprintf (file, _("#\n# %s configuration file, created by "
|
||||
|
||||
@@ -1594,7 +1594,16 @@ gui_draw_buffer_chat (t_gui_buffer *buffer, int erase)
|
||||
num_unit = 2;
|
||||
else
|
||||
num_unit = 3;
|
||||
sprintf (format, " (%s %%s/s)", unit_format[num_unit]);
|
||||
wprintw (ptr_win->win_chat, " (");
|
||||
if (ptr_dcc->status == DCC_ACTIVE)
|
||||
{
|
||||
wprintw (ptr_win->win_chat, _("ETA"));
|
||||
wprintw (ptr_win->win_chat, ": %.2lu:%.2lu:%.2lu - ",
|
||||
ptr_dcc->eta / 3600,
|
||||
(ptr_dcc->eta / 60) % 60,
|
||||
ptr_dcc->eta % 60);
|
||||
}
|
||||
sprintf (format, "%s %%s/s)", unit_format[num_unit]);
|
||||
buf = weechat_convert_encoding ((local_utf8) ?
|
||||
cfg_look_charset_decode_iso : cfg_look_charset_decode_utf,
|
||||
(cfg_look_charset_internal && cfg_look_charset_internal[0]) ?
|
||||
@@ -1824,31 +1833,31 @@ gui_draw_buffer_nick (t_gui_buffer *buffer, int erase)
|
||||
}
|
||||
else
|
||||
{
|
||||
if (ptr_nick->is_chanowner)
|
||||
if (ptr_nick->flags & NICK_CHANOWNER)
|
||||
{
|
||||
gui_window_set_weechat_color (ptr_win->win_nick, COLOR_WIN_NICK_CHANOWNER);
|
||||
mvwprintw (ptr_win->win_nick, y, x, "~");
|
||||
x++;
|
||||
}
|
||||
else if (ptr_nick->is_chanadmin)
|
||||
else if (ptr_nick->flags & NICK_CHANADMIN)
|
||||
{
|
||||
gui_window_set_weechat_color (ptr_win->win_nick, COLOR_WIN_NICK_CHANADMIN);
|
||||
mvwprintw (ptr_win->win_nick, y, x, "&");
|
||||
x++;
|
||||
}
|
||||
else if (ptr_nick->is_op)
|
||||
else if (ptr_nick->flags & NICK_OP)
|
||||
{
|
||||
gui_window_set_weechat_color (ptr_win->win_nick, COLOR_WIN_NICK_OP);
|
||||
mvwprintw (ptr_win->win_nick, y, x, "@");
|
||||
x++;
|
||||
}
|
||||
else if (ptr_nick->is_halfop)
|
||||
else if (ptr_nick->flags & NICK_HALFOP)
|
||||
{
|
||||
gui_window_set_weechat_color (ptr_win->win_nick, COLOR_WIN_NICK_HALFOP);
|
||||
mvwprintw (ptr_win->win_nick, y, x, "%%");
|
||||
x++;
|
||||
}
|
||||
else if (ptr_nick->has_voice)
|
||||
else if (ptr_nick->flags & NICK_VOICE)
|
||||
{
|
||||
gui_window_set_weechat_color (ptr_win->win_nick, COLOR_WIN_NICK_VOICE);
|
||||
mvwprintw (ptr_win->win_nick, y, x, "+");
|
||||
@@ -1861,7 +1870,7 @@ gui_draw_buffer_nick (t_gui_buffer *buffer, int erase)
|
||||
x++;
|
||||
}
|
||||
gui_window_set_weechat_color (ptr_win->win_nick,
|
||||
((cfg_irc_away_check > 0) && (ptr_nick->is_away)) ?
|
||||
((cfg_irc_away_check > 0) && (ptr_nick->flags & NICK_AWAY)) ?
|
||||
COLOR_WIN_NICK_AWAY : COLOR_WIN_NICK);
|
||||
mvwprintw (ptr_win->win_nick, y, x, format, ptr_nick->nick);
|
||||
|
||||
@@ -2004,7 +2013,7 @@ gui_draw_buffer_status (t_gui_buffer *buffer, int erase)
|
||||
gui_window_set_weechat_color (ptr_win->win_status,
|
||||
COLOR_WIN_STATUS_CHANNEL);
|
||||
if ((!CHANNEL(ptr_win->buffer)->nicks)
|
||||
&& (CHANNEL(ptr_win->buffer)->type != CHAT_PRIVATE))
|
||||
&& (CHANNEL(ptr_win->buffer)->type != CHANNEL_TYPE_PRIVATE))
|
||||
wprintw (ptr_win->win_status, "(%s)",
|
||||
CHANNEL(ptr_win->buffer)->name);
|
||||
else
|
||||
@@ -2013,7 +2022,7 @@ gui_draw_buffer_status (t_gui_buffer *buffer, int erase)
|
||||
if (ptr_win->buffer == CHANNEL(ptr_win->buffer)->buffer)
|
||||
{
|
||||
/* display channel modes */
|
||||
if (CHANNEL(ptr_win->buffer)->type == CHAT_CHANNEL)
|
||||
if (CHANNEL(ptr_win->buffer)->type == CHANNEL_TYPE_CHANNEL)
|
||||
{
|
||||
gui_window_set_weechat_color (ptr_win->win_status,
|
||||
COLOR_WIN_STATUS_DELIMITERS);
|
||||
@@ -2050,7 +2059,7 @@ gui_draw_buffer_status (t_gui_buffer *buffer, int erase)
|
||||
}
|
||||
|
||||
/* display DCC if private is DCC CHAT */
|
||||
if ((CHANNEL(ptr_win->buffer)->type == CHAT_PRIVATE)
|
||||
if ((CHANNEL(ptr_win->buffer)->type == CHANNEL_TYPE_PRIVATE)
|
||||
&& (CHANNEL(ptr_win->buffer)->dcc_chat))
|
||||
{
|
||||
gui_window_set_weechat_color (ptr_win->win_status,
|
||||
|
||||
@@ -88,29 +88,30 @@ gui_action_clipboard_paste (t_gui_window *window)
|
||||
void
|
||||
gui_action_return (t_gui_window *window)
|
||||
{
|
||||
t_gui_buffer *ptr_buffer;
|
||||
char *command;
|
||||
|
||||
if (window->buffer->has_input)
|
||||
{
|
||||
if (window->buffer->input_buffer_size > 0)
|
||||
{
|
||||
window->buffer->input_buffer[window->buffer->input_buffer_size] = '\0';
|
||||
history_add (window->buffer, window->buffer->input_buffer);
|
||||
command = strdup (window->buffer->input_buffer);
|
||||
if (!command)
|
||||
return;
|
||||
history_buffer_add (window->buffer, window->buffer->input_buffer);
|
||||
history_global_add (window->buffer->input_buffer);
|
||||
window->buffer->input_buffer[0] = '\0';
|
||||
window->buffer->input_buffer_size = 0;
|
||||
window->buffer->input_buffer_length = 0;
|
||||
window->buffer->input_buffer_pos = 0;
|
||||
window->buffer->input_buffer_1st_display = 0;
|
||||
window->buffer->completion.position = -1;
|
||||
window->buffer->ptr_history = NULL;
|
||||
ptr_buffer = window->buffer;
|
||||
gui_draw_buffer_input (window->buffer, 0);
|
||||
user_command (SERVER(window->buffer),
|
||||
window->buffer,
|
||||
window->buffer->input_buffer);
|
||||
if (ptr_buffer == window->buffer)
|
||||
{
|
||||
ptr_buffer->input_buffer[0] = '\0';
|
||||
gui_draw_buffer_input (ptr_buffer, 0);
|
||||
}
|
||||
command);
|
||||
free (command);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -694,7 +695,8 @@ gui_action_up (t_gui_window *window)
|
||||
if (window->buffer->input_buffer_size > 0)
|
||||
{
|
||||
window->buffer->input_buffer[window->buffer->input_buffer_size] = '\0';
|
||||
history_add (window->buffer, window->buffer->input_buffer);
|
||||
history_buffer_add (window->buffer, window->buffer->input_buffer);
|
||||
history_global_add (window->buffer->input_buffer);
|
||||
}
|
||||
}
|
||||
else
|
||||
|
||||
@@ -137,8 +137,8 @@ gui_window_new (t_gui_window *parent, int x, int y, int width, int height,
|
||||
t_gui_window_tree *ptr_tree, *child1, *child2, *ptr_leaf;
|
||||
|
||||
#ifdef DEBUG
|
||||
wee_log_printf ("Creating new window (x:%d, y:%d, width:%d, height:%d)\n",
|
||||
x, y, width, height);
|
||||
weechat_log_printf ("Creating new window (x:%d, y:%d, width:%d, height:%d)\n",
|
||||
x, y, width, height);
|
||||
#endif
|
||||
|
||||
if (parent)
|
||||
@@ -353,7 +353,7 @@ gui_buffer_new (t_gui_window *window, void *server, void *channel, int dcc,
|
||||
t_gui_buffer *new_buffer, *ptr_buffer;
|
||||
|
||||
#ifdef DEBUG
|
||||
wee_log_printf ("Creating new buffer\n");
|
||||
weechat_log_printf ("Creating new buffer\n");
|
||||
#endif
|
||||
|
||||
/* use first buffer if no server was assigned to this buffer */
|
||||
@@ -665,11 +665,11 @@ gui_buffer_free (t_gui_buffer *buffer, int switch_to_another)
|
||||
}
|
||||
|
||||
/*
|
||||
* gui_new_line: create new line for a buffer
|
||||
* gui_line_new: create new line for a buffer
|
||||
*/
|
||||
|
||||
t_gui_line *
|
||||
gui_new_line (t_gui_buffer *buffer)
|
||||
gui_line_new (t_gui_buffer *buffer)
|
||||
{
|
||||
t_gui_line *new_line, *ptr_line;
|
||||
|
||||
@@ -693,7 +693,7 @@ gui_new_line (t_gui_buffer *buffer)
|
||||
}
|
||||
else
|
||||
{
|
||||
wee_log_printf (_("Not enough memory for new line\n"));
|
||||
weechat_log_printf (_("Not enough memory for new line\n"));
|
||||
return NULL;
|
||||
}
|
||||
|
||||
@@ -708,7 +708,6 @@ gui_new_line (t_gui_buffer *buffer)
|
||||
buffer->lines = ptr_line;
|
||||
ptr_line->prev_line = NULL;
|
||||
buffer->num_lines--;
|
||||
//if (buffer->first_line_displayed)
|
||||
gui_draw_buffer_chat (buffer, 1);
|
||||
}
|
||||
|
||||
@@ -774,7 +773,7 @@ gui_add_to_line (t_gui_buffer *buffer, int type, char *message)
|
||||
if (buffer->line_complete)
|
||||
{
|
||||
buffer->line_complete = 0;
|
||||
if (!gui_new_line (buffer))
|
||||
if (!gui_line_new (buffer))
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -880,8 +879,8 @@ gui_printf_internal (t_gui_buffer *buffer, int display_time, int type, char *mes
|
||||
|
||||
if (buffer == NULL)
|
||||
{
|
||||
wee_log_printf ("WARNING: gui_printf_internal without buffer! This is a bug, "
|
||||
"please send to developers - thanks\n");
|
||||
weechat_log_printf ("WARNING: gui_printf_internal without buffer! This is a bug, "
|
||||
"please send to developers - thanks\n");
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -1045,7 +1044,7 @@ gui_infobar_printf (int time_displayed, int color, char *message, ...)
|
||||
gui_draw_buffer_infobar (gui_current_window->buffer, 1);
|
||||
}
|
||||
else
|
||||
wee_log_printf (_("Not enough memory for infobar message\n"));
|
||||
weechat_log_printf (_("Not enough memory for infobar message\n"));
|
||||
}
|
||||
|
||||
if (buf2)
|
||||
@@ -1616,45 +1615,45 @@ gui_buffer_move_to_number (t_gui_window *window, int number)
|
||||
void
|
||||
gui_window_print_log (t_gui_window *window)
|
||||
{
|
||||
wee_log_printf ("[window (addr:0x%X)]\n", window);
|
||||
wee_log_printf (" win_x . . . . . . . : %d\n", window->win_x);
|
||||
wee_log_printf (" win_y . . . . . . . : %d\n", window->win_y);
|
||||
wee_log_printf (" win_width . . . . . : %d\n", window->win_width);
|
||||
wee_log_printf (" win_height. . . . . : %d\n", window->win_height);
|
||||
wee_log_printf (" win_width_pct . . . : %d\n", window->win_width_pct);
|
||||
wee_log_printf (" win_height_pct. . . : %d\n", window->win_height_pct);
|
||||
wee_log_printf (" win_chat_x. . . . . : %d\n", window->win_chat_x);
|
||||
wee_log_printf (" win_chat_y. . . . . : %d\n", window->win_chat_y);
|
||||
wee_log_printf (" win_chat_width. . . : %d\n", window->win_chat_width);
|
||||
wee_log_printf (" win_chat_height . . : %d\n", window->win_chat_height);
|
||||
wee_log_printf (" win_chat_cursor_x . : %d\n", window->win_chat_cursor_x);
|
||||
wee_log_printf (" win_chat_cursor_y . : %d\n", window->win_chat_cursor_y);
|
||||
wee_log_printf (" win_nick_x. . . . . : %d\n", window->win_nick_x);
|
||||
wee_log_printf (" win_nick_y. . . . . : %d\n", window->win_nick_y);
|
||||
wee_log_printf (" win_nick_width. . . : %d\n", window->win_nick_width);
|
||||
wee_log_printf (" win_nick_height . . : %d\n", window->win_nick_height);
|
||||
wee_log_printf (" win_nick_start. . . : %d\n", window->win_nick_start);
|
||||
wee_log_printf (" win_title . . . . . : 0x%X\n", window->win_title);
|
||||
wee_log_printf (" win_chat. . . . . . : 0x%X\n", window->win_chat);
|
||||
wee_log_printf (" win_nick. . . . . . : 0x%X\n", window->win_nick);
|
||||
wee_log_printf (" win_status. . . . . : 0x%X\n", window->win_status);
|
||||
wee_log_printf (" win_infobar . . . . : 0x%X\n", window->win_infobar);
|
||||
wee_log_printf (" win_input . . . . . : 0x%X\n", window->win_input);
|
||||
wee_log_printf (" win_separator . . . : 0x%X\n", window->win_separator);
|
||||
wee_log_printf (" textview_chat . . . : 0x%X\n", window->textview_chat);
|
||||
wee_log_printf (" textbuffer_chat . . : 0x%X\n", window->textbuffer_chat);
|
||||
wee_log_printf (" texttag_chat. . . . : 0x%X\n", window->texttag_chat);
|
||||
wee_log_printf (" textview_nicklist . : 0x%X\n", window->textview_nicklist);
|
||||
wee_log_printf (" textbuffer_nicklist : 0x%X\n", window->textbuffer_nicklist);
|
||||
wee_log_printf (" dcc_first . . . . . : 0x%X\n", window->dcc_first);
|
||||
wee_log_printf (" dcc_selected. . . . : 0x%X\n", window->dcc_selected);
|
||||
wee_log_printf (" dcc_last_displayed. : 0x%X\n", window->dcc_last_displayed);
|
||||
wee_log_printf (" buffer. . . . . . . : 0x%X\n", window->buffer);
|
||||
wee_log_printf (" first_line_displayed: %d\n", window->first_line_displayed);
|
||||
wee_log_printf (" start_line. . . . . : 0x%X\n", window->start_line);
|
||||
wee_log_printf (" start_line_pos. . . : %d\n", window->start_line_pos);
|
||||
wee_log_printf (" prev_window . . . . : 0x%X\n", window->prev_window);
|
||||
wee_log_printf (" next_window . . . . : 0x%X\n", window->next_window);
|
||||
weechat_log_printf ("[window (addr:0x%X)]\n", window);
|
||||
weechat_log_printf (" win_x . . . . . . . : %d\n", window->win_x);
|
||||
weechat_log_printf (" win_y . . . . . . . : %d\n", window->win_y);
|
||||
weechat_log_printf (" win_width . . . . . : %d\n", window->win_width);
|
||||
weechat_log_printf (" win_height. . . . . : %d\n", window->win_height);
|
||||
weechat_log_printf (" win_width_pct . . . : %d\n", window->win_width_pct);
|
||||
weechat_log_printf (" win_height_pct. . . : %d\n", window->win_height_pct);
|
||||
weechat_log_printf (" win_chat_x. . . . . : %d\n", window->win_chat_x);
|
||||
weechat_log_printf (" win_chat_y. . . . . : %d\n", window->win_chat_y);
|
||||
weechat_log_printf (" win_chat_width. . . : %d\n", window->win_chat_width);
|
||||
weechat_log_printf (" win_chat_height . . : %d\n", window->win_chat_height);
|
||||
weechat_log_printf (" win_chat_cursor_x . : %d\n", window->win_chat_cursor_x);
|
||||
weechat_log_printf (" win_chat_cursor_y . : %d\n", window->win_chat_cursor_y);
|
||||
weechat_log_printf (" win_nick_x. . . . . : %d\n", window->win_nick_x);
|
||||
weechat_log_printf (" win_nick_y. . . . . : %d\n", window->win_nick_y);
|
||||
weechat_log_printf (" win_nick_width. . . : %d\n", window->win_nick_width);
|
||||
weechat_log_printf (" win_nick_height . . : %d\n", window->win_nick_height);
|
||||
weechat_log_printf (" win_nick_start. . . : %d\n", window->win_nick_start);
|
||||
weechat_log_printf (" win_title . . . . . : 0x%X\n", window->win_title);
|
||||
weechat_log_printf (" win_chat. . . . . . : 0x%X\n", window->win_chat);
|
||||
weechat_log_printf (" win_nick. . . . . . : 0x%X\n", window->win_nick);
|
||||
weechat_log_printf (" win_status. . . . . : 0x%X\n", window->win_status);
|
||||
weechat_log_printf (" win_infobar . . . . : 0x%X\n", window->win_infobar);
|
||||
weechat_log_printf (" win_input . . . . . : 0x%X\n", window->win_input);
|
||||
weechat_log_printf (" win_separator . . . : 0x%X\n", window->win_separator);
|
||||
weechat_log_printf (" textview_chat . . . : 0x%X\n", window->textview_chat);
|
||||
weechat_log_printf (" textbuffer_chat . . : 0x%X\n", window->textbuffer_chat);
|
||||
weechat_log_printf (" texttag_chat. . . . : 0x%X\n", window->texttag_chat);
|
||||
weechat_log_printf (" textview_nicklist . : 0x%X\n", window->textview_nicklist);
|
||||
weechat_log_printf (" textbuffer_nicklist : 0x%X\n", window->textbuffer_nicklist);
|
||||
weechat_log_printf (" dcc_first . . . . . : 0x%X\n", window->dcc_first);
|
||||
weechat_log_printf (" dcc_selected. . . . : 0x%X\n", window->dcc_selected);
|
||||
weechat_log_printf (" dcc_last_displayed. : 0x%X\n", window->dcc_last_displayed);
|
||||
weechat_log_printf (" buffer. . . . . . . : 0x%X\n", window->buffer);
|
||||
weechat_log_printf (" first_line_displayed: %d\n", window->first_line_displayed);
|
||||
weechat_log_printf (" start_line. . . . . : 0x%X\n", window->start_line);
|
||||
weechat_log_printf (" start_line_pos. . . : %d\n", window->start_line_pos);
|
||||
weechat_log_printf (" prev_window . . . . : 0x%X\n", window->prev_window);
|
||||
weechat_log_printf (" next_window . . . . : 0x%X\n", window->next_window);
|
||||
|
||||
}
|
||||
|
||||
@@ -1668,35 +1667,35 @@ gui_buffer_print_log (t_gui_buffer *buffer)
|
||||
t_gui_line *ptr_line;
|
||||
int num;
|
||||
|
||||
wee_log_printf ("[buffer (addr:0x%X)]\n", buffer);
|
||||
wee_log_printf (" num_displayed. . . . : %d\n", buffer->num_displayed);
|
||||
wee_log_printf (" number . . . . . . . : %d\n", buffer->number);
|
||||
wee_log_printf (" server . . . . . . . : 0x%X\n", buffer->server);
|
||||
wee_log_printf (" all_servers. . . . . : %d\n", buffer->all_servers);
|
||||
wee_log_printf (" channel. . . . . . . : 0x%X\n", buffer->channel);
|
||||
wee_log_printf (" dcc. . . . . . . . . : %d\n", buffer->dcc);
|
||||
wee_log_printf (" lines. . . . . . . . : 0x%X\n", buffer->lines);
|
||||
wee_log_printf (" last_line. . . . . . : 0x%X\n", buffer->last_line);
|
||||
wee_log_printf (" last_read_line . . . : 0x%X\n", buffer->last_read_line);
|
||||
wee_log_printf (" num_lines. . . . . . : %d\n", buffer->num_lines);
|
||||
wee_log_printf (" line_complete. . . . : %d\n", buffer->line_complete);
|
||||
wee_log_printf (" notify_level . . . . : %d\n", buffer->notify_level);
|
||||
wee_log_printf (" log_filename . . . . : '%s'\n", buffer->log_filename);
|
||||
wee_log_printf (" log_file . . . . . . : 0x%X\n", buffer->log_file);
|
||||
wee_log_printf (" has_input. . . . . . : %d\n", buffer->has_input);
|
||||
wee_log_printf (" input_buffer . . . . : '%s'\n", buffer->input_buffer);
|
||||
wee_log_printf (" input_buffer_alloc . : %d\n", buffer->input_buffer_alloc);
|
||||
wee_log_printf (" input_buffer_size. . : %d\n", buffer->input_buffer_size);
|
||||
wee_log_printf (" input_buffer_length. : %d\n", buffer->input_buffer_length);
|
||||
wee_log_printf (" input_buffer_pos . . : %d\n", buffer->input_buffer_pos);
|
||||
wee_log_printf (" input_buffer_1st_disp: %d\n", buffer->input_buffer_1st_display);
|
||||
wee_log_printf (" history. . . . . . . : 0x%X\n", buffer->history);
|
||||
wee_log_printf (" last_history . . . . : 0x%X\n", buffer->last_history);
|
||||
wee_log_printf (" ptr_history. . . . . : 0x%X\n", buffer->ptr_history);
|
||||
wee_log_printf (" prev_buffer. . . . . : 0x%X\n", buffer->prev_buffer);
|
||||
wee_log_printf (" next_buffer. . . . . : 0x%X\n", buffer->next_buffer);
|
||||
wee_log_printf ("\n");
|
||||
wee_log_printf (" => last 100 lines:\n");
|
||||
weechat_log_printf ("[buffer (addr:0x%X)]\n", buffer);
|
||||
weechat_log_printf (" num_displayed. . . . : %d\n", buffer->num_displayed);
|
||||
weechat_log_printf (" number . . . . . . . : %d\n", buffer->number);
|
||||
weechat_log_printf (" server . . . . . . . : 0x%X\n", buffer->server);
|
||||
weechat_log_printf (" all_servers. . . . . : %d\n", buffer->all_servers);
|
||||
weechat_log_printf (" channel. . . . . . . : 0x%X\n", buffer->channel);
|
||||
weechat_log_printf (" dcc. . . . . . . . . : %d\n", buffer->dcc);
|
||||
weechat_log_printf (" lines. . . . . . . . : 0x%X\n", buffer->lines);
|
||||
weechat_log_printf (" last_line. . . . . . : 0x%X\n", buffer->last_line);
|
||||
weechat_log_printf (" last_read_line . . . : 0x%X\n", buffer->last_read_line);
|
||||
weechat_log_printf (" num_lines. . . . . . : %d\n", buffer->num_lines);
|
||||
weechat_log_printf (" line_complete. . . . : %d\n", buffer->line_complete);
|
||||
weechat_log_printf (" notify_level . . . . : %d\n", buffer->notify_level);
|
||||
weechat_log_printf (" log_filename . . . . : '%s'\n", buffer->log_filename);
|
||||
weechat_log_printf (" log_file . . . . . . : 0x%X\n", buffer->log_file);
|
||||
weechat_log_printf (" has_input. . . . . . : %d\n", buffer->has_input);
|
||||
weechat_log_printf (" input_buffer . . . . : '%s'\n", buffer->input_buffer);
|
||||
weechat_log_printf (" input_buffer_alloc . : %d\n", buffer->input_buffer_alloc);
|
||||
weechat_log_printf (" input_buffer_size. . : %d\n", buffer->input_buffer_size);
|
||||
weechat_log_printf (" input_buffer_length. : %d\n", buffer->input_buffer_length);
|
||||
weechat_log_printf (" input_buffer_pos . . : %d\n", buffer->input_buffer_pos);
|
||||
weechat_log_printf (" input_buffer_1st_disp: %d\n", buffer->input_buffer_1st_display);
|
||||
weechat_log_printf (" history. . . . . . . : 0x%X\n", buffer->history);
|
||||
weechat_log_printf (" last_history . . . . : 0x%X\n", buffer->last_history);
|
||||
weechat_log_printf (" ptr_history. . . . . : 0x%X\n", buffer->ptr_history);
|
||||
weechat_log_printf (" prev_buffer. . . . . : 0x%X\n", buffer->prev_buffer);
|
||||
weechat_log_printf (" next_buffer. . . . . : 0x%X\n", buffer->next_buffer);
|
||||
weechat_log_printf ("\n");
|
||||
weechat_log_printf (" => last 100 lines:\n");
|
||||
|
||||
num = 0;
|
||||
ptr_line = buffer->last_line;
|
||||
@@ -1713,9 +1712,9 @@ gui_buffer_print_log (t_gui_buffer *buffer)
|
||||
while (ptr_line)
|
||||
{
|
||||
num--;
|
||||
wee_log_printf (" line N-%05d: %s\n",
|
||||
num,
|
||||
(ptr_line->data) ? ptr_line->data : "(empty)");
|
||||
weechat_log_printf (" line N-%05d: %s\n",
|
||||
num,
|
||||
(ptr_line->data) ? ptr_line->data : "(empty)");
|
||||
|
||||
ptr_line = ptr_line->next_line;
|
||||
}
|
||||
|
||||
@@ -431,8 +431,8 @@ gui_key_bind (char *key, char *command)
|
||||
|
||||
if (!key || !command)
|
||||
{
|
||||
wee_log_printf (_("%s unable to bind key \"%s\"\n"),
|
||||
WEECHAT_ERROR, key);
|
||||
weechat_log_printf (_("%s unable to bind key \"%s\"\n"),
|
||||
WEECHAT_ERROR, key);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
@@ -442,8 +442,8 @@ gui_key_bind (char *key, char *command)
|
||||
ptr_function = gui_key_function_search_by_name (command);
|
||||
if (!ptr_function)
|
||||
{
|
||||
wee_log_printf (_("%s unable to bind key \"%s\" (invalid function name: \"%s\")\n"),
|
||||
WEECHAT_ERROR, key, command);
|
||||
weechat_log_printf (_("%s unable to bind key \"%s\" (invalid function name: \"%s\")\n"),
|
||||
WEECHAT_ERROR, key, command);
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
@@ -455,8 +455,8 @@ gui_key_bind (char *key, char *command)
|
||||
ptr_function);
|
||||
if (!new_key)
|
||||
{
|
||||
wee_log_printf (_("%s not enough memory for key binding\n"),
|
||||
WEECHAT_ERROR);
|
||||
weechat_log_printf (_("%s not enough memory for key binding\n"),
|
||||
WEECHAT_ERROR);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
||||
@@ -140,8 +140,8 @@ enum t_weechat_color
|
||||
#define CHANNEL(buffer) ((t_irc_channel *)(buffer->channel))
|
||||
|
||||
#define BUFFER_IS_SERVER(buffer) ((SERVER(buffer) || (buffer->all_servers)) && !CHANNEL(buffer))
|
||||
#define BUFFER_IS_CHANNEL(buffer) (CHANNEL(buffer) && (CHANNEL(buffer)->type == CHAT_CHANNEL))
|
||||
#define BUFFER_IS_PRIVATE(buffer) (CHANNEL(buffer) && (CHANNEL(buffer)->type == CHAT_PRIVATE))
|
||||
#define BUFFER_IS_CHANNEL(buffer) (CHANNEL(buffer) && (CHANNEL(buffer)->type == CHANNEL_TYPE_CHANNEL))
|
||||
#define BUFFER_IS_PRIVATE(buffer) (CHANNEL(buffer) && (CHANNEL(buffer)->type == CHANNEL_TYPE_PRIVATE))
|
||||
|
||||
#define BUFFER_HAS_NICKLIST(buffer) (BUFFER_IS_CHANNEL(buffer))
|
||||
|
||||
@@ -409,7 +409,7 @@ extern void gui_infobar_printf (int, int, char *, ...);
|
||||
extern void gui_window_free (t_gui_window *);
|
||||
extern void gui_infobar_remove ();
|
||||
extern void gui_buffer_free (t_gui_buffer *, int);
|
||||
extern t_gui_line *gui_new_line (t_gui_buffer *);
|
||||
extern t_gui_line *gui_line_new (t_gui_buffer *);
|
||||
extern int gui_word_strlen (t_gui_window *, char *);
|
||||
extern int gui_word_real_pos (t_gui_window *, char *, int);
|
||||
extern void gui_printf_internal (t_gui_buffer *, int, int, char *, ...);
|
||||
|
||||
@@ -41,8 +41,7 @@ char *channel_modes = "iklmnst";
|
||||
*/
|
||||
|
||||
t_irc_channel *
|
||||
channel_new (t_irc_server *server, int channel_type, char *channel_name,
|
||||
int switch_to_buffer)
|
||||
channel_new (t_irc_server *server, int channel_type, char *channel_name)
|
||||
{
|
||||
t_irc_channel *new_channel;
|
||||
|
||||
@@ -58,8 +57,9 @@ channel_new (t_irc_server *server, int channel_type, char *channel_name,
|
||||
new_channel->dcc_chat = NULL;
|
||||
new_channel->name = strdup (channel_name);
|
||||
new_channel->topic = NULL;
|
||||
memset (new_channel->modes, ' ', sizeof (new_channel->modes));
|
||||
new_channel->modes[sizeof (new_channel->modes) - 1] = '\0';
|
||||
new_channel->modes = (char *) malloc (NUM_CHANNEL_MODES + 1);
|
||||
memset (new_channel->modes, ' ', NUM_CHANNEL_MODES);
|
||||
new_channel->modes[NUM_CHANNEL_MODES] = '\0';
|
||||
new_channel->limit = 0;
|
||||
new_channel->key = NULL;
|
||||
new_channel->nicks_count = 0;
|
||||
@@ -75,8 +75,6 @@ channel_new (t_irc_server *server, int channel_type, char *channel_name,
|
||||
else
|
||||
server->channels = new_channel;
|
||||
server->last_channel = new_channel;
|
||||
|
||||
gui_buffer_new (gui_current_window, server, new_channel, 0, switch_to_buffer);
|
||||
|
||||
/* all is ok, return address of new channel */
|
||||
return new_channel;
|
||||
@@ -182,11 +180,11 @@ channel_remove_away (t_irc_channel *channel)
|
||||
{
|
||||
t_irc_nick *ptr_nick;
|
||||
|
||||
if (channel->type == CHAT_CHANNEL)
|
||||
if (channel->type == CHANNEL_TYPE_CHANNEL)
|
||||
{
|
||||
for (ptr_nick = channel->nicks; ptr_nick; ptr_nick = ptr_nick->next_nick)
|
||||
{
|
||||
ptr_nick->is_away = 0;
|
||||
NICK_SET_FLAG(ptr_nick, 0, NICK_AWAY);
|
||||
}
|
||||
gui_draw_buffer_nick (channel->buffer, 0);
|
||||
}
|
||||
@@ -199,7 +197,7 @@ channel_remove_away (t_irc_channel *channel)
|
||||
void
|
||||
channel_check_away (t_irc_server *server, t_irc_channel *channel)
|
||||
{
|
||||
if (channel->type == CHAT_CHANNEL)
|
||||
if (channel->type == CHANNEL_TYPE_CHANNEL)
|
||||
{
|
||||
channel->checking_away++;
|
||||
server_sendf (server, "WHO %s\r\n", channel->name);
|
||||
@@ -215,7 +213,7 @@ channel_set_away (t_irc_channel *channel, char *nick, int is_away)
|
||||
{
|
||||
t_irc_nick *ptr_nick;
|
||||
|
||||
if (channel->type == CHAT_CHANNEL)
|
||||
if (channel->type == CHANNEL_TYPE_CHANNEL)
|
||||
{
|
||||
ptr_nick = nick_search (channel, nick);
|
||||
if (ptr_nick)
|
||||
@@ -234,10 +232,11 @@ channel_create_dcc (t_irc_dcc *ptr_dcc)
|
||||
|
||||
ptr_channel = channel_search (ptr_dcc->server, ptr_dcc->nick);
|
||||
if (!ptr_channel)
|
||||
ptr_channel = channel_new (ptr_dcc->server, CHAT_PRIVATE,
|
||||
ptr_dcc->nick, 0);
|
||||
ptr_channel = channel_new (ptr_dcc->server, CHANNEL_TYPE_PRIVATE,
|
||||
ptr_dcc->nick);
|
||||
if (!ptr_channel)
|
||||
return 0;
|
||||
gui_buffer_new (gui_current_window, ptr_dcc->server, ptr_channel, 0, 0);
|
||||
|
||||
if (ptr_channel->dcc_chat &&
|
||||
(!DCC_ENDED(((t_irc_dcc *)(ptr_channel->dcc_chat))->status)))
|
||||
@@ -406,17 +405,17 @@ channel_set_notify_level (t_irc_server *server, t_irc_channel *channel, int noti
|
||||
void
|
||||
channel_print_log (t_irc_channel *channel)
|
||||
{
|
||||
wee_log_printf ("=> channel %s (addr:0x%X)]\n", channel->name, channel);
|
||||
wee_log_printf (" type . . . . : %d\n", channel->type);
|
||||
wee_log_printf (" dcc_chat . . : 0x%X\n", channel->dcc_chat);
|
||||
wee_log_printf (" topic. . . . : '%s'\n", channel->topic);
|
||||
wee_log_printf (" modes. . . . : '%s'\n", channel->modes);
|
||||
wee_log_printf (" limit. . . . : %d\n", channel->limit);
|
||||
wee_log_printf (" key. . . . . : '%s'\n", channel->key);
|
||||
wee_log_printf (" checking_away: %d\n", channel->checking_away);
|
||||
wee_log_printf (" nicks. . . . : 0x%X\n", channel->nicks);
|
||||
wee_log_printf (" last_nick. . : 0x%X\n", channel->last_nick);
|
||||
wee_log_printf (" buffer . . . : 0x%X\n", channel->buffer);
|
||||
wee_log_printf (" prev_channel : 0x%X\n", channel->prev_channel);
|
||||
wee_log_printf (" next_channel : 0x%X\n", channel->next_channel);
|
||||
weechat_log_printf ("=> channel %s (addr:0x%X)]\n", channel->name, channel);
|
||||
weechat_log_printf (" type . . . . : %d\n", channel->type);
|
||||
weechat_log_printf (" dcc_chat . . : 0x%X\n", channel->dcc_chat);
|
||||
weechat_log_printf (" topic. . . . : '%s'\n", channel->topic);
|
||||
weechat_log_printf (" modes. . . . : '%s'\n", channel->modes);
|
||||
weechat_log_printf (" limit. . . . : %d\n", channel->limit);
|
||||
weechat_log_printf (" key. . . . . : '%s'\n", channel->key);
|
||||
weechat_log_printf (" checking_away: %d\n", channel->checking_away);
|
||||
weechat_log_printf (" nicks. . . . : 0x%X\n", channel->nicks);
|
||||
weechat_log_printf (" last_nick. . : 0x%X\n", channel->last_nick);
|
||||
weechat_log_printf (" buffer . . . : 0x%X\n", channel->buffer);
|
||||
weechat_log_printf (" prev_channel : 0x%X\n", channel->prev_channel);
|
||||
weechat_log_printf (" next_channel : 0x%X\n", channel->next_channel);
|
||||
}
|
||||
|
||||
+106
-11
@@ -148,6 +148,9 @@ dcc_find_filename (t_irc_dcc *ptr_dcc)
|
||||
{
|
||||
char *ptr_home, *filename2;
|
||||
|
||||
if (!DCC_IS_FILE(ptr_dcc->type))
|
||||
return;
|
||||
|
||||
ptr_home = getenv ("HOME");
|
||||
ptr_dcc->local_filename = (char *) malloc (strlen (cfg_dcc_download_path) +
|
||||
strlen (ptr_dcc->nick) +
|
||||
@@ -223,20 +226,32 @@ void
|
||||
dcc_calculate_speed (t_irc_dcc *ptr_dcc, int ended)
|
||||
{
|
||||
time_t local_time, elapsed;
|
||||
unsigned long bytes_per_sec_total;
|
||||
|
||||
local_time = time (NULL);
|
||||
if (ended || local_time > ptr_dcc->last_check_time)
|
||||
{
|
||||
|
||||
if (ended)
|
||||
{
|
||||
/* calculate bytes per second (global) */
|
||||
elapsed = local_time - ptr_dcc->start_transfer;
|
||||
if (elapsed == 0)
|
||||
elapsed = 1;
|
||||
ptr_dcc->bytes_per_sec = (ptr_dcc->pos - ptr_dcc->start_resume) / elapsed;
|
||||
ptr_dcc->eta = 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
/* calculate ETA */
|
||||
elapsed = local_time - ptr_dcc->start_transfer;
|
||||
if (elapsed == 0)
|
||||
elapsed = 1;
|
||||
bytes_per_sec_total = (ptr_dcc->pos - ptr_dcc->start_resume) / elapsed;
|
||||
if (bytes_per_sec_total == 0)
|
||||
bytes_per_sec_total = 1;
|
||||
ptr_dcc->eta = (ptr_dcc->size - ptr_dcc->pos) / bytes_per_sec_total;
|
||||
|
||||
/* calculate bytes per second (since last check time) */
|
||||
elapsed = local_time - ptr_dcc->last_check_time;
|
||||
if (elapsed == 0)
|
||||
elapsed = 1;
|
||||
@@ -605,6 +620,54 @@ dcc_start_resume (t_irc_server *server, char *filename, int port,
|
||||
WEECHAT_ERROR, filename, port, pos_start);
|
||||
}
|
||||
|
||||
/*
|
||||
* dcc_alloc: allocate a new DCC file
|
||||
*/
|
||||
|
||||
t_irc_dcc *
|
||||
dcc_alloc ()
|
||||
{
|
||||
t_irc_dcc *new_dcc;
|
||||
|
||||
/* create new DCC struct */
|
||||
if ((new_dcc = (t_irc_dcc *) malloc (sizeof (t_irc_dcc))) == NULL)
|
||||
return NULL;
|
||||
|
||||
/* default values */
|
||||
new_dcc->server = NULL;
|
||||
new_dcc->channel = NULL;
|
||||
new_dcc->type = 0;
|
||||
new_dcc->status = 0;
|
||||
new_dcc->start_time = 0;
|
||||
new_dcc->start_transfer = 0;
|
||||
new_dcc->addr = 0;
|
||||
new_dcc->port = 0;
|
||||
new_dcc->nick = NULL;
|
||||
new_dcc->sock = -1;
|
||||
new_dcc->unterminated_message = NULL;
|
||||
new_dcc->file = -1;
|
||||
new_dcc->filename = NULL;
|
||||
new_dcc->local_filename = NULL;
|
||||
new_dcc->filename_suffix = -1;
|
||||
new_dcc->size = 0;
|
||||
new_dcc->pos = 0;
|
||||
new_dcc->ack = 0;
|
||||
new_dcc->start_resume = 0;
|
||||
new_dcc->last_check_time = 0;
|
||||
new_dcc->last_check_pos = 0;
|
||||
new_dcc->last_activity = 0;
|
||||
new_dcc->bytes_per_sec = 0;
|
||||
new_dcc->eta = 0;
|
||||
|
||||
new_dcc->prev_dcc = NULL;
|
||||
new_dcc->next_dcc = dcc_list;
|
||||
if (dcc_list)
|
||||
dcc_list->prev_dcc = new_dcc;
|
||||
dcc_list = new_dcc;
|
||||
|
||||
return new_dcc;
|
||||
}
|
||||
|
||||
/*
|
||||
* dcc_add: add a DCC file to queue
|
||||
*/
|
||||
@@ -615,8 +678,8 @@ dcc_add (t_irc_server *server, int type, unsigned long addr, int port, char *nic
|
||||
{
|
||||
t_irc_dcc *new_dcc;
|
||||
|
||||
/* create new DCC struct */
|
||||
if ((new_dcc = (t_irc_dcc *) malloc (sizeof (t_irc_dcc))) == NULL)
|
||||
new_dcc = dcc_alloc ();
|
||||
if (!new_dcc)
|
||||
{
|
||||
irc_display_prefix (server, server->buffer, PREFIX_ERROR);
|
||||
gui_printf (server->buffer,
|
||||
@@ -650,17 +713,13 @@ dcc_add (t_irc_server *server, int type, unsigned long addr, int port, char *nic
|
||||
new_dcc->start_resume = 0;
|
||||
new_dcc->last_check_time = time (NULL);
|
||||
new_dcc->last_check_pos = 0;
|
||||
new_dcc->bytes_per_sec = 0;
|
||||
new_dcc->last_activity = time (NULL);
|
||||
new_dcc->bytes_per_sec = 0;
|
||||
new_dcc->eta = 0;
|
||||
if (local_filename)
|
||||
new_dcc->local_filename = strdup (local_filename);
|
||||
else
|
||||
dcc_find_filename (new_dcc);
|
||||
new_dcc->prev_dcc = NULL;
|
||||
new_dcc->next_dcc = dcc_list;
|
||||
if (dcc_list)
|
||||
dcc_list->prev_dcc = new_dcc;
|
||||
dcc_list = new_dcc;
|
||||
|
||||
gui_current_window->dcc_first = NULL;
|
||||
gui_current_window->dcc_selected = NULL;
|
||||
@@ -1424,9 +1483,45 @@ dcc_end ()
|
||||
if (ptr_dcc->sock != -1)
|
||||
{
|
||||
if (ptr_dcc->status == DCC_ACTIVE)
|
||||
wee_log_printf (_("Aborting active DCC: \"%s\" from %s\n"),
|
||||
ptr_dcc->filename, ptr_dcc->nick);
|
||||
weechat_log_printf (_("Aborting active DCC: \"%s\" from %s\n"),
|
||||
ptr_dcc->filename, ptr_dcc->nick);
|
||||
dcc_close (ptr_dcc, DCC_FAILED);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* dcc_print_log: print DCC infos in log (usually for crash dump)
|
||||
*/
|
||||
|
||||
void
|
||||
dcc_print_log (t_irc_dcc *dcc)
|
||||
{
|
||||
weechat_log_printf ("[DCC (addr:0x%X)]\n", dcc);
|
||||
weechat_log_printf (" server. . . . . . . : 0x%X\n", dcc->server);
|
||||
weechat_log_printf (" channel . . . . . . : 0x%X\n", dcc->channel);
|
||||
weechat_log_printf (" type. . . . . . . . : %d\n", dcc->type);
|
||||
weechat_log_printf (" status. . . . . . . : %d\n", dcc->status);
|
||||
weechat_log_printf (" start_time. . . . . : %ld\n", dcc->start_time);
|
||||
weechat_log_printf (" start_transfer. . . : %ld\n", dcc->start_transfer);
|
||||
weechat_log_printf (" addr. . . . . . . . : %lu\n", dcc->addr);
|
||||
weechat_log_printf (" port. . . . . . . . : %d\n", dcc->port);
|
||||
weechat_log_printf (" nick. . . . . . . . : '%s'\n", dcc->nick);
|
||||
weechat_log_printf (" sock. . . . . . . . : %d\n", dcc->sock);
|
||||
weechat_log_printf (" unterminated_message: '%s'\n", dcc->unterminated_message);
|
||||
weechat_log_printf (" file. . . . . . . . : %d\n", dcc->file);
|
||||
weechat_log_printf (" filename. . . . . . : '%s'\n", dcc->filename);
|
||||
weechat_log_printf (" local_filename. . . : '%s'\n", dcc->local_filename);
|
||||
weechat_log_printf (" filename_suffix . . : %d\n", dcc->filename_suffix);
|
||||
weechat_log_printf (" size. . . . . . . . : %lu\n", dcc->size);
|
||||
weechat_log_printf (" pos . . . . . . . . : %lu\n", dcc->pos);
|
||||
weechat_log_printf (" ack . . . . . . . . : %lu\n", dcc->ack);
|
||||
weechat_log_printf (" start_resume. . . . : %lu\n", dcc->start_resume);
|
||||
weechat_log_printf (" last_check_time . . : %ld\n", dcc->last_check_time);
|
||||
weechat_log_printf (" last_check_pos. . . : %lu\n", dcc->last_check_pos);
|
||||
weechat_log_printf (" last_activity . . . : %ld\n", dcc->last_activity);
|
||||
weechat_log_printf (" bytes_per_sec . . . : %lu\n", dcc->bytes_per_sec);
|
||||
weechat_log_printf (" eta . . . . . . . . : %lu\n", dcc->eta);
|
||||
weechat_log_printf (" prev_dcc. . . . . . : 0x%X\n", dcc->prev_dcc);
|
||||
weechat_log_printf (" next_dcc. . . . . . : 0x%X\n", dcc->next_dcc);
|
||||
}
|
||||
|
||||
@@ -97,19 +97,19 @@ irc_display_nick (t_gui_buffer *buffer, t_irc_nick *nick, char *nickname,
|
||||
(nick) ? "<" : ">");
|
||||
if (nick && cfg_look_nickmode)
|
||||
{
|
||||
if (nick->is_chanowner)
|
||||
if (nick->flags & NICK_CHANOWNER)
|
||||
gui_printf_type (buffer, type, "%s~",
|
||||
GUI_COLOR(COLOR_WIN_NICK_OP));
|
||||
else if (nick->is_chanadmin)
|
||||
else if (nick->flags & NICK_CHANADMIN)
|
||||
gui_printf_type (buffer, type, "%s&",
|
||||
GUI_COLOR(COLOR_WIN_NICK_OP));
|
||||
else if (nick->is_op)
|
||||
else if (nick->flags & NICK_OP)
|
||||
gui_printf_type (buffer, type, "%s@",
|
||||
GUI_COLOR(COLOR_WIN_NICK_OP));
|
||||
else if (nick->is_halfop)
|
||||
else if (nick->flags & NICK_HALFOP)
|
||||
gui_printf_type (buffer, type, "%s%%",
|
||||
GUI_COLOR(COLOR_WIN_NICK_HALFOP));
|
||||
else if (nick->has_voice)
|
||||
else if (nick->flags & NICK_VOICE)
|
||||
gui_printf_type (buffer, type, "%s+",
|
||||
GUI_COLOR(COLOR_WIN_NICK_VOICE));
|
||||
else
|
||||
|
||||
@@ -459,18 +459,18 @@ ignore_print_log ()
|
||||
{
|
||||
t_irc_ignore *ptr_ignore;
|
||||
|
||||
wee_log_printf ("[ignore list]\n");
|
||||
weechat_log_printf ("[ignore list]\n");
|
||||
|
||||
for (ptr_ignore = irc_ignore; ptr_ignore;
|
||||
ptr_ignore = ptr_ignore->next_ignore)
|
||||
{
|
||||
wee_log_printf ("\n");
|
||||
wee_log_printf (" -> ignore at 0x%X:\n", ptr_ignore);
|
||||
wee_log_printf (" mask. . . . . . . : %s\n", ptr_ignore->mask);
|
||||
wee_log_printf (" type. . . . . . . : %s\n", ptr_ignore->type);
|
||||
wee_log_printf (" channel_name. . . : %s\n", ptr_ignore->channel_name);
|
||||
wee_log_printf (" server_name . . . : %s\n", ptr_ignore->server_name);
|
||||
wee_log_printf (" prev_ignore . . . : 0x%X\n", ptr_ignore->prev_ignore);
|
||||
wee_log_printf (" next_ignore . . . : 0x%X\n", ptr_ignore->next_ignore);
|
||||
weechat_log_printf ("\n");
|
||||
weechat_log_printf (" -> ignore at 0x%X:\n", ptr_ignore);
|
||||
weechat_log_printf (" mask. . . . . . . : %s\n", ptr_ignore->mask);
|
||||
weechat_log_printf (" type. . . . . . . : %s\n", ptr_ignore->type);
|
||||
weechat_log_printf (" channel_name. . . : %s\n", ptr_ignore->channel_name);
|
||||
weechat_log_printf (" server_name . . . : %s\n", ptr_ignore->server_name);
|
||||
weechat_log_printf (" prev_ignore . . . : 0x%X\n", ptr_ignore->prev_ignore);
|
||||
weechat_log_printf (" next_ignore . . . : 0x%X\n", ptr_ignore->next_ignore);
|
||||
}
|
||||
}
|
||||
|
||||
+33
-39
@@ -59,15 +59,15 @@ nick_find_color (t_irc_nick *nick)
|
||||
int
|
||||
nick_score_for_sort (t_irc_nick *nick)
|
||||
{
|
||||
if (nick->is_chanowner)
|
||||
if (nick->flags & NICK_CHANOWNER)
|
||||
return -32;
|
||||
if (nick->is_chanadmin)
|
||||
if (nick->flags & NICK_CHANADMIN)
|
||||
return -16;
|
||||
if (nick->is_op)
|
||||
if (nick->flags & NICK_OP)
|
||||
return -8;
|
||||
if (nick->is_halfop)
|
||||
if (nick->flags & NICK_HALFOP)
|
||||
return -4;
|
||||
if (nick->has_voice)
|
||||
if (nick->flags & NICK_VOICE)
|
||||
return -2;
|
||||
return 0;
|
||||
}
|
||||
@@ -168,7 +168,7 @@ nick_insert_sorted (t_irc_channel *channel, t_irc_nick *nick)
|
||||
*/
|
||||
|
||||
t_irc_nick *
|
||||
nick_new (t_irc_channel *channel, char *nick_name,
|
||||
nick_new (t_irc_server *server, t_irc_channel *channel, char *nick_name,
|
||||
int is_chanowner, int is_chanadmin, int is_op, int is_halfop,
|
||||
int has_voice)
|
||||
{
|
||||
@@ -178,35 +178,31 @@ nick_new (t_irc_channel *channel, char *nick_name,
|
||||
if ((new_nick = nick_search (channel, nick_name)))
|
||||
{
|
||||
/* update nick */
|
||||
new_nick->is_chanowner = is_chanowner;
|
||||
new_nick->is_chanadmin = is_chanadmin;
|
||||
new_nick->is_op = is_op;
|
||||
new_nick->is_halfop = is_halfop;
|
||||
new_nick->has_voice = has_voice;
|
||||
NICK_SET_FLAG(new_nick, is_chanowner, NICK_CHANOWNER);
|
||||
NICK_SET_FLAG(new_nick, is_chanadmin, NICK_CHANADMIN);
|
||||
NICK_SET_FLAG(new_nick, is_op, NICK_OP);
|
||||
NICK_SET_FLAG(new_nick, is_halfop, NICK_HALFOP);
|
||||
NICK_SET_FLAG(new_nick, has_voice, NICK_VOICE);
|
||||
return new_nick;
|
||||
}
|
||||
|
||||
/* alloc memory for new nick */
|
||||
if ((new_nick = (t_irc_nick *) malloc (sizeof (t_irc_nick))) == NULL)
|
||||
{
|
||||
gui_printf (channel->buffer,
|
||||
_("%s cannot allocate new nick\n"), WEECHAT_ERROR);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
||||
/* initialize new nick */
|
||||
new_nick->nick = strdup (nick_name);
|
||||
new_nick->is_chanowner = is_chanowner;
|
||||
new_nick->is_chanadmin = is_chanadmin;
|
||||
new_nick->is_op = is_op;
|
||||
new_nick->is_halfop = is_halfop;
|
||||
new_nick->has_voice = has_voice;
|
||||
new_nick->is_away = 0;
|
||||
if (ascii_strcasecmp (new_nick->nick, SERVER(channel->buffer)->nick) == 0)
|
||||
new_nick->flags = 0;
|
||||
NICK_SET_FLAG(new_nick, is_chanowner, NICK_CHANOWNER);
|
||||
NICK_SET_FLAG(new_nick, is_chanadmin, NICK_CHANADMIN);
|
||||
NICK_SET_FLAG(new_nick, is_op, NICK_OP);
|
||||
NICK_SET_FLAG(new_nick, is_halfop, NICK_HALFOP);
|
||||
NICK_SET_FLAG(new_nick, has_voice, NICK_VOICE);
|
||||
if (ascii_strcasecmp (new_nick->nick, server->nick) == 0)
|
||||
new_nick->color = COLOR_WIN_NICK_SELF;
|
||||
else
|
||||
new_nick->color = nick_find_color (new_nick);
|
||||
|
||||
|
||||
nick_insert_sorted (channel, new_nick);
|
||||
|
||||
channel->nicks_count++;
|
||||
@@ -347,15 +343,17 @@ nick_count (t_irc_channel *channel, int *total, int *count_op,
|
||||
ptr_nick = ptr_nick->next_nick)
|
||||
{
|
||||
(*total)++;
|
||||
if ((ptr_nick->is_chanowner) || (ptr_nick->is_chanadmin) || (ptr_nick->is_op))
|
||||
if ((ptr_nick->flags & NICK_CHANOWNER) ||
|
||||
(ptr_nick->flags & NICK_CHANADMIN) ||
|
||||
(ptr_nick->flags & NICK_OP))
|
||||
(*count_op)++;
|
||||
else
|
||||
{
|
||||
if (ptr_nick->is_halfop)
|
||||
if (ptr_nick->flags & NICK_HALFOP)
|
||||
(*count_halfop)++;
|
||||
else
|
||||
{
|
||||
if (ptr_nick->has_voice)
|
||||
if (ptr_nick->flags & NICK_VOICE)
|
||||
(*count_voice)++;
|
||||
else
|
||||
(*count_normal)++;
|
||||
@@ -391,9 +389,10 @@ nick_get_max_length (t_irc_channel *channel)
|
||||
void
|
||||
nick_set_away (t_irc_channel *channel, t_irc_nick *nick, int is_away)
|
||||
{
|
||||
if (nick->is_away != is_away)
|
||||
if (((is_away) && (!(nick->flags & NICK_AWAY))) ||
|
||||
((!is_away) && (nick->flags & NICK_AWAY)))
|
||||
{
|
||||
nick->is_away = is_away;
|
||||
NICK_SET_FLAG(nick, is_away, NICK_AWAY);
|
||||
gui_draw_buffer_nick (channel->buffer, 0);
|
||||
}
|
||||
}
|
||||
@@ -405,14 +404,9 @@ nick_set_away (t_irc_channel *channel, t_irc_nick *nick, int is_away)
|
||||
void
|
||||
nick_print_log (t_irc_nick *nick)
|
||||
{
|
||||
wee_log_printf ("=> nick %s (addr:0x%X)]\n", nick->nick, nick);
|
||||
wee_log_printf (" is_chanowner . : %d\n", nick->is_chanowner);
|
||||
wee_log_printf (" is_chanadmin . : %d\n", nick->is_chanadmin);
|
||||
wee_log_printf (" is_op. . . . . : %d\n", nick->is_op);
|
||||
wee_log_printf (" is_halfop. . . : %d\n", nick->is_halfop);
|
||||
wee_log_printf (" has_voice. . . : %d\n", nick->has_voice);
|
||||
wee_log_printf (" is_away. . . . : %d\n", nick->is_away);
|
||||
wee_log_printf (" color. . . . . : %d\n", nick->color);
|
||||
wee_log_printf (" prev_nick. . . : 0x%X\n", nick->prev_nick);
|
||||
wee_log_printf (" next_nick. . . : 0x%X\n", nick->next_nick);
|
||||
weechat_log_printf ("=> nick %s (addr:0x%X)]\n", nick->nick, nick);
|
||||
weechat_log_printf (" flags. . . . . : %d\n", nick->flags);
|
||||
weechat_log_printf (" color. . . . . : %d\n", nick->color);
|
||||
weechat_log_printf (" prev_nick. . . : 0x%X\n", nick->prev_nick);
|
||||
weechat_log_printf (" next_nick. . . : 0x%X\n", nick->next_nick);
|
||||
}
|
||||
|
||||
+32
-28
@@ -396,7 +396,7 @@ irc_cmd_recv_join (t_irc_server *server, char *host, char *nick, char *arguments
|
||||
ptr_channel = channel_search (server, arguments);
|
||||
if (!ptr_channel)
|
||||
{
|
||||
ptr_channel = channel_new (server, CHAT_CHANNEL, arguments, 1);
|
||||
ptr_channel = channel_new (server, CHANNEL_TYPE_CHANNEL, arguments);
|
||||
if (!ptr_channel)
|
||||
{
|
||||
irc_display_prefix (server, server->buffer, PREFIX_ERROR);
|
||||
@@ -405,6 +405,7 @@ irc_cmd_recv_join (t_irc_server *server, char *host, char *nick, char *arguments
|
||||
WEECHAT_ERROR, arguments);
|
||||
return -1;
|
||||
}
|
||||
gui_buffer_new (gui_current_window, server, ptr_channel, 0, 1);
|
||||
}
|
||||
|
||||
if (!command_ignored)
|
||||
@@ -423,7 +424,7 @@ irc_cmd_recv_join (t_irc_server *server, char *host, char *nick, char *arguments
|
||||
GUI_COLOR(COLOR_WIN_CHAT_CHANNEL),
|
||||
arguments);
|
||||
}
|
||||
(void) nick_new (ptr_channel, nick, 0, 0, 0, 0, 0);
|
||||
(void) nick_new (server, ptr_channel, nick, 0, 0, 0, 0, 0);
|
||||
gui_draw_buffer_nick (ptr_channel->buffer, 1);
|
||||
gui_draw_buffer_status (ptr_channel->buffer, 1);
|
||||
return 0;
|
||||
@@ -705,7 +706,7 @@ void irc_get_channel_modes (t_irc_server *server, t_irc_channel *ptr_channel,
|
||||
ptr_nick = nick_search (ptr_channel, parm);
|
||||
if (ptr_nick)
|
||||
{
|
||||
ptr_nick->is_halfop = (set_flag == '+') ? 1 : 0;
|
||||
NICK_SET_FLAG(ptr_nick, (set_flag == '+'), NICK_HALFOP);
|
||||
nick_resort (ptr_channel, ptr_nick);
|
||||
gui_draw_buffer_nick (ptr_channel->buffer, 1);
|
||||
}
|
||||
@@ -728,8 +729,8 @@ void irc_get_channel_modes (t_irc_server *server, t_irc_channel *ptr_channel,
|
||||
_("sets invite-only channel flag") :
|
||||
_("removes invite-only channel flag"),
|
||||
NULL);
|
||||
SET_CHANNEL_MODE(ptr_channel, (set_flag == '+'),
|
||||
CHANNEL_MODE_INVITE);
|
||||
CHANNEL_SET_MODE(ptr_channel, (set_flag == '+'),
|
||||
CHANNEL_MODE_INVITE);
|
||||
break;
|
||||
case 'k':
|
||||
pos = NULL;
|
||||
@@ -748,8 +749,8 @@ void irc_get_channel_modes (t_irc_server *server, t_irc_channel *ptr_channel,
|
||||
(set_flag == '+') ?
|
||||
((parm) ? parm : NULL) :
|
||||
NULL);
|
||||
SET_CHANNEL_MODE(ptr_channel, (set_flag == '+'),
|
||||
CHANNEL_MODE_KEY);
|
||||
CHANNEL_SET_MODE(ptr_channel, (set_flag == '+'),
|
||||
CHANNEL_MODE_KEY);
|
||||
if (ptr_channel->key)
|
||||
free (ptr_channel->key);
|
||||
ptr_channel->key = strdup (parm);
|
||||
@@ -780,8 +781,8 @@ void irc_get_channel_modes (t_irc_server *server, t_irc_channel *ptr_channel,
|
||||
(set_flag == '+') ?
|
||||
((parm) ? parm : NULL) :
|
||||
NULL);
|
||||
SET_CHANNEL_MODE(ptr_channel, (set_flag == '+'),
|
||||
CHANNEL_MODE_LIMIT);
|
||||
CHANNEL_SET_MODE(ptr_channel, (set_flag == '+'),
|
||||
CHANNEL_MODE_LIMIT);
|
||||
ptr_channel->limit = atoi (parm);
|
||||
|
||||
/* look for next parameter */
|
||||
@@ -801,8 +802,8 @@ void irc_get_channel_modes (t_irc_server *server, t_irc_channel *ptr_channel,
|
||||
_("sets moderated channel flag") :
|
||||
_("removes moderated channel flag"),
|
||||
NULL);
|
||||
SET_CHANNEL_MODE(ptr_channel, (set_flag == '+'),
|
||||
CHANNEL_MODE_MODERATED);
|
||||
CHANNEL_SET_MODE(ptr_channel, (set_flag == '+'),
|
||||
CHANNEL_MODE_MODERATED);
|
||||
break;
|
||||
case 'n':
|
||||
if (nick_host)
|
||||
@@ -812,8 +813,8 @@ void irc_get_channel_modes (t_irc_server *server, t_irc_channel *ptr_channel,
|
||||
_("sets messages from channel only flag") :
|
||||
_("removes messages from channel only flag"),
|
||||
NULL);
|
||||
SET_CHANNEL_MODE(ptr_channel, (set_flag == '+'),
|
||||
CHANNEL_MODE_NO_MSG_OUT);
|
||||
CHANNEL_SET_MODE(ptr_channel, (set_flag == '+'),
|
||||
CHANNEL_MODE_NO_MSG_OUT);
|
||||
break;
|
||||
case 'o':
|
||||
pos = NULL;
|
||||
@@ -835,7 +836,7 @@ void irc_get_channel_modes (t_irc_server *server, t_irc_channel *ptr_channel,
|
||||
ptr_nick = nick_search (ptr_channel, parm);
|
||||
if (ptr_nick)
|
||||
{
|
||||
ptr_nick->is_op = (set_flag == '+') ? 1 : 0;
|
||||
NICK_SET_FLAG(ptr_nick, (set_flag == '+'), NICK_OP);
|
||||
nick_resort (ptr_channel, ptr_nick);
|
||||
gui_draw_buffer_nick (ptr_channel->buffer, 1);
|
||||
}
|
||||
@@ -858,8 +859,8 @@ void irc_get_channel_modes (t_irc_server *server, t_irc_channel *ptr_channel,
|
||||
_("sets private channel flag") :
|
||||
_("removes private channel flag"),
|
||||
NULL);
|
||||
SET_CHANNEL_MODE(ptr_channel, (set_flag == '+'),
|
||||
CHANNEL_MODE_SECRET);
|
||||
CHANNEL_SET_MODE(ptr_channel, (set_flag == '+'),
|
||||
CHANNEL_MODE_SECRET);
|
||||
break;
|
||||
case 'q':
|
||||
pos = NULL;
|
||||
@@ -894,8 +895,8 @@ void irc_get_channel_modes (t_irc_server *server, t_irc_channel *ptr_channel,
|
||||
_("sets secret channel flag") :
|
||||
_("removes secret channel flag"),
|
||||
NULL);
|
||||
SET_CHANNEL_MODE(ptr_channel, (set_flag == '+'),
|
||||
CHANNEL_MODE_SECRET);
|
||||
CHANNEL_SET_MODE(ptr_channel, (set_flag == '+'),
|
||||
CHANNEL_MODE_SECRET);
|
||||
break;
|
||||
case 't':
|
||||
if (nick_host)
|
||||
@@ -905,8 +906,8 @@ void irc_get_channel_modes (t_irc_server *server, t_irc_channel *ptr_channel,
|
||||
_("sets topic protection") :
|
||||
_("removes topic protection"),
|
||||
NULL);
|
||||
SET_CHANNEL_MODE(ptr_channel, (set_flag == '+'),
|
||||
CHANNEL_MODE_TOPIC);
|
||||
CHANNEL_SET_MODE(ptr_channel, (set_flag == '+'),
|
||||
CHANNEL_MODE_TOPIC);
|
||||
break;
|
||||
case 'v':
|
||||
pos = NULL;
|
||||
@@ -929,7 +930,7 @@ void irc_get_channel_modes (t_irc_server *server, t_irc_channel *ptr_channel,
|
||||
ptr_nick = nick_search (ptr_channel, parm);
|
||||
if (ptr_nick)
|
||||
{
|
||||
ptr_nick->has_voice = (set_flag == '+') ? 1 : 0;
|
||||
NICK_SET_FLAG(ptr_nick, (set_flag == '+'), NICK_VOICE);
|
||||
nick_resort (ptr_channel, ptr_nick);
|
||||
gui_draw_buffer_nick (ptr_channel->buffer, 1);
|
||||
}
|
||||
@@ -1222,7 +1223,7 @@ irc_cmd_recv_notice (t_irc_server *server, char *host, char *nick, char *argumen
|
||||
ptr_channel = channel_search (server, nick);
|
||||
if (!ptr_channel)
|
||||
{
|
||||
ptr_channel = channel_new (server, CHAT_PRIVATE, nick, 0);
|
||||
ptr_channel = channel_new (server, CHANNEL_TYPE_PRIVATE, nick);
|
||||
if (!ptr_channel)
|
||||
{
|
||||
irc_display_prefix (server, server->buffer, PREFIX_ERROR);
|
||||
@@ -1231,6 +1232,7 @@ irc_cmd_recv_notice (t_irc_server *server, char *host, char *nick, char *argumen
|
||||
WEECHAT_ERROR, nick);
|
||||
return -1;
|
||||
}
|
||||
gui_buffer_new (gui_current_window, server, ptr_channel, 0, 0);
|
||||
}
|
||||
if (!ptr_channel->topic)
|
||||
ptr_channel->topic = strdup ((host2) ? host2 : "");
|
||||
@@ -2034,7 +2036,7 @@ irc_cmd_recv_privmsg (t_irc_server *server, char *host, char *nick, char *argume
|
||||
{
|
||||
if (!ptr_channel)
|
||||
{
|
||||
ptr_channel = channel_new (server, CHAT_PRIVATE, nick, 0);
|
||||
ptr_channel = channel_new (server, CHANNEL_TYPE_PRIVATE, nick);
|
||||
if (!ptr_channel)
|
||||
{
|
||||
irc_display_prefix (server, server->buffer, PREFIX_ERROR);
|
||||
@@ -2043,6 +2045,7 @@ irc_cmd_recv_privmsg (t_irc_server *server, char *host, char *nick, char *argume
|
||||
WEECHAT_ERROR, nick);
|
||||
return -1;
|
||||
}
|
||||
gui_buffer_new (gui_current_window, server, ptr_channel, 0, 0);
|
||||
}
|
||||
if (!ptr_channel->topic)
|
||||
ptr_channel->topic = strdup (host2);
|
||||
@@ -2124,7 +2127,7 @@ irc_cmd_recv_privmsg (t_irc_server *server, char *host, char *nick, char *argume
|
||||
{
|
||||
if (!ptr_channel)
|
||||
{
|
||||
ptr_channel = channel_new (server, CHAT_PRIVATE, nick, 0);
|
||||
ptr_channel = channel_new (server, CHANNEL_TYPE_PRIVATE, nick);
|
||||
if (!ptr_channel)
|
||||
{
|
||||
irc_display_prefix (server, server->buffer, PREFIX_ERROR);
|
||||
@@ -2133,6 +2136,7 @@ irc_cmd_recv_privmsg (t_irc_server *server, char *host, char *nick, char *argume
|
||||
WEECHAT_ERROR, nick);
|
||||
return -1;
|
||||
}
|
||||
gui_buffer_new (gui_current_window, server, ptr_channel, 0, 0);
|
||||
}
|
||||
if (!ptr_channel->topic)
|
||||
ptr_channel->topic = strdup (host2);
|
||||
@@ -2206,7 +2210,7 @@ irc_cmd_recv_quit (t_irc_server *server, char *host, char *nick, char *arguments
|
||||
for (ptr_channel = server->channels; ptr_channel;
|
||||
ptr_channel = ptr_channel->next_channel)
|
||||
{
|
||||
if (ptr_channel->type == CHAT_PRIVATE)
|
||||
if (ptr_channel->type == CHANNEL_TYPE_PRIVATE)
|
||||
ptr_nick = NULL;
|
||||
else
|
||||
ptr_nick = nick_search (ptr_channel, nick);
|
||||
@@ -2454,7 +2458,7 @@ irc_cmd_recv_004 (t_irc_server *server, char *host, char *nick, char *arguments)
|
||||
for (ptr_channel = server->channels; ptr_channel;
|
||||
ptr_channel = ptr_channel->next_channel)
|
||||
{
|
||||
if (ptr_channel->type == CHAT_CHANNEL)
|
||||
if (ptr_channel->type == CHANNEL_TYPE_CHANNEL)
|
||||
{
|
||||
if (ptr_channel->key)
|
||||
server_sendf (server, "JOIN %s %s\r\n",
|
||||
@@ -4309,8 +4313,8 @@ irc_cmd_recv_353 (t_irc_server *server, char *host, char *nick, char *arguments)
|
||||
pos[0] = '\0';
|
||||
pos++;
|
||||
}
|
||||
if (!nick_new (ptr_channel, pos_nick, is_chanowner, is_chanadmin,
|
||||
is_op, is_halfop, has_voice))
|
||||
if (!nick_new (server, ptr_channel, pos_nick, is_chanowner,
|
||||
is_chanadmin, is_op, is_halfop, has_voice))
|
||||
{
|
||||
irc_display_prefix (server, server->buffer, PREFIX_ERROR);
|
||||
gui_printf_nolog (server->buffer,
|
||||
|
||||
@@ -107,7 +107,7 @@ irc_cmd_send_ame (t_irc_server *server, char *arguments)
|
||||
for (ptr_channel = ptr_server->channels; ptr_channel;
|
||||
ptr_channel = ptr_channel->next_channel)
|
||||
{
|
||||
if (ptr_channel->type == CHAT_CHANNEL)
|
||||
if (ptr_channel->type == CHANNEL_TYPE_CHANNEL)
|
||||
{
|
||||
server_sendf (ptr_server, "PRIVMSG %s :\01ACTION %s\01\r\n",
|
||||
ptr_channel->name,
|
||||
@@ -156,7 +156,7 @@ irc_cmd_send_amsg (t_irc_server *server, char *arguments)
|
||||
for (ptr_channel = ptr_server->channels; ptr_channel;
|
||||
ptr_channel = ptr_channel->next_channel)
|
||||
{
|
||||
if (ptr_channel->type == CHAT_CHANNEL)
|
||||
if (ptr_channel->type == CHANNEL_TYPE_CHANNEL)
|
||||
{
|
||||
server_sendf (ptr_server, "PRIVMSG %s :%s\r\n",
|
||||
ptr_channel->name, arguments);
|
||||
@@ -965,7 +965,7 @@ irc_send_me_all_channels (t_irc_server *server, char *arguments)
|
||||
for (ptr_channel = server->channels; ptr_channel;
|
||||
ptr_channel = ptr_channel->next_channel)
|
||||
{
|
||||
if (ptr_channel->type == CHAT_CHANNEL)
|
||||
if (ptr_channel->type == CHANNEL_TYPE_CHANNEL)
|
||||
irc_send_me (server, ptr_channel, arguments);
|
||||
}
|
||||
return 0;
|
||||
@@ -1145,7 +1145,7 @@ irc_cmd_send_msg (t_irc_server *server, char *arguments)
|
||||
ptr_channel = channel_search (server, arguments);
|
||||
if (!ptr_channel)
|
||||
{
|
||||
ptr_channel = channel_new (server, CHAT_PRIVATE, arguments, 1);
|
||||
ptr_channel = channel_new (server, CHANNEL_TYPE_PRIVATE, arguments);
|
||||
if (!ptr_channel)
|
||||
{
|
||||
irc_display_prefix (NULL, server->buffer, PREFIX_ERROR);
|
||||
@@ -1154,6 +1154,7 @@ irc_cmd_send_msg (t_irc_server *server, char *arguments)
|
||||
WEECHAT_ERROR, arguments);
|
||||
return -1;
|
||||
}
|
||||
gui_buffer_new (gui_current_window, server, ptr_channel, 0, 1);
|
||||
gui_draw_buffer_title (ptr_channel->buffer, 1);
|
||||
}
|
||||
|
||||
@@ -1485,7 +1486,7 @@ irc_cmd_send_query (t_irc_server *server, char *arguments)
|
||||
ptr_channel = channel_search (server, arguments);
|
||||
if (!ptr_channel)
|
||||
{
|
||||
ptr_channel = channel_new (server, CHAT_PRIVATE, arguments, 1);
|
||||
ptr_channel = channel_new (server, CHANNEL_TYPE_PRIVATE, arguments);
|
||||
if (!ptr_channel)
|
||||
{
|
||||
irc_display_prefix (NULL, server->buffer, PREFIX_ERROR);
|
||||
@@ -1494,6 +1495,7 @@ irc_cmd_send_query (t_irc_server *server, char *arguments)
|
||||
WEECHAT_ERROR, arguments);
|
||||
return -1;
|
||||
}
|
||||
gui_buffer_new (gui_current_window, server, ptr_channel, 0, 1);
|
||||
gui_draw_buffer_title (ptr_channel->buffer, 1);
|
||||
}
|
||||
else
|
||||
|
||||
@@ -91,9 +91,7 @@ server_init (t_irc_server *server)
|
||||
server->child_write = -1;
|
||||
server->sock = -1;
|
||||
server->is_connected = 0;
|
||||
#ifdef HAVE_GNUTLS
|
||||
server->ssl_connected = 0;
|
||||
#endif
|
||||
server->unterminated_message = NULL;
|
||||
server->nick = NULL;
|
||||
server->reconnect_start = 0;
|
||||
@@ -365,14 +363,14 @@ server_new (char *name, int autoconnect, int autoreconnect, int autoreconnect_de
|
||||
return NULL;
|
||||
|
||||
#ifdef DEBUG
|
||||
wee_log_printf ("Creating new server (name:%s, address:%s, port:%d, pwd:%s, "
|
||||
"nick1:%s, nick2:%s, nick3:%s, username:%s, realname:%s, "
|
||||
"command:%s, autojoin:%s, autorejoin:%s, notify_levels:%s)\n",
|
||||
name, address, port, (password) ? password : "",
|
||||
(nick1) ? nick1 : "", (nick2) ? nick2 : "", (nick3) ? nick3 : "",
|
||||
(username) ? username : "", (realname) ? realname : "",
|
||||
(command) ? command : "", (autojoin) ? autojoin : "",
|
||||
(autorejoin) ? "on" : "off", (notify_levels) ? notify_levels : "");
|
||||
weechat_log_printf ("Creating new server (name:%s, address:%s, port:%d, pwd:%s, "
|
||||
"nick1:%s, nick2:%s, nick3:%s, username:%s, realname:%s, "
|
||||
"command:%s, autojoin:%s, autorejoin:%s, notify_levels:%s)\n",
|
||||
name, address, port, (password) ? password : "",
|
||||
(nick1) ? nick1 : "", (nick2) ? nick2 : "", (nick3) ? nick3 : "",
|
||||
(username) ? username : "", (realname) ? realname : "",
|
||||
(command) ? command : "", (autojoin) ? autojoin : "",
|
||||
(autorejoin) ? "on" : "off", (notify_levels) ? notify_levels : "");
|
||||
#endif
|
||||
|
||||
if ((new_server = server_alloc ()))
|
||||
@@ -801,9 +799,7 @@ server_close_connection (t_irc_server *server)
|
||||
|
||||
/* server is now disconnected */
|
||||
server->is_connected = 0;
|
||||
#ifdef HAVE_GNUTLS
|
||||
server->ssl_connected = 0;
|
||||
#endif
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -1399,12 +1395,12 @@ server_connect (t_irc_server *server)
|
||||
(server->ssl) ? " (SSL)" : "",
|
||||
cfg_proxy_type_values[cfg_proxy_type], cfg_proxy_address, cfg_proxy_port,
|
||||
(cfg_proxy_ipv6) ? " (IPv6)" : "");
|
||||
wee_log_printf (_("Connecting to server %s:%d%s%s via %s proxy %s:%d%s...\n"),
|
||||
server->address, server->port,
|
||||
(server->ipv6) ? " (IPv6)" : "",
|
||||
(server->ssl) ? " (SSL)" : "",
|
||||
cfg_proxy_type_values[cfg_proxy_type], cfg_proxy_address, cfg_proxy_port,
|
||||
(cfg_proxy_ipv6) ? " (IPv6)" : "");
|
||||
weechat_log_printf (_("Connecting to server %s:%d%s%s via %s proxy %s:%d%s...\n"),
|
||||
server->address, server->port,
|
||||
(server->ipv6) ? " (IPv6)" : "",
|
||||
(server->ssl) ? " (SSL)" : "",
|
||||
cfg_proxy_type_values[cfg_proxy_type], cfg_proxy_address, cfg_proxy_port,
|
||||
(cfg_proxy_ipv6) ? " (IPv6)" : "");
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -1413,18 +1409,18 @@ server_connect (t_irc_server *server)
|
||||
PACKAGE_NAME, server->address, server->port,
|
||||
(server->ipv6) ? " (IPv6)" : "",
|
||||
(server->ssl) ? " (SSL)" : "");
|
||||
wee_log_printf (_("Connecting to server %s:%d%s%s...\n"),
|
||||
server->address, server->port,
|
||||
(server->ipv6) ? " (IPv6)" : "",
|
||||
(server->ssl) ? " (SSL)" : "");
|
||||
weechat_log_printf (_("Connecting to server %s:%d%s%s...\n"),
|
||||
server->address, server->port,
|
||||
(server->ipv6) ? " (IPv6)" : "",
|
||||
(server->ssl) ? " (SSL)" : "");
|
||||
}
|
||||
|
||||
/* close any opened connection and kill child process if running */
|
||||
server_close_connection (server);
|
||||
|
||||
/* init SSL if asked */
|
||||
#ifdef HAVE_GNUTLS
|
||||
server->ssl_connected = 0;
|
||||
#ifdef HAVE_GNUTLS
|
||||
if (server->ssl)
|
||||
{
|
||||
if (gnutls_init (&server->gnutls_sess, GNUTLS_CLIENT) != 0)
|
||||
@@ -1706,7 +1702,7 @@ server_remove_away ()
|
||||
{
|
||||
for (ptr_channel = ptr_server->channels; ptr_channel; ptr_channel = ptr_channel->next_channel)
|
||||
{
|
||||
if (ptr_channel->type == CHAT_CHANNEL)
|
||||
if (ptr_channel->type == CHANNEL_TYPE_CHANNEL)
|
||||
channel_remove_away (ptr_channel);
|
||||
}
|
||||
}
|
||||
@@ -1729,7 +1725,7 @@ server_check_away ()
|
||||
{
|
||||
for (ptr_channel = ptr_server->channels; ptr_channel; ptr_channel = ptr_channel->next_channel)
|
||||
{
|
||||
if (ptr_channel->type == CHAT_CHANNEL)
|
||||
if (ptr_channel->type == CHANNEL_TYPE_CHANNEL)
|
||||
channel_check_away (ptr_server, ptr_channel);
|
||||
}
|
||||
}
|
||||
@@ -1749,7 +1745,7 @@ server_set_away (t_irc_server *server, char *nick, int is_away)
|
||||
{
|
||||
if (server->is_connected)
|
||||
{
|
||||
if (ptr_channel->type == CHAT_CHANNEL)
|
||||
if (ptr_channel->type == CHANNEL_TYPE_CHANNEL)
|
||||
channel_set_away (ptr_channel, nick, is_away);
|
||||
}
|
||||
}
|
||||
@@ -1762,49 +1758,50 @@ server_set_away (t_irc_server *server, char *nick, int is_away)
|
||||
void
|
||||
server_print_log (t_irc_server *server)
|
||||
{
|
||||
wee_log_printf ("[server %s (addr:0x%X)]\n", server->name, server);
|
||||
wee_log_printf (" autoconnect . . . . : %d\n", server->autoconnect);
|
||||
wee_log_printf (" autoreconnect . . . : %d\n", server->autoreconnect);
|
||||
wee_log_printf (" autoreconnect_delay : %d\n", server->autoreconnect_delay);
|
||||
wee_log_printf (" command_line. . . . : %d\n", server->command_line);
|
||||
wee_log_printf (" address . . . . . . : '%s'\n", server->address);
|
||||
wee_log_printf (" port. . . . . . . . : %d\n", server->port);
|
||||
wee_log_printf (" ipv6. . . . . . . . : %d\n", server->ipv6);
|
||||
wee_log_printf (" ssl . . . . . . . . : %d\n", server->ssl);
|
||||
wee_log_printf (" password. . . . . . : '%s'\n",
|
||||
(server->password && server->password[0]) ? "(hidden)" : server->password);
|
||||
wee_log_printf (" nick1 . . . . . . . : '%s'\n", server->nick1);
|
||||
wee_log_printf (" nick2 . . . . . . . : '%s'\n", server->nick2);
|
||||
wee_log_printf (" nick3 . . . . . . . : '%s'\n", server->nick3);
|
||||
wee_log_printf (" username. . . . . . : '%s'\n", server->username);
|
||||
wee_log_printf (" realname. . . . . . : '%s'\n", server->realname);
|
||||
wee_log_printf (" command . . . . . . : '%s'\n",
|
||||
(server->command && server->command[0]) ? "(hidden)" : server->command);
|
||||
wee_log_printf (" command_delay . . . : %d\n", server->command_delay);
|
||||
wee_log_printf (" autojoin. . . . . . : '%s'\n", server->autojoin);
|
||||
wee_log_printf (" autorejoin. . . . . : %d\n", server->autorejoin);
|
||||
wee_log_printf (" notify_levels . . . : %s\n", server->notify_levels);
|
||||
wee_log_printf (" child_pid . . . . . : %d\n", server->child_pid);
|
||||
wee_log_printf (" child_read . . . . : %d\n", server->child_read);
|
||||
wee_log_printf (" child_write . . . . : %d\n", server->child_write);
|
||||
wee_log_printf (" sock. . . . . . . . : %d\n", server->sock);
|
||||
wee_log_printf (" is_connected. . . . : %d\n", server->is_connected);
|
||||
#ifdef HAVE_GNUTLS
|
||||
wee_log_printf(" ssl_connected . . . : %d\n", server->ssl_connected);
|
||||
#endif
|
||||
wee_log_printf (" unterminated_message: '%s'\n", server->unterminated_message);
|
||||
wee_log_printf (" nick. . . . . . . . : '%s'\n", server->nick);
|
||||
wee_log_printf (" reconnect_start . . : %ld\n", server->reconnect_start);
|
||||
wee_log_printf (" reconnect_join. . . : %d\n", server->reconnect_join);
|
||||
wee_log_printf (" is_away . . . . . . : %d\n", server->is_away);
|
||||
wee_log_printf (" away_time . . . . . : %ld\n", server->away_time);
|
||||
wee_log_printf (" lag . . . . . . . . : %d\n", server->lag);
|
||||
wee_log_printf (" lag_check_time. . . : tv_sec:%d, tv_usec:%d\n",
|
||||
server->lag_check_time.tv_sec, server->lag_check_time.tv_usec);
|
||||
wee_log_printf (" lag_next_check. . . : %ld\n", server->lag_next_check);
|
||||
wee_log_printf (" buffer. . . . . . . : 0x%X\n", server->buffer);
|
||||
wee_log_printf (" channels. . . . . . : 0x%X\n", server->channels);
|
||||
wee_log_printf (" last_channel. . . . : 0x%X\n", server->last_channel);
|
||||
wee_log_printf (" prev_server . . . . : 0x%X\n", server->prev_server);
|
||||
wee_log_printf (" next_server . . . . : 0x%X\n", server->next_server);
|
||||
weechat_log_printf ("[server %s (addr:0x%X)]\n", server->name, server);
|
||||
weechat_log_printf (" autoconnect . . . . : %d\n", server->autoconnect);
|
||||
weechat_log_printf (" autoreconnect . . . : %d\n", server->autoreconnect);
|
||||
weechat_log_printf (" autoreconnect_delay : %d\n", server->autoreconnect_delay);
|
||||
weechat_log_printf (" command_line. . . . : %d\n", server->command_line);
|
||||
weechat_log_printf (" address . . . . . . : '%s'\n", server->address);
|
||||
weechat_log_printf (" port. . . . . . . . : %d\n", server->port);
|
||||
weechat_log_printf (" ipv6. . . . . . . . : %d\n", server->ipv6);
|
||||
weechat_log_printf (" ssl . . . . . . . . : %d\n", server->ssl);
|
||||
weechat_log_printf (" password. . . . . . : '%s'\n",
|
||||
(server->password && server->password[0]) ?
|
||||
"(hidden)" : server->password);
|
||||
weechat_log_printf (" nick1 . . . . . . . : '%s'\n", server->nick1);
|
||||
weechat_log_printf (" nick2 . . . . . . . : '%s'\n", server->nick2);
|
||||
weechat_log_printf (" nick3 . . . . . . . : '%s'\n", server->nick3);
|
||||
weechat_log_printf (" username. . . . . . : '%s'\n", server->username);
|
||||
weechat_log_printf (" realname. . . . . . : '%s'\n", server->realname);
|
||||
weechat_log_printf (" command . . . . . . : '%s'\n",
|
||||
(server->command && server->command[0]) ?
|
||||
"(hidden)" : server->command);
|
||||
weechat_log_printf (" command_delay . . . : %d\n", server->command_delay);
|
||||
weechat_log_printf (" autojoin. . . . . . : '%s'\n", server->autojoin);
|
||||
weechat_log_printf (" autorejoin. . . . . : %d\n", server->autorejoin);
|
||||
weechat_log_printf (" notify_levels . . . : %s\n", server->notify_levels);
|
||||
weechat_log_printf (" child_pid . . . . . : %d\n", server->child_pid);
|
||||
weechat_log_printf (" child_read . . . . : %d\n", server->child_read);
|
||||
weechat_log_printf (" child_write . . . . : %d\n", server->child_write);
|
||||
weechat_log_printf (" sock. . . . . . . . : %d\n", server->sock);
|
||||
weechat_log_printf (" is_connected. . . . : %d\n", server->is_connected);
|
||||
weechat_log_printf (" ssl_connected . . . : %d\n", server->ssl_connected);
|
||||
weechat_log_printf (" unterminated_message: '%s'\n", server->unterminated_message);
|
||||
weechat_log_printf (" nick. . . . . . . . : '%s'\n", server->nick);
|
||||
weechat_log_printf (" reconnect_start . . : %ld\n", server->reconnect_start);
|
||||
weechat_log_printf (" reconnect_join. . . : %d\n", server->reconnect_join);
|
||||
weechat_log_printf (" is_away . . . . . . : %d\n", server->is_away);
|
||||
weechat_log_printf (" away_time . . . . . : %ld\n", server->away_time);
|
||||
weechat_log_printf (" lag . . . . . . . . : %d\n", server->lag);
|
||||
weechat_log_printf (" lag_check_time. . . : tv_sec:%d, tv_usec:%d\n",
|
||||
server->lag_check_time.tv_sec,
|
||||
server->lag_check_time.tv_usec);
|
||||
weechat_log_printf (" lag_next_check. . . : %ld\n", server->lag_next_check);
|
||||
weechat_log_printf (" buffer. . . . . . . : 0x%X\n", server->buffer);
|
||||
weechat_log_printf (" channels. . . . . . : 0x%X\n", server->channels);
|
||||
weechat_log_printf (" last_channel. . . . : 0x%X\n", server->last_channel);
|
||||
weechat_log_printf (" prev_server . . . . : 0x%X\n", server->prev_server);
|
||||
weechat_log_printf (" next_server . . . . : 0x%X\n", server->next_server);
|
||||
}
|
||||
|
||||
+63
-56
@@ -46,9 +46,41 @@
|
||||
#define PREFIX_ERROR "=!="
|
||||
#define PREFIX_PLUGIN "-P-"
|
||||
|
||||
#define DEFAULT_IRC_PORT 6667
|
||||
|
||||
/* nick types */
|
||||
|
||||
#define NICK_CHANOWNER 1
|
||||
#define NICK_CHANADMIN 2
|
||||
#define NICK_OP 4
|
||||
#define NICK_HALFOP 8
|
||||
#define NICK_VOICE 16
|
||||
#define NICK_AWAY 32
|
||||
#define NICK_SET_FLAG(nick, set, flag) \
|
||||
if (set) \
|
||||
nick->flags |= flag; \
|
||||
else \
|
||||
nick->flags &= 0xFFFF - flag;
|
||||
|
||||
typedef struct t_irc_nick t_irc_nick;
|
||||
|
||||
struct t_irc_nick
|
||||
{
|
||||
char *nick; /* nickname */
|
||||
int flags; /* chanowner/chanadmin (unrealircd), */
|
||||
/* op, halfop, voice, away */
|
||||
int color; /* color for nickname in chat window */
|
||||
t_irc_nick *prev_nick; /* link to previous nick on the channel */
|
||||
t_irc_nick *next_nick; /* link to next nick on the channel */
|
||||
};
|
||||
|
||||
/* channel types */
|
||||
|
||||
#define CHANNEL_PREFIX "#&+!"
|
||||
|
||||
/* channel modes */
|
||||
#define CHANNEL_TYPE_UNKNOWN -1
|
||||
#define CHANNEL_TYPE_CHANNEL 0
|
||||
#define CHANNEL_TYPE_PRIVATE 1
|
||||
|
||||
#define NUM_CHANNEL_MODES 7
|
||||
#define CHANNEL_MODE_INVITE 0
|
||||
@@ -58,69 +90,21 @@
|
||||
#define CHANNEL_MODE_NO_MSG_OUT 4
|
||||
#define CHANNEL_MODE_SECRET 5
|
||||
#define CHANNEL_MODE_TOPIC 6
|
||||
#define SET_CHANNEL_MODE(channel, set, mode) \
|
||||
#define CHANNEL_SET_MODE(channel, set, mode) \
|
||||
if (set) \
|
||||
channel->modes[mode] = channel_modes[mode]; \
|
||||
else \
|
||||
channel->modes[mode] = ' ';
|
||||
|
||||
#define DEFAULT_IRC_PORT 6667
|
||||
|
||||
/* DCC types & status */
|
||||
|
||||
#define DCC_CHAT_RECV 0 /* receiving DCC chat */
|
||||
#define DCC_CHAT_SEND 1 /* sending DCC chat */
|
||||
#define DCC_FILE_RECV 2 /* incoming DCC file */
|
||||
#define DCC_FILE_SEND 3 /* sending DCC file */
|
||||
|
||||
#define DCC_WAITING 0 /* waiting for host answer */
|
||||
#define DCC_CONNECTING 1 /* connecting to host */
|
||||
#define DCC_ACTIVE 2 /* sending/receiving data */
|
||||
#define DCC_DONE 3 /* transfer done */
|
||||
#define DCC_FAILED 4 /* DCC failed */
|
||||
#define DCC_ABORTED 5 /* DCC aborted by user */
|
||||
|
||||
#define DCC_IS_CHAT(type) ((type == DCC_CHAT_RECV) || (type == DCC_CHAT_SEND))
|
||||
#define DCC_IS_FILE(type) ((type == DCC_FILE_RECV) || (type == DCC_FILE_SEND))
|
||||
#define DCC_IS_RECV(type) ((type == DCC_CHAT_RECV) || (type == DCC_FILE_RECV))
|
||||
#define DCC_IS_SEND(type) ((type == DCC_CHAT_SEND) || (type == DCC_FILE_SEND))
|
||||
|
||||
#define DCC_ENDED(status) ((status == DCC_DONE) || (status == DCC_FAILED) || \
|
||||
(status == DCC_ABORTED))
|
||||
|
||||
/* nick types */
|
||||
|
||||
typedef struct t_irc_nick t_irc_nick;
|
||||
|
||||
struct t_irc_nick
|
||||
{
|
||||
char *nick; /* nickname */
|
||||
int is_chanowner; /* chan owner? (specific to unrealircd) */
|
||||
int is_chanadmin; /* chan admin? (specific to unrealircd) */
|
||||
int is_op; /* operator privileges? */
|
||||
int is_halfop; /* half operator privileges? */
|
||||
int has_voice; /* nick has voice? */
|
||||
int is_away; /* = 1 if nick is away, otherwise 0 */
|
||||
int color; /* color for nickname in chat window */
|
||||
t_irc_nick *prev_nick; /* link to previous nick on the channel */
|
||||
t_irc_nick *next_nick; /* link to next nick on the channel */
|
||||
};
|
||||
|
||||
/* channel types */
|
||||
|
||||
typedef struct t_irc_channel t_irc_channel;
|
||||
|
||||
#define CHAT_UNKNOWN -1
|
||||
#define CHAT_CHANNEL 0
|
||||
#define CHAT_PRIVATE 1
|
||||
|
||||
struct t_irc_channel
|
||||
{
|
||||
int type; /* channel type */
|
||||
void *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[NUM_CHANNEL_MODES+1];/* channel modes */
|
||||
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) */
|
||||
@@ -166,11 +150,10 @@ struct t_irc_server
|
||||
int child_write; /* to write into child pipe */
|
||||
int sock; /* socket for server (IPv4 or IPv6) */
|
||||
int is_connected; /* 1 if WeeChat is connected to server */
|
||||
#ifdef HAVE_GNUTLS
|
||||
int ssl_connected; /* = 1 if connected with SSL */
|
||||
#ifdef HAVE_GNUTLS
|
||||
gnutls_session gnutls_sess; /* gnutls session (only if SSL is used) */
|
||||
#endif
|
||||
|
||||
char *unterminated_message; /* beginning of a message in input buf */
|
||||
char *nick; /* current nickname */
|
||||
time_t reconnect_start; /* this time + delay = reconnect time */
|
||||
@@ -221,6 +204,26 @@ struct t_irc_message
|
||||
|
||||
/* DCC types */
|
||||
|
||||
#define DCC_CHAT_RECV 0 /* receiving DCC chat */
|
||||
#define DCC_CHAT_SEND 1 /* sending DCC chat */
|
||||
#define DCC_FILE_RECV 2 /* incoming DCC file */
|
||||
#define DCC_FILE_SEND 3 /* sending DCC file */
|
||||
|
||||
#define DCC_WAITING 0 /* waiting for host answer */
|
||||
#define DCC_CONNECTING 1 /* connecting to host */
|
||||
#define DCC_ACTIVE 2 /* sending/receiving data */
|
||||
#define DCC_DONE 3 /* transfer done */
|
||||
#define DCC_FAILED 4 /* DCC failed */
|
||||
#define DCC_ABORTED 5 /* DCC aborted by user */
|
||||
|
||||
#define DCC_IS_CHAT(type) ((type == DCC_CHAT_RECV) || (type == DCC_CHAT_SEND))
|
||||
#define DCC_IS_FILE(type) ((type == DCC_FILE_RECV) || (type == DCC_FILE_SEND))
|
||||
#define DCC_IS_RECV(type) ((type == DCC_CHAT_RECV) || (type == DCC_FILE_RECV))
|
||||
#define DCC_IS_SEND(type) ((type == DCC_CHAT_SEND) || (type == DCC_FILE_SEND))
|
||||
|
||||
#define DCC_ENDED(status) ((status == DCC_DONE) || (status == DCC_FAILED) || \
|
||||
(status == DCC_ABORTED))
|
||||
|
||||
typedef struct t_irc_dcc t_irc_dcc;
|
||||
|
||||
struct t_irc_dcc
|
||||
@@ -246,8 +249,9 @@ struct t_irc_dcc
|
||||
unsigned long start_resume; /* start of resume (in bytes) */
|
||||
time_t last_check_time; /* last time we looked at bytes sent/rcv*/
|
||||
unsigned long last_check_pos; /* bytes sent/recv at last check */
|
||||
unsigned long bytes_per_sec; /* bytes per second */
|
||||
time_t last_activity; /* time of last byte received/sent */
|
||||
unsigned long bytes_per_sec; /* bytes per second */
|
||||
unsigned long eta; /* estimated time of arrival */
|
||||
t_irc_dcc *prev_dcc; /* link to previous dcc file/chat */
|
||||
t_irc_dcc *next_dcc; /* link to next dcc file/chat */
|
||||
};
|
||||
@@ -327,7 +331,7 @@ extern int pass_proxy(int, char*, int, char*);
|
||||
|
||||
/* channel functions (irc-channel.c) */
|
||||
|
||||
extern t_irc_channel *channel_new (t_irc_server *, int, char *, int);
|
||||
extern t_irc_channel *channel_new (t_irc_server *, int, char *);
|
||||
extern void channel_free (t_irc_server *, t_irc_channel *);
|
||||
extern void channel_free_all (t_irc_server *);
|
||||
extern t_irc_channel *channel_search (t_irc_server *, char *);
|
||||
@@ -345,7 +349,8 @@ extern void channel_print_log (t_irc_channel *);
|
||||
/* nick functions (irc-nick.c) */
|
||||
|
||||
extern int nick_find_color (t_irc_nick *);
|
||||
extern t_irc_nick *nick_new (t_irc_channel *, char *, int, int, int, int, int);
|
||||
extern t_irc_nick *nick_new (t_irc_server *, t_irc_channel *, char *,
|
||||
int, int, int, int, int);
|
||||
extern void nick_resort (t_irc_channel *, t_irc_nick *);
|
||||
extern void nick_change (t_irc_channel *, t_irc_nick *, char *);
|
||||
extern void nick_free (t_irc_channel *, t_irc_nick *);
|
||||
@@ -364,12 +369,14 @@ extern void dcc_close (t_irc_dcc *, int);
|
||||
extern void dcc_accept (t_irc_dcc *);
|
||||
extern void dcc_accept_resume (t_irc_server *, char *, int, unsigned long);
|
||||
extern void dcc_start_resume (t_irc_server *, char *, int, unsigned long);
|
||||
extern t_irc_dcc *dcc_alloc ();
|
||||
extern t_irc_dcc *dcc_add (t_irc_server *, int, unsigned long, int, char *, int,
|
||||
char *, char *, unsigned long);
|
||||
extern void dcc_send_request (t_irc_server *, int, char *, char *);
|
||||
extern void dcc_chat_sendf (t_irc_dcc *, char *, ...);
|
||||
extern void dcc_handle ();
|
||||
extern void dcc_end ();
|
||||
extern void dcc_print_log (t_irc_dcc *);
|
||||
|
||||
/* IRC display (irc-diplay.c) */
|
||||
|
||||
|
||||
Reference in New Issue
Block a user