mirror of
https://github.com/irssi/irssi.git
synced 2024-12-04 14:46:39 -05:00
Moved join, part, quit, kick, nick, invite and topic printing to core.
git-svn-id: http://svn.irssi.org/repos/irssi/trunk@726 dbcabf3a-b0e7-0310-adc4-f8d773084564
This commit is contained in:
parent
3c78d95614
commit
f07f552661
@ -23,6 +23,7 @@
|
||||
#include "signals.h"
|
||||
#include "commands.h"
|
||||
#include "levels.h"
|
||||
#include "misc.h"
|
||||
#include "special-vars.h"
|
||||
#include "settings.h"
|
||||
|
||||
@ -31,6 +32,7 @@
|
||||
#include "channels.h"
|
||||
#include "nicklist.h"
|
||||
#include "hilight-text.h"
|
||||
#include "ignore.h"
|
||||
|
||||
static char *get_nickmode(CHANNEL_REC *channel, const char *nick)
|
||||
{
|
||||
@ -53,6 +55,9 @@ static void sig_message_public(SERVER_REC *server, const char *msg,
|
||||
int for_me, print_channel, level;
|
||||
char *color;
|
||||
|
||||
if (ignore_check(server, nick, address, target, msg, MSGLEVEL_PUBLIC))
|
||||
return;
|
||||
|
||||
chanrec = channel_find(server, target);
|
||||
for_me = nick_match_msg(server, msg, server->nick);
|
||||
color = for_me ? NULL :
|
||||
@ -102,6 +107,9 @@ static void sig_message_private(SERVER_REC *server, const char *msg,
|
||||
{
|
||||
QUERY_REC *query;
|
||||
|
||||
if (ignore_check(server, nick, address, NULL, msg, MSGLEVEL_MSGS))
|
||||
return;
|
||||
|
||||
query = query_find(server, nick);
|
||||
printformat(server, nick, MSGLEVEL_MSGS,
|
||||
query == NULL ? IRCTXT_MSG_PRIVATE :
|
||||
@ -203,13 +211,215 @@ static void cmd_msg(const char *data, SERVER_REC *server, WI_ITEM_REC *item)
|
||||
cmd_params_free(free_arg);
|
||||
}
|
||||
|
||||
static void sig_message_join(SERVER_REC *server, const char *channel,
|
||||
const char *nick, const char *address)
|
||||
{
|
||||
if (ignore_check(server, nick, address, channel, NULL, MSGLEVEL_JOINS))
|
||||
return;
|
||||
|
||||
printformat(server, channel, MSGLEVEL_JOINS,
|
||||
IRCTXT_JOIN, nick, address, channel);
|
||||
}
|
||||
|
||||
static void sig_message_part(SERVER_REC *server, const char *channel,
|
||||
const char *nick, const char *address,
|
||||
const char *reason)
|
||||
{
|
||||
if (ignore_check(server, nick, address, channel, NULL, MSGLEVEL_PARTS))
|
||||
return;
|
||||
|
||||
printformat(server, channel, MSGLEVEL_PARTS,
|
||||
IRCTXT_PART, nick, address, channel, reason);
|
||||
}
|
||||
|
||||
static void sig_message_quit(SERVER_REC *server, const char *nick,
|
||||
const char *address, const char *reason)
|
||||
{
|
||||
WINDOW_REC *window;
|
||||
GString *chans;
|
||||
GSList *tmp, *windows;
|
||||
char *print_channel;
|
||||
int once, count;
|
||||
|
||||
if (ignore_check(server, nick, address, NULL, reason, MSGLEVEL_QUITS))
|
||||
return;
|
||||
|
||||
print_channel = NULL;
|
||||
once = settings_get_bool("show_quit_once");
|
||||
|
||||
count = 0; windows = NULL;
|
||||
chans = !once ? NULL : g_string_new(NULL);
|
||||
for (tmp = server->channels; tmp != NULL; tmp = tmp->next) {
|
||||
CHANNEL_REC *rec = tmp->data;
|
||||
|
||||
if (!nicklist_find(rec, nick) ||
|
||||
ignore_check(server, nick, address, rec->name,
|
||||
reason, MSGLEVEL_QUITS))
|
||||
continue;
|
||||
|
||||
if (print_channel == NULL ||
|
||||
active_win->active == (WI_ITEM_REC *) rec)
|
||||
print_channel = rec->name;
|
||||
|
||||
if (!once) {
|
||||
window = window_item_window((WI_ITEM_REC *) rec);
|
||||
if (g_slist_find(windows, window) == NULL) {
|
||||
windows = g_slist_append(windows, window);
|
||||
printformat(server, rec->name, MSGLEVEL_QUITS,
|
||||
IRCTXT_QUIT, nick, address, reason);
|
||||
}
|
||||
} else {
|
||||
g_string_sprintfa(chans, "%s,", rec->name);
|
||||
count++;
|
||||
}
|
||||
}
|
||||
g_slist_free(windows);
|
||||
|
||||
if (once && count > 0) {
|
||||
g_string_truncate(chans, chans->len-1);
|
||||
printformat(server, print_channel, MSGLEVEL_QUITS,
|
||||
count == 1 ? IRCTXT_QUIT : IRCTXT_QUIT_ONCE,
|
||||
nick, address, reason, chans->str);
|
||||
}
|
||||
if (chans != NULL)
|
||||
g_string_free(chans, TRUE);
|
||||
}
|
||||
|
||||
static void sig_message_kick(SERVER_REC *server, const char *channel,
|
||||
const char *nick, const char *kicker,
|
||||
const char *address, const char *reason)
|
||||
{
|
||||
if (ignore_check(server, kicker, address,
|
||||
channel, reason, MSGLEVEL_KICKS))
|
||||
return;
|
||||
|
||||
printformat(server, channel, MSGLEVEL_KICKS,
|
||||
IRCTXT_KICK, nick, channel, kicker, reason);
|
||||
}
|
||||
|
||||
static void print_nick_change_channel(SERVER_REC *server, const char *channel,
|
||||
const char *newnick, const char *oldnick,
|
||||
const char *address,
|
||||
int ownnick)
|
||||
{
|
||||
if (ignore_check(server, oldnick, address,
|
||||
channel, newnick, MSGLEVEL_NICKS))
|
||||
return;
|
||||
|
||||
printformat(server, channel, MSGLEVEL_NICKS,
|
||||
ownnick ? IRCTXT_YOUR_NICK_CHANGED : IRCTXT_NICK_CHANGED,
|
||||
oldnick, newnick);
|
||||
}
|
||||
|
||||
static void print_nick_change(SERVER_REC *server, const char *newnick,
|
||||
const char *oldnick, const char *address,
|
||||
int ownnick)
|
||||
{
|
||||
GSList *tmp, *windows;
|
||||
int msgprint;
|
||||
|
||||
if (ignore_check(server, oldnick, address, NULL, NULL, MSGLEVEL_NICKS))
|
||||
return;
|
||||
|
||||
msgprint = FALSE;
|
||||
|
||||
/* Print to each channel/query where the nick is.
|
||||
Don't print more than once to the same window. */
|
||||
windows = NULL;
|
||||
for (tmp = server->channels; tmp != NULL; tmp = tmp->next) {
|
||||
CHANNEL_REC *channel = tmp->data;
|
||||
WINDOW_REC *window =
|
||||
window_item_window((WI_ITEM_REC *) channel);
|
||||
|
||||
if (nicklist_find(channel, oldnick) == NULL ||
|
||||
g_slist_find(windows, window) != NULL)
|
||||
continue;
|
||||
|
||||
windows = g_slist_append(windows, window);
|
||||
print_nick_change_channel(server, channel->name, newnick,
|
||||
oldnick, address, ownnick);
|
||||
msgprint = TRUE;
|
||||
}
|
||||
|
||||
for (tmp = server->queries; tmp != NULL; tmp = tmp->next) {
|
||||
QUERY_REC *query = tmp->data;
|
||||
WINDOW_REC *window =
|
||||
window_item_window((WI_ITEM_REC *) query);
|
||||
|
||||
if (g_strcasecmp(query->name, oldnick) != 0 ||
|
||||
g_slist_find(windows, window) != NULL)
|
||||
continue;
|
||||
|
||||
windows = g_slist_append(windows, window);
|
||||
print_nick_change_channel(server, query->name, newnick,
|
||||
oldnick, address, ownnick);
|
||||
msgprint = TRUE;
|
||||
}
|
||||
g_slist_free(windows);
|
||||
|
||||
if (!msgprint && ownnick) {
|
||||
printformat(server, NULL, MSGLEVEL_NICKS,
|
||||
IRCTXT_YOUR_NICK_CHANGED, oldnick, newnick);
|
||||
}
|
||||
}
|
||||
|
||||
static void sig_message_nick(SERVER_REC *server, const char *newnick,
|
||||
const char *oldnick, const char *address)
|
||||
{
|
||||
print_nick_change(server, newnick, oldnick, address, FALSE);
|
||||
}
|
||||
|
||||
static void sig_message_own_nick(SERVER_REC *server, const char *newnick,
|
||||
const char *oldnick, const char *address)
|
||||
{
|
||||
print_nick_change(server, newnick, oldnick, address, TRUE);
|
||||
}
|
||||
|
||||
static void sig_message_invite(SERVER_REC *server, const char *channel,
|
||||
const char *nick, const char *address)
|
||||
{
|
||||
char *str;
|
||||
|
||||
if (*channel == '\0' ||
|
||||
ignore_check(server, nick, address,
|
||||
channel, NULL, MSGLEVEL_INVITES))
|
||||
return;
|
||||
|
||||
str = show_lowascii(channel);
|
||||
printformat(server, NULL, MSGLEVEL_INVITES,
|
||||
IRCTXT_INVITE, nick, str);
|
||||
g_free(str);
|
||||
}
|
||||
|
||||
static void sig_message_topic(SERVER_REC *server, const char *channel,
|
||||
const char *topic,
|
||||
const char *nick, const char *address)
|
||||
{
|
||||
if (ignore_check(server, nick, address,
|
||||
channel, topic, MSGLEVEL_TOPICS))
|
||||
return;
|
||||
|
||||
printformat(server, channel, MSGLEVEL_TOPICS,
|
||||
*topic != '\0' ? IRCTXT_NEW_TOPIC : IRCTXT_TOPIC_UNSET,
|
||||
nick, channel, topic);
|
||||
}
|
||||
|
||||
void fe_messages_init(void)
|
||||
{
|
||||
settings_add_bool("lookandfeel", "show_nickmode", TRUE);
|
||||
settings_add_bool("lookandfeel", "print_active_channel", FALSE);
|
||||
settings_add_bool("lookandfeel", "show_quit_once", FALSE);
|
||||
|
||||
signal_add_last("message public", (SIGNAL_FUNC) sig_message_public);
|
||||
signal_add_last("message private", (SIGNAL_FUNC) sig_message_private);
|
||||
signal_add_last("message join", (SIGNAL_FUNC) sig_message_join);
|
||||
signal_add_last("message part", (SIGNAL_FUNC) sig_message_part);
|
||||
signal_add_last("message quit", (SIGNAL_FUNC) sig_message_quit);
|
||||
signal_add_last("message kick", (SIGNAL_FUNC) sig_message_kick);
|
||||
signal_add_last("message nick", (SIGNAL_FUNC) sig_message_nick);
|
||||
signal_add_last("message own_nick", (SIGNAL_FUNC) sig_message_own_nick);
|
||||
signal_add_last("message invite", (SIGNAL_FUNC) sig_message_invite);
|
||||
signal_add_last("message topic", (SIGNAL_FUNC) sig_message_topic);
|
||||
command_bind_last("msg", NULL, (SIGNAL_FUNC) cmd_msg);
|
||||
}
|
||||
|
||||
@ -217,5 +427,13 @@ void fe_messages_deinit(void)
|
||||
{
|
||||
signal_remove("message public", (SIGNAL_FUNC) sig_message_public);
|
||||
signal_remove("message private", (SIGNAL_FUNC) sig_message_private);
|
||||
signal_remove("message join", (SIGNAL_FUNC) sig_message_join);
|
||||
signal_remove("message part", (SIGNAL_FUNC) sig_message_part);
|
||||
signal_remove("message quit", (SIGNAL_FUNC) sig_message_quit);
|
||||
signal_remove("message kick", (SIGNAL_FUNC) sig_message_kick);
|
||||
signal_remove("message nick", (SIGNAL_FUNC) sig_message_nick);
|
||||
signal_remove("message own_nick", (SIGNAL_FUNC) sig_message_own_nick);
|
||||
signal_remove("message invite", (SIGNAL_FUNC) sig_message_invite);
|
||||
signal_remove("message topic", (SIGNAL_FUNC) sig_message_topic);
|
||||
command_unbind("msg", (SIGNAL_FUNC) cmd_msg);
|
||||
}
|
||||
|
@ -63,6 +63,16 @@ FORMAT_REC fecommon_core_formats[] = {
|
||||
/* ---- */
|
||||
{ NULL, "Channels", 0 },
|
||||
|
||||
{ "join", "%c%_$0%_ %K[%c$1%K]%n has joined %_$2", 3, { 0, 0, 0 } },
|
||||
{ "part", "%c$0 %K[%n$1%K]%n has left %_$2%_ %K[%n$3%n%K]", 4, { 0, 0, 0, 0 } },
|
||||
{ "kick", "%c$0%n was kicked from %_$1%_ by %_$2%_ %K[%n$3%K]", 4, { 0, 0, 0, 0 } },
|
||||
{ "quit", "%c$0 %K[%n$1%K]%n has quit IRC %K[%n$2%n%K]", 3, { 0, 0, 0 } },
|
||||
{ "quit_once", "%_$3%_ %c$0 %K[%n$1%K]%n has quit IRC %K[%n$2%K]", 4, { 0, 0, 0, 0 } },
|
||||
{ "invite", "%_$0%_ invites you to %_$1", 2, { 0, 0 } },
|
||||
{ "new_topic", "%_$0%_ changed the topic of %c$1%n to%K:%n $2", 3, { 0, 0, 0 } },
|
||||
{ "topic_unset", "Topic unset by %_$0%_ on %c$1", 2, { 0, 0 } },
|
||||
{ "your_nick_changed", "You're now known as %c$1", 2, { 0, 0 } },
|
||||
{ "nick_changed", "%_$0%_ is now known as %c$1", 2, { 0, 0 } },
|
||||
{ "talking_in", "You are now talking in %_$0%_", 1, { 0 } },
|
||||
{ "not_in_channels", "You are not on any channels", 0 },
|
||||
{ "current_channel", "Current channel $0", 1, { 0 } },
|
||||
|
@ -39,6 +39,16 @@ enum {
|
||||
|
||||
IRCTXT_FILL_3,
|
||||
|
||||
IRCTXT_JOIN,
|
||||
IRCTXT_PART,
|
||||
IRCTXT_KICK,
|
||||
IRCTXT_QUIT,
|
||||
IRCTXT_QUIT_ONCE,
|
||||
IRCTXT_INVITE,
|
||||
IRCTXT_NEW_TOPIC,
|
||||
IRCTXT_TOPIC_UNSET,
|
||||
IRCTXT_YOUR_NICK_CHANGED,
|
||||
IRCTXT_NICK_CHANGED,
|
||||
IRCTXT_TALKING_IN,
|
||||
IRCTXT_NOT_IN_CHANNELS,
|
||||
IRCTXT_CURRENT_CHANNEL,
|
||||
|
@ -95,7 +95,6 @@ void fe_common_irc_init(void)
|
||||
args_register(options);
|
||||
|
||||
settings_add_bool("lookandfeel", "show_away_once", TRUE);
|
||||
settings_add_bool("lookandfeel", "show_quit_once", FALSE);
|
||||
|
||||
theme_register(fecommon_irc_formats);
|
||||
|
||||
|
@ -39,10 +39,8 @@
|
||||
|
||||
#include "completion.h"
|
||||
|
||||
#define target_level(target) \
|
||||
(ischannel((target)[0]) ? MSGLEVEL_PUBLIC : MSGLEVEL_MSGS)
|
||||
|
||||
static void event_privmsg(const char *data, IRC_SERVER_REC *server, const char *nick, const char *addr)
|
||||
static void event_privmsg(const char *data, IRC_SERVER_REC *server,
|
||||
const char *nick, const char *addr)
|
||||
{
|
||||
char *params, *target, *msg;
|
||||
|
||||
@ -52,11 +50,9 @@ static void event_privmsg(const char *data, IRC_SERVER_REC *server, const char *
|
||||
if (nick == NULL) nick = server->real_address;
|
||||
if (addr == NULL) addr = "";
|
||||
|
||||
if (!ignore_check(server, nick, addr, target, msg, target_level(target))) {
|
||||
signal_emit(ischannel(*target) ?
|
||||
"message public" : "message private", 5,
|
||||
server, msg, nick, addr, target);
|
||||
}
|
||||
|
||||
g_free(params);
|
||||
}
|
||||
@ -64,7 +60,8 @@ static void event_privmsg(const char *data, IRC_SERVER_REC *server, const char *
|
||||
/* we use "ctcp msg" here because "ctcp msg action" can be ignored with
|
||||
/IGNORE * CTCPS, and we don't want that.. */
|
||||
static void ctcp_msg_check_action(const char *data, IRC_SERVER_REC *server,
|
||||
const char *nick, const char *addr, const char *target)
|
||||
const char *nick, const char *addr,
|
||||
const char *target)
|
||||
{
|
||||
void *item;
|
||||
int level;
|
||||
@ -77,7 +74,7 @@ static void ctcp_msg_check_action(const char *data, IRC_SERVER_REC *server,
|
||||
|
||||
level = MSGLEVEL_ACTIONS |
|
||||
(ischannel(*target) ? MSGLEVEL_PUBLIC : MSGLEVEL_MSGS);
|
||||
if (ignore_check(server, nick, addr, target, data, level))
|
||||
if (ignore_check(SERVER(server), nick, addr, target, data, level))
|
||||
return;
|
||||
|
||||
if (ischannel(*target)) {
|
||||
@ -102,7 +99,8 @@ static void ctcp_msg_check_action(const char *data, IRC_SERVER_REC *server,
|
||||
}
|
||||
}
|
||||
|
||||
static void event_notice(const char *data, IRC_SERVER_REC *server, const char *nick, const char *addr)
|
||||
static void event_notice(const char *data, IRC_SERVER_REC *server,
|
||||
const char *nick, const char *addr)
|
||||
{
|
||||
char *params, *target, *msg;
|
||||
int op_notice;
|
||||
@ -118,13 +116,13 @@ static void event_notice(const char *data, IRC_SERVER_REC *server, const char *n
|
||||
|
||||
if (addr == NULL) {
|
||||
/* notice from server */
|
||||
if (*msg != 1 && !ignore_check(server, nick, "", target, msg, MSGLEVEL_SNOTES))
|
||||
if (*msg != 1 && !ignore_check(SERVER(server), nick, "", target, msg, MSGLEVEL_SNOTES))
|
||||
printformat(server, target, MSGLEVEL_SNOTES, IRCTXT_NOTICE_SERVER, nick, msg);
|
||||
} else {
|
||||
op_notice = *target == '@' && ischannel(target[1]);
|
||||
if (op_notice) target++;
|
||||
|
||||
if (ignore_check(server, nick, addr, ischannel(*target) ?
|
||||
if (ignore_check(SERVER(server), nick, addr, ischannel(*target) ?
|
||||
target : NULL, msg, MSGLEVEL_NOTICES))
|
||||
return;
|
||||
|
||||
@ -143,7 +141,8 @@ static void event_notice(const char *data, IRC_SERVER_REC *server, const char *n
|
||||
g_free(params);
|
||||
}
|
||||
|
||||
static void event_join(const char *data, IRC_SERVER_REC *server, const char *nick, const char *addr)
|
||||
static void event_join(const char *data, IRC_SERVER_REC *server,
|
||||
const char *nick, const char *addr)
|
||||
{
|
||||
char *params, *channel, *tmp;
|
||||
|
||||
@ -153,150 +152,59 @@ static void event_join(const char *data, IRC_SERVER_REC *server, const char *nic
|
||||
tmp = strchr(channel, 7); /* ^G does something weird.. */
|
||||
if (tmp != NULL) *tmp = '\0';
|
||||
|
||||
if (!ignore_check(server, nick, addr, channel, NULL, MSGLEVEL_JOINS))
|
||||
printformat(server, channel, MSGLEVEL_JOINS, IRCTXT_JOIN, nick, addr, channel);
|
||||
signal_emit("message join", 4, server, channel, nick, addr);
|
||||
g_free(params);
|
||||
}
|
||||
|
||||
static void event_part(const char *data, IRC_SERVER_REC *server, const char *nick, const char *addr)
|
||||
static void event_part(const char *data, IRC_SERVER_REC *server,
|
||||
const char *nick, const char *addr)
|
||||
{
|
||||
char *params, *channel, *reason;
|
||||
|
||||
g_return_if_fail(data != NULL);
|
||||
|
||||
params = event_get_params(data, 2 | PARAM_FLAG_GETREST, &channel, &reason);
|
||||
|
||||
if (!ignore_check(server, nick, addr, channel, NULL, MSGLEVEL_PARTS))
|
||||
printformat(server, channel, MSGLEVEL_PARTS, IRCTXT_PART, nick, addr, channel, reason);
|
||||
params = event_get_params(data, 2 | PARAM_FLAG_GETREST,
|
||||
&channel, &reason);
|
||||
signal_emit("message part", 5, server, channel, nick, addr, reason);
|
||||
g_free(params);
|
||||
}
|
||||
|
||||
static void event_quit(const char *data, IRC_SERVER_REC *server, const char *nick, const char *addr)
|
||||
static void event_quit(const char *data, IRC_SERVER_REC *server,
|
||||
const char *nick, const char *addr)
|
||||
{
|
||||
WINDOW_REC *window;
|
||||
GString *chans;
|
||||
GSList *tmp, *windows;
|
||||
char *print_channel;
|
||||
int once, count;
|
||||
|
||||
g_return_if_fail(data != NULL);
|
||||
|
||||
if (*data == ':') data++; /* quit message */
|
||||
if (ignore_check(server, nick, addr, NULL, data, MSGLEVEL_QUITS))
|
||||
return;
|
||||
|
||||
print_channel = NULL;
|
||||
once = settings_get_bool("show_quit_once");
|
||||
|
||||
count = 0; windows = NULL;
|
||||
chans = !once ? NULL : g_string_new(NULL);
|
||||
for (tmp = channels; tmp != NULL; tmp = tmp->next) {
|
||||
IRC_CHANNEL_REC *rec = tmp->data;
|
||||
|
||||
if (!IS_IRC_CHANNEL(rec) || rec->server != server ||
|
||||
!nicklist_find(CHANNEL(rec), nick) ||
|
||||
ignore_check(server, nick, addr, rec->name, data, MSGLEVEL_QUITS))
|
||||
continue;
|
||||
|
||||
if (print_channel == NULL || active_win->active == (WI_ITEM_REC *) rec)
|
||||
print_channel = rec->name;
|
||||
|
||||
if (!once) {
|
||||
window = window_item_window((WI_ITEM_REC *) rec);
|
||||
if (g_slist_find(windows, window) == NULL) {
|
||||
windows = g_slist_append(windows, window);
|
||||
printformat(server, rec->name, MSGLEVEL_QUITS, IRCTXT_QUIT, nick, addr, data);
|
||||
}
|
||||
} else {
|
||||
g_string_sprintfa(chans, "%s,", rec->name);
|
||||
count++;
|
||||
}
|
||||
}
|
||||
g_slist_free(windows);
|
||||
|
||||
if (once && count > 0) {
|
||||
g_string_truncate(chans, chans->len-1);
|
||||
printformat(server, print_channel, MSGLEVEL_QUITS,
|
||||
count == 1 ? IRCTXT_QUIT : IRCTXT_QUIT_ONCE,
|
||||
nick, addr, data, chans->str);
|
||||
}
|
||||
if (chans != NULL)
|
||||
g_string_free(chans, TRUE);
|
||||
signal_emit("message quit", 4, server, nick, addr, data);
|
||||
}
|
||||
|
||||
static void event_kick(const char *data, IRC_SERVER_REC *server, const char *kicker, const char *addr)
|
||||
static void event_kick(const char *data, IRC_SERVER_REC *server,
|
||||
const char *kicker, const char *addr)
|
||||
{
|
||||
char *params, *channel, *nick, *reason;
|
||||
|
||||
g_return_if_fail(data != NULL);
|
||||
|
||||
params = event_get_params(data, 3 | PARAM_FLAG_GETREST, &channel, &nick, &reason);
|
||||
if (!ignore_check(server, kicker, addr, channel, reason, MSGLEVEL_KICKS)) {
|
||||
printformat(server, channel, MSGLEVEL_KICKS,
|
||||
IRCTXT_KICK, nick, channel, kicker, reason);
|
||||
}
|
||||
params = event_get_params(data, 3 | PARAM_FLAG_GETREST,
|
||||
&channel, &nick, &reason);
|
||||
signal_emit("message kick", 6, server, channel, nick,
|
||||
kicker, addr, reason);
|
||||
g_free(params);
|
||||
}
|
||||
|
||||
static void print_nick_change(IRC_SERVER_REC *server, const char *target, const char *newnick, const char *oldnick, const char *addr, int ownnick)
|
||||
static void event_nick(const char *data, IRC_SERVER_REC *server,
|
||||
const char *sender, const char *addr)
|
||||
{
|
||||
if (ignore_check(server, oldnick, addr, target, newnick, MSGLEVEL_NICKS))
|
||||
return;
|
||||
|
||||
if (ownnick)
|
||||
printformat(server, target, MSGLEVEL_NICKS, IRCTXT_YOUR_NICK_CHANGED, newnick);
|
||||
else
|
||||
printformat(server, target, MSGLEVEL_NICKS, IRCTXT_NICK_CHANGED, oldnick, newnick);
|
||||
}
|
||||
|
||||
static void event_nick(gchar *data, IRC_SERVER_REC *server, gchar *sender, gchar *addr)
|
||||
{
|
||||
GSList *tmp, *windows;
|
||||
char *params, *newnick;
|
||||
int ownnick, msgprint;
|
||||
|
||||
g_return_if_fail(data != NULL);
|
||||
|
||||
if (ignore_check(server, sender, addr, NULL, NULL, MSGLEVEL_NICKS))
|
||||
return;
|
||||
|
||||
params = event_get_params(data, 1, &newnick);
|
||||
|
||||
msgprint = FALSE;
|
||||
ownnick = g_strcasecmp(sender, server->nick) == 0;
|
||||
signal_emit(g_strcasecmp(sender, server->nick) == 0 ?
|
||||
"message own_nick" : "message nick", 4,
|
||||
server, newnick, sender, addr);
|
||||
|
||||
/* Print to each channel/query where the nick is.
|
||||
Don't print more than once to the same window. */
|
||||
windows = NULL;
|
||||
for (tmp = server->channels; tmp != NULL; tmp = tmp->next) {
|
||||
CHANNEL_REC *channel = tmp->data;
|
||||
WINDOW_REC *window =
|
||||
window_item_window((WI_ITEM_REC *) channel);
|
||||
|
||||
if (nicklist_find(channel, sender) &&
|
||||
g_slist_find(windows, window) == NULL) {
|
||||
windows = g_slist_append(windows, window);
|
||||
print_nick_change(server, channel->name, newnick, sender, addr, ownnick);
|
||||
msgprint = TRUE;
|
||||
}
|
||||
}
|
||||
|
||||
for (tmp = server->queries; tmp != NULL; tmp = tmp->next) {
|
||||
QUERY_REC *query = tmp->data;
|
||||
WINDOW_REC *window =
|
||||
window_item_window((WI_ITEM_REC *) query);
|
||||
|
||||
if (g_strcasecmp(query->name, sender) == 0 &&
|
||||
g_slist_find(windows, window) == NULL) {
|
||||
windows = g_slist_append(windows, window);
|
||||
print_nick_change(server, query->name, newnick, sender, addr, ownnick);
|
||||
msgprint = TRUE;
|
||||
}
|
||||
}
|
||||
g_slist_free(windows);
|
||||
|
||||
if (!msgprint && ownnick)
|
||||
printformat(server, NULL, MSGLEVEL_NICKS, IRCTXT_YOUR_NICK_CHANGED, newnick);
|
||||
g_free(params);
|
||||
}
|
||||
|
||||
@ -308,7 +216,7 @@ static void event_mode(const char *data, IRC_SERVER_REC *server, const char *nic
|
||||
if (nick == NULL) nick = server->real_address;
|
||||
|
||||
params = event_get_params(data, 2 | PARAM_FLAG_GETREST, &channel, &mode);
|
||||
if (ignore_check(server, nick, addr, channel, mode, MSGLEVEL_MODES)) {
|
||||
if (ignore_check(SERVER(server), nick, addr, channel, mode, MSGLEVEL_MODES)) {
|
||||
g_free(params);
|
||||
return;
|
||||
}
|
||||
@ -341,33 +249,28 @@ static void event_pong(const char *data, IRC_SERVER_REC *server, const char *nic
|
||||
g_free(params);
|
||||
}
|
||||
|
||||
static void event_invite(const char *data, IRC_SERVER_REC *server, const char *nick, const char *addr)
|
||||
static void event_invite(const char *data, IRC_SERVER_REC *server,
|
||||
const char *nick, const char *addr)
|
||||
{
|
||||
char *params, *channel;
|
||||
|
||||
g_return_if_fail(data != NULL);
|
||||
|
||||
params = event_get_params(data, 2, NULL, &channel);
|
||||
if (*channel != '\0' && !ignore_check(server, nick, addr, channel, NULL, MSGLEVEL_INVITES)) {
|
||||
channel = show_lowascii(channel);
|
||||
printformat(server, NULL, MSGLEVEL_INVITES, IRCTXT_INVITE, nick, channel);
|
||||
g_free(channel);
|
||||
}
|
||||
signal_emit("message invite", 4, server, channel, nick, addr);
|
||||
g_free(params);
|
||||
}
|
||||
|
||||
static void event_topic(const char *data, IRC_SERVER_REC *server, const char *nick, const char *addr)
|
||||
static void event_topic(const char *data, IRC_SERVER_REC *server,
|
||||
const char *nick, const char *addr)
|
||||
{
|
||||
char *params, *channel, *topic;
|
||||
|
||||
g_return_if_fail(data != NULL);
|
||||
|
||||
params = event_get_params(data, 2 | PARAM_FLAG_GETREST, &channel, &topic);
|
||||
|
||||
if (!ignore_check(server, nick, addr, channel, topic, MSGLEVEL_TOPICS))
|
||||
printformat(server, channel, MSGLEVEL_TOPICS,
|
||||
*topic != '\0' ? IRCTXT_NEW_TOPIC : IRCTXT_TOPIC_UNSET,
|
||||
nick, channel, topic);
|
||||
params = event_get_params(data, 2 | PARAM_FLAG_GETREST,
|
||||
&channel, &topic);
|
||||
signal_emit("message topic", 5, server, channel, topic, nick, addr);
|
||||
g_free(params);
|
||||
}
|
||||
|
||||
@ -384,7 +287,7 @@ static void event_wallops(const char *data, IRC_SERVER_REC *server, const char *
|
||||
g_return_if_fail(data != NULL);
|
||||
|
||||
if (*data == ':') data++;
|
||||
if (ignore_check(server, nick, addr, NULL, data, MSGLEVEL_WALLOPS))
|
||||
if (ignore_check(SERVER(server), nick, addr, NULL, data, MSGLEVEL_WALLOPS))
|
||||
return;
|
||||
|
||||
if (g_strncasecmp(data, "\001ACTION", 7) != 0)
|
||||
|
@ -102,7 +102,6 @@ static NETJOIN_REC *netjoin_add(IRC_SERVER_REC *server, const char *nick, GSList
|
||||
|
||||
g_return_val_if_fail(server != NULL, NULL);
|
||||
g_return_val_if_fail(nick != NULL, NULL);
|
||||
g_return_val_if_fail(channels != NULL, NULL);
|
||||
|
||||
rec = g_new0(NETJOIN_REC, 1);
|
||||
rec->nick = g_strdup(nick);
|
||||
@ -297,7 +296,7 @@ static void event_join(const char *data, IRC_SERVER_REC *server,
|
||||
tmp = strchr(channel, 7); /* ^G does something weird.. */
|
||||
if (tmp != NULL) *tmp = '\0';
|
||||
|
||||
if (!ignore_check(server, nick, address, channel, NULL, MSGLEVEL_JOINS)) {
|
||||
if (!ignore_check(SERVER(server), nick, address, channel, NULL, MSGLEVEL_JOINS)) {
|
||||
if (join_tag == -1)
|
||||
join_tag = g_timeout_add(1000, (GSourceFunc) sig_check_netjoins, NULL);
|
||||
|
||||
|
@ -88,8 +88,9 @@ static void get_server_splits(void *key, NETSPLIT_REC *split, TEMP_SPLIT_REC *re
|
||||
for (tmp = split->channels; tmp != NULL; tmp = tmp->next) {
|
||||
NETSPLIT_CHAN_REC *splitchan = tmp->data;
|
||||
|
||||
if (ignore_check(rec->server_rec, split->nick, split->address,
|
||||
splitchan->name, "", MSGLEVEL_QUITS))
|
||||
if (ignore_check(SERVER(rec->server_rec), split->nick,
|
||||
split->address, splitchan->name, "",
|
||||
MSGLEVEL_QUITS))
|
||||
continue;
|
||||
|
||||
chanrec = find_split_chan(rec, splitchan->name);
|
||||
|
@ -48,8 +48,6 @@ FORMAT_REC fecommon_irc_formats[] = {
|
||||
/* ---- */
|
||||
{ NULL, "Channels", 0 },
|
||||
|
||||
{ "join", "%c%_$0%_ %K[%c$1%K]%n has joined %_$2", 3, { 0, 0, 0 } },
|
||||
{ "part", "%c$0 %K[%n$1%K]%n has left %_$2%_ %K[%n$3%n%K]", 4, { 0, 0, 0, 0 } },
|
||||
{ "joinerror_toomany", "Cannot join to channel %_$0%_ %K(%nYou have joined to too many channels%K)", 1, { 0 } },
|
||||
{ "joinerror_full", "Cannot join to channel %_$0%_ %K(%nChannel is full%K)", 1, { 0 } },
|
||||
{ "joinerror_invite", "Cannot join to channel %_$0%_ %K(%nYou must be invited%K)", 1, { 0 } },
|
||||
@ -57,10 +55,6 @@ FORMAT_REC fecommon_irc_formats[] = {
|
||||
{ "joinerror_bad_key", "Cannot join to channel %_$0%_ %K(%nBad channel key%K)", 1, { 0 } },
|
||||
{ "joinerror_bad_mask", "Cannot join to channel %_$0%_ %K(%nBad channel mask%K)", 1, { 0 } },
|
||||
{ "joinerror_unavail", "Cannot join to channel %_$0%_ %K(%nChannel is temporarily unavailable%K)", 1, { 0 } },
|
||||
{ "kick", "%c$0%n was kicked from %_$1%_ by %_$2%_ %K[%n$3%K]", 4, { 0, 0, 0, 0 } },
|
||||
{ "quit", "%c$0 %K[%n$1%K]%n has quit IRC %K[%n$2%n%K]", 3, { 0, 0, 0 } },
|
||||
{ "quit_once", "%_$3%_ %c$0 %K[%n$1%K]%n has quit IRC %K[%n$2%K]", 4, { 0, 0, 0, 0 } },
|
||||
{ "invite", "%_$0%_ invites you to %_$1", 2, { 0, 0 } },
|
||||
{ "inviting", "Inviting $0 to %_$1", 2, { 0, 0 } },
|
||||
{ "not_invited", "You have not been invited to a channel!", 0 },
|
||||
{ "names", "%K[%g%_Users%_%K(%g$0%K)]%n $1", 2, { 0, 0 } },
|
||||
@ -69,8 +63,6 @@ FORMAT_REC fecommon_irc_formats[] = {
|
||||
{ "channel_created", "Channel %_$0%_ created $1", 2, { 0, 0 } },
|
||||
{ "topic", "Topic for %c$0%K:%n $1", 2, { 0, 0 } },
|
||||
{ "no_topic", "No topic set for %c$0", 1, { 0 } },
|
||||
{ "new_topic", "%_$0%_ changed the topic of %c$1%n to%K:%n $2", 3, { 0, 0, 0 } },
|
||||
{ "topic_unset", "Topic unset by %_$0%_ on %c$1", 2, { 0, 0 } },
|
||||
{ "topic_info", "Topic set by %_$0%_ %K[%n$1%K]", 2, { 0, 0 } },
|
||||
{ "chanmode_change", "mode/%c$0 %K[%n$1%K]%n by %_$2", 3, { 0, 0, 0 } },
|
||||
{ "server_chanmode_change", "%RServerMode/%c$0 %K[%n$1%K]%n by %_$2", 3, { 0, 0, 0 } },
|
||||
@ -95,8 +87,6 @@ FORMAT_REC fecommon_irc_formats[] = {
|
||||
{ "nick_away", "$0 is away: $1", 2, { 0, 0 } },
|
||||
{ "no_such_nick", "$0: No such nick/channel", 1, { 0 } },
|
||||
{ "your_nick", "Your nickname is $0", 1, { 0 } },
|
||||
{ "your_nick_changed", "You're now known as %c$0", 1, { 0 } },
|
||||
{ "nick_changed", "%_$0%_ is now known as %c$1", 2, { 0, 0 } },
|
||||
{ "nick_in_use", "Nick %_$0%_ is already in use", 1, { 0 } },
|
||||
{ "nick_unavailable", "Nick %_$0%_ is temporarily unavailable", 1, { 0 } },
|
||||
{ "your_nick_owned", "Your nick is owned by %_$3%_ %K[%n$1@$2%K]", 4, { 0, 0, 0, 0 } },
|
||||
|
@ -25,8 +25,6 @@ enum {
|
||||
|
||||
IRCTXT_FILL_2,
|
||||
|
||||
IRCTXT_JOIN,
|
||||
IRCTXT_PART,
|
||||
IRCTXT_JOINERROR_TOOMANY,
|
||||
IRCTXT_JOINERROR_FULL,
|
||||
IRCTXT_JOINERROR_INVITE,
|
||||
@ -34,10 +32,6 @@ enum {
|
||||
IRCTXT_JOINERROR_BAD_KEY,
|
||||
IRCTXT_JOINERROR_BAD_MASK,
|
||||
IRCTXT_JOINERROR_UNAVAIL,
|
||||
IRCTXT_KICK,
|
||||
IRCTXT_QUIT,
|
||||
IRCTXT_QUIT_ONCE,
|
||||
IRCTXT_INVITE,
|
||||
IRCTXT_INVITING,
|
||||
IRCTXT_NOT_INVITED,
|
||||
IRCTXT_NAMES,
|
||||
@ -46,8 +40,6 @@ enum {
|
||||
IRCTXT_CHANNEL_CREATED,
|
||||
IRCTXT_TOPIC,
|
||||
IRCTXT_NO_TOPIC,
|
||||
IRCTXT_NEW_TOPIC,
|
||||
IRCTXT_TOPIC_UNSET,
|
||||
IRCTXT_TOPIC_INFO,
|
||||
IRCTXT_CHANMODE_CHANGE,
|
||||
IRCTXT_SERVER_CHANMODE_CHANGE,
|
||||
@ -71,8 +63,6 @@ enum {
|
||||
IRCTXT_NICK_AWAY,
|
||||
IRCTXT_NO_SUCH_NICK,
|
||||
IRCTXT_YOUR_NICK,
|
||||
IRCTXT_YOUR_NICK_CHANGED,
|
||||
IRCTXT_NICK_CHANGED,
|
||||
IRCTXT_NICK_IN_USE,
|
||||
IRCTXT_NICK_UNAVAILABLE,
|
||||
IRCTXT_YOUR_NICK_OWNED,
|
||||
|
Loading…
Reference in New Issue
Block a user