summaryrefslogtreecommitdiff
path: root/src/irc
diff options
context:
space:
mode:
authorSebastien Helleu <flashcode@flashtux.org>2005-06-30 12:55:36 +0000
committerSebastien Helleu <flashcode@flashtux.org>2005-06-30 12:55:36 +0000
commit5bd56f86c6276e13cbf3a2d7bfb1a96023fc2305 (patch)
tree6a8aa5ab289e16ce58bd2e927d43384471736b9d /src/irc
parent2fab4da03de5f879b7fe90ae8e9d83c7627d4285 (diff)
downloadweechat-5bd56f86c6276e13cbf3a2d7bfb1a96023fc2305.zip
* commands from users outside channel now authorized (if special user or channel without "n" flag)
* completion added for config option (with /set command)
Diffstat (limited to 'src/irc')
-rw-r--r--src/irc/irc-display.c18
-rw-r--r--src/irc/irc-recv.c49
-rw-r--r--src/irc/irc-send.c4
-rw-r--r--src/irc/irc.h2
4 files changed, 33 insertions, 40 deletions
diff --git a/src/irc/irc-display.c b/src/irc/irc-display.c
index 8aafd29b0..0e182b1e8 100644
--- a/src/irc/irc-display.c
+++ b/src/irc/irc-display.c
@@ -66,13 +66,14 @@ irc_display_prefix (t_gui_buffer *buffer, char *prefix)
*/
void
-irc_display_nick (t_gui_buffer *buffer, t_irc_nick *nick, int message_type,
- int display_around, int color_nick, int no_nickmode)
+irc_display_nick (t_gui_buffer *buffer, t_irc_nick *nick, char *nickname,
+ int message_type, int display_around, int color_nick, int no_nickmode)
{
if (display_around)
gui_printf_type_color (buffer,
- message_type, COLOR_WIN_CHAT_DARK, "<");
- if (cfg_look_nickmode)
+ message_type, COLOR_WIN_CHAT_DARK,
+ (nick) ? "<" : ">");
+ if (nick && cfg_look_nickmode)
{
if (nick->is_chanowner)
gui_printf_type_color (buffer,
@@ -104,19 +105,20 @@ irc_display_nick (t_gui_buffer *buffer, t_irc_nick *nick, int message_type,
gui_printf_type_color (buffer,
message_type,
COLOR_WIN_CHAT_HIGHLIGHT,
- "%s", nick->nick);
+ "%s", (nick) ? nick->nick : nickname);
else
gui_printf_type_color (buffer,
message_type,
- (color_nick) ?
+ (nick && color_nick) ?
((cfg_look_color_nicks) ?
nick->color : COLOR_WIN_CHAT) :
COLOR_WIN_CHAT,
- "%s", nick->nick);
+ "%s", (nick) ? nick->nick : nickname);
if (display_around)
gui_printf_type_color (buffer,
- message_type, COLOR_WIN_CHAT_DARK, "> ");
+ message_type, COLOR_WIN_CHAT_DARK,
+ (nick) ? "> " : "< ");
}
/*
diff --git a/src/irc/irc-recv.c b/src/irc/irc-recv.c
index c3b3a3e54..85bbbfbc2 100644
--- a/src/irc/irc-recv.c
+++ b/src/irc/irc-recv.c
@@ -1246,37 +1246,28 @@ irc_cmd_recv_privmsg (t_irc_server *server, char *host, char *arguments)
else
{
ptr_nick = nick_search (ptr_channel, host);
- if (ptr_nick)
+ if (strstr (pos, server->nick))
{
- if (strstr (pos, server->nick))
- {
- irc_display_nick (ptr_channel->buffer, ptr_nick,
- MSG_TYPE_NICK | MSG_TYPE_HIGHLIGHT,
- 1, -1, 0);
- if ( (cfg_look_infobar)
- && (cfg_look_infobar_delay_highlight > 0)
- && (ptr_channel->buffer != gui_current_window->buffer) )
- gui_infobar_printf (cfg_look_infobar_delay_highlight,
- COLOR_WIN_INFOBAR_HIGHLIGHT,
- _("On %s: %s> %s"),
- ptr_channel->name,
- host, pos);
- }
- else
- irc_display_nick (ptr_channel->buffer, ptr_nick,
- MSG_TYPE_NICK, 1, 1, 0);
- gui_printf_type_color (ptr_channel->buffer,
- MSG_TYPE_MSG,
- COLOR_WIN_CHAT, "%s\n", pos);
+ irc_display_nick (ptr_channel->buffer, ptr_nick,
+ (ptr_nick) ? NULL : host,
+ MSG_TYPE_NICK | MSG_TYPE_HIGHLIGHT,
+ 1, -1, 0);
+ if ( (cfg_look_infobar)
+ && (cfg_look_infobar_delay_highlight > 0)
+ && (ptr_channel->buffer != gui_current_window->buffer) )
+ gui_infobar_printf (cfg_look_infobar_delay_highlight,
+ COLOR_WIN_INFOBAR_HIGHLIGHT,
+ _("On %s: %s> %s"),
+ ptr_channel->name,
+ host, pos);
}
else
- {
- irc_display_prefix (server->buffer, PREFIX_ERROR);
- gui_printf_nolog (server->buffer,
- _("%s nick \"%s\" not found for \"%s\" command (message: \"%s\")\n"),
- WEECHAT_ERROR, host, "privmsg", pos);
- return -1;
- }
+ irc_display_nick (ptr_channel->buffer, ptr_nick,
+ (ptr_nick) ? NULL : host,
+ MSG_TYPE_NICK, 1, 1, 0);
+ gui_printf_type_color (ptr_channel->buffer,
+ MSG_TYPE_MSG,
+ COLOR_WIN_CHAT, "%s\n", pos);
}
}
else
@@ -3336,7 +3327,7 @@ irc_cmd_recv_366 (t_irc_server *server, char *host, char *arguments)
for (ptr_nick = ptr_channel->nicks; ptr_nick; ptr_nick = ptr_nick->next_nick)
{
- irc_display_nick (ptr_channel->buffer, ptr_nick,
+ irc_display_nick (ptr_channel->buffer, ptr_nick, NULL,
MSG_TYPE_MSG, 0, 0, 1);
if (ptr_nick != ptr_channel->last_nick)
gui_printf (ptr_channel->buffer, " ");
diff --git a/src/irc/irc-send.c b/src/irc/irc-send.c
index 1809c2c40..22a90b2f3 100644
--- a/src/irc/irc-send.c
+++ b/src/irc/irc-send.c
@@ -876,7 +876,7 @@ irc_cmd_send_msg (t_irc_server *server, char *arguments)
ptr_nick = nick_search (ptr_channel, server->nick);
if (ptr_nick)
{
- irc_display_nick (ptr_channel->buffer, ptr_nick,
+ irc_display_nick (ptr_channel->buffer, ptr_nick, NULL,
MSG_TYPE_NICK, 1, 1, 0);
gui_printf_type_color (ptr_channel->buffer,
MSG_TYPE_MSG,
@@ -901,7 +901,7 @@ irc_cmd_send_msg (t_irc_server *server, char *arguments)
ptr_nick = nick_search (ptr_channel, server->nick);
if (ptr_nick)
{
- irc_display_nick (ptr_channel->buffer, ptr_nick,
+ irc_display_nick (ptr_channel->buffer, ptr_nick, NULL,
MSG_TYPE_NICK, 1, 1, 0);
gui_printf_type_color (ptr_channel->buffer,
MSG_TYPE_MSG,
diff --git a/src/irc/irc.h b/src/irc/irc.h
index 1087a4052..bc69d163d 100644
--- a/src/irc/irc.h
+++ b/src/irc/irc.h
@@ -331,7 +331,7 @@ extern void dcc_end ();
/* IRC display (irc-diplay.c) */
extern void irc_display_prefix (/*@null@*/ t_gui_buffer *, char *);
-extern void irc_display_nick (t_gui_buffer *, t_irc_nick *, int, int, int, int);
+extern void irc_display_nick (t_gui_buffer *, t_irc_nick *, char *, int, int, int, int);
extern void irc_display_mode (t_gui_buffer *, char *, char, char *, char *,
char *, char *);
extern void irc_display_server (t_irc_server *ptr_server);