mirror of
https://github.com/weechat/weechat.git
synced 2026-07-03 08:13:14 +02:00
Added modes channel (and /mode command is now ok), dcc skeleton, fixed display bug for nicklist
This commit is contained in:
@@ -1,10 +1,11 @@
|
||||
WeeChat - Wee Enhanced Environment for Chat
|
||||
===========================================
|
||||
|
||||
ChangeLog - 2004-02-25
|
||||
ChangeLog - 2004-02-29
|
||||
|
||||
|
||||
Version 0.0.6 (under dev!):
|
||||
* /mode command is now ok and channel flags are displayed in status bar
|
||||
* fixed display bug (text was blinking when scrolling)
|
||||
* CTCP Version reply is now in english only and doesn't show host (security reason)
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
WeeChat - Wee Enhanced Environment for Chat
|
||||
===========================================
|
||||
|
||||
TODO - 2004-02-07
|
||||
TODO - 2004-02-29
|
||||
|
||||
Legend:
|
||||
# done
|
||||
@@ -10,38 +10,33 @@ Legend:
|
||||
? is this really necessary?
|
||||
|
||||
|
||||
v0.0.5:
|
||||
v0.0.6:
|
||||
------
|
||||
|
||||
* General:
|
||||
# debug messages can be enabled via ./configure --enbale-debug option
|
||||
- Windows version
|
||||
+ Solaris version
|
||||
|
||||
* WeeChat commands:
|
||||
# "/set" command: allow the user to set the WeeChat variables
|
||||
under WeeChat without editing the config file (colors, time
|
||||
format, etc)
|
||||
|
||||
* IRC protocol:
|
||||
+ "/mode" command: change the user/channels modes
|
||||
+ "/dcc" command (for chat and sending/receiving files)
|
||||
|
||||
* Interface:
|
||||
+ internationalization (traduce WeeChat in many languages)
|
||||
# info bar
|
||||
# add clock
|
||||
- display current channel modes (example : #weechat(+nt))
|
||||
|
||||
* Configuration:
|
||||
+ add missing options for config file
|
||||
+ add key bindings to config file
|
||||
|
||||
- add key bindings to config file
|
||||
|
||||
|
||||
Future versions:
|
||||
---------------
|
||||
|
||||
* General:
|
||||
- Windows version
|
||||
- *BSD version
|
||||
|
||||
* IRC protocol:
|
||||
+ "/mode" command: change the user/channels modes
|
||||
- "/dcc" command (for chat and sending/receiving files)
|
||||
- complete "/list" command: add regexp search, display only channels that
|
||||
match regexp
|
||||
- "/ignore" and "/unignore" commands: hide all that is write by a given
|
||||
@@ -64,7 +59,6 @@ Future versions:
|
||||
|
||||
* Interface:
|
||||
+ Gtk GUI
|
||||
- display current channel modes (example : #weechat(+nt))
|
||||
- interpret special chars in messages (color & bold for example)
|
||||
- many channel windows in one window/term (window split)
|
||||
- add lag indicator
|
||||
|
||||
+352
-331
File diff suppressed because it is too large
Load Diff
@@ -808,6 +808,7 @@ gui_redraw_window_nick (t_gui_window *window)
|
||||
if (has_colors ())
|
||||
gui_window_set_color (window->win_nick, COLOR_WIN_NICK);
|
||||
|
||||
snprintf (format_empty, 32, "%%-%ds", window->win_nick_width);
|
||||
for (i = 0; i < window->win_nick_height; i++)
|
||||
{
|
||||
mvwprintw (window->win_nick, i, 0, format_empty, " ");
|
||||
@@ -825,6 +826,7 @@ gui_draw_window_status (t_gui_window *window)
|
||||
{
|
||||
t_gui_window *ptr_win;
|
||||
char format_more[32];
|
||||
int i;
|
||||
|
||||
/* TODO: manage splitted windows! */
|
||||
if (window != gui_current_window)
|
||||
@@ -913,7 +915,28 @@ gui_draw_window_status (t_gui_window *window)
|
||||
gui_window_set_color (window->win_status,
|
||||
COLOR_WIN_STATUS);
|
||||
}
|
||||
wprintw (window->win_status, "%s ", CHANNEL(ptr_win)->name);
|
||||
wprintw (window->win_status, "%s", CHANNEL(ptr_win)->name);
|
||||
if (gui_current_window == CHANNEL(ptr_win)->window)
|
||||
{
|
||||
/* display channel modes */
|
||||
wprintw (window->win_status, "(+");
|
||||
i = 0;
|
||||
while (CHANNEL(ptr_win)->modes[i])
|
||||
{
|
||||
if (CHANNEL(ptr_win)->modes[i] != ' ')
|
||||
wprintw (window->win_status, "%c",
|
||||
CHANNEL(ptr_win)->modes[i]);
|
||||
i++;
|
||||
}
|
||||
if (CHANNEL(ptr_win)->modes[CHANNEL_MODE_KEY] != ' ')
|
||||
wprintw (window->win_status, ",%s",
|
||||
CHANNEL(ptr_win)->key);
|
||||
if (CHANNEL(ptr_win)->modes[CHANNEL_MODE_LIMIT] != ' ')
|
||||
wprintw (window->win_status, ",%d",
|
||||
CHANNEL(ptr_win)->limit);
|
||||
wprintw (window->win_status, ")");
|
||||
}
|
||||
wprintw (window->win_status, " ");
|
||||
}
|
||||
if (!SERVER(ptr_win))
|
||||
{
|
||||
|
||||
@@ -26,4 +26,5 @@ lib_weechat_irc_a_SOURCES = irc.h \
|
||||
irc-server.c \
|
||||
irc-channel.c \
|
||||
irc-nick.c \
|
||||
irc-dcc.c \
|
||||
irc-display.c
|
||||
|
||||
@@ -32,6 +32,7 @@
|
||||
|
||||
|
||||
t_irc_channel *current_channel = NULL;
|
||||
char *channel_modes = "iklmnst";
|
||||
|
||||
|
||||
/*
|
||||
@@ -55,6 +56,10 @@ channel_new (t_irc_server *server, int channel_type, char *channel_name,
|
||||
new_channel->type = channel_type;
|
||||
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->limit = 0;
|
||||
new_channel->key = NULL;
|
||||
new_channel->nicks = NULL;
|
||||
new_channel->last_nick = NULL;
|
||||
|
||||
|
||||
@@ -44,6 +44,12 @@ t_irc_command irc_commands[] =
|
||||
N_("nickname type"),
|
||||
N_("nickname: user to send ctcp to\ntype: \"action\" or \"version\""),
|
||||
2, MAX_ARGS, 1, NULL, irc_cmd_send_ctcp, NULL },
|
||||
{ "dcc", N_("starts DCC (file or chat)"),
|
||||
N_("action nickname [file]"),
|
||||
N_("action: 'send' (file) or 'chat'\n"
|
||||
"nickname: nickname to send file or chat\n"
|
||||
"file: filename (on local host)"),
|
||||
2, 3, 1, NULL, irc_cmd_send_dcc, NULL },
|
||||
{ "deop", N_("removes channel operator status from nickname(s)"),
|
||||
N_("nickname [nickname]"), "",
|
||||
1, 1, 1, irc_cmd_send_deop, NULL, NULL },
|
||||
|
||||
+211
-83
@@ -317,9 +317,6 @@ irc_cmd_recv_mode (t_irc_server *server, char *host, char *arguments)
|
||||
pos_parm++;
|
||||
while (pos_parm[0] == ' ')
|
||||
pos_parm++;
|
||||
pos2 = strchr (pos_parm, ' ');
|
||||
if (pos2)
|
||||
pos2[0] = '\0';
|
||||
}
|
||||
|
||||
set_flag = '+';
|
||||
@@ -347,7 +344,6 @@ irc_cmd_recv_mode (t_irc_server *server, char *host, char *arguments)
|
||||
_("sets ban on") :
|
||||
_("removes ban on"),
|
||||
pos_parm);
|
||||
/* TODO: change & redraw channel modes */
|
||||
break;
|
||||
case 'i':
|
||||
irc_display_mode (ptr_channel->window,
|
||||
@@ -356,16 +352,68 @@ irc_cmd_recv_mode (t_irc_server *server, char *host, char *arguments)
|
||||
_("sets invite-only channel flag") :
|
||||
_("removes invite-only channel flag"),
|
||||
NULL);
|
||||
/* TODO: change & redraw channel modes */
|
||||
SET_CHANNEL_MODE(ptr_channel, (set_flag == '+'),
|
||||
CHANNEL_MODE_INVITE);
|
||||
break;
|
||||
case 'k':
|
||||
pos2 = NULL;
|
||||
if (pos_parm)
|
||||
{
|
||||
pos2 = strchr (pos_parm, ' ');
|
||||
if (pos2)
|
||||
pos2[0] = '\0';
|
||||
}
|
||||
irc_display_mode (ptr_channel->window,
|
||||
arguments, set_flag, "k", host,
|
||||
(set_flag == '+') ?
|
||||
_("sets channel key to") :
|
||||
_("removes channel key"),
|
||||
(set_flag == '+') ?
|
||||
((pos_parm) ? pos_parm : NULL) :
|
||||
NULL);
|
||||
SET_CHANNEL_MODE(ptr_channel, (set_flag == '+'),
|
||||
CHANNEL_MODE_KEY);
|
||||
if (ptr_channel->key)
|
||||
free (ptr_channel->key);
|
||||
ptr_channel->key = strdup (pos_parm);
|
||||
|
||||
/* look for next parameter */
|
||||
if (pos_parm && pos2)
|
||||
{
|
||||
pos2++;
|
||||
while (pos2[0] == ' ')
|
||||
pos2++;
|
||||
pos_parm = pos2;
|
||||
}
|
||||
break;
|
||||
case 'l':
|
||||
pos2 = NULL;
|
||||
if (pos_parm)
|
||||
{
|
||||
pos2 = strchr (pos_parm, ' ');
|
||||
if (pos2)
|
||||
pos2[0] = '\0';
|
||||
}
|
||||
irc_display_mode (ptr_channel->window,
|
||||
arguments, set_flag, "l", host,
|
||||
(set_flag == '+') ?
|
||||
_("sets the user limit to") :
|
||||
_("removes user limit"),
|
||||
(set_flag == '+') ? pos_parm : NULL);
|
||||
/* TODO: change & redraw channel modes */
|
||||
(set_flag == '+') ?
|
||||
((pos_parm) ? pos_parm : NULL) :
|
||||
NULL);
|
||||
SET_CHANNEL_MODE(ptr_channel, (set_flag == '+'),
|
||||
CHANNEL_MODE_LIMIT);
|
||||
ptr_channel->limit = atoi (pos_parm);
|
||||
|
||||
/* look for next parameter */
|
||||
if (pos_parm && pos2)
|
||||
{
|
||||
pos2++;
|
||||
while (pos2[0] == ' ')
|
||||
pos2++;
|
||||
pos_parm = pos2;
|
||||
}
|
||||
break;
|
||||
case 'm':
|
||||
irc_display_mode (ptr_channel->window,
|
||||
@@ -374,7 +422,18 @@ irc_cmd_recv_mode (t_irc_server *server, char *host, char *arguments)
|
||||
_("sets moderated channel flag") :
|
||||
_("removes moderated channel flag"),
|
||||
NULL);
|
||||
/* TODO: change & redraw channel modes */
|
||||
SET_CHANNEL_MODE(ptr_channel, (set_flag == '+'),
|
||||
CHANNEL_MODE_MODERATED);
|
||||
break;
|
||||
case 'n':
|
||||
irc_display_mode (ptr_channel->window,
|
||||
arguments, set_flag, "n", host,
|
||||
(set_flag == '+') ?
|
||||
_("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);
|
||||
break;
|
||||
case 'o':
|
||||
irc_display_mode (ptr_channel->window,
|
||||
@@ -391,7 +450,6 @@ irc_cmd_recv_mode (t_irc_server *server, char *host, char *arguments)
|
||||
gui_redraw_window_nick (ptr_channel->window);
|
||||
}
|
||||
break;
|
||||
/* TODO: remove this obsolete (?) channel flag? */
|
||||
case 'p':
|
||||
irc_display_mode (ptr_channel->window,
|
||||
arguments, set_flag, "p", host,
|
||||
@@ -399,7 +457,8 @@ irc_cmd_recv_mode (t_irc_server *server, char *host, char *arguments)
|
||||
_("sets private channel flag") :
|
||||
_("removes private channel flag"),
|
||||
NULL);
|
||||
/* TODO: change & redraw channel modes */
|
||||
SET_CHANNEL_MODE(ptr_channel, (set_flag == '+'),
|
||||
CHANNEL_MODE_SECRET);
|
||||
break;
|
||||
case 's':
|
||||
irc_display_mode (ptr_channel->window,
|
||||
@@ -408,7 +467,8 @@ irc_cmd_recv_mode (t_irc_server *server, char *host, char *arguments)
|
||||
_("sets secret channel flag") :
|
||||
_("removes secret channel flag"),
|
||||
NULL);
|
||||
/* TODO: change & redraw channel modes */
|
||||
SET_CHANNEL_MODE(ptr_channel, (set_flag == '+'),
|
||||
CHANNEL_MODE_SECRET);
|
||||
break;
|
||||
case 't':
|
||||
irc_display_mode (ptr_channel->window,
|
||||
@@ -417,7 +477,8 @@ irc_cmd_recv_mode (t_irc_server *server, char *host, char *arguments)
|
||||
_("sets topic protection") :
|
||||
_("removes topic protection"),
|
||||
NULL);
|
||||
/* TODO: change & redraw channel modes */
|
||||
SET_CHANNEL_MODE(ptr_channel, (set_flag == '+'),
|
||||
CHANNEL_MODE_TOPIC);
|
||||
break;
|
||||
case 'v':
|
||||
irc_display_mode (ptr_channel->window,
|
||||
@@ -438,6 +499,7 @@ irc_cmd_recv_mode (t_irc_server *server, char *host, char *arguments)
|
||||
}
|
||||
pos++;
|
||||
}
|
||||
gui_draw_window_status (gui_current_window);
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -741,6 +803,7 @@ int
|
||||
irc_cmd_recv_privmsg (t_irc_server *server, char *host, char *arguments)
|
||||
{
|
||||
char *pos, *pos2, *host2;
|
||||
char *pos_file, *pos_addr, *pos_port, *pos_size; /* for DCC */
|
||||
t_irc_channel *ptr_channel;
|
||||
t_irc_nick *ptr_nick;
|
||||
struct utsname *buf;
|
||||
@@ -893,79 +956,144 @@ irc_cmd_recv_privmsg (t_irc_server *server, char *host, char *arguments)
|
||||
COLOR_WIN_CHAT, _("from"));
|
||||
gui_printf_color (server->window,
|
||||
COLOR_WIN_CHAT_NICK, " %s\n", host);
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* ping request from another user => answer */
|
||||
if (strncmp (pos, "\01PING", 5) == 0)
|
||||
{
|
||||
pos += 5;
|
||||
while (pos[0] == ' ')
|
||||
pos++;
|
||||
pos2 = strchr (pos, '\01');
|
||||
if (pos2)
|
||||
pos2[0] = '\0';
|
||||
else
|
||||
pos = NULL;
|
||||
if (pos && !pos[0])
|
||||
pos = NULL;
|
||||
if (pos)
|
||||
server_sendf (server, "NOTICE %s :\01PING %s\01\r\n",
|
||||
host, pos);
|
||||
else
|
||||
server_sendf (server, "NOTICE %s :\01PING\01\r\n",
|
||||
host);
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* incoming DCC file */
|
||||
if (strncmp (pos, "\01DCC SEND", 9) == 0)
|
||||
{
|
||||
pos2 = strchr (pos, '\01');
|
||||
if (!pos2)
|
||||
{
|
||||
gui_printf (server->window,
|
||||
_("%s cannot parse \"%s\" command\n"),
|
||||
WEECHAT_ERROR, "privmsg");
|
||||
return -1;
|
||||
}
|
||||
pos2[0] = '\0';
|
||||
pos_file = pos + 9;
|
||||
while (pos_file[0] == ' ')
|
||||
pos_file++;
|
||||
|
||||
/* look for file size */
|
||||
pos_size = strrchr (pos_file, ' ');
|
||||
if (!pos_size)
|
||||
{
|
||||
gui_printf (server->window,
|
||||
_("%s cannot parse \"%s\" command\n"),
|
||||
WEECHAT_ERROR, "privmsg");
|
||||
return -1;
|
||||
}
|
||||
pos2 = pos_size;
|
||||
pos_size++;
|
||||
while (pos2[0] == ' ')
|
||||
pos2--;
|
||||
pos2[1] = '\0';
|
||||
|
||||
/* look for DCC port */
|
||||
pos_port = strrchr (pos_file, ' ');
|
||||
if (!pos_port)
|
||||
{
|
||||
gui_printf (server->window,
|
||||
_("%s cannot parse \"%s\" command\n"),
|
||||
WEECHAT_ERROR, "privmsg");
|
||||
return -1;
|
||||
}
|
||||
pos2 = pos_port;
|
||||
pos_port++;
|
||||
while (pos2[0] == ' ')
|
||||
pos2--;
|
||||
pos2[1] = '\0';
|
||||
|
||||
/* look for DCC address (IP) */
|
||||
pos_addr = strrchr (pos_file, ' ');
|
||||
if (!pos_addr)
|
||||
{
|
||||
gui_printf (server->window,
|
||||
_("%s cannot parse \"%s\" command\n"),
|
||||
WEECHAT_ERROR, "privmsg");
|
||||
return -1;
|
||||
}
|
||||
pos2 = pos_addr;
|
||||
pos_addr++;
|
||||
while (pos2[0] == ' ')
|
||||
pos2--;
|
||||
pos2[1] = '\0';
|
||||
|
||||
wee_log_printf ("Incoming DCC file (NOT DEVELOPED!): "
|
||||
"\"%s\", address=\"%s\", port=\"%s\", size=\"%s\"\n",
|
||||
pos_file, pos_addr, pos_port, pos_size);
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* private message received => display it */
|
||||
ptr_channel = channel_search (server, host);
|
||||
if (!ptr_channel)
|
||||
{
|
||||
ptr_channel = channel_new (server, CHAT_PRIVATE, host, 0);
|
||||
if (!ptr_channel)
|
||||
{
|
||||
gui_printf (server->window,
|
||||
_("%s cannot create new private window \"%s\"\n"),
|
||||
WEECHAT_ERROR, host);
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
if (!ptr_channel->topic)
|
||||
{
|
||||
ptr_channel->topic = strdup (host2);
|
||||
gui_redraw_window_title (ptr_channel->window);
|
||||
}
|
||||
|
||||
gui_printf_color_type (ptr_channel->window,
|
||||
MSG_TYPE_NICK,
|
||||
COLOR_WIN_CHAT_DARK, "<");
|
||||
if (strstr (pos, server->nick))
|
||||
{
|
||||
gui_printf_color_type (ptr_channel->window,
|
||||
MSG_TYPE_NICK,
|
||||
COLOR_WIN_CHAT_HIGHLIGHT,
|
||||
"%s", host);
|
||||
if ( (cfg_look_infobar_delay_highlight > 0)
|
||||
&& (ptr_channel->window != gui_current_window) )
|
||||
gui_infobar_printf (cfg_look_infobar_delay_highlight,
|
||||
COLOR_WIN_INFOBAR_HIGHLIGHT,
|
||||
_("Private %s> %s"),
|
||||
host, pos);
|
||||
}
|
||||
else
|
||||
{
|
||||
/* ping request from another user => answer */
|
||||
if (strncmp (pos, "\01PING", 5) == 0)
|
||||
{
|
||||
pos += 5;
|
||||
while (pos[0] == ' ')
|
||||
pos++;
|
||||
pos2 = strchr (pos, '\01');
|
||||
if (pos2)
|
||||
pos2[0] = '\0';
|
||||
else
|
||||
pos = NULL;
|
||||
if (pos && !pos[0])
|
||||
pos = NULL;
|
||||
if (pos)
|
||||
server_sendf (server, "NOTICE %s :\01PING %s\01\r\n",
|
||||
host, pos);
|
||||
else
|
||||
server_sendf (server, "NOTICE %s :\01PING\01\r\n",
|
||||
host);
|
||||
}
|
||||
else
|
||||
{
|
||||
/* private message received => display it */
|
||||
ptr_channel = channel_search (server, host);
|
||||
if (!ptr_channel)
|
||||
{
|
||||
ptr_channel = channel_new (server, CHAT_PRIVATE, host, 0);
|
||||
if (!ptr_channel)
|
||||
{
|
||||
gui_printf (server->window,
|
||||
_("%s cannot create new private window \"%s\"\n"),
|
||||
WEECHAT_ERROR, host);
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
if (!ptr_channel->topic)
|
||||
{
|
||||
ptr_channel->topic = strdup (host2);
|
||||
gui_redraw_window_title (ptr_channel->window);
|
||||
}
|
||||
|
||||
gui_printf_color_type (ptr_channel->window,
|
||||
MSG_TYPE_NICK,
|
||||
COLOR_WIN_CHAT_DARK, "<");
|
||||
if (strstr (pos, server->nick))
|
||||
{
|
||||
gui_printf_color_type (ptr_channel->window,
|
||||
MSG_TYPE_NICK,
|
||||
COLOR_WIN_CHAT_HIGHLIGHT,
|
||||
"%s", host);
|
||||
if ( (cfg_look_infobar_delay_highlight > 0)
|
||||
&& (ptr_channel->window != gui_current_window) )
|
||||
gui_infobar_printf (cfg_look_infobar_delay_highlight,
|
||||
COLOR_WIN_INFOBAR_HIGHLIGHT,
|
||||
_("Private %s> %s"),
|
||||
host, pos);
|
||||
}
|
||||
else
|
||||
gui_printf_color_type (ptr_channel->window,
|
||||
MSG_TYPE_NICK,
|
||||
COLOR_WIN_NICK_PRIVATE,
|
||||
"%s", host);
|
||||
gui_printf_color_type (ptr_channel->window,
|
||||
MSG_TYPE_NICK,
|
||||
COLOR_WIN_CHAT_DARK, "> ");
|
||||
gui_printf_color_type (ptr_channel->window,
|
||||
MSG_TYPE_MSG,
|
||||
COLOR_WIN_CHAT, "%s\n", pos);
|
||||
}
|
||||
}
|
||||
gui_printf_color_type (ptr_channel->window,
|
||||
MSG_TYPE_NICK,
|
||||
COLOR_WIN_NICK_PRIVATE,
|
||||
"%s", host);
|
||||
gui_printf_color_type (ptr_channel->window,
|
||||
MSG_TYPE_NICK,
|
||||
COLOR_WIN_CHAT_DARK, "> ");
|
||||
gui_printf_color_type (ptr_channel->window,
|
||||
MSG_TYPE_MSG,
|
||||
COLOR_WIN_CHAT, "%s\n", pos);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
@@ -178,6 +178,17 @@ irc_cmd_send_ctcp (t_irc_server *server, char *arguments)
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*
|
||||
* irc_cmd_send_dcc: starts DCC (file or chat)
|
||||
*/
|
||||
|
||||
int
|
||||
irc_cmd_send_dcc (t_irc_server *server, char *arguments)
|
||||
{
|
||||
/* TODO: write this command! */
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*
|
||||
* irc_cmd_send_deop: remove operator privileges from nickname(s)
|
||||
*/
|
||||
|
||||
@@ -34,6 +34,20 @@
|
||||
|
||||
#define CHANNEL_PREFIX "#&+!"
|
||||
|
||||
#define NUM_CHANNEL_MODES 7
|
||||
#define CHANNEL_MODE_INVITE 0
|
||||
#define CHANNEL_MODE_KEY 1
|
||||
#define CHANNEL_MODE_LIMIT 2
|
||||
#define CHANNEL_MODE_MODERATED 3
|
||||
#define CHANNEL_MODE_NO_MSG_OUT 4
|
||||
#define CHANNEL_MODE_SECRET 5
|
||||
#define CHANNEL_MODE_TOPIC 6
|
||||
#define SET_CHANNEL_MODE(channel, set, mode) \
|
||||
if (set) \
|
||||
channel->modes[mode] = channel_modes[mode]; \
|
||||
else \
|
||||
channel->modes[mode] = ' ';
|
||||
|
||||
#define DEFAULT_IRC_PORT 6667
|
||||
|
||||
/* nick types */
|
||||
@@ -64,6 +78,9 @@ struct t_irc_channel
|
||||
int type; /* channel type */
|
||||
char *name; /* name of channel (exemple: "#abc") */
|
||||
char *topic; /* topic of channel (host for private) */
|
||||
char modes[NUM_CHANNEL_MODES+1];/* channel modes */
|
||||
int limit; /* user limit (0 is limit not set) */
|
||||
char *key; /* channel key (NULL if no key is set) */
|
||||
t_irc_nick *nicks; /* nicks on the channel */
|
||||
t_irc_nick *last_nick; /* last nick on the channel */
|
||||
t_gui_window *window; /* GUI window allocated for channel */
|
||||
@@ -139,6 +156,7 @@ extern t_irc_command irc_commands[];
|
||||
extern t_irc_server *irc_servers, *current_irc_server;
|
||||
extern t_irc_message *recv_msgq, *msgq_last_msg;
|
||||
extern t_irc_channel *current_channel;
|
||||
extern char *channel_modes;
|
||||
|
||||
/* server functions (irc-server.c) */
|
||||
|
||||
@@ -180,6 +198,10 @@ extern t_irc_nick *nick_search (t_irc_channel *, char *);
|
||||
extern void nick_count (t_irc_channel *, int *, int *, int *, int *, int *);
|
||||
extern int nick_get_max_length (t_irc_channel *);
|
||||
|
||||
/* DCC functions (irc-dcc.c) */
|
||||
|
||||
extern void dcc_send ();
|
||||
|
||||
/* IRC display (irc-diplay.c) */
|
||||
|
||||
extern void irc_display_prefix (/*@null@*/ t_gui_window *, char *);
|
||||
@@ -195,6 +217,7 @@ extern void irc_login (t_irc_server *);
|
||||
extern int irc_cmd_send_admin (t_irc_server *, char *);
|
||||
extern int irc_cmd_send_away (t_irc_server *, char *);
|
||||
extern int irc_cmd_send_ctcp (t_irc_server *, char *);
|
||||
extern int irc_cmd_send_dcc (t_irc_server *, char *);
|
||||
extern int irc_cmd_send_deop (t_irc_server *, int, char **);
|
||||
extern int irc_cmd_send_devoice (t_irc_server *, int, char **);
|
||||
extern int irc_cmd_send_die (t_irc_server *, char *);
|
||||
|
||||
+2
-1
@@ -1,10 +1,11 @@
|
||||
WeeChat - Wee Enhanced Environment for Chat
|
||||
===========================================
|
||||
|
||||
ChangeLog - 2004-02-25
|
||||
ChangeLog - 2004-02-29
|
||||
|
||||
|
||||
Version 0.0.6 (under dev!):
|
||||
* /mode command is now ok and channel flags are displayed in status bar
|
||||
* fixed display bug (text was blinking when scrolling)
|
||||
* CTCP Version reply is now in english only and doesn't show host (security reason)
|
||||
|
||||
|
||||
+10
-16
@@ -1,7 +1,7 @@
|
||||
WeeChat - Wee Enhanced Environment for Chat
|
||||
===========================================
|
||||
|
||||
TODO - 2004-02-07
|
||||
TODO - 2004-02-29
|
||||
|
||||
Legend:
|
||||
# done
|
||||
@@ -10,38 +10,33 @@ Legend:
|
||||
? is this really necessary?
|
||||
|
||||
|
||||
v0.0.5:
|
||||
v0.0.6:
|
||||
------
|
||||
|
||||
* General:
|
||||
# debug messages can be enabled via ./configure --enbale-debug option
|
||||
- Windows version
|
||||
+ Solaris version
|
||||
|
||||
* WeeChat commands:
|
||||
# "/set" command: allow the user to set the WeeChat variables
|
||||
under WeeChat without editing the config file (colors, time
|
||||
format, etc)
|
||||
|
||||
* IRC protocol:
|
||||
+ "/mode" command: change the user/channels modes
|
||||
+ "/dcc" command (for chat and sending/receiving files)
|
||||
|
||||
* Interface:
|
||||
+ internationalization (traduce WeeChat in many languages)
|
||||
# info bar
|
||||
# add clock
|
||||
- display current channel modes (example : #weechat(+nt))
|
||||
|
||||
* Configuration:
|
||||
+ add missing options for config file
|
||||
+ add key bindings to config file
|
||||
|
||||
- add key bindings to config file
|
||||
|
||||
|
||||
Future versions:
|
||||
---------------
|
||||
|
||||
* General:
|
||||
- Windows version
|
||||
- *BSD version
|
||||
|
||||
* IRC protocol:
|
||||
+ "/mode" command: change the user/channels modes
|
||||
- "/dcc" command (for chat and sending/receiving files)
|
||||
- complete "/list" command: add regexp search, display only channels that
|
||||
match regexp
|
||||
- "/ignore" and "/unignore" commands: hide all that is write by a given
|
||||
@@ -64,7 +59,6 @@ Future versions:
|
||||
|
||||
* Interface:
|
||||
+ Gtk GUI
|
||||
- display current channel modes (example : #weechat(+nt))
|
||||
- interpret special chars in messages (color & bold for example)
|
||||
- many channel windows in one window/term (window split)
|
||||
- add lag indicator
|
||||
|
||||
+334
-312
File diff suppressed because it is too large
Load Diff
+352
-331
File diff suppressed because it is too large
Load Diff
@@ -808,6 +808,7 @@ gui_redraw_window_nick (t_gui_window *window)
|
||||
if (has_colors ())
|
||||
gui_window_set_color (window->win_nick, COLOR_WIN_NICK);
|
||||
|
||||
snprintf (format_empty, 32, "%%-%ds", window->win_nick_width);
|
||||
for (i = 0; i < window->win_nick_height; i++)
|
||||
{
|
||||
mvwprintw (window->win_nick, i, 0, format_empty, " ");
|
||||
@@ -825,6 +826,7 @@ gui_draw_window_status (t_gui_window *window)
|
||||
{
|
||||
t_gui_window *ptr_win;
|
||||
char format_more[32];
|
||||
int i;
|
||||
|
||||
/* TODO: manage splitted windows! */
|
||||
if (window != gui_current_window)
|
||||
@@ -913,7 +915,28 @@ gui_draw_window_status (t_gui_window *window)
|
||||
gui_window_set_color (window->win_status,
|
||||
COLOR_WIN_STATUS);
|
||||
}
|
||||
wprintw (window->win_status, "%s ", CHANNEL(ptr_win)->name);
|
||||
wprintw (window->win_status, "%s", CHANNEL(ptr_win)->name);
|
||||
if (gui_current_window == CHANNEL(ptr_win)->window)
|
||||
{
|
||||
/* display channel modes */
|
||||
wprintw (window->win_status, "(+");
|
||||
i = 0;
|
||||
while (CHANNEL(ptr_win)->modes[i])
|
||||
{
|
||||
if (CHANNEL(ptr_win)->modes[i] != ' ')
|
||||
wprintw (window->win_status, "%c",
|
||||
CHANNEL(ptr_win)->modes[i]);
|
||||
i++;
|
||||
}
|
||||
if (CHANNEL(ptr_win)->modes[CHANNEL_MODE_KEY] != ' ')
|
||||
wprintw (window->win_status, ",%s",
|
||||
CHANNEL(ptr_win)->key);
|
||||
if (CHANNEL(ptr_win)->modes[CHANNEL_MODE_LIMIT] != ' ')
|
||||
wprintw (window->win_status, ",%d",
|
||||
CHANNEL(ptr_win)->limit);
|
||||
wprintw (window->win_status, ")");
|
||||
}
|
||||
wprintw (window->win_status, " ");
|
||||
}
|
||||
if (!SERVER(ptr_win))
|
||||
{
|
||||
|
||||
@@ -26,4 +26,5 @@ lib_weechat_irc_a_SOURCES = irc.h \
|
||||
irc-server.c \
|
||||
irc-channel.c \
|
||||
irc-nick.c \
|
||||
irc-dcc.c \
|
||||
irc-display.c
|
||||
|
||||
@@ -32,6 +32,7 @@
|
||||
|
||||
|
||||
t_irc_channel *current_channel = NULL;
|
||||
char *channel_modes = "iklmnst";
|
||||
|
||||
|
||||
/*
|
||||
@@ -55,6 +56,10 @@ channel_new (t_irc_server *server, int channel_type, char *channel_name,
|
||||
new_channel->type = channel_type;
|
||||
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->limit = 0;
|
||||
new_channel->key = NULL;
|
||||
new_channel->nicks = NULL;
|
||||
new_channel->last_nick = NULL;
|
||||
|
||||
|
||||
@@ -44,6 +44,12 @@ t_irc_command irc_commands[] =
|
||||
N_("nickname type"),
|
||||
N_("nickname: user to send ctcp to\ntype: \"action\" or \"version\""),
|
||||
2, MAX_ARGS, 1, NULL, irc_cmd_send_ctcp, NULL },
|
||||
{ "dcc", N_("starts DCC (file or chat)"),
|
||||
N_("action nickname [file]"),
|
||||
N_("action: 'send' (file) or 'chat'\n"
|
||||
"nickname: nickname to send file or chat\n"
|
||||
"file: filename (on local host)"),
|
||||
2, 3, 1, NULL, irc_cmd_send_dcc, NULL },
|
||||
{ "deop", N_("removes channel operator status from nickname(s)"),
|
||||
N_("nickname [nickname]"), "",
|
||||
1, 1, 1, irc_cmd_send_deop, NULL, NULL },
|
||||
|
||||
+211
-83
@@ -317,9 +317,6 @@ irc_cmd_recv_mode (t_irc_server *server, char *host, char *arguments)
|
||||
pos_parm++;
|
||||
while (pos_parm[0] == ' ')
|
||||
pos_parm++;
|
||||
pos2 = strchr (pos_parm, ' ');
|
||||
if (pos2)
|
||||
pos2[0] = '\0';
|
||||
}
|
||||
|
||||
set_flag = '+';
|
||||
@@ -347,7 +344,6 @@ irc_cmd_recv_mode (t_irc_server *server, char *host, char *arguments)
|
||||
_("sets ban on") :
|
||||
_("removes ban on"),
|
||||
pos_parm);
|
||||
/* TODO: change & redraw channel modes */
|
||||
break;
|
||||
case 'i':
|
||||
irc_display_mode (ptr_channel->window,
|
||||
@@ -356,16 +352,68 @@ irc_cmd_recv_mode (t_irc_server *server, char *host, char *arguments)
|
||||
_("sets invite-only channel flag") :
|
||||
_("removes invite-only channel flag"),
|
||||
NULL);
|
||||
/* TODO: change & redraw channel modes */
|
||||
SET_CHANNEL_MODE(ptr_channel, (set_flag == '+'),
|
||||
CHANNEL_MODE_INVITE);
|
||||
break;
|
||||
case 'k':
|
||||
pos2 = NULL;
|
||||
if (pos_parm)
|
||||
{
|
||||
pos2 = strchr (pos_parm, ' ');
|
||||
if (pos2)
|
||||
pos2[0] = '\0';
|
||||
}
|
||||
irc_display_mode (ptr_channel->window,
|
||||
arguments, set_flag, "k", host,
|
||||
(set_flag == '+') ?
|
||||
_("sets channel key to") :
|
||||
_("removes channel key"),
|
||||
(set_flag == '+') ?
|
||||
((pos_parm) ? pos_parm : NULL) :
|
||||
NULL);
|
||||
SET_CHANNEL_MODE(ptr_channel, (set_flag == '+'),
|
||||
CHANNEL_MODE_KEY);
|
||||
if (ptr_channel->key)
|
||||
free (ptr_channel->key);
|
||||
ptr_channel->key = strdup (pos_parm);
|
||||
|
||||
/* look for next parameter */
|
||||
if (pos_parm && pos2)
|
||||
{
|
||||
pos2++;
|
||||
while (pos2[0] == ' ')
|
||||
pos2++;
|
||||
pos_parm = pos2;
|
||||
}
|
||||
break;
|
||||
case 'l':
|
||||
pos2 = NULL;
|
||||
if (pos_parm)
|
||||
{
|
||||
pos2 = strchr (pos_parm, ' ');
|
||||
if (pos2)
|
||||
pos2[0] = '\0';
|
||||
}
|
||||
irc_display_mode (ptr_channel->window,
|
||||
arguments, set_flag, "l", host,
|
||||
(set_flag == '+') ?
|
||||
_("sets the user limit to") :
|
||||
_("removes user limit"),
|
||||
(set_flag == '+') ? pos_parm : NULL);
|
||||
/* TODO: change & redraw channel modes */
|
||||
(set_flag == '+') ?
|
||||
((pos_parm) ? pos_parm : NULL) :
|
||||
NULL);
|
||||
SET_CHANNEL_MODE(ptr_channel, (set_flag == '+'),
|
||||
CHANNEL_MODE_LIMIT);
|
||||
ptr_channel->limit = atoi (pos_parm);
|
||||
|
||||
/* look for next parameter */
|
||||
if (pos_parm && pos2)
|
||||
{
|
||||
pos2++;
|
||||
while (pos2[0] == ' ')
|
||||
pos2++;
|
||||
pos_parm = pos2;
|
||||
}
|
||||
break;
|
||||
case 'm':
|
||||
irc_display_mode (ptr_channel->window,
|
||||
@@ -374,7 +422,18 @@ irc_cmd_recv_mode (t_irc_server *server, char *host, char *arguments)
|
||||
_("sets moderated channel flag") :
|
||||
_("removes moderated channel flag"),
|
||||
NULL);
|
||||
/* TODO: change & redraw channel modes */
|
||||
SET_CHANNEL_MODE(ptr_channel, (set_flag == '+'),
|
||||
CHANNEL_MODE_MODERATED);
|
||||
break;
|
||||
case 'n':
|
||||
irc_display_mode (ptr_channel->window,
|
||||
arguments, set_flag, "n", host,
|
||||
(set_flag == '+') ?
|
||||
_("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);
|
||||
break;
|
||||
case 'o':
|
||||
irc_display_mode (ptr_channel->window,
|
||||
@@ -391,7 +450,6 @@ irc_cmd_recv_mode (t_irc_server *server, char *host, char *arguments)
|
||||
gui_redraw_window_nick (ptr_channel->window);
|
||||
}
|
||||
break;
|
||||
/* TODO: remove this obsolete (?) channel flag? */
|
||||
case 'p':
|
||||
irc_display_mode (ptr_channel->window,
|
||||
arguments, set_flag, "p", host,
|
||||
@@ -399,7 +457,8 @@ irc_cmd_recv_mode (t_irc_server *server, char *host, char *arguments)
|
||||
_("sets private channel flag") :
|
||||
_("removes private channel flag"),
|
||||
NULL);
|
||||
/* TODO: change & redraw channel modes */
|
||||
SET_CHANNEL_MODE(ptr_channel, (set_flag == '+'),
|
||||
CHANNEL_MODE_SECRET);
|
||||
break;
|
||||
case 's':
|
||||
irc_display_mode (ptr_channel->window,
|
||||
@@ -408,7 +467,8 @@ irc_cmd_recv_mode (t_irc_server *server, char *host, char *arguments)
|
||||
_("sets secret channel flag") :
|
||||
_("removes secret channel flag"),
|
||||
NULL);
|
||||
/* TODO: change & redraw channel modes */
|
||||
SET_CHANNEL_MODE(ptr_channel, (set_flag == '+'),
|
||||
CHANNEL_MODE_SECRET);
|
||||
break;
|
||||
case 't':
|
||||
irc_display_mode (ptr_channel->window,
|
||||
@@ -417,7 +477,8 @@ irc_cmd_recv_mode (t_irc_server *server, char *host, char *arguments)
|
||||
_("sets topic protection") :
|
||||
_("removes topic protection"),
|
||||
NULL);
|
||||
/* TODO: change & redraw channel modes */
|
||||
SET_CHANNEL_MODE(ptr_channel, (set_flag == '+'),
|
||||
CHANNEL_MODE_TOPIC);
|
||||
break;
|
||||
case 'v':
|
||||
irc_display_mode (ptr_channel->window,
|
||||
@@ -438,6 +499,7 @@ irc_cmd_recv_mode (t_irc_server *server, char *host, char *arguments)
|
||||
}
|
||||
pos++;
|
||||
}
|
||||
gui_draw_window_status (gui_current_window);
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -741,6 +803,7 @@ int
|
||||
irc_cmd_recv_privmsg (t_irc_server *server, char *host, char *arguments)
|
||||
{
|
||||
char *pos, *pos2, *host2;
|
||||
char *pos_file, *pos_addr, *pos_port, *pos_size; /* for DCC */
|
||||
t_irc_channel *ptr_channel;
|
||||
t_irc_nick *ptr_nick;
|
||||
struct utsname *buf;
|
||||
@@ -893,79 +956,144 @@ irc_cmd_recv_privmsg (t_irc_server *server, char *host, char *arguments)
|
||||
COLOR_WIN_CHAT, _("from"));
|
||||
gui_printf_color (server->window,
|
||||
COLOR_WIN_CHAT_NICK, " %s\n", host);
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* ping request from another user => answer */
|
||||
if (strncmp (pos, "\01PING", 5) == 0)
|
||||
{
|
||||
pos += 5;
|
||||
while (pos[0] == ' ')
|
||||
pos++;
|
||||
pos2 = strchr (pos, '\01');
|
||||
if (pos2)
|
||||
pos2[0] = '\0';
|
||||
else
|
||||
pos = NULL;
|
||||
if (pos && !pos[0])
|
||||
pos = NULL;
|
||||
if (pos)
|
||||
server_sendf (server, "NOTICE %s :\01PING %s\01\r\n",
|
||||
host, pos);
|
||||
else
|
||||
server_sendf (server, "NOTICE %s :\01PING\01\r\n",
|
||||
host);
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* incoming DCC file */
|
||||
if (strncmp (pos, "\01DCC SEND", 9) == 0)
|
||||
{
|
||||
pos2 = strchr (pos, '\01');
|
||||
if (!pos2)
|
||||
{
|
||||
gui_printf (server->window,
|
||||
_("%s cannot parse \"%s\" command\n"),
|
||||
WEECHAT_ERROR, "privmsg");
|
||||
return -1;
|
||||
}
|
||||
pos2[0] = '\0';
|
||||
pos_file = pos + 9;
|
||||
while (pos_file[0] == ' ')
|
||||
pos_file++;
|
||||
|
||||
/* look for file size */
|
||||
pos_size = strrchr (pos_file, ' ');
|
||||
if (!pos_size)
|
||||
{
|
||||
gui_printf (server->window,
|
||||
_("%s cannot parse \"%s\" command\n"),
|
||||
WEECHAT_ERROR, "privmsg");
|
||||
return -1;
|
||||
}
|
||||
pos2 = pos_size;
|
||||
pos_size++;
|
||||
while (pos2[0] == ' ')
|
||||
pos2--;
|
||||
pos2[1] = '\0';
|
||||
|
||||
/* look for DCC port */
|
||||
pos_port = strrchr (pos_file, ' ');
|
||||
if (!pos_port)
|
||||
{
|
||||
gui_printf (server->window,
|
||||
_("%s cannot parse \"%s\" command\n"),
|
||||
WEECHAT_ERROR, "privmsg");
|
||||
return -1;
|
||||
}
|
||||
pos2 = pos_port;
|
||||
pos_port++;
|
||||
while (pos2[0] == ' ')
|
||||
pos2--;
|
||||
pos2[1] = '\0';
|
||||
|
||||
/* look for DCC address (IP) */
|
||||
pos_addr = strrchr (pos_file, ' ');
|
||||
if (!pos_addr)
|
||||
{
|
||||
gui_printf (server->window,
|
||||
_("%s cannot parse \"%s\" command\n"),
|
||||
WEECHAT_ERROR, "privmsg");
|
||||
return -1;
|
||||
}
|
||||
pos2 = pos_addr;
|
||||
pos_addr++;
|
||||
while (pos2[0] == ' ')
|
||||
pos2--;
|
||||
pos2[1] = '\0';
|
||||
|
||||
wee_log_printf ("Incoming DCC file (NOT DEVELOPED!): "
|
||||
"\"%s\", address=\"%s\", port=\"%s\", size=\"%s\"\n",
|
||||
pos_file, pos_addr, pos_port, pos_size);
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* private message received => display it */
|
||||
ptr_channel = channel_search (server, host);
|
||||
if (!ptr_channel)
|
||||
{
|
||||
ptr_channel = channel_new (server, CHAT_PRIVATE, host, 0);
|
||||
if (!ptr_channel)
|
||||
{
|
||||
gui_printf (server->window,
|
||||
_("%s cannot create new private window \"%s\"\n"),
|
||||
WEECHAT_ERROR, host);
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
if (!ptr_channel->topic)
|
||||
{
|
||||
ptr_channel->topic = strdup (host2);
|
||||
gui_redraw_window_title (ptr_channel->window);
|
||||
}
|
||||
|
||||
gui_printf_color_type (ptr_channel->window,
|
||||
MSG_TYPE_NICK,
|
||||
COLOR_WIN_CHAT_DARK, "<");
|
||||
if (strstr (pos, server->nick))
|
||||
{
|
||||
gui_printf_color_type (ptr_channel->window,
|
||||
MSG_TYPE_NICK,
|
||||
COLOR_WIN_CHAT_HIGHLIGHT,
|
||||
"%s", host);
|
||||
if ( (cfg_look_infobar_delay_highlight > 0)
|
||||
&& (ptr_channel->window != gui_current_window) )
|
||||
gui_infobar_printf (cfg_look_infobar_delay_highlight,
|
||||
COLOR_WIN_INFOBAR_HIGHLIGHT,
|
||||
_("Private %s> %s"),
|
||||
host, pos);
|
||||
}
|
||||
else
|
||||
{
|
||||
/* ping request from another user => answer */
|
||||
if (strncmp (pos, "\01PING", 5) == 0)
|
||||
{
|
||||
pos += 5;
|
||||
while (pos[0] == ' ')
|
||||
pos++;
|
||||
pos2 = strchr (pos, '\01');
|
||||
if (pos2)
|
||||
pos2[0] = '\0';
|
||||
else
|
||||
pos = NULL;
|
||||
if (pos && !pos[0])
|
||||
pos = NULL;
|
||||
if (pos)
|
||||
server_sendf (server, "NOTICE %s :\01PING %s\01\r\n",
|
||||
host, pos);
|
||||
else
|
||||
server_sendf (server, "NOTICE %s :\01PING\01\r\n",
|
||||
host);
|
||||
}
|
||||
else
|
||||
{
|
||||
/* private message received => display it */
|
||||
ptr_channel = channel_search (server, host);
|
||||
if (!ptr_channel)
|
||||
{
|
||||
ptr_channel = channel_new (server, CHAT_PRIVATE, host, 0);
|
||||
if (!ptr_channel)
|
||||
{
|
||||
gui_printf (server->window,
|
||||
_("%s cannot create new private window \"%s\"\n"),
|
||||
WEECHAT_ERROR, host);
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
if (!ptr_channel->topic)
|
||||
{
|
||||
ptr_channel->topic = strdup (host2);
|
||||
gui_redraw_window_title (ptr_channel->window);
|
||||
}
|
||||
|
||||
gui_printf_color_type (ptr_channel->window,
|
||||
MSG_TYPE_NICK,
|
||||
COLOR_WIN_CHAT_DARK, "<");
|
||||
if (strstr (pos, server->nick))
|
||||
{
|
||||
gui_printf_color_type (ptr_channel->window,
|
||||
MSG_TYPE_NICK,
|
||||
COLOR_WIN_CHAT_HIGHLIGHT,
|
||||
"%s", host);
|
||||
if ( (cfg_look_infobar_delay_highlight > 0)
|
||||
&& (ptr_channel->window != gui_current_window) )
|
||||
gui_infobar_printf (cfg_look_infobar_delay_highlight,
|
||||
COLOR_WIN_INFOBAR_HIGHLIGHT,
|
||||
_("Private %s> %s"),
|
||||
host, pos);
|
||||
}
|
||||
else
|
||||
gui_printf_color_type (ptr_channel->window,
|
||||
MSG_TYPE_NICK,
|
||||
COLOR_WIN_NICK_PRIVATE,
|
||||
"%s", host);
|
||||
gui_printf_color_type (ptr_channel->window,
|
||||
MSG_TYPE_NICK,
|
||||
COLOR_WIN_CHAT_DARK, "> ");
|
||||
gui_printf_color_type (ptr_channel->window,
|
||||
MSG_TYPE_MSG,
|
||||
COLOR_WIN_CHAT, "%s\n", pos);
|
||||
}
|
||||
}
|
||||
gui_printf_color_type (ptr_channel->window,
|
||||
MSG_TYPE_NICK,
|
||||
COLOR_WIN_NICK_PRIVATE,
|
||||
"%s", host);
|
||||
gui_printf_color_type (ptr_channel->window,
|
||||
MSG_TYPE_NICK,
|
||||
COLOR_WIN_CHAT_DARK, "> ");
|
||||
gui_printf_color_type (ptr_channel->window,
|
||||
MSG_TYPE_MSG,
|
||||
COLOR_WIN_CHAT, "%s\n", pos);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
@@ -178,6 +178,17 @@ irc_cmd_send_ctcp (t_irc_server *server, char *arguments)
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*
|
||||
* irc_cmd_send_dcc: starts DCC (file or chat)
|
||||
*/
|
||||
|
||||
int
|
||||
irc_cmd_send_dcc (t_irc_server *server, char *arguments)
|
||||
{
|
||||
/* TODO: write this command! */
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*
|
||||
* irc_cmd_send_deop: remove operator privileges from nickname(s)
|
||||
*/
|
||||
|
||||
@@ -34,6 +34,20 @@
|
||||
|
||||
#define CHANNEL_PREFIX "#&+!"
|
||||
|
||||
#define NUM_CHANNEL_MODES 7
|
||||
#define CHANNEL_MODE_INVITE 0
|
||||
#define CHANNEL_MODE_KEY 1
|
||||
#define CHANNEL_MODE_LIMIT 2
|
||||
#define CHANNEL_MODE_MODERATED 3
|
||||
#define CHANNEL_MODE_NO_MSG_OUT 4
|
||||
#define CHANNEL_MODE_SECRET 5
|
||||
#define CHANNEL_MODE_TOPIC 6
|
||||
#define SET_CHANNEL_MODE(channel, set, mode) \
|
||||
if (set) \
|
||||
channel->modes[mode] = channel_modes[mode]; \
|
||||
else \
|
||||
channel->modes[mode] = ' ';
|
||||
|
||||
#define DEFAULT_IRC_PORT 6667
|
||||
|
||||
/* nick types */
|
||||
@@ -64,6 +78,9 @@ struct t_irc_channel
|
||||
int type; /* channel type */
|
||||
char *name; /* name of channel (exemple: "#abc") */
|
||||
char *topic; /* topic of channel (host for private) */
|
||||
char modes[NUM_CHANNEL_MODES+1];/* channel modes */
|
||||
int limit; /* user limit (0 is limit not set) */
|
||||
char *key; /* channel key (NULL if no key is set) */
|
||||
t_irc_nick *nicks; /* nicks on the channel */
|
||||
t_irc_nick *last_nick; /* last nick on the channel */
|
||||
t_gui_window *window; /* GUI window allocated for channel */
|
||||
@@ -139,6 +156,7 @@ extern t_irc_command irc_commands[];
|
||||
extern t_irc_server *irc_servers, *current_irc_server;
|
||||
extern t_irc_message *recv_msgq, *msgq_last_msg;
|
||||
extern t_irc_channel *current_channel;
|
||||
extern char *channel_modes;
|
||||
|
||||
/* server functions (irc-server.c) */
|
||||
|
||||
@@ -180,6 +198,10 @@ extern t_irc_nick *nick_search (t_irc_channel *, char *);
|
||||
extern void nick_count (t_irc_channel *, int *, int *, int *, int *, int *);
|
||||
extern int nick_get_max_length (t_irc_channel *);
|
||||
|
||||
/* DCC functions (irc-dcc.c) */
|
||||
|
||||
extern void dcc_send ();
|
||||
|
||||
/* IRC display (irc-diplay.c) */
|
||||
|
||||
extern void irc_display_prefix (/*@null@*/ t_gui_window *, char *);
|
||||
@@ -195,6 +217,7 @@ extern void irc_login (t_irc_server *);
|
||||
extern int irc_cmd_send_admin (t_irc_server *, char *);
|
||||
extern int irc_cmd_send_away (t_irc_server *, char *);
|
||||
extern int irc_cmd_send_ctcp (t_irc_server *, char *);
|
||||
extern int irc_cmd_send_dcc (t_irc_server *, char *);
|
||||
extern int irc_cmd_send_deop (t_irc_server *, int, char **);
|
||||
extern int irc_cmd_send_devoice (t_irc_server *, int, char **);
|
||||
extern int irc_cmd_send_die (t_irc_server *, char *);
|
||||
|
||||
Reference in New Issue
Block a user