Replace identify-msg support with solanum.chat/identify-msg.

This commit is contained in:
Sadie Powell 2021-06-18 20:34:11 +01:00 committed by Patrick
parent f5926fbd23
commit 08e13a3ac5
6 changed files with 17 additions and 37 deletions

View File

@ -418,8 +418,6 @@ static int handle_keyx_notice(char *word[], char *word_eol[], void *userdata) {
g_assert(hexchat_set_context(ph, query_ctx) == 1);
dh_message++; /* : prefix */
if (*dh_message == '+' || *dh_message == '-')
dh_message++; /* identify-msg */
if (g_strcmp0 (word[6], "CBC") == 0)
mode = FISH_CBC_MODE;

View File

@ -94,9 +94,6 @@ ctcp_handle (session *sess, char *to, char *nick, char *ip,
char outbuf[1024];
int ctcp_offset = 2;
if (serv->have_idmsg && (word[4][1] == '+' || word[4][1] == '-') )
ctcp_offset = 3;
/* consider DCC to be different from other CTCPs */
if (!g_ascii_strncasecmp (msg, "DCC", 3))
{
@ -129,7 +126,7 @@ ctcp_handle (session *sess, char *to, char *nick, char *ip,
if (ctcp_check (sess, nick, word, word_eol, word[4] + ctcp_offset))
goto generic;
inbound_action (sess, to, nick, ip, msg + 7, FALSE, id, tags_data);
inbound_action (sess, to, nick, ip, msg + 7, FALSE, tags_data->identified, tags_data);
return;
}

View File

@ -567,7 +567,7 @@ typedef struct server
unsigned int have_awaynotify:1;
unsigned int have_uhnames:1;
unsigned int have_whox:1; /* have undernet's WHOX features */
unsigned int have_idmsg:1; /* freenode's IDENTIFY-MSG */
unsigned int have_idmsg:1; /* cap solanum.chat/identify-msg */
unsigned int have_accnotify:1; /* cap account-notify */
unsigned int have_extjoin:1; /* cap extended-join */
unsigned int have_account_tag:1; /* cap account-tag */

View File

@ -190,7 +190,7 @@ inbound_privmsg (server *serv, char *from, char *ip, char *text, int id,
if (ip && ip[0])
set_topic (sess, ip, ip);
inbound_chanmsg (serv, NULL, NULL, from, text, FALSE, id, tags_data);
inbound_chanmsg (serv, NULL, NULL, from, text, FALSE, tags_data->identified, tags_data);
return;
}
@ -1656,7 +1656,7 @@ inbound_toggle_caps (server *serv, const char *extensions_str, gboolean enable)
{
const char *extension = extensions[i];
if (!strcmp (extension, "identify-msg"))
if (!strcmp (extension, "solanum.chat/identify-msg"))
serv->have_idmsg = enable;
else if (!strcmp (extension, "multi-prefix"))
serv->have_namesx = enable;
@ -1713,8 +1713,6 @@ inbound_cap_del (server *serv, char *nick, char *extensions,
}
static const char * const supported_caps[] = {
"identify-msg",
/* IRCv3.1 */
"multi-prefix",
"away-notify",
@ -1737,6 +1735,9 @@ static const char * const supported_caps[] = {
/* Twitch */
"twitch.tv/membership",
/* Solanum */
"solanum.chat/identify-msg",
};
static int

View File

@ -1189,8 +1189,6 @@ process_named_msg (session *sess, char *type, char *word[], char *word_eol[],
case WORDL('N','O','T','I'):
{
int id = FALSE; /* identified */
text = word_eol[4];
if (*text == ':')
{
@ -1219,18 +1217,8 @@ process_named_msg (session *sess, char *type, char *word[], char *word_eol[],
}
#endif
if (serv->have_idmsg)
{
if (*text == '+')
{
id = TRUE;
text++;
} else if (*text == '-')
text++;
}
if (!ignore_check (word[1], IG_NOTI))
inbound_notice (serv, word[3], nick, text, ip, id, tags_data);
inbound_notice (serv, word[3], nick, text, ip, tags_data->identified, tags_data);
}
return;
@ -1238,7 +1226,6 @@ process_named_msg (session *sess, char *type, char *word[], char *word_eol[],
{
char *to = word[3];
int len;
int id = FALSE; /* identified */
if (*to)
{
/* Handle limited channel messages, for now no special event */
@ -1249,15 +1236,7 @@ process_named_msg (session *sess, char *type, char *word[], char *word_eol[],
text = word_eol[4];
if (*text == ':')
text++;
if (serv->have_idmsg)
{
if (*text == '+')
{
id = TRUE;
text++;
} else if (*text == '-')
text++;
}
len = strlen (text);
if (text[0] == 1) /* ctcp */
{
@ -1289,7 +1268,7 @@ process_named_msg (session *sess, char *type, char *word[], char *word_eol[],
}
}
ctcp_handle (sess, to, nick, ip, text, word, word_eol, id,
ctcp_handle (sess, to, nick, ip, text, word, word_eol, tags_data->identified,
tags_data);
/* Note word will be invalid beyond this scope */
@ -1300,13 +1279,13 @@ process_named_msg (session *sess, char *type, char *word[], char *word_eol[],
{
if (ignore_check (word[1], IG_CHAN))
return;
inbound_chanmsg (serv, NULL, to, nick, text, FALSE, id,
inbound_chanmsg (serv, NULL, to, nick, text, FALSE, tags_data->identified,
tags_data);
} else
{
if (ignore_check (word[1], IG_PRIV))
return;
inbound_privmsg (serv, nick, ip, text, id, tags_data);
inbound_privmsg (serv, nick, ip, text, tags_data->identified, tags_data);
}
}
}
@ -1537,6 +1516,9 @@ handle_message_tags (server *serv, const char *tags_str,
if (serv->have_account_tag && !strcmp (key, "account"))
tags_data->account = g_strdup (value);
if (serv->have_idmsg && strcmp (key, "solanum.chat/identified"))
tags_data->identified = TRUE;
if (serv->have_server_time && !strcmp (key, "time"))
handle_message_tag_time (value, tags_data);
}

View File

@ -26,6 +26,7 @@
#define MESSAGE_TAGS_DATA_INIT \
{ \
NULL, /* account name */ \
FALSE, /* identified to nick */ \
(time_t)0, /* timestamp */ \
}
@ -38,6 +39,7 @@
typedef struct
{
char *account;
gboolean identified;
time_t timestamp;
} message_tags_data;