mirror of
https://github.com/irssi/irssi.git
synced 2024-09-01 04:14:16 -04:00
Merge pull request #1097 from ailin-nemui/cap-extended-joins
use extended-join capability
This commit is contained in:
commit
6e32c1f638
@ -6,7 +6,7 @@
|
|||||||
#define IRSSI_GLOBAL_CONFIG "irssi.conf" /* config file name in /etc/ */
|
#define IRSSI_GLOBAL_CONFIG "irssi.conf" /* config file name in /etc/ */
|
||||||
#define IRSSI_HOME_CONFIG "config" /* config file name in ~/.irssi/ */
|
#define IRSSI_HOME_CONFIG "config" /* config file name in ~/.irssi/ */
|
||||||
|
|
||||||
#define IRSSI_ABI_VERSION 21
|
#define IRSSI_ABI_VERSION 22
|
||||||
|
|
||||||
#define DEFAULT_SERVER_ADD_PORT 6667
|
#define DEFAULT_SERVER_ADD_PORT 6667
|
||||||
#define DEFAULT_SERVER_ADD_TLS_PORT 6697
|
#define DEFAULT_SERVER_ADD_TLS_PORT 6697
|
||||||
|
@ -8,6 +8,7 @@ time_t last_check; /* last time gone was checked */
|
|||||||
char *nick;
|
char *nick;
|
||||||
char *host;
|
char *host;
|
||||||
char *realname;
|
char *realname;
|
||||||
|
char *account;
|
||||||
int hops;
|
int hops;
|
||||||
|
|
||||||
/* status in server */
|
/* 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,
|
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;
|
int level = MSGLEVEL_JOINS;
|
||||||
|
|
||||||
ignore_check_plus(server, nick, address, channel, NULL, &level, FALSE);
|
ignore_check_plus(server, nick, address, channel, NULL, &level, FALSE);
|
||||||
|
|
||||||
printformat(server, channel, level,
|
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,
|
static void sig_message_part(SERVER_REC *server, const char *channel,
|
||||||
|
@ -94,7 +94,7 @@ FORMAT_REC fecommon_core_formats[] = {
|
|||||||
/* ---- */
|
/* ---- */
|
||||||
{ NULL, "Channels", 0 },
|
{ 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 } },
|
{ "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 } },
|
{ "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 } },
|
{ "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,
|
static void event_join(IRC_SERVER_REC *server, const char *data,
|
||||||
const char *nick, const char *addr)
|
const char *nick, const char *addr)
|
||||||
{
|
{
|
||||||
char *params, *channel, *tmp;
|
char *params, *channel, *tmp, *account, *realname;
|
||||||
|
|
||||||
g_return_if_fail(data != NULL);
|
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.. */
|
tmp = strchr(channel, 7); /* ^G does something weird.. */
|
||||||
if (tmp != NULL) *tmp = '\0';
|
if (tmp != NULL) *tmp = '\0';
|
||||||
|
|
||||||
signal_emit("message join", 4, server,
|
signal_emit("message join", 6, server,
|
||||||
get_visible_target(server, channel), nick, addr);
|
get_visible_target(server, channel), nick, addr, account, realname);
|
||||||
g_free(params);
|
g_free(params);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -233,6 +233,7 @@ static void server_init(IRC_SERVER_REC *server)
|
|||||||
irc_cap_toggle(server, CAP_SASL, TRUE);
|
irc_cap_toggle(server, CAP_SASL, TRUE);
|
||||||
|
|
||||||
irc_cap_toggle(server, CAP_MULTI_PREFIX, 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);
|
irc_send_cmd_now(server, "CAP LS " CAP_LS_VERSION);
|
||||||
|
|
||||||
|
@ -17,6 +17,7 @@
|
|||||||
#define CAP_LS_VERSION "302"
|
#define CAP_LS_VERSION "302"
|
||||||
#define CAP_SASL "sasl"
|
#define CAP_SASL "sasl"
|
||||||
#define CAP_MULTI_PREFIX "multi-prefix"
|
#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 */
|
/* returns IRC_SERVER_REC if it's IRC server, NULL if it isn't */
|
||||||
#define IRC_SERVER(server) \
|
#define IRC_SERVER(server) \
|
||||||
|
@ -35,7 +35,7 @@ static int massjoin_max_joins;
|
|||||||
static void event_join(IRC_SERVER_REC *server, const char *data,
|
static void event_join(IRC_SERVER_REC *server, const char *data,
|
||||||
const char *nick, const char *address)
|
const char *nick, const char *address)
|
||||||
{
|
{
|
||||||
char *params, *channel, *ptr;
|
char *params, *channel, *account, *realname, *ptr;
|
||||||
IRC_CHANNEL_REC *chanrec;
|
IRC_CHANNEL_REC *chanrec;
|
||||||
NICK_REC *nickrec;
|
NICK_REC *nickrec;
|
||||||
GSList *nicks, *tmp;
|
GSList *nicks, *tmp;
|
||||||
@ -47,7 +47,8 @@ static void event_join(IRC_SERVER_REC *server, const char *data,
|
|||||||
return;
|
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.. */
|
ptr = strchr(channel, 7); /* ^G does something weird.. */
|
||||||
if (ptr != NULL) *ptr = '\0';
|
if (ptr != NULL) *ptr = '\0';
|
||||||
|
|
||||||
@ -66,6 +67,11 @@ static void event_join(IRC_SERVER_REC *server, const char *data,
|
|||||||
|
|
||||||
/* add user to nicklist */
|
/* add user to nicklist */
|
||||||
nickrec = irc_nicklist_insert(chanrec, nick, FALSE, FALSE, FALSE, TRUE, NULL);
|
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);
|
nicklist_set_host(CHANNEL(chanrec), nickrec, address);
|
||||||
|
|
||||||
if (chanrec->massjoins == 0) {
|
if (chanrec->massjoins == 0) {
|
||||||
@ -92,6 +98,11 @@ static void event_join(IRC_SERVER_REC *server, const char *data,
|
|||||||
g_slist_free(nicks);
|
g_slist_free(nicks);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (*realname != '\0' && g_strcmp0(nickrec->realname, realname) != 0) {
|
||||||
|
g_free(nickrec->realname);
|
||||||
|
nickrec->realname = g_strdup(realname);
|
||||||
|
}
|
||||||
|
|
||||||
chanrec->massjoins++;
|
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, "nick", 4, new_pv(nick->nick), 0);
|
||||||
(void) hv_store(hv, "host", 4, new_pv(nick->host), 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, "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, "hops", 4, newSViv(nick->hops), 0);
|
||||||
|
|
||||||
(void) hv_store(hv, "gone", 4, newSViv(nick->gone), 0);
|
(void) hv_store(hv, "gone", 4, newSViv(nick->gone), 0);
|
||||||
|
Loading…
Reference in New Issue
Block a user