mirror of
https://github.com/irssi/irssi.git
synced 2024-11-03 04:27:19 -05:00
use extended-join capability
This commit is contained in:
parent
1c99bf78c7
commit
25270e0465
@ -8,6 +8,7 @@ time_t last_check; /* last time gone was checked */
|
||||
char *nick;
|
||||
char *host;
|
||||
char *realname;
|
||||
char *account;
|
||||
int hops;
|
||||
|
||||
/* status in server */
|
||||
|
@ -349,14 +349,15 @@ static void sig_message_own_private(SERVER_REC *server, const char *msg,
|
||||
}
|
||||
|
||||
static void sig_message_join(SERVER_REC *server, const char *channel,
|
||||
const char *nick, const char *address)
|
||||
const char *nick, const char *address,
|
||||
const char *account, const char *realname)
|
||||
{
|
||||
int level = MSGLEVEL_JOINS;
|
||||
|
||||
ignore_check_plus(server, nick, address, channel, NULL, &level, FALSE);
|
||||
|
||||
printformat(server, channel, level,
|
||||
TXT_JOIN, nick, address, channel);
|
||||
TXT_JOIN, nick, address, channel, account, realname);
|
||||
}
|
||||
|
||||
static void sig_message_part(SERVER_REC *server, const char *channel,
|
||||
|
@ -94,7 +94,7 @@ FORMAT_REC fecommon_core_formats[] = {
|
||||
/* ---- */
|
||||
{ NULL, "Channels", 0 },
|
||||
|
||||
{ "join", "{channick_hilight $0} {chanhost_hilight $1} has joined {channel $2}", 3, { 0, 0, 0 } },
|
||||
{ "join", "{channick_hilight $0} {chanhost_hilight $1} has joined {channel $2}", 5, { 0, 0, 0, 0, 0 } },
|
||||
{ "part", "{channick $0} {chanhost $1} has left {channel $2} {reason $3}", 4, { 0, 0, 0, 0 } },
|
||||
{ "kick", "{channick $0} was kicked from {channel $1} by {nick $2} {reason $3}", 5, { 0, 0, 0, 0, 0 } },
|
||||
{ "quit", "{channick $0} {chanhost $1} has quit {reason $2}", 4, { 0, 0, 0, 0 } },
|
||||
|
@ -113,16 +113,16 @@ static void event_notice(IRC_SERVER_REC *server, const char *data,
|
||||
static void event_join(IRC_SERVER_REC *server, const char *data,
|
||||
const char *nick, const char *addr)
|
||||
{
|
||||
char *params, *channel, *tmp;
|
||||
char *params, *channel, *tmp, *account, *realname;
|
||||
|
||||
g_return_if_fail(data != NULL);
|
||||
|
||||
params = event_get_params(data, 1, &channel);
|
||||
params = event_get_params(data, 3, &channel, &account, &realname);
|
||||
tmp = strchr(channel, 7); /* ^G does something weird.. */
|
||||
if (tmp != NULL) *tmp = '\0';
|
||||
|
||||
signal_emit("message join", 4, server,
|
||||
get_visible_target(server, channel), nick, addr);
|
||||
signal_emit("message join", 6, server,
|
||||
get_visible_target(server, channel), nick, addr, account, realname);
|
||||
g_free(params);
|
||||
}
|
||||
|
||||
|
@ -239,6 +239,7 @@ static void server_init(IRC_SERVER_REC *server)
|
||||
irc_cap_toggle(server, CAP_SASL, TRUE);
|
||||
|
||||
irc_cap_toggle(server, CAP_MULTI_PREFIX, TRUE);
|
||||
irc_cap_toggle(server, CAP_EXTENDED_JOIN, TRUE);
|
||||
|
||||
irc_send_cmd_now(server, "CAP LS " CAP_LS_VERSION);
|
||||
|
||||
|
@ -8,6 +8,7 @@
|
||||
#define CAP_LS_VERSION "302"
|
||||
#define CAP_SASL "sasl"
|
||||
#define CAP_MULTI_PREFIX "multi-prefix"
|
||||
#define CAP_EXTENDED_JOIN "extended-join"
|
||||
|
||||
/* returns IRC_SERVER_REC if it's IRC server, NULL if it isn't */
|
||||
#define IRC_SERVER(server) \
|
||||
|
@ -35,7 +35,7 @@ static int massjoin_max_joins;
|
||||
static void event_join(IRC_SERVER_REC *server, const char *data,
|
||||
const char *nick, const char *address)
|
||||
{
|
||||
char *params, *channel, *ptr;
|
||||
char *params, *channel, *account, *realname, *ptr;
|
||||
IRC_CHANNEL_REC *chanrec;
|
||||
NICK_REC *nickrec;
|
||||
GSList *nicks, *tmp;
|
||||
@ -47,7 +47,8 @@ static void event_join(IRC_SERVER_REC *server, const char *data,
|
||||
return;
|
||||
}
|
||||
|
||||
params = event_get_params(data, 1, &channel);
|
||||
params = event_get_params(data, 3, &channel, &account, &realname);
|
||||
|
||||
ptr = strchr(channel, 7); /* ^G does something weird.. */
|
||||
if (ptr != NULL) *ptr = '\0';
|
||||
|
||||
@ -66,6 +67,11 @@ static void event_join(IRC_SERVER_REC *server, const char *data,
|
||||
|
||||
/* add user to nicklist */
|
||||
nickrec = irc_nicklist_insert(chanrec, nick, FALSE, FALSE, FALSE, TRUE, NULL);
|
||||
if (*account != '\0' && g_strcmp0(nickrec->account, account) != 0) {
|
||||
g_free(nickrec->account);
|
||||
nickrec->account = g_strdup(account);
|
||||
}
|
||||
|
||||
nicklist_set_host(CHANNEL(chanrec), nickrec, address);
|
||||
|
||||
if (chanrec->massjoins == 0) {
|
||||
@ -92,6 +98,11 @@ static void event_join(IRC_SERVER_REC *server, const char *data,
|
||||
g_slist_free(nicks);
|
||||
}
|
||||
|
||||
if (*realname != '\0' && g_strcmp0(nickrec->realname, realname) != 0) {
|
||||
g_free(nickrec->realname);
|
||||
nickrec->realname = g_strdup(realname);
|
||||
}
|
||||
|
||||
chanrec->massjoins++;
|
||||
}
|
||||
|
||||
|
@ -426,6 +426,7 @@ void perl_nick_fill_hash(HV *hv, NICK_REC *nick)
|
||||
(void) hv_store(hv, "nick", 4, new_pv(nick->nick), 0);
|
||||
(void) hv_store(hv, "host", 4, new_pv(nick->host), 0);
|
||||
(void) hv_store(hv, "realname", 8, new_pv(nick->realname), 0);
|
||||
(void) hv_store(hv, "account", 7, new_pv(nick->account), 0);
|
||||
(void) hv_store(hv, "hops", 4, newSViv(nick->hops), 0);
|
||||
|
||||
(void) hv_store(hv, "gone", 4, newSViv(nick->gone), 0);
|
||||
|
Loading…
Reference in New Issue
Block a user