mirror of
https://github.com/irssi/irssi.git
synced 2026-08-10 12:23:37 +02:00
Fixed DCC stuff. Added DCCMSGS level for DCC chat messages.
Actions match now either MSGS or PUBLIC level as well as the ACTIONS level always. Added DCCMSGS level to default highlight levels. Highlighting works with other than public messages now even if -nick option is used. git-svn-id: http://svn.irssi.org/repos/irssi/trunk@463 dbcabf3a-b0e7-0310-adc4-f8d773084564
This commit is contained in:
parent
1b736a68a7
commit
796d51afe4
10 changed files with 54 additions and 35 deletions
|
|
@ -32,7 +32,8 @@
|
|||
#include "hilight-text.h"
|
||||
|
||||
#define DEFAULT_HILIGHT_LEVEL \
|
||||
(MSGLEVEL_PUBLIC | MSGLEVEL_MSGS | MSGLEVEL_NOTICES | MSGLEVEL_ACTIONS)
|
||||
(MSGLEVEL_PUBLIC | MSGLEVEL_MSGS | MSGLEVEL_NOTICES | \
|
||||
MSGLEVEL_ACTIONS | MSGLEVEL_DCCMSGS)
|
||||
|
||||
static int hilight_next;
|
||||
GSList *hilights;
|
||||
|
|
@ -201,8 +202,7 @@ char *hilight_match(const char *channel, const char *nickmask, int level, const
|
|||
|
||||
if ((level & (rec->level > 0 ? rec->level : DEFAULT_HILIGHT_LEVEL)) == 0)
|
||||
continue;
|
||||
if ((rec->nick && nickmask == NULL) ||
|
||||
(!rec->nick && nickmask != NULL))
|
||||
if (!rec->nick && nickmask != NULL)
|
||||
continue;
|
||||
if (rec->channels != NULL && (channel == NULL || strarray_find(rec->channels, channel) == -1))
|
||||
continue;
|
||||
|
|
|
|||
|
|
@ -118,7 +118,7 @@ static void dcc_chat_action(const char *msg, DCC_REC *dcc)
|
|||
g_return_if_fail(msg != NULL);
|
||||
|
||||
sender = g_strconcat("=", dcc->nick, NULL);
|
||||
printformat(NULL, sender, MSGLEVEL_DCC | MSGLEVEL_MSGS,
|
||||
printformat(NULL, sender, MSGLEVEL_DCCMSGS,
|
||||
IRCTXT_ACTION_DCC, dcc->nick, msg);
|
||||
g_free(sender);
|
||||
}
|
||||
|
|
@ -131,7 +131,7 @@ static void dcc_chat_ctcp(const char *msg, DCC_REC *dcc)
|
|||
g_return_if_fail(msg != NULL);
|
||||
|
||||
sender = g_strconcat("=", dcc->nick, NULL);
|
||||
printformat(NULL, sender, MSGLEVEL_DCC | MSGLEVEL_CTCPS, IRCTXT_DCC_CTCP, dcc->nick, msg);
|
||||
printformat(NULL, sender, MSGLEVEL_DCC, IRCTXT_DCC_CTCP, dcc->nick, msg);
|
||||
g_free(sender);
|
||||
}
|
||||
|
||||
|
|
@ -143,7 +143,7 @@ static void dcc_chat_msg(DCC_REC *dcc, const char *msg)
|
|||
g_return_if_fail(msg != NULL);
|
||||
|
||||
sender = g_strconcat("=", dcc->nick, NULL);
|
||||
printformat(NULL, sender, MSGLEVEL_DCC | MSGLEVEL_MSGS,
|
||||
printformat(NULL, sender, MSGLEVEL_DCCMSGS,
|
||||
query_find(NULL, sender) ? IRCTXT_DCC_MSG_QUERY :
|
||||
IRCTXT_DCC_MSG, dcc->nick, msg);
|
||||
g_free(sender);
|
||||
|
|
@ -310,7 +310,7 @@ static void cmd_msg(const char *data)
|
|||
printformat(NULL, NULL, MSGLEVEL_CLIENTERROR,
|
||||
IRCTXT_DCC_CHAT_NOT_FOUND, target+1);
|
||||
} else {
|
||||
printformat(NULL, target, MSGLEVEL_DCC | MSGLEVEL_MSGS | MSGLEVEL_NOHILIGHT,
|
||||
printformat(NULL, target, MSGLEVEL_DCCMSGS | MSGLEVEL_NOHILIGHT,
|
||||
query_find(NULL, target) ? IRCTXT_OWN_DCC_QUERY :
|
||||
IRCTXT_OWN_DCC, dcc->mynick, text);
|
||||
}
|
||||
|
|
@ -327,7 +327,7 @@ static void cmd_me(const char *data, SERVER_REC *server, WI_IRC_REC *item)
|
|||
dcc = item_get_dcc(item);
|
||||
if (dcc == NULL) return;
|
||||
|
||||
printformat(NULL, item->name, MSGLEVEL_DCC | MSGLEVEL_ACTIONS | MSGLEVEL_NOHILIGHT,
|
||||
printformat(NULL, item->name, MSGLEVEL_DCCMSGS | MSGLEVEL_NOHILIGHT,
|
||||
IRCTXT_OWN_DCC_ME, dcc->mynick, data);
|
||||
}
|
||||
|
||||
|
|
@ -353,7 +353,7 @@ static void cmd_action(const char *data, SERVER_REC *server, WI_IRC_REC *item)
|
|||
printformat(NULL, NULL, MSGLEVEL_CLIENTERROR,
|
||||
IRCTXT_DCC_CHAT_NOT_FOUND, target+1);
|
||||
} else {
|
||||
printformat(NULL, target, MSGLEVEL_DCC | MSGLEVEL_ACTIONS,
|
||||
printformat(NULL, target, MSGLEVEL_DCCMSGS | MSGLEVEL_NOHILIGHT,
|
||||
IRCTXT_OWN_DCC_ME, dcc->mynick, text);
|
||||
}
|
||||
cmd_params_free(free_arg);
|
||||
|
|
@ -384,7 +384,7 @@ static void cmd_ctcp(const char *data, SERVER_REC *server)
|
|||
IRCTXT_DCC_CHAT_NOT_FOUND, target+1);
|
||||
} else {
|
||||
g_strup(ctcpcmd);
|
||||
printformat(server, target, MSGLEVEL_DCC | MSGLEVEL_CTCPS, IRCTXT_OWN_DCC_CTCP,
|
||||
printformat(server, target, MSGLEVEL_DCC, IRCTXT_OWN_DCC_CTCP,
|
||||
target, ctcpcmd, ctcpdata);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -129,6 +129,7 @@ static void event_privmsg(const char *data, IRC_SERVER_REC *server, const char *
|
|||
static void ctcp_msg_check_action(gchar *data, IRC_SERVER_REC *server, gchar *nick, gchar *addr, gchar *target)
|
||||
{
|
||||
WI_ITEM_REC *item;
|
||||
int level;
|
||||
|
||||
g_return_if_fail(data != NULL);
|
||||
|
||||
|
|
@ -136,7 +137,9 @@ static void ctcp_msg_check_action(gchar *data, IRC_SERVER_REC *server, gchar *ni
|
|||
return;
|
||||
data += 7;
|
||||
|
||||
if (ignore_check(server, nick, addr, target, data, MSGLEVEL_ACTIONS))
|
||||
level = MSGLEVEL_ACTIONS |
|
||||
(ischannel(*target) ? MSGLEVEL_PUBLIC : MSGLEVEL_MSGS);
|
||||
if (ignore_check(server, nick, addr, target, data, level))
|
||||
return;
|
||||
|
||||
if (ischannel(*target)) {
|
||||
|
|
@ -145,17 +148,17 @@ static void ctcp_msg_check_action(gchar *data, IRC_SERVER_REC *server, gchar *ni
|
|||
|
||||
if (window_item_is_active(item)) {
|
||||
/* message to active channel in window */
|
||||
printformat(server, target, MSGLEVEL_ACTIONS,
|
||||
printformat(server, target, level,
|
||||
IRCTXT_ACTION_PUBLIC, nick, data);
|
||||
} else {
|
||||
/* message to not existing/active channel */
|
||||
printformat(server, target, MSGLEVEL_ACTIONS,
|
||||
printformat(server, target, level,
|
||||
IRCTXT_ACTION_PUBLIC_CHANNEL, nick, target, data);
|
||||
}
|
||||
} else {
|
||||
/* private action */
|
||||
item = (WI_ITEM_REC *) privmsg_get_query(server, nick, FALSE);
|
||||
printformat(server, nick, MSGLEVEL_ACTIONS,
|
||||
printformat(server, nick, level,
|
||||
item == NULL ? IRCTXT_ACTION_PRIVATE : IRCTXT_ACTION_PRIVATE_QUERY,
|
||||
nick, addr == NULL ? "" : addr, data);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -178,9 +178,11 @@ static void cmd_me(gchar *data, IRC_SERVER_REC *server, WI_IRC_REC *item)
|
|||
if (!irc_item_check(item))
|
||||
return;
|
||||
|
||||
if (server == NULL || !server->connected) cmd_return_error(CMDERR_NOT_CONNECTED);
|
||||
if (server == NULL || !server->connected)
|
||||
cmd_return_error(CMDERR_NOT_CONNECTED);
|
||||
|
||||
printformat(server, item->name, MSGLEVEL_ACTIONS,
|
||||
printformat(server, item->name, MSGLEVEL_ACTIONS | MSGLEVEL_NOHILIGHT |
|
||||
(ischannel(*item->name) ? MSGLEVEL_PUBLIC : MSGLEVEL_MSGS),
|
||||
IRCTXT_OWN_ME, server->nick, data);
|
||||
|
||||
irc_send_cmdv(server, "PRIVMSG %s :\001ACTION %s\001", item->name, data);
|
||||
|
|
@ -192,13 +194,17 @@ static void cmd_action(const char *data, IRC_SERVER_REC *server)
|
|||
void *free_arg;
|
||||
|
||||
g_return_if_fail(data != NULL);
|
||||
if (server == NULL || !server->connected) cmd_return_error(CMDERR_NOT_CONNECTED);
|
||||
if (server == NULL || !server->connected)
|
||||
cmd_return_error(CMDERR_NOT_CONNECTED);
|
||||
|
||||
if (!cmd_get_params(data, &free_arg, 2 | PARAM_FLAG_GETREST, &target, &text))
|
||||
return;
|
||||
if (*target == '\0' || *text == '\0') cmd_param_error(CMDERR_NOT_ENOUGH_PARAMS);
|
||||
if (*target == '\0' || *text == '\0')
|
||||
cmd_param_error(CMDERR_NOT_ENOUGH_PARAMS);
|
||||
|
||||
printformat(server, target, MSGLEVEL_ACTIONS, IRCTXT_OWN_ME, server->nick, text);
|
||||
printformat(server, target, MSGLEVEL_ACTIONS | MSGLEVEL_NOHILIGHT |
|
||||
(ischannel(*target) ? MSGLEVEL_PUBLIC : MSGLEVEL_MSGS),
|
||||
IRCTXT_OWN_ME, server->nick, text);
|
||||
irc_send_cmdv(server, "PRIVMSG %s :\001ACTION %s\001", target, text);
|
||||
cmd_params_free(free_arg);
|
||||
}
|
||||
|
|
@ -236,6 +242,12 @@ static void cmd_ctcp(const char *data, IRC_SERVER_REC *server)
|
|||
return;
|
||||
if (*target == '\0' || *ctcpcmd == '\0') cmd_param_error(CMDERR_NOT_ENOUGH_PARAMS);
|
||||
|
||||
if (*target == '=') {
|
||||
/* don't handle DCC CTCPs */
|
||||
cmd_params_free(free_arg);
|
||||
return;
|
||||
}
|
||||
|
||||
if (*target == '@' && ischannel(target[1]))
|
||||
target++; /* Hybrid 6 feature, send ctcp to all ops in channel */
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue