mirror of
https://github.com/irssi/irssi.git
synced 2026-08-11 04:43:34 +02:00
Implement CHANTYPES support
This commit is contained in:
parent
c122a2a226
commit
16c71cf1fb
23 changed files with 57 additions and 55 deletions
|
|
@ -44,7 +44,7 @@ static void dcc_request(CHAT_DCC_REC *dcc)
|
|||
if (!IS_DCC_CHAT(dcc)) return;
|
||||
|
||||
printformat(dcc->server, NULL, MSGLEVEL_DCC,
|
||||
ischannel(*dcc->target) ? IRCTXT_DCC_CHAT_CHANNEL :
|
||||
server_ischannel(SERVER(dcc->server), dcc->target) ? IRCTXT_DCC_CHAT_CHANNEL :
|
||||
IRCTXT_DCC_CHAT, dcc->id, dcc->addrstr,
|
||||
dcc->port, dcc->target);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -21,6 +21,7 @@
|
|||
#include "module.h"
|
||||
#include "signals.h"
|
||||
#include "levels.h"
|
||||
#include "servers.h"
|
||||
|
||||
#include "irc.h"
|
||||
#include "dcc-file.h"
|
||||
|
|
@ -35,12 +36,12 @@ static void dcc_request(GET_DCC_REC *dcc)
|
|||
{
|
||||
char *sizestr;
|
||||
|
||||
if (!IS_DCC_GET(dcc)) return;
|
||||
if (!IS_DCC_GET(dcc)) return;
|
||||
|
||||
sizestr = dcc_get_size_str(dcc->size);
|
||||
|
||||
printformat(dcc->server, NULL, MSGLEVEL_DCC,
|
||||
ischannel(*dcc->target) ? IRCTXT_DCC_SEND_CHANNEL :
|
||||
server_ischannel(SERVER(dcc->server), dcc->target) ? IRCTXT_DCC_SEND_CHANNEL :
|
||||
IRCTXT_DCC_SEND, dcc->nick, dcc->addrstr,
|
||||
dcc->port, dcc->arg, sizestr, dcc->target);
|
||||
|
||||
|
|
|
|||
|
|
@ -49,7 +49,7 @@ static void ctcp_default_msg(IRC_SERVER_REC *server, const char *data,
|
|||
data = p+1;
|
||||
}
|
||||
|
||||
printformat(server, ischannel(*target) ? target : nick, MSGLEVEL_CTCPS,
|
||||
printformat(server, server_ischannel(SERVER(server), target) ? target : nick, MSGLEVEL_CTCPS,
|
||||
IRCTXT_CTCP_REQUESTED_UNKNOWN,
|
||||
nick, addr, cmd, data, target);
|
||||
g_free(cmd);
|
||||
|
|
@ -113,8 +113,8 @@ static void ctcp_default_reply(IRC_SERVER_REC *server, const char *data,
|
|||
ctcpdata = ptr+1;
|
||||
}
|
||||
|
||||
printformat(server, ischannel(*target) ? target : nick, MSGLEVEL_CTCPS,
|
||||
ischannel(*target) ? IRCTXT_CTCP_REPLY_CHANNEL :
|
||||
printformat(server, server_ischannel(SERVER(server), target) ? target : nick, MSGLEVEL_CTCPS,
|
||||
server_ischannel(SERVER(server), target) ? IRCTXT_CTCP_REPLY_CHANNEL :
|
||||
IRCTXT_CTCP_REPLY, ctcp, nick, ctcpdata, target);
|
||||
g_free(ctcp);
|
||||
}
|
||||
|
|
@ -137,7 +137,7 @@ static void ctcp_ping_reply(IRC_SERVER_REC *server, const char *data,
|
|||
|
||||
g_get_current_time(&tv);
|
||||
usecs = get_timeval_diff(&tv, &tv2);
|
||||
printformat(server, ischannel(*target) ? target : nick, MSGLEVEL_CTCPS,
|
||||
printformat(server, server_ischannel(SERVER(server), target) ? target : nick, MSGLEVEL_CTCPS,
|
||||
IRCTXT_CTCP_PING_REPLY, nick, usecs/1000, usecs%1000);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -400,7 +400,7 @@ static void event_target_unavailable(IRC_SERVER_REC *server, const char *data,
|
|||
g_return_if_fail(data != NULL);
|
||||
|
||||
params = event_get_params(data, 2, NULL, &target);
|
||||
if (!ischannel(*target)) {
|
||||
if (!server_ischannel(SERVER(server), target)) {
|
||||
/* nick unavailable */
|
||||
printformat(server, NULL, MSGLEVEL_CRAP,
|
||||
IRCTXT_NICK_UNAVAILABLE, target);
|
||||
|
|
@ -583,7 +583,7 @@ static void print_event_received(IRC_SERVER_REC *server, const char *data,
|
|||
return;
|
||||
ptr++;
|
||||
|
||||
if (ischannel(*data)) /* directed at channel */
|
||||
if (server_ischannel(SERVER(server), data)) /* directed at channel */
|
||||
target = g_strndup(data, (int)(ptr - data - 1));
|
||||
else if (!target_param || *ptr == ':' || (ptr2 = strchr(ptr, ' ')) == NULL)
|
||||
target = NULL;
|
||||
|
|
|
|||
|
|
@ -52,15 +52,15 @@ static void event_privmsg(IRC_SERVER_REC *server, const char *data,
|
|||
params = event_get_params(data, 2 | PARAM_FLAG_GETREST, &target, &msg);
|
||||
if (nick == NULL) nick = server->real_address;
|
||||
if (addr == NULL) addr = "";
|
||||
if (*target == '@' && ischannel(target[1])) {
|
||||
if (*target == '@' && server_ischannel(SERVER(server), &target[1])) {
|
||||
/* Hybrid 6 feature, send msg to all ops in channel */
|
||||
recoded = recode_in(SERVER(server), msg, target+1);
|
||||
signal_emit("message irc op_public", 5,
|
||||
server, recoded, nick, addr,
|
||||
get_visible_target(server, target+1));
|
||||
} else {
|
||||
recoded = recode_in(SERVER(server), msg, ischannel(*target) ? target : nick);
|
||||
signal_emit(ischannel(*target) ?
|
||||
recoded = recode_in(SERVER(server), msg, server_ischannel(SERVER(server), target) ? target : nick);
|
||||
signal_emit(server_ischannel(SERVER(server), target) ?
|
||||
"message public" : "message private", 5,
|
||||
server, recoded, nick, addr,
|
||||
get_visible_target(server, target));
|
||||
|
|
|
|||
|
|
@ -46,7 +46,7 @@ static void sig_event_forward(SERVER_REC *server, const char *data,
|
|||
char *params, *from, *to;
|
||||
|
||||
params = event_get_params(data, 3, NULL, &from, &to);
|
||||
if (from != NULL && to != NULL && ischannel(*from) && ischannel(*to)) {
|
||||
if (from != NULL && to != NULL && server_ischannel(server, *from) && server_ischannel(server, *to)) {
|
||||
channel = irc_channel_find(server, from);
|
||||
if (channel != NULL && irc_channel_find(server, to) == NULL) {
|
||||
window_bind_add(window_item_window(channel),
|
||||
|
|
|
|||
|
|
@ -57,7 +57,7 @@ static const char *skip_target(IRC_SERVER_REC *server, const char *target)
|
|||
break;
|
||||
};
|
||||
|
||||
if(ischannel(target[i]))
|
||||
if(server_ischannel(SERVER(server), &target[i]))
|
||||
target += i;
|
||||
|
||||
return target;
|
||||
|
|
@ -136,7 +136,7 @@ static void sig_message_own_action(IRC_SERVER_REC *server, const char *msg,
|
|||
|
||||
oldtarget = target;
|
||||
target = skip_target(IRC_SERVER(server), target);
|
||||
if (ischannel(*target))
|
||||
if (server_ischannel(SERVER(server), target))
|
||||
item = irc_channel_find(server, target);
|
||||
else
|
||||
item = irc_query_find(server, target);
|
||||
|
|
@ -146,7 +146,7 @@ static void sig_message_own_action(IRC_SERVER_REC *server, const char *msg,
|
|||
|
||||
printformat(server, target,
|
||||
MSGLEVEL_ACTIONS | MSGLEVEL_NOHILIGHT | MSGLEVEL_NO_ACT |
|
||||
(ischannel(*target) ? MSGLEVEL_PUBLIC : MSGLEVEL_MSGS),
|
||||
(server_ischannel(SERVER(server), target) ? MSGLEVEL_PUBLIC : MSGLEVEL_MSGS),
|
||||
item != NULL && oldtarget == target ? IRCTXT_OWN_ACTION : IRCTXT_OWN_ACTION_TARGET,
|
||||
server->nick, msg, oldtarget);
|
||||
g_free_not_null(freemsg);
|
||||
|
|
@ -166,7 +166,7 @@ static void sig_message_irc_action(IRC_SERVER_REC *server, const char *msg,
|
|||
target = skip_target(IRC_SERVER(server), target);
|
||||
|
||||
level = MSGLEVEL_ACTIONS |
|
||||
(ischannel(*target) ? MSGLEVEL_PUBLIC : MSGLEVEL_MSGS);
|
||||
(server_ischannel(SERVER(server), target) ? MSGLEVEL_PUBLIC : MSGLEVEL_MSGS);
|
||||
|
||||
if (ignore_check(SERVER(server), nick, address, target, msg, level))
|
||||
return;
|
||||
|
|
@ -175,7 +175,7 @@ static void sig_message_irc_action(IRC_SERVER_REC *server, const char *msg,
|
|||
level | MSGLEVEL_NO_ACT))
|
||||
level |= MSGLEVEL_NO_ACT;
|
||||
|
||||
if (ischannel(*target)) {
|
||||
if (server_ischannel(SERVER(server), target)) {
|
||||
item = irc_channel_find(server, target);
|
||||
} else {
|
||||
own = (!g_strcmp0(nick, server->nick));
|
||||
|
|
@ -185,7 +185,7 @@ static void sig_message_irc_action(IRC_SERVER_REC *server, const char *msg,
|
|||
if (settings_get_bool("emphasis"))
|
||||
msg = freemsg = expand_emphasis(item, msg);
|
||||
|
||||
if (ischannel(*target)) {
|
||||
if (server_ischannel(SERVER(server), target)) {
|
||||
/* channel action */
|
||||
if (window_item_is_active(item) && target == oldtarget) {
|
||||
/* message to active channel in window */
|
||||
|
|
@ -245,16 +245,16 @@ static void sig_message_irc_notice(SERVER_REC *server, const char *msg,
|
|||
}
|
||||
|
||||
if (ignore_check(server, nick, address,
|
||||
ischannel(*target) ? target : NULL,
|
||||
server_ischannel(SERVER(server), target) ? target : NULL,
|
||||
msg, level))
|
||||
return;
|
||||
|
||||
if (ignore_check(server, nick, address,
|
||||
ischannel(*target) ? target : NULL,
|
||||
server_ischannel(SERVER(server), target) ? target : NULL,
|
||||
msg, level | MSGLEVEL_NO_ACT))
|
||||
level |= MSGLEVEL_NO_ACT;
|
||||
|
||||
if (ischannel(*target)) {
|
||||
if (server_ischannel(SERVER(server), target)) {
|
||||
/* notice in some channel */
|
||||
printformat(server, target, level,
|
||||
IRCTXT_NOTICE_PUBLIC, nick, oldtarget, msg);
|
||||
|
|
@ -283,7 +283,7 @@ static void sig_message_irc_ctcp(IRC_SERVER_REC *server, const char *cmd,
|
|||
|
||||
oldtarget = target;
|
||||
target = skip_target(server, target);
|
||||
printformat(server, ischannel(*target) ? target : nick, MSGLEVEL_CTCPS,
|
||||
printformat(server, server_ischannel(SERVER(server), target) ? target : nick, MSGLEVEL_CTCPS,
|
||||
IRCTXT_CTCP_REQUESTED, nick, addr, cmd, data, oldtarget);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -63,7 +63,7 @@ static void event_privmsg(SERVER_REC *server, const char *data,
|
|||
|
||||
g_return_if_fail(data != NULL);
|
||||
|
||||
if (nick == NULL || address == NULL || ischannel(*data) ||
|
||||
if (nick == NULL || address == NULL || server_ischannel(server, data) ||
|
||||
!settings_get_bool("query_track_nick_changes"))
|
||||
return;
|
||||
|
||||
|
|
|
|||
|
|
@ -168,7 +168,7 @@ static void sig_message_mode(IRC_SERVER_REC *server, const char *channel,
|
|||
mode, MSGLEVEL_MODES))
|
||||
return;
|
||||
|
||||
if (!ischannel(*channel)) {
|
||||
if (!server_ischannel(SERVER(server), channel)) {
|
||||
/* user mode change */
|
||||
printformat(server, NULL, MSGLEVEL_MODES,
|
||||
IRCTXT_USERMODE_CHANGE, mode, channel);
|
||||
|
|
|
|||
|
|
@ -400,7 +400,7 @@ static void msg_mode(IRC_SERVER_REC *server, const char *channel,
|
|||
int show;
|
||||
|
||||
g_return_if_fail(data != NULL);
|
||||
if (!ischannel(*channel) || addr != NULL)
|
||||
if (!server_ischannel(SERVER(server), channel) || addr != NULL)
|
||||
return;
|
||||
|
||||
params = event_get_params(data, 2 | PARAM_FLAG_GETREST,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue