From 333a02d015fcea22a7ac5aaec086ec17b8bb195d Mon Sep 17 00:00:00 2001 From: Sadie Powell Date: Tue, 1 Jun 2021 06:25:19 +0100 Subject: Implement support for the IRCv3 UTF8ONLY specification. https://ircv3.net/specs/extensions/utf8-only --- src/common/modes.c | 3 +++ 1 file changed, 3 insertions(+) (limited to 'src/common') diff --git a/src/common/modes.c b/src/common/modes.c index 82b466cb..17f9ce99 100644 --- a/src/common/modes.c +++ b/src/common/modes.c @@ -913,6 +913,9 @@ inbound_005 (server * serv, char *word[], const message_tags_data *tags_data) { server_set_encoding (serv, "UTF-8"); } + } else if (g_strcmp0 (tokname, "UTF8ONLY") == 0) + { + server_set_encoding (serv, "UTF-8"); } else if (g_strcmp0 (tokname, "NAMESX") == 0) { /* 12345678901234567 */ -- cgit 1.4.1 From 09e9d1f749aa2d1ba2daaa114a25c3129dd9c4a9 Mon Sep 17 00:00:00 2001 From: DasBrain Date: Thu, 27 May 2021 09:35:47 +0200 Subject: Place ChanServ notices in the front buffer if the front buffer is on the same network. --- src/common/inbound.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'src/common') diff --git a/src/common/inbound.c b/src/common/inbound.c index 7175b2ae..8b48bd7f 100644 --- a/src/common/inbound.c +++ b/src/common/inbound.c @@ -107,7 +107,8 @@ find_session_from_nick (char *nick, server *serv) if (serv->front_session) { - if (userlist_find (serv->front_session, nick)) + // If we are here for ChanServ, then it is usually a reply for the user + if (!g_ascii_strcasecmp(nick, "ChanServ") || userlist_find (serv->front_session, nick)) return serv->front_session; } -- cgit 1.4.1 From 747a52aae8806a9072a23ea68212767f352ac431 Mon Sep 17 00:00:00 2001 From: Sadie Powell Date: Sun, 23 May 2021 06:58:18 +0100 Subject: Default new servers to use TLS if built with OpenSSL. --- src/common/outbound.c | 2 +- src/common/servlist.c | 3 +++ src/fe-gtk/servlistgui.c | 14 ++++++++++---- 3 files changed, 14 insertions(+), 5 deletions(-) (limited to 'src/common') diff --git a/src/common/outbound.c b/src/common/outbound.c index 614aad38..e8d35c96 100644 --- a/src/common/outbound.c +++ b/src/common/outbound.c @@ -3930,7 +3930,7 @@ cmd_voice (struct session *sess, char *tbuf, char *word[], char *word_eol[]) const struct commands xc_cmds[] = { {"ADDBUTTON", cmd_addbutton, 0, 0, 1, N_("ADDBUTTON , adds a button under the user-list")}, - {"ADDSERVER", cmd_addserver, 0, 0, 1, N_("ADDSERVER , adds a new network with a new server to the network list")}, + {"ADDSERVER", cmd_addserver, 0, 0, 1, N_("ADDSERVER , adds a new network with a new server to the network list")}, {"ALLCHAN", cmd_allchannels, 0, 0, 1, N_("ALLCHAN , sends a command to all channels you're in")}, {"ALLCHANL", cmd_allchannelslocal, 0, 0, 1, diff --git a/src/common/servlist.c b/src/common/servlist.c index 79a5694b..45bc4999 100644 --- a/src/common/servlist.c +++ b/src/common/servlist.c @@ -947,6 +947,9 @@ servlist_net_add (char *name, char *comment, int prepend) net = g_new0 (ircnet, 1); net->name = g_strdup (name); net->flags = FLAG_CYCLE | FLAG_USE_GLOBAL | FLAG_USE_PROXY; +#ifdef USE_OPENSSL + net->flags |= FLAG_USE_SSL; +#endif if (prepend) network_list = g_slist_prepend (network_list, net); diff --git a/src/fe-gtk/servlistgui.c b/src/fe-gtk/servlistgui.c index b22330ac..0220525d 100644 --- a/src/fe-gtk/servlistgui.c +++ b/src/fe-gtk/servlistgui.c @@ -39,6 +39,12 @@ #define SERVLIST_X_PADDING 4 /* horizontal paddig in the network editor */ #define SERVLIST_Y_PADDING 0 /* vertical padding in the network editor */ +#ifdef USE_OPENSSL +# define DEFAULT_SERVER "irc.example.com/6697" +#else +# define DEFAULT_SERVER "irc.example.com/6667" +#endif + /* servlistgui.c globals */ static GtkWidget *serverlist_win = NULL; static GtkWidget *networks_tree; /* network TreeView */ @@ -299,7 +305,7 @@ servlist_networks_populate_ (GtkWidget *treeview, GSList *netlist, gboolean favo if (!netlist) { net = servlist_net_add (_("New Network"), "", FALSE); - servlist_server_add (net, "newserver/6667"); + servlist_server_add (net, DEFAULT_SERVER); netlist = network_list; } store = (GtkListStore *)gtk_tree_view_get_model (GTK_TREE_VIEW (treeview)); @@ -434,10 +440,10 @@ servlist_addserver (void) return; store = GTK_LIST_STORE (gtk_tree_view_get_model (GTK_TREE_VIEW (edit_trees[SERVER_TREE]))); - servlist_server_add (selected_net, "newserver/6667"); + servlist_server_add (selected_net, DEFAULT_SERVER); gtk_list_store_append (store, &iter); - gtk_list_store_set (store, &iter, 0, "newserver/6667", 1, TRUE, -1); + gtk_list_store_set (store, &iter, 0, DEFAULT_SERVER, 1, TRUE, -1); /* select this server */ servlist_select_and_show (GTK_TREE_VIEW (edit_trees[SERVER_TREE]), &iter, store); @@ -498,7 +504,7 @@ servlist_addnet_cb (GtkWidget *item, GtkTreeView *treeview) net = servlist_net_add (_("New Network"), "", TRUE); net->encoding = g_strdup (IRC_DEFAULT_CHARSET); - servlist_server_add (net, "newserver/6667"); + servlist_server_add (net, DEFAULT_SERVER); store = (GtkListStore *)gtk_tree_view_get_model (treeview); gtk_list_store_prepend (store, &iter); -- cgit 1.4.1 From 1f608e600bfb77a3e9bf013690515de65ec08a7d Mon Sep 17 00:00:00 2001 From: Sadie Powell Date: Sun, 30 May 2021 06:25:09 +0100 Subject: Require opting out of SSL verification in /server and /reconnect. --- src/common/outbound.c | 34 ++++++++++++++++++++++------------ 1 file changed, 22 insertions(+), 12 deletions(-) (limited to 'src/common') diff --git a/src/common/outbound.c b/src/common/outbound.c index e8d35c96..0248a58d 100644 --- a/src/common/outbound.c +++ b/src/common/outbound.c @@ -3225,16 +3225,19 @@ cmd_reconnect (struct session *sess, char *tbuf, char *word[], char *word_eol[]) else if (*word[2]) { int offset = 0; -#ifdef USE_OPENSSL - int use_ssl = FALSE; - if (strcmp (word[2], "-ssl") == 0) +#ifdef USE_OPENSSL + if (g_strcmp0 (word[2], "-ssl") == 0) + { + serv->use_ssl = TRUE; + serv->accept_invalid_cert = FALSE; + offset++; /* args move up by 1 word */ + } else if (g_strcmp0 (word[2], "-ssl-noverify") == 0) { - use_ssl = TRUE; + serv->use_ssl = TRUE; + serv->accept_invalid_cert = TRUE; offset++; /* args move up by 1 word */ } - serv->use_ssl = use_ssl; - serv->accept_invalid_cert = TRUE; #endif if (*word[4+offset]) @@ -3422,15 +3425,22 @@ cmd_server (struct session *sess, char *tbuf, char *word[], char *word_eol[]) char *channel = NULL; char *key = NULL; int use_ssl = FALSE; + int use_ssl_noverify = FALSE; int is_url = TRUE; server *serv = sess->server; ircnet *net = NULL; #ifdef USE_OPENSSL /* BitchX uses -ssl, mIRC uses -e, let's support both */ - if (strcmp (word[2], "-ssl") == 0 || strcmp (word[2], "-e") == 0) + if (g_strcmp0 (word[2], "-ssl") == 0 || g_strcmp0 (word[2], "-e") == 0) + { + use_ssl = TRUE; + offset++; /* args move up by 1 word */ + } + else if (g_strcmp0 (word[2], "-ssl-noverify") == 0) { use_ssl = TRUE; + use_ssl_noverify = TRUE; offset++; /* args move up by 1 word */ } #endif @@ -3497,7 +3507,7 @@ cmd_server (struct session *sess, char *tbuf, char *word[], char *word_eol[]) #ifdef USE_OPENSSL serv->use_ssl = use_ssl; - serv->accept_invalid_cert = TRUE; + serv->accept_invalid_cert = use_ssl_noverify; #endif /* try to connect by Network name */ @@ -3528,7 +3538,7 @@ cmd_servchan (struct session *sess, char *tbuf, char *word[], int offset = 0; #ifdef USE_OPENSSL - if (strcmp (word[2], "-ssl") == 0) + if (g_strcmp0 (word[2], "-ssl") == 0 || g_strcmp0 (word[2], "-ssl-noverify") == 0) offset++; #endif @@ -4077,7 +4087,7 @@ const struct commands xc_cmds[] = { N_("QUOTE , sends the text in raw form to the server")}, #ifdef USE_OPENSSL {"RECONNECT", cmd_reconnect, 0, 0, 1, - N_("RECONNECT [-ssl] [] [] [], Can be called just as /RECONNECT to reconnect to the current server or with /RECONNECT ALL to reconnect to all the open servers")}, + N_("RECONNECT [-ssl|-ssl-noverify] [] [] [], Can be called just as /RECONNECT to reconnect to the current server or with /RECONNECT ALL to reconnect to all the open servers")}, #else {"RECONNECT", cmd_reconnect, 0, 0, 1, N_("RECONNECT [] [] [], Can be called just as /RECONNECT to reconnect to the current server or with /RECONNECT ALL to reconnect to all the open servers")}, @@ -4089,14 +4099,14 @@ const struct commands xc_cmds[] = { {"SEND", cmd_send, 0, 0, 1, N_("SEND []")}, #ifdef USE_OPENSSL {"SERVCHAN", cmd_servchan, 0, 0, 1, - N_("SERVCHAN [-ssl] , connects and joins a channel")}, + N_("SERVCHAN [-ssl|-ssl-noverify] , connects and joins a channel")}, #else {"SERVCHAN", cmd_servchan, 0, 0, 1, N_("SERVCHAN , connects and joins a channel")}, #endif #ifdef USE_OPENSSL {"SERVER", cmd_server, 0, 0, 1, - N_("SERVER [-ssl] [] [], connects to a server, the default port is 6667 for normal connections, and 6697 for ssl connections")}, + N_("SERVER [-ssl|-ssl-noverify] [] [], connects to a server, the default port is 6667 for normal connections, and 6697 for ssl connections")}, #else {"SERVER", cmd_server, 0, 0, 1, N_("SERVER [] [], connects to a server, the default port is 6667")}, -- cgit 1.4.1 From f5926fbd2392476f918fb1ab2a405c1c451359a1 Mon Sep 17 00:00:00 2001 From: Sadie Powell Date: Mon, 31 May 2021 01:11:19 +0100 Subject: Consistently set the SSL state in /reconnect. We need to use a temporary variable here as we're overwriting the existing server object which may have values set here already. --- src/common/outbound.c | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) (limited to 'src/common') diff --git a/src/common/outbound.c b/src/common/outbound.c index 0248a58d..c39a1d46 100644 --- a/src/common/outbound.c +++ b/src/common/outbound.c @@ -3227,17 +3227,21 @@ cmd_reconnect (struct session *sess, char *tbuf, char *word[], char *word_eol[]) int offset = 0; #ifdef USE_OPENSSL + int use_ssl = FALSE; + int use_ssl_noverify = FALSE; if (g_strcmp0 (word[2], "-ssl") == 0) { - serv->use_ssl = TRUE; - serv->accept_invalid_cert = FALSE; + use_ssl = TRUE; + use_ssl_noverify = FALSE; offset++; /* args move up by 1 word */ } else if (g_strcmp0 (word[2], "-ssl-noverify") == 0) { - serv->use_ssl = TRUE; - serv->accept_invalid_cert = TRUE; + use_ssl = TRUE; + use_ssl_noverify = TRUE; offset++; /* args move up by 1 word */ } + serv->use_ssl = use_ssl; + serv->accept_invalid_cert = use_ssl_noverify; #endif if (*word[4+offset]) -- cgit 1.4.1 From 08e13a3ac58896fd9a0a2e5a004f9b180d1dfeeb Mon Sep 17 00:00:00 2001 From: Sadie Powell Date: Fri, 18 Jun 2021 20:34:11 +0100 Subject: Replace identify-msg support with solanum.chat/identify-msg. --- plugins/fishlim/plugin_hexchat.c | 2 -- src/common/ctcp.c | 5 +---- src/common/hexchat.h | 2 +- src/common/inbound.c | 9 +++++---- src/common/proto-irc.c | 34 ++++++++-------------------------- src/common/proto-irc.h | 2 ++ 6 files changed, 17 insertions(+), 37 deletions(-) (limited to 'src/common') diff --git a/plugins/fishlim/plugin_hexchat.c b/plugins/fishlim/plugin_hexchat.c index 83286e28..93e28487 100644 --- a/plugins/fishlim/plugin_hexchat.c +++ b/plugins/fishlim/plugin_hexchat.c @@ -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; diff --git a/src/common/ctcp.c b/src/common/ctcp.c index a8e1ea8d..f9c05440 100644 --- a/src/common/ctcp.c +++ b/src/common/ctcp.c @@ -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; } diff --git a/src/common/hexchat.h b/src/common/hexchat.h index d8effa1f..5c9949a2 100644 --- a/src/common/hexchat.h +++ b/src/common/hexchat.h @@ -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 */ diff --git a/src/common/inbound.c b/src/common/inbound.c index 8b48bd7f..3c505a57 100644 --- a/src/common/inbound.c +++ b/src/common/inbound.c @@ -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 diff --git a/src/common/proto-irc.c b/src/common/proto-irc.c index c8e44b62..54a73e97 100644 --- a/src/common/proto-irc.c +++ b/src/common/proto-irc.c @@ -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); } diff --git a/src/common/proto-irc.h b/src/common/proto-irc.h index 0f72c644..6f52f1bc 100644 --- a/src/common/proto-irc.h +++ b/src/common/proto-irc.h @@ -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; -- cgit 1.4.1 From 55e4f1c42e8d1131b01659fad67db5d084780227 Mon Sep 17 00:00:00 2001 From: Sadie Powell Date: Tue, 1 Jun 2021 13:31:38 +0100 Subject: Implement support for strikethrough text. https://defs.ircdocs.horse/info/formatting.html --- src/common/outbound.c | 3 +++ src/common/util.c | 1 + src/fe-gtk/maingui.c | 5 ++++- src/fe-gtk/sexy-spell-entry.c | 20 ++++++++++++++++++++ src/fe-gtk/xtext.c | 17 +++++++++++++++++ src/fe-gtk/xtext.h | 22 ++++++++++++---------- 6 files changed, 57 insertions(+), 11 deletions(-) (limited to 'src/common') diff --git a/src/common/outbound.c b/src/common/outbound.c index c39a1d46..70fcd436 100644 --- a/src/common/outbound.c +++ b/src/common/outbound.c @@ -4434,6 +4434,9 @@ check_special_chars (char *cmd, int do_ascii) /* check for %X */ case 'I': buf[i] = '\035'; break; + case 'S': + buf[i] = '\036'; + break; case 'C': buf[i] = '\003'; break; diff --git a/src/common/util.c b/src/common/util.c index 5b5fb23f..fa0783d4 100644 --- a/src/common/util.c +++ b/src/common/util.c @@ -329,6 +329,7 @@ strip_color2 (const char *src, int len, char *dst, int flags) case '\026': /*ATTR_REVERSE: */ case '\002': /*ATTR_BOLD: */ case '\037': /*ATTR_UNDERLINE: */ + case '\036': /*ATTR_STRIKETHROUGH: */ case '\035': /*ATTR_ITALICS: */ if (!(flags & STRIP_ATTRIB)) goto pass_char; break; diff --git a/src/fe-gtk/maingui.c b/src/fe-gtk/maingui.c index 4e5baaa0..b77da59b 100644 --- a/src/fe-gtk/maingui.c +++ b/src/fe-gtk/maingui.c @@ -1394,6 +1394,8 @@ mg_color_insert (GtkWidget *item, gpointer userdata) text = "\037"; break; case 102: text = "\035"; break; + case 103: + text = "\036"; break; default: text = "\017"; break; } @@ -1447,7 +1449,8 @@ mg_create_color_menu (GtkWidget *menu, session *sess) mg_markup_item (submenu, _("Bold"), 100); mg_markup_item (submenu, _("Underline"), 101); mg_markup_item (submenu, _("Italic"), 102); - mg_markup_item (submenu, _("Normal"), 103); + mg_markup_item (submenu, _("Strikethrough"), 103); + mg_markup_item (submenu, _("Normal"), 999); subsubmenu = mg_submenu (submenu, _("Colors 0-7")); diff --git a/src/fe-gtk/sexy-spell-entry.c b/src/fe-gtk/sexy-spell-entry.c index dce19b82..04ff0f8a 100644 --- a/src/fe-gtk/sexy-spell-entry.c +++ b/src/fe-gtk/sexy-spell-entry.c @@ -389,6 +389,17 @@ insert_italic (SexySpellEntry *entry, guint start, gboolean toggle) pango_attr_list_change (entry->priv->attr_list, iattr); } +static void +insert_strikethrough (SexySpellEntry *entry, guint start, gboolean toggle) +{ + PangoAttribute *sattr; + + sattr = pango_attr_strikethrough_new (!toggle); + sattr->start_index = start; + sattr->end_index = PANGO_ATTR_INDEX_TO_TEXT_END; + pango_attr_list_change (entry->priv->attr_list, sattr); +} + static void insert_color (SexySpellEntry *entry, guint start, int fgcolor, int bgcolor) { @@ -429,6 +440,7 @@ insert_reset (SexySpellEntry *entry, guint start) insert_bold (entry, start, TRUE); insert_underline (entry, start, TRUE); insert_italic (entry, start, TRUE); + insert_strikethrough (entry, start, TRUE); insert_color (entry, start, -1, -1); } @@ -918,6 +930,7 @@ check_attributes (SexySpellEntry *entry, const char *text, int len) gboolean bold = FALSE; gboolean italic = FALSE; gboolean underline = FALSE; + gboolean strikethrough = FALSE; int parsing_color = 0; char fg_color[3]; char bg_color[3]; @@ -942,6 +955,12 @@ check_attributes (SexySpellEntry *entry, const char *text, int len) italic = !italic; goto check_color; + case ATTR_STRIKETHROUGH: + insert_hiddenchar (entry, i, i + 1); + insert_strikethrough (entry, i, strikethrough); + strikethrough = !strikethrough; + goto check_color; + case ATTR_UNDERLINE: insert_hiddenchar (entry, i, i + 1); insert_underline (entry, i, underline); @@ -954,6 +973,7 @@ check_attributes (SexySpellEntry *entry, const char *text, int len) bold = FALSE; italic = FALSE; underline = FALSE; + strikethrough = FALSE; goto check_color; case ATTR_HIDDEN: diff --git a/src/fe-gtk/xtext.c b/src/fe-gtk/xtext.c index 418bb4da..6a0fccba 100644 --- a/src/fe-gtk/xtext.c +++ b/src/fe-gtk/xtext.c @@ -433,6 +433,7 @@ gtk_xtext_init (GtkXText * xtext) xtext->nc = 0; xtext->pixel_offset = 0; xtext->underline = FALSE; + xtext->strikethrough = FALSE; xtext->hidden = FALSE; xtext->font = NULL; xtext->layout = NULL; @@ -2451,6 +2452,7 @@ gtk_xtext_strip_color (unsigned char *text, int len, unsigned char *outbuf, case ATTR_REVERSE: case ATTR_BOLD: case ATTR_UNDERLINE: + case ATTR_STRIKETHROUGH: case ATTR_ITALICS: xtext_do_chunk (&c); if (*text == ATTR_RESET) @@ -2627,6 +2629,13 @@ gtk_xtext_render_flush (GtkXText * xtext, int x, int y, unsigned char *str, g_object_unref (pix); } + if (xtext->strikethrough) + { + /* pango_attr_strikethrough_new does not render in the custom widget so we need to reinvent the wheel */ + y = dest_y + (xtext->fontsize / 2); + gdk_draw_line (xtext->draw_buf, gc, dest_x, y, dest_x + str_width - 1, y); + } + if (xtext->underline) { dounder: @@ -2651,6 +2660,7 @@ gtk_xtext_reset (GtkXText * xtext, int mark, int attribs) if (attribs) { xtext->underline = FALSE; + xtext->strikethrough = FALSE; xtext->hidden = FALSE; } if (!mark) @@ -2961,6 +2971,12 @@ gtk_xtext_render_str (GtkXText * xtext, int y, textentry * ent, pstr += j + 1; j = 0; break; + case ATTR_STRIKETHROUGH: + RENDER_FLUSH; + xtext->strikethrough = !xtext->strikethrough; + pstr += j + 1; + j = 0; + break; case ATTR_ITALICS: RENDER_FLUSH; *emphasis ^= EMPH_ITAL; @@ -3191,6 +3207,7 @@ find_next_wrap (GtkXText * xtext, textentry * ent, unsigned char *str, case ATTR_REVERSE: case ATTR_BOLD: case ATTR_UNDERLINE: + case ATTR_STRIKETHROUGH: case ATTR_ITALICS: if (*str == ATTR_RESET) emphasis = 0; diff --git a/src/fe-gtk/xtext.h b/src/fe-gtk/xtext.h index 12d6f563..18d769fb 100644 --- a/src/fe-gtk/xtext.h +++ b/src/fe-gtk/xtext.h @@ -29,16 +29,17 @@ #define GTK_IS_XTEXT_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GTK_TYPE_XTEXT)) #define GTK_XTEXT_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GTK_TYPE_XTEXT, GtkXTextClass)) -#define ATTR_BOLD '\002' -#define ATTR_COLOR '\003' -#define ATTR_BLINK '\006' -#define ATTR_BEEP '\007' -#define ATTR_HIDDEN '\010' -#define ATTR_ITALICS2 '\011' -#define ATTR_RESET '\017' -#define ATTR_REVERSE '\026' -#define ATTR_ITALICS '\035' -#define ATTR_UNDERLINE '\037' +#define ATTR_BOLD '\002' +#define ATTR_COLOR '\003' +#define ATTR_BLINK '\006' +#define ATTR_BEEP '\007' +#define ATTR_HIDDEN '\010' +#define ATTR_ITALICS2 '\011' +#define ATTR_RESET '\017' +#define ATTR_REVERSE '\026' +#define ATTR_ITALICS '\035' +#define ATTR_STRIKETHROUGH '\036' +#define ATTR_UNDERLINE '\037' /* these match palette.h */ #define XTEXT_MIRC_COLS 32 @@ -207,6 +208,7 @@ struct _GtkXText /* current text states */ unsigned int underline:1; + unsigned int strikethrough:1; unsigned int hidden:1; /* text parsing states */ -- cgit 1.4.1 From d5b45773157f40e1f078a5b02695d3fa2bb41b2d Mon Sep 17 00:00:00 2001 From: Sadie Powell Date: Mon, 21 Jun 2021 00:29:36 +0100 Subject: Implement generic support for IRCv3 standard replies. (#2589) https://ircv3.net/specs/extensions/standard-replies Co-authored-by: Patrick --- src/common/proto-irc.c | 45 +++++++++++++++++++++++++++++++++++++++++++++ src/common/text.c | 11 +++++++++++ src/common/textevents.in | 36 ++++++++++++++++++++++++++++++++++++ 3 files changed, 92 insertions(+) (limited to 'src/common') diff --git a/src/common/proto-irc.c b/src/common/proto-irc.c index 54a73e97..e0aa888e 100644 --- a/src/common/proto-irc.c +++ b/src/common/proto-irc.c @@ -460,6 +460,18 @@ channel_date (session *sess, char *chan, char *timestr, tags_data->timestamp); } +static int +trailing_index(const char *word_eol[]) +{ + int param_index; + for (param_index = 3; param_index < PDIWORDS; ++param_index) + { + if (word_eol[param_index][0] == ':') + break; + } + return param_index; +} + static void process_numeric (session * sess, int n, char *word[], char *word_eol[], char *text, @@ -1139,6 +1151,39 @@ process_named_msg (session *sess, char *type, char *word[], char *word_eol[], (word_eol[3][0] == ':') ? word_eol[3] + 1 : NULL, tags_data); return; + + case WORDL('F','A','I','L'): + text = STRIP_COLON(word, word_eol, trailing_index(word_eol)); + if (g_strcmp0(word[3], "*") == 0) + { + EMIT_SIGNAL_TIMESTAMP (XP_TE_FAIL, sess, word[4], text, NULL, NULL, NULL, tags_data->timestamp); + } else + { + EMIT_SIGNAL_TIMESTAMP (XP_TE_FAILCMD, sess, word[3], word[4], text, NULL, NULL, tags_data->timestamp); + } + return; + + case WORDL('W','A','R','N'): + text = STRIP_COLON(word, word_eol, trailing_index(word_eol)); + if (g_strcmp0(word[3], "*") == 0) + { + EMIT_SIGNAL_TIMESTAMP (XP_TE_WARN, sess, word[4], text, NULL, NULL, NULL, tags_data->timestamp); + } else + { + EMIT_SIGNAL_TIMESTAMP (XP_TE_WARNCMD, sess, word[3], word[4], text, NULL, NULL, tags_data->timestamp); + } + return; + + case WORDL('N','O','T','E'): + text = STRIP_COLON(word, word_eol, trailing_index(word_eol)); + if (g_strcmp0(word[3], "*") == 0) + { + EMIT_SIGNAL_TIMESTAMP (XP_TE_NOTE, sess, word[4], text, NULL, NULL, NULL, tags_data->timestamp); + } else + { + EMIT_SIGNAL_TIMESTAMP (XP_TE_NOTECMD, sess, word[3], word[4], text, NULL, NULL, tags_data->timestamp); + } + return; } goto garbage; diff --git a/src/common/text.c b/src/common/text.c index b0a90e03..a77700fa 100644 --- a/src/common/text.c +++ b/src/common/text.c @@ -1512,6 +1512,17 @@ static char * const pevt_discon_help[] = { N_("Error"), }; +static char * const pevt_stdrpl_help[] = { + N_("Error Code"), + N_("Error Message"), +}; + +static char * const pevt_stdrplcmd_help[] = { + N_("Command"), + N_("Error Code"), + N_("Error Message"), +}; + #include "textevents.h" static void diff --git a/src/common/textevents.in b/src/common/textevents.in index 14bd4b06..19b0d497 100644 --- a/src/common/textevents.in +++ b/src/common/textevents.in @@ -436,6 +436,18 @@ pevt_discon_help %C20*%O$tDisconnected (%C20$1%O) 1 +Fail +XP_TE_FAIL +pevt_stdrpl_help +%C20*%O$t$2%O +2 + +Fail Command +XP_TE_FAILCMD +pevt_stdrplcmd_help +%C20*%O$t$1: $3%O +3 + Found IP XP_TE_FOUNDIP pevt_foundip_help @@ -574,6 +586,18 @@ pevt_generic_none_help %C23*%O$tNo process is currently running 0 +Note +XP_TE_NOTE +pevt_stdrpl_help +%C22*%O$t$2%O +2 + +Note Command +XP_TE_NOTECMD +pevt_stdrplcmd_help +%C22*%O$t$1: $3%O +3 + Notice XP_TE_NOTICE pevt_notice_help @@ -802,6 +826,18 @@ pevt_usersonchan_help %C22*%O$tUsers on %C22$1%C: %C24$2%O 2 +Warn +XP_TE_WARN +pevt_stdrpl_help +%C23*%O$t$2%O +2 + +Warn Command +XP_TE_WARNCMD +pevt_stdrplcmd_help +%C23*%O$t$1: $3%O +3 + WhoIs Authenticated XP_TE_WHOIS_AUTH pevt_whoisauth_help -- cgit 1.4.1 From 199c03c8c671d86819cace9a75d7f6bca54b6589 Mon Sep 17 00:00:00 2001 From: Sadie Powell Date: Tue, 22 Jun 2021 13:59:43 +0100 Subject: Fix parsing +beI lists on InspIRCd. --- src/common/proto-irc.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'src/common') diff --git a/src/common/proto-irc.c b/src/common/proto-irc.c index e0aa888e..501bf5a0 100644 --- a/src/common/proto-irc.c +++ b/src/common/proto-irc.c @@ -813,7 +813,7 @@ process_numeric (session * sess, int n, break; case 346: /* +I-list entry */ - if (!inbound_banlist (sess, atol (word[7]), word[4], word[5], word[6], 346, + if (!inbound_banlist (sess, atol (STRIP_COLON (word, word_eol, 7)), word[4], word[5], word[6], 346, tags_data)) goto def; break; @@ -824,7 +824,7 @@ process_numeric (session * sess, int n, break; case 348: /* +e-list entry */ - if (!inbound_banlist (sess, atol (word[7]), word[4], word[5], word[6], 348, + if (!inbound_banlist (sess, atol (STRIP_COLON (word, word_eol, 7)), word[4], word[5], word[6], 348, tags_data)) goto def; break; @@ -849,7 +849,7 @@ process_numeric (session * sess, int n, break; case 367: /* banlist entry */ - if (!inbound_banlist (sess, atol (word[7]), word[4], word[5], word[6], 367, + if (!inbound_banlist (sess, atol (STRIP_COLON (word, word_eol, 7)), word[4], word[5], word[6], 367, tags_data)) goto def; break; -- cgit 1.4.1 From c9145a14600abaed617de3d35689719af23168ea Mon Sep 17 00:00:00 2001 From: moon <86449186+spirocybin@users.noreply.github.com> Date: Fri, 25 Jun 2021 19:14:42 -0600 Subject: Update servlist.c - Network clean up (#2597) Added 1 server to Aitvaras Added 1 server to EFNet Added 2 servers to chatpat (previously UniBG) Added DosersNET Put network list into alphabetical order. Removed 2 servers from EFNet Removed 3 servers from Aitvaras Removed 3 servers from UniBG (now chatpat) Removed AccessIRC (no longer exists) Removed BetaChat (no longer exists) Removed Buddy.IM (no longer exists) Removed ChatNet (no longer exists) Removed ChattingAway (no longer exists) Removed Criten (connects to Rizon) Removed DeltaPool for having zero connections and channels. Removed ElectroCode (no longer exists) Removed GalaxyNet (no longer exists) Removed GeeksIRC (no longer exists) Removed IdleMonkeys (no longer exists) Removed IndirectIRC (no longer exists) Removed iZ-smart.net (no longer exists) Removed ObsidianIRC (no longer exists) Removed PonyChat (no longer exists) Removed SceneNet (connects to ChatJunkies) Removed SeilEn.de (no longer exists) Removed SolidIRC (no longer exists) Removed StarChat (no longer exists) Removed TURLINet (no longer exists) Removed WorldNet (no longer exists) Renamed DeltaAnime to DaIRC Renamed Irctoo.net to IRCtoo Renamed KBFail to Keyboard-Failure Renamed Krstarica to PIK Renamed OzNet to OzOrg Renamed PIRC.PL to pirc.pl Renamed PTNet.org to PTNet Renamed UniBG to chatpat --- src/common/servlist.c | 119 +++++++++++--------------------------------------- 1 file changed, 25 insertions(+), 94 deletions(-) (limited to 'src/common') diff --git a/src/common/servlist.c b/src/common/servlist.c index 45bc4999..d9ea6e45 100644 --- a/src/common/servlist.c +++ b/src/common/servlist.c @@ -54,10 +54,6 @@ static const struct defaultserver def[] = /* Invalid hostname in cert */ {0, "irc.2600.net"}, - {"AccessIRC", 0}, - /* Self signed */ - {0, "irc.accessirc.net"}, - {"ACN", 0, 0, 0, LOGIN_SASL, 0, TRUE}, {0, "global.acn.gr"}, @@ -67,15 +63,11 @@ static const struct defaultserver def[] = {"Aitvaras", 0}, #ifdef USE_OPENSSL {0, "irc.data.lt/+6668"}, - {0, "irc.omnitel.net/+6668"}, - {0, "irc.ktu.lt/+6668"}, - {0, "irc.kis.lt/+6668"}, + {0, "irc.omicron.lt/+6668"}, {0, "irc.vub.lt/+6668"}, #endif {0, "irc.data.lt"}, - {0, "irc.omnitel.net"}, - {0, "irc.ktu.lt"}, - {0, "irc.kis.lt"}, + {0, "irc.omicron.lt"}, {0, "irc.vub.lt"}, {"Anthrochat", 0, 0, 0, 0, 0, TRUE}, @@ -90,10 +82,6 @@ static const struct defaultserver def[] = {"AzzurraNet", 0}, {0, "irc.azzurra.org"}, - {"BetaChat", 0, 0, 0, LOGIN_SASL}, - {0, "irc.betachat.net"}, - {"BuddyIM", 0, 0, 0, LOGIN_SASL, 0, TRUE}, - {0, "irc.buddy.im"}, {"Canternet", 0, 0, 0, LOGIN_SASL, 0, TRUE}, {0, "irc.canternet.org"}, @@ -103,19 +91,16 @@ static const struct defaultserver def[] = {"ChatJunkies", 0}, {0, "irc.chatjunkies.org"}, - {"ChatNet", 0}, - {0, "irc.chatnet.org"}, + {"chatpat", 0, 0, "CP1251", LOGIN_CUSTOM, "MSG NS IDENTIFY %p"}, + {0, "irc.unibg.net"}, + {0, "irc.chatpat.bg"}, {"ChatSpike", 0, 0, 0, LOGIN_SASL}, {0, "irc.chatspike.net"}, - {"ChattingAway", 0}, - {0, "irc.chattingaway.com"}, - - {"Criten", 0}, - /* Self signed */ - {0, "irc.criten.net"}, - + {"DaIRC", 0}, + {0, "irc.dairc.net"}, + {"DALnet", 0, 0, 0, LOGIN_NICKSERV}, /* Self signed */ {0, "us.dal.net"}, @@ -132,19 +117,17 @@ static const struct defaultserver def[] = {"Dark-Tou-Net", 0}, {0, "irc.d-t-net.de"}, - - {"DeltaAnime", 0}, - {0, "irc.deltaanime.net"}, + +#ifdef USE_OPENSSL + {"DosersNET", 0, 0, 0, LOGIN_SASL, 0, TRUE}, + {0, "irc.dosers.net/+6697"}, +#endif {"EFnet", 0}, {0, "irc.choopa.net"}, - {0, "irc.paraphysics.net"}, {0, "efnet.port80.se"}, {0, "irc.underworld.no"}, - {0, "irc.inet.tele.dk"}, - - {"ElectroCode", 0, 0, 0, LOGIN_SASL, 0, TRUE}, - {0, "irc.electrocode.net"}, + {0, "efnet.deic.eu"}, {"EnterTheGame", 0}, {0, "irc.enterthegame.com"}, @@ -171,15 +154,8 @@ static const struct defaultserver def[] = /* irc. points to chat. but many users and urls still reference it */ {0, "irc.freenode.net"}, - {"GalaxyNet", 0}, - {0, "irc.galaxynet.org"}, - {"GameSurge", 0}, {0, "irc.gamesurge.net"}, - - {"GeeksIRC", 0, 0, 0, LOGIN_SASL}, - /* Self signed */ - {0, "irc.geeksirc.net"}, {"GeekShed", 0, 0, 0, 0, 0, TRUE}, {0, "irc.geekshed.net"}, @@ -206,13 +182,6 @@ static const struct defaultserver def[] = {"Hashmark", 0}, {0, "irc.hashmark.net"}, - - {"IdleMonkeys", 0}, - {0, "irc.idlemonkeys.net"}, - - {"IndirectIRC", 0, 0, 0, LOGIN_SASL}, - /* Self signed */ - {0, "irc.indirectirc.com"}, {"Interlinked", 0, 0, 0, LOGIN_SASL, 0, TRUE}, {0, "irc.interlinked.me"}, @@ -226,19 +195,16 @@ static const struct defaultserver def[] = {"IRCNet", 0}, {0, "open.ircnet.net"}, - {"Irctoo.net", 0}, + {"IRCtoo", 0}, {0, "irc.irctoo.net"}, - {"iZ-smart.net", 0, 0, "CP1252"}, - {0, "irc.iz-smart.net"}, - - {"KBFail", 0}, + {"Keyboard-Failure", 0}, /* SSL is self-signed */ {0, "irc.kbfail.net"}, - {"Krstarica", 0}, - {0, "irc.krstarica.com"}, - + {"Libera.Chat", 0, 0, 0, LOGIN_SASL, 0, TRUE}, + {0, "irc.libera.chat"}, + #ifdef USE_OPENSSL {"LibertaCasa", 0, 0, 0, LOGIN_SASL, 0, TRUE}, {0, "irc.liberta.casa"}, @@ -248,9 +214,6 @@ static const struct defaultserver def[] = /* Self signed */ {0, "irc.librairc.net"}, - {"Libera.Chat", 0, 0, 0, LOGIN_SASL, 0, TRUE}, - {0, "irc.libera.chat"}, - #ifdef USE_OPENSSL {"LinkNet", 0}, {0, "irc.link-net.org/+7000"}, @@ -262,10 +225,6 @@ static const struct defaultserver def[] = {"MIXXnet", 0}, {0, "irc.mixxnet.net"}, - {"ObsidianIRC", 0}, - /* Self signed */ - {0, "irc.obsidianirc.net"}, - {"Oceanius", 0, 0, 0, LOGIN_SASL}, /* Self signed */ {0, "irc.oceanius.com"}, @@ -276,16 +235,16 @@ static const struct defaultserver def[] = {"OtherNet", 0}, {0, "irc.othernet.org"}, - {"OzNet", 0}, + {"OzOrg", 0}, {0, "irc.oz.org"}, - {"PIRC.PL", 0, 0, 0, 0, 0, TRUE}, + {"PIK", 0}, + {0, "irc.krstarica.com"}, + + {"pirc.pl", 0, 0, 0, 0, 0, TRUE}, {0, "irc.pirc.pl"}, - - {"PonyChat", 0, 0, 0, LOGIN_SASL, 0, TRUE}, - {0, "irc.ponychat.net"}, - {"PTNet.org", 0}, + {"PTNet", 0}, {0, "irc.ptnet.org"}, {0, "uevora.ptnet.org"}, {0, "claranet.ptnet.org"}, @@ -306,12 +265,6 @@ static const struct defaultserver def[] = {0, "irc.ru"}, {0, "irc.lucky.net"}, - {"SceneNet", 0}, - {0, "irc.scene.org"}, - - {"SeilEn.de", 0, 0, "CP1252"}, - {0, "irc.seilen.de"}, - {"Serenity-IRC", 0}, {0, "irc.serenity-irc.net"}, @@ -328,10 +281,6 @@ static const struct defaultserver def[] = {"Sohbet.Net", 0, 0, "CP1254"}, {0, "irc.sohbet.net"}, - {"SolidIRC", 0}, - /* Self signed */ - {0, "irc.solidirc.com"}, - {"SorceryNet", 0, 0, 0, LOGIN_SASL}, /* Self signed */ {0, "irc.sorcery.net"}, @@ -339,9 +288,6 @@ static const struct defaultserver def[] = {"SpotChat", 0, 0, 0, LOGIN_SASL, 0, TRUE}, {0, "irc.spotchat.org"}, - {"StarChat", 0}, - {0, "irc.starchat.net"}, - {"Station51", 0}, /* Self signed */ {0, "irc.station51.net"}, @@ -370,27 +316,12 @@ static const struct defaultserver def[] = {0, "coconut.tripsit.me"}, {0, "innsbruck.tripsit.me"}, #endif - - {"TURLINet", 0, 0, 0, 0, 0, TRUE}, - /* Other servers use CP1251 and invalid certs */ - {0, "irc.servx.ru"}, {"UnderNet", 0, 0, 0, LOGIN_CUSTOM, "MSG x@channels.undernet.org login %u %p"}, {0, "us.undernet.org"}, - {"UniBG", 0, 0, "CP1251", LOGIN_CUSTOM, "MSG NS IDENTIFY %p"}, - {0, "irc.lirex.com"}, - {0, "irc.naturella.com"}, - {0, "irc.techno-link.com"}, - - {"Worldnet", 0}, - {0, "irc.worldnet.net"}, - {"Xertion", 0, 0, 0, LOGIN_SASL, 0, TRUE}, {0, "irc.xertion.org"}, - - {"DeltaPool", 0, 0, 0, LOGIN_SASL, 0, TRUE}, - {0, "irc.deltapool.net"}, {0,0} }; -- cgit 1.4.1 From c5e0b22c55546f48f4c6f0380aa06e54ca485074 Mon Sep 17 00:00:00 2001 From: Patrick Date: Sat, 26 Jun 2021 10:51:32 -0500 Subject: servlist: Add ICQ-Chat Closes #2506 --- src/common/servlist.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'src/common') diff --git a/src/common/servlist.c b/src/common/servlist.c index d9ea6e45..c5772bdb 100644 --- a/src/common/servlist.c +++ b/src/common/servlist.c @@ -182,7 +182,10 @@ static const struct defaultserver def[] = {"Hashmark", 0}, {0, "irc.hashmark.net"}, - + + {"ICQ-Chat", 0, 0, 0, LOGIN_SASL, 0, TRUE}, + {0, "irc.icq-chat.com"}, + {"Interlinked", 0, 0, 0, LOGIN_SASL, 0, TRUE}, {0, "irc.interlinked.me"}, -- cgit 1.4.1 From 816769af5b9379142861632b528c82b836ae6c77 Mon Sep 17 00:00:00 2001 From: adamus1red Date: Tue, 29 Jun 2021 18:32:14 +0100 Subject: Add DigitalIRC to default servlist.c --- src/common/servlist.c | 3 +++ 1 file changed, 3 insertions(+) (limited to 'src/common') diff --git a/src/common/servlist.c b/src/common/servlist.c index c5772bdb..39bee877 100644 --- a/src/common/servlist.c +++ b/src/common/servlist.c @@ -118,6 +118,9 @@ static const struct defaultserver def[] = {"Dark-Tou-Net", 0}, {0, "irc.d-t-net.de"}, + {"DigitalIRC", 0, 0, 0, LOGIN_SASL, 0, TRUE}, + {0, "irc.digitalirc.org"}, + #ifdef USE_OPENSSL {"DosersNET", 0, 0, 0, LOGIN_SASL, 0, TRUE}, {0, "irc.dosers.net/+6697"}, -- cgit 1.4.1 From cfb43bf5505a853cd8f80db2cfa9a1240e726cb8 Mon Sep 17 00:00:00 2001 From: Valerie Pond <79415174+ValwareIRC@users.noreply.github.com> Date: Fri, 2 Jul 2021 03:36:29 +0100 Subject: servlist: Add back TURLINet (#2602) --- src/common/servlist.c | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'src/common') diff --git a/src/common/servlist.c b/src/common/servlist.c index 39bee877..e7f22cc9 100644 --- a/src/common/servlist.c +++ b/src/common/servlist.c @@ -315,6 +315,12 @@ static const struct defaultserver def[] = {"tilde.chat", 0, 0, 0, LOGIN_SASL, 0, TRUE}, {0, "irc.tilde.chat"}, + {"TURLINet", 0, 0, 0, 0, 0, TRUE}, + /* all servers use UTF-8 and valid certs */ + {0, "irc.servx.org"}, + {0, "i.valware.uk"}, + + #ifdef USE_OPENSSL {"TripSit", 0, 0, 0, LOGIN_SASL, 0, TRUE}, {0, "irc.tripsit.me"}, -- cgit 1.4.1 From c8536ed50c5472bf9b8ac958367ebb5eba26a20f Mon Sep 17 00:00:00 2001 From: Patrick Date: Fri, 9 Jul 2021 19:29:21 -0500 Subject: servlist: Remove freenode Closes #2604 --- src/common/servlist.c | 5 ----- 1 file changed, 5 deletions(-) (limited to 'src/common') diff --git a/src/common/servlist.c b/src/common/servlist.c index e7f22cc9..a203e702 100644 --- a/src/common/servlist.c +++ b/src/common/servlist.c @@ -152,11 +152,6 @@ static const struct defaultserver def[] = /* Self signed */ {0, "irc.fdfnet.net"}, - {"freenode", 0, 0, 0, LOGIN_SASL, 0, TRUE}, - {0, "chat.freenode.net"}, - /* irc. points to chat. but many users and urls still reference it */ - {0, "irc.freenode.net"}, - {"GameSurge", 0}, {0, "irc.gamesurge.net"}, -- cgit 1.4.1 From 25440a07c3b421134b4376d7db3ee4b7ed57ad98 Mon Sep 17 00:00:00 2001 From: Michael Catanzaro Date: Mon, 12 Jul 2021 08:38:02 -0500 Subject: Avoid direct use of libproxy Since hexchat already depends on GLib, it's better to use GProxyResolver instead. This might use libproxy, or not, as appropriate. P.S. This removes a memory safety issue because proxy_list is allocated using malloc(), not g_malloc(), and therefore using g_strfreev() is incorrect. The proper way to free the proxy list returned by libproxy is to use px_proxy_factory_free_proxies() (but nobody does that because it was added in libproxy 0.4.16, which is somewhat recent). --- meson.build | 1 - meson_options.txt | 3 --- src/common/hexchat.c | 16 ---------------- src/common/meson.build | 4 ---- src/common/server.c | 26 ++++++++++++++++---------- src/fe-gtk/setup.c | 2 -- 6 files changed, 16 insertions(+), 36 deletions(-) (limited to 'src/common') diff --git a/meson.build b/meson.build index 9b33574b..0f5faca8 100644 --- a/meson.build +++ b/meson.build @@ -33,7 +33,6 @@ config_h.set10('ENABLE_NLS', true) # Optional features config_h.set('USE_OPENSSL', get_option('with-ssl')) -config_h.set('USE_LIBPROXY', get_option('with-libproxy')) config_h.set('USE_LIBCANBERRA', get_option('with-libcanberra')) config_h.set('USE_DBUS', get_option('with-dbus')) config_h.set('USE_PLUGIN', get_option('with-plugin')) diff --git a/meson_options.txt b/meson_options.txt index 100a5ee7..ad03d6bc 100644 --- a/meson_options.txt +++ b/meson_options.txt @@ -13,9 +13,6 @@ option('with-plugin', type: 'boolean', option('with-dbus', type: 'boolean', description: 'Support used for single-instance and scripting interface, Unix only' ) -option('with-libproxy', type: 'boolean', - description: 'Support for getting proxy information, Unix only' -) option('with-libnotify', type: 'boolean', description: 'Support for freedesktop notifications, Unix only' ) diff --git a/src/common/hexchat.c b/src/common/hexchat.c index 8702c63d..3ba7ed6d 100644 --- a/src/common/hexchat.c +++ b/src/common/hexchat.c @@ -57,10 +57,6 @@ #include /* for g_type_init() */ #endif -#ifdef USE_LIBPROXY -#include -#endif - GSList *popup_list = 0; GSList *button_list = 0; GSList *dlgbutton_list = 0; @@ -111,10 +107,6 @@ struct session *current_tab; struct session *current_sess = 0; struct hexchatprefs prefs; -#ifdef USE_LIBPROXY -pxProxyFactory *libproxy_factory; -#endif - /* * Update the priority queue of the "interesting sessions" * (sess_list_by_lastact). @@ -1102,10 +1094,6 @@ main (int argc, char *argv[]) hexchat_remote (); #endif -#ifdef USE_LIBPROXY - libproxy_factory = px_proxy_factory_new (); -#endif - #ifdef WIN32 coinit_result = CoInitializeEx (NULL, COINIT_APARTMENTTHREADED); if (SUCCEEDED (coinit_result)) @@ -1148,10 +1136,6 @@ main (int argc, char *argv[]) } #endif -#ifdef USE_LIBPROXY - px_proxy_factory_free (libproxy_factory); -#endif - #ifdef WIN32 WSACleanup (); #endif diff --git a/src/common/meson.build b/src/common/meson.build index 492227b2..09491e84 100644 --- a/src/common/meson.build +++ b/src/common/meson.build @@ -77,10 +77,6 @@ if get_option('with-ssl') common_deps += libssl_dep endif -if get_option('with-libproxy') - common_deps += dependency('libproxy-1.0') -endif - if get_option('with-libcanberra') common_deps += dependency('libcanberra', version: '>= 0.22') endif diff --git a/src/common/server.c b/src/common/server.c index 5c645eb5..4f809fa8 100644 --- a/src/common/server.c +++ b/src/common/server.c @@ -61,10 +61,6 @@ #include "ssl.h" #endif -#ifdef USE_LIBPROXY -#include -#endif - #ifdef USE_OPENSSL /* local variables */ static struct session *g_sess = NULL; @@ -78,9 +74,15 @@ static void server_disconnect (session * sess, int sendquit, int err); static int server_cleanup (server * serv); static void server_connect (server *serv, char *hostname, int port, int no_login); -#ifdef USE_LIBPROXY -extern pxProxyFactory *libproxy_factory; -#endif +static void +write_error (char *message, GError **error) +{ + if (error == NULL || *error == NULL) { + return; + } + g_printerr ("%s: %s\n", message, (*error)->message); + g_clear_error (error); +} /* actually send to the socket. This might do a character translation or send via SSL. server/dcc both use this function. */ @@ -1392,14 +1394,16 @@ server_child (server * serv) if (!serv->dont_use_proxy) /* blocked in serverlist? */ { -#ifdef USE_LIBPROXY if (prefs.hex_net_proxy_type == 5) { char **proxy_list; char *url, *proxy; + GProxyResolver *resolver; + GError *error = NULL; + resolver = g_proxy_resolver_get_default (); url = g_strdup_printf ("irc://%s:%d", hostname, port); - proxy_list = px_proxy_factory_get_proxies (libproxy_factory, url); + proxy_list = g_proxy_resolver_lookup (resolver, url, NULL, &error); if (proxy_list) { /* can use only one */ @@ -1412,6 +1416,8 @@ server_child (server * serv) proxy_type = 3; else if (!strncmp (proxy, "socks", 5)) proxy_type = 2; + } else { + write_error ("Failed to lookup proxy", &error); } if (proxy_type) { @@ -1426,7 +1432,7 @@ server_child (server * serv) g_strfreev (proxy_list); g_free (url); } -#endif + if (prefs.hex_net_proxy_host[0] && prefs.hex_net_proxy_type > 0 && prefs.hex_net_proxy_use != 2) /* proxy is NOT dcc-only */ diff --git a/src/fe-gtk/setup.c b/src/fe-gtk/setup.c index 3d003eef..a7e3a15c 100644 --- a/src/fe-gtk/setup.c +++ b/src/fe-gtk/setup.c @@ -614,9 +614,7 @@ static const char *const proxytypes[] = N_("SOCKS4"), N_("SOCKS5"), N_("HTTP"), -#ifdef USE_LIBPROXY N_("Auto"), -#endif NULL }; -- cgit 1.4.1 From cbb0927a7a9113d3b6b772e7b0566752dd54e6dd Mon Sep 17 00:00:00 2001 From: Patrick Griffis Date: Tue, 13 Jul 2021 11:12:22 -0500 Subject: build: Misc cleanup of options Cleanup of option names, use features where applicable, and printing of summary. --- .github/workflows/ubuntu-build.yml | 5 ++-- data/meson.build | 6 ++--- data/misc/meson.build | 12 +++++----- meson.build | 49 +++++++++++++++++++++++++++++++------- meson_options.txt | 33 ++++++++++++++----------- src/common/dbus/meson.build | 2 +- src/common/meson.build | 11 ++++----- src/fe-gtk/meson.build | 6 ++--- src/meson.build | 6 ++--- 9 files changed, 83 insertions(+), 47 deletions(-) (limited to 'src/common') diff --git a/.github/workflows/ubuntu-build.yml b/.github/workflows/ubuntu-build.yml index fdeb9b00..cf5a60c1 100644 --- a/.github/workflows/ubuntu-build.yml +++ b/.github/workflows/ubuntu-build.yml @@ -10,10 +10,11 @@ jobs: - name: Install Dependencies run: | sudo apt-get update - sudo apt-get install -y meson libcanberra-dev libdbus-glib-1-dev libglib2.0-dev libgtk2.0-dev libluajit-5.1-dev libnotify-dev libpci-dev libperl-dev libproxy-dev libssl-dev python3-dev python3-cffi mono-devel desktop-file-utils + sudo apt-get install -y python3-setuptools python3-pip libcanberra-dev libdbus-glib-1-dev libglib2.0-dev libgtk2.0-dev libluajit-5.1-dev libnotify-dev libpci-dev libperl-dev libproxy-dev libssl-dev python3-dev python3-cffi mono-devel desktop-file-utils + sudo pip3 install meson - name: Configure - run: meson build -Dwith-text=true -Dwith-theme-manager=true + run: meson build -Dtext=true -Dtheme-manager=true -Dauto_features=enabled - name: Build run: ninja -C build diff --git a/data/meson.build b/data/meson.build index b905c314..6c6b1a9c 100644 --- a/data/meson.build +++ b/data/meson.build @@ -1,11 +1,11 @@ -if get_option('with-plugin') +if get_option('plugin') subdir('pkgconfig') endif -if get_option('with-gtk') +if get_option('gtk-frontend') subdir('icons') subdir('misc') subdir('man') -elif get_option('with-theme-manager') +elif get_option('theme-manager') subdir('misc') endif diff --git a/data/misc/meson.build b/data/misc/meson.build index f7f1c27f..2abf3075 100644 --- a/data/misc/meson.build +++ b/data/misc/meson.build @@ -2,8 +2,8 @@ appdir = join_paths(get_option('datadir'), 'applications') metainfodir = join_paths(get_option('datadir'), 'metainfo') desktop_utils = find_program('desktop-file-validate', required: false) -if get_option('with-gtk') - if get_option('with-appdata') +if get_option('gtk-frontend') + if get_option('install-appdata') hexchat_appdata = i18n.merge_file( input: 'io.github.Hexchat.appdata.xml.in', output: 'io.github.Hexchat.appdata.xml', @@ -21,7 +21,7 @@ if get_option('with-gtk') endif desktop_conf = configuration_data() - if get_option('with-dbus') + if dbus_glib_dep.found() desktop_conf.set('exec_command', 'hexchat --existing %U') else desktop_conf.set('exec_command', 'hexchat %U') @@ -49,7 +49,7 @@ if get_option('with-gtk') endif endif -if get_option('with-theme-manager') +if get_option('theme-manager') htm_desktop = i18n.merge_file( input: 'io.github.Hexchat.ThemeManager.desktop.in', output: 'io.github.Hexchat.ThemeManager.desktop', @@ -70,7 +70,7 @@ if get_option('with-theme-manager') ) endif -if get_option('with-plugin') and get_option('with-appdata') +if get_option('plugin') plugin_metainfo = [] # FIXME: These should all get translated somewhere @@ -124,4 +124,4 @@ if get_option('with-plugin') and get_option('with-appdata') install_dir: get_option('install-plugin-metainfo') ? metainfodir : '', ) endforeach -endif \ No newline at end of file +endif diff --git a/meson.build b/meson.build index 0f5faca8..7a29fd23 100644 --- a/meson.build +++ b/meson.build @@ -1,6 +1,6 @@ project('hexchat', 'c', version: '2.14.3', - meson_version: '>= 0.40.0', + meson_version: '>= 0.47.0', default_options: [ 'c_std=gnu89', 'buildtype=debugoptimized', @@ -15,12 +15,18 @@ cc = meson.get_compiler('c') libgio_dep = dependency('gio-2.0', version: '>= 2.34.0') libgmodule_dep = dependency('gmodule-2.0') + +libcanberra_dep = dependency('libcanberra', version: '>= 0.22', + required: get_option('libcanberra')) +dbus_glib_dep = dependency('dbus-glib-1', required: get_option('dbus')) +libnotify_dep = dependency('libnotify', required: get_option('libnotify')) + global_deps = [] if cc.get_id() == 'msvc' libssl_dep = cc.find_library('libeay32') else libssl_dep = dependency('openssl', version: '>= 0.9.8', - required: get_option('with-ssl')) + required: get_option('tls')) endif config_h = configuration_data() @@ -32,10 +38,10 @@ config_h.set_quoted('LOCALEDIR', join_paths(get_option('prefix'), config_h.set10('ENABLE_NLS', true) # Optional features -config_h.set('USE_OPENSSL', get_option('with-ssl')) -config_h.set('USE_LIBCANBERRA', get_option('with-libcanberra')) -config_h.set('USE_DBUS', get_option('with-dbus')) -config_h.set('USE_PLUGIN', get_option('with-plugin')) +config_h.set('USE_OPENSSL', libssl_dep.found()) +config_h.set('USE_LIBCANBERRA', libcanberra_dep.found()) +config_h.set('USE_DBUS', dbus_glib_dep.found()) +config_h.set('USE_PLUGIN', get_option('plugin')) config_h.set('G_DISABLE_SINGLE_INCLUDES', true) config_h.set('GTK_DISABLE_DEPRECATED', true) @@ -152,7 +158,7 @@ endforeach add_project_link_arguments(global_ldflags, language: 'c') subdir('src') -if get_option('with-plugin') +if get_option('plugin') subdir('plugins') endif if cc.get_id() != 'msvc' @@ -160,6 +166,33 @@ if cc.get_id() != 'msvc' subdir('po') # FIXME: build xgettext meson.add_install_script('meson_post_install.py', - '@0@'.format(get_option('with-theme-manager')) + '@0@'.format(get_option('theme-manager')) ) endif + +if meson.version().version_compare('>= 0.53.0') + summary({ + 'prefix': get_option('prefix'), + 'bindir': get_option('bindir'), + 'libdir': get_option('libdir'), + 'datadir': get_option('datadir'), + }, section: 'Directories') + + summary({ + 'TLS (openssl)': libssl_dep.found(), + 'Plugin Support': get_option('plugin'), + 'DBus Support': dbus_glib_dep.found(), + 'libnotify': libnotify_dep.found(), + 'libcanberra': libcanberra_dep.found(), + }, section: 'Features') + + summary({ + 'Lua': get_option('with-lua'), + 'Python': get_option('with-python'), + 'Perl': get_option('with-perl'), + 'Perl Legacy API': get_option('with-perl-legacy-api'), + 'FiSH': get_option('with-fishlim'), + 'Sysinfo': get_option('with-sysinfo'), + 'DCC Checksum': get_option('with-checksum'), + }, section: 'Plugins') +endif diff --git a/meson_options.txt b/meson_options.txt index ad03d6bc..58a8012a 100644 --- a/meson_options.txt +++ b/meson_options.txt @@ -1,33 +1,41 @@ -option('with-gtk', type: 'boolean', +# Applications +option('gtk-frontend', type: 'boolean', description: 'Main graphical interface' ) -option('with-text', type: 'boolean', value: false, +option('text-frontend', type: 'boolean', value: false, description: 'Text interface (not generally useful)' ) -option('with-ssl', type: 'boolean', +option('theme-manager', type: 'boolean', value: false, + description: 'Utility to help manage themes, requires mono/.net' +) + +# Features +option('tls', type: 'feature', value: 'enabled', description: 'Support for TLS connections, requires openssl' ) -option('with-plugin', type: 'boolean', +option('plugin', type: 'boolean', description: 'Support for loadable plugins' ) -option('with-dbus', type: 'boolean', +option('dbus', type: 'feature', value: 'auto', description: 'Support used for single-instance and scripting interface, Unix only' ) -option('with-libnotify', type: 'boolean', +option('libnotify', type: 'feature', value: 'auto', description: 'Support for freedesktop notifications, Unix only' ) -option('with-libcanberra', type: 'boolean', +option('libcanberra', type: 'feature', value: 'auto', description: 'Support for sound alerts, Unix only' ) -option('with-theme-manager', type: 'boolean', value: false, - description: 'Utility to help manage themes, requires mono/.net' -) + +# Install options option('dbus-service-use-appid', type: 'boolean', value: false, description: 'Rename dbus service to match app-id, required for Flatpak' ) -option('with-appdata', type: 'boolean', +option('install-appdata', type: 'boolean', description: 'Install appdata files for app stores' ) +option('install-plugin-metainfo', type: 'boolean', value: false, + description: 'Installs metainfo files for enabled plugins, useful when distros create split packages' +) # Plugins option('with-checksum', type: 'boolean', @@ -57,9 +65,6 @@ option('with-upd', type: 'boolean', option('with-winamp', type: 'boolean', description: 'Winamp plugin, Windows only' ) -option('install-plugin-metainfo', type: 'boolean', value: false, - description: 'Installs metainfo files for enabled plugins, useful when distros create split packages' -) option('with-perl-legacy-api', type: 'boolean', value: false, description: 'Enables the legacy IRC perl module for compatibility with old scripts' ) diff --git a/src/common/dbus/meson.build b/src/common/dbus/meson.build index 69066be0..856bbe55 100644 --- a/src/common/dbus/meson.build +++ b/src/common/dbus/meson.build @@ -1,5 +1,5 @@ dbus_deps = [ - dependency('dbus-glib-1') + dbus_glib_dep ] dbus_sources = [ diff --git a/src/common/meson.build b/src/common/meson.build index 09491e84..6ca0f20c 100644 --- a/src/common/meson.build +++ b/src/common/meson.build @@ -28,6 +28,7 @@ common_sysinfo_deps = [] common_deps = [ libgio_dep, + libcanberra_dep, ] + global_deps common_includes = [ @@ -72,22 +73,18 @@ textevents = custom_target('textevents', # SIGACTION # HAVE_GTK_MAC -if get_option('with-ssl') +if libssl_dep.found() common_sources += 'ssl.c' common_deps += libssl_dep endif -if get_option('with-libcanberra') - common_deps += dependency('libcanberra', version: '>= 0.22') -endif - -if get_option('with-dbus') +if dbus_glib_dep.found() subdir('dbus') common_deps += hexchat_dbus_dep common_includes += include_directories('dbus') endif -if get_option('with-plugin') +if get_option('plugin') common_deps += libgmodule_dep install_headers('hexchat-plugin.h') endif diff --git a/src/fe-gtk/meson.build b/src/fe-gtk/meson.build index 3dfc7427..020d2631 100644 --- a/src/fe-gtk/meson.build +++ b/src/fe-gtk/meson.build @@ -43,9 +43,9 @@ hexchat_gtk_cflags = [] hexchat_gtk_ldflags = [] -if get_option('with-libnotify') +if libnotify_dep.found() hexchat_gtk_sources += 'notifications/notification-libnotify.c' - hexchat_gtk_deps += dependency('libnotify') + hexchat_gtk_deps += libnotify_dep elif false # TODO HAVE_GTK_MAC elif host_machine.system() == 'windows' hexchat_gtk_sources += 'notifications/notification-windows.c' @@ -69,7 +69,7 @@ if iso_codes.found() join_paths(iso_codes_prefix, 'share/locale')) endif -if get_option('with-plugin') +if get_option('plugin') hexchat_gtk_sources += 'plugingui.c' endif diff --git a/src/meson.build b/src/meson.build index ff2c8871..23453ec1 100644 --- a/src/meson.build +++ b/src/meson.build @@ -1,13 +1,13 @@ subdir('common') -if get_option('with-gtk') +if get_option('gtk-frontend') subdir('fe-gtk') endif -if get_option('with-text') +if get_option('text-frontend') subdir('fe-text') endif -if get_option('with-theme-manager') +if get_option('theme-manager') subdir('htm') endif -- cgit 1.4.1 From ef0e67039258b7db11838496c61dbdec0be97f60 Mon Sep 17 00:00:00 2001 From: Sadie Powell Date: Mon, 23 Aug 2021 16:34:13 +0100 Subject: Remove some weird guesswork on the 004 numeric. (#2621) Bahamut and ircu both send 005 MODES and ELIST so this is entirely unnecessary. The other IRCd checked for here is for a dead network. While we're editing this code fix HexChat on servers that can only support one mode at a time (these are mostly gateway servers). --- src/common/modes.c | 4 ++-- src/common/proto-irc.c | 16 ---------------- src/common/server.c | 2 ++ 3 files changed, 4 insertions(+), 18 deletions(-) (limited to 'src/common') diff --git a/src/common/modes.c b/src/common/modes.c index 17f9ce99..188d2197 100644 --- a/src/common/modes.c +++ b/src/common/modes.c @@ -67,8 +67,8 @@ send_channel_modes (session *sess, char *tbuf, char *word[], int wpos, int usable_modes, orig_len, len, wlen, i, max; server *serv = sess->server; - /* sanity check. IRC RFC says three per line. */ - if (serv->modes_per_line < 3) + /* sanity check. IRC RFC says three per line but some servers may support less. */ + if (serv->modes_per_line < 1) serv->modes_per_line = 3; if (modes_per_line < 1) modes_per_line = serv->modes_per_line; diff --git a/src/common/proto-irc.c b/src/common/proto-irc.c index 501bf5a0..49017506 100644 --- a/src/common/proto-irc.c +++ b/src/common/proto-irc.c @@ -503,22 +503,6 @@ process_numeric (session * sess, int n, goto def; - case 4: /* check the ircd type */ - serv->use_listargs = FALSE; - serv->modes_per_line = 3; /* default to IRC RFC */ - if (strncmp (word[5], "bahamut", 7) == 0) /* DALNet */ - { - serv->use_listargs = TRUE; /* use the /list args */ - } else if (strncmp (word[5], "u2.10.", 6) == 0) /* Undernet */ - { - serv->use_listargs = TRUE; /* use the /list args */ - serv->modes_per_line = 6; /* allow 6 modes per line */ - } else if (strncmp (word[5], "glx2", 4) == 0) - { - serv->use_listargs = TRUE; /* use the /list args */ - } - goto def; - case 5: inbound_005 (serv, word, tags_data); goto def; diff --git a/src/common/server.c b/src/common/server.c index 4f809fa8..0c0306d5 100644 --- a/src/common/server.c +++ b/src/common/server.c @@ -1770,6 +1770,7 @@ server_set_defaults (server *serv) serv->chanmodes = g_strdup ("beI,k,l"); serv->nick_prefixes = g_strdup ("@%+"); serv->nick_modes = g_strdup ("ohv"); + serv->modes_per_line = 3; /* https://datatracker.ietf.org/doc/html/rfc1459#section-4.2.3.1 */ serv->sasl_mech = MECH_PLAIN; if (!serv->encoding) @@ -1778,6 +1779,7 @@ server_set_defaults (server *serv) serv->nickcount = 1; serv->end_of_motd = FALSE; serv->sent_capend = FALSE; + serv->use_listargs = FALSE; serv->is_away = FALSE; serv->supports_watch = FALSE; serv->supports_monitor = FALSE; -- cgit 1.4.1 From 899b4cd3eb85f46ee44e0ee7577ebaa43b082196 Mon Sep 17 00:00:00 2001 From: Sadie Powell Date: Mon, 23 Aug 2021 23:00:07 +0100 Subject: Increase the linebuf length to fit a full message including tags. --- src/common/hexchat.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/common') diff --git a/src/common/hexchat.h b/src/common/hexchat.h index 5c9949a2..43a5f43a 100644 --- a/src/common/hexchat.h +++ b/src/common/hexchat.h @@ -503,7 +503,7 @@ typedef struct server char servername[128]; /* what the server says is its name */ char password[86]; char nick[NICKLEN]; - char linebuf[2048]; /* RFC says 512 chars including \r\n */ + char linebuf[8704]; /* RFC says 512 chars including \r\n, IRCv3 message tags add 8191, plus the NUL byte */ char *last_away_reason; int pos; /* current position in linebuf */ int nickcount; -- cgit 1.4.1 From 8239fbd041abdfbc17ed605a8190a62f6825beb4 Mon Sep 17 00:00:00 2001 From: Sadie Powell Date: Mon, 23 Aug 2021 23:30:32 +0100 Subject: Be a bit less insulting about servers with longer line lengths. --- src/common/server.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/common') diff --git a/src/common/server.c b/src/common/server.c index 0c0306d5..1825117c 100644 --- a/src/common/server.c +++ b/src/common/server.c @@ -362,7 +362,7 @@ server_read (GIOChannel *source, GIOCondition condition, server *serv) serv->linebuf[serv->pos] = lbuf[i]; if (serv->pos >= (sizeof (serv->linebuf) - 1)) fprintf (stderr, - "*** HEXCHAT WARNING: Buffer overflow - shit server!\n"); + "*** HEXCHAT WARNING: Buffer overflow - non-compliant server!\n"); else serv->pos++; } -- cgit 1.4.1 From 3f07670b34512c9242ae2c20984f38cb453ce51f Mon Sep 17 00:00:00 2001 From: Patrick Griffis Date: Fri, 1 Oct 2021 12:15:26 -0500 Subject: win32: Update to OpenSSL 1.1 --- .github/workflows/windows-build.yml | 2 +- meson.build | 2 +- plugins/fishlim/fishlim.vcxproj | 4 ++-- src/common/server.c | 2 +- src/common/ssl.c | 21 ++++++++++----------- src/common/ssl.h | 2 +- win32/copy/copy.vcxproj | 4 ++-- win32/hexchat.props | 4 ++-- win32/installer/hexchat.iss.tt | 9 +++++++-- 9 files changed, 27 insertions(+), 23 deletions(-) (limited to 'src/common') diff --git a/.github/workflows/windows-build.yml b/.github/workflows/windows-build.yml index 4ce03c00..f5e20e12 100644 --- a/.github/workflows/windows-build.yml +++ b/.github/workflows/windows-build.yml @@ -28,7 +28,7 @@ jobs: Invoke-WebRequest https://dl.hexchat.net/misc/idpsetup-1.5.1.exe -OutFile deps\idpsetup.exe & deps\idpsetup.exe /VERYSILENT - Invoke-WebRequest https://dl.hexchat.net/gtk/gtk-${{ matrix.platform }}-2018-08-29.7z -OutFile deps\gtk-${{ matrix.arch }}.7z + Invoke-WebRequest https://dl.hexchat.net/gtk/gtk-${{ matrix.platform }}-2018-08-29-openssl1.1.7z -OutFile deps\gtk-${{ matrix.arch }}.7z & 7z.exe x deps\gtk-${{ matrix.arch }}.7z -oC:\gtk-build\gtk Invoke-WebRequest https://dl.hexchat.net/gtk-win32/gendef-20111031.7z -OutFile deps\gendef.7z diff --git a/meson.build b/meson.build index fe5f245d..9330abf3 100644 --- a/meson.build +++ b/meson.build @@ -22,7 +22,7 @@ dbus_glib_dep = dependency('dbus-glib-1', required: get_option('dbus')) global_deps = [] if cc.get_id() == 'msvc' - libssl_dep = cc.find_library('libeay32') + libssl_dep = cc.find_library('libssl') else libssl_dep = dependency('openssl', version: '>= 0.9.8', required: get_option('tls')) diff --git a/plugins/fishlim/fishlim.vcxproj b/plugins/fishlim/fishlim.vcxproj index 579c2436..3661e1e6 100644 --- a/plugins/fishlim/fishlim.vcxproj +++ b/plugins/fishlim/fishlim.vcxproj @@ -29,7 +29,7 @@ - WIN32;NDEBUG;_WINDOWS;_USRDLL;FISHLIM_EXPORTS;%(PreprocessorDefinitions) + WIN32;NDEBUG;_WINDOWS;_USRDLL;FISHLIM_EXPORTS;HAVE_DH_SET0_PQG;HAVE_DH_GET0_KEY;HAVE_DH_SET0_KEY;%(PreprocessorDefinitions) $(DepsRoot)\include;$(Glib);..\..\src\common;$(HexChatLib);%(AdditionalIncludeDirectories) @@ -40,7 +40,7 @@ - WIN32;_WIN64;_AMD64_;NDEBUG;_WINDOWS;_USRDLL;FISHLIM_EXPORTS;%(PreprocessorDefinitions) + WIN32;_WIN64;_AMD64_;NDEBUG;_WINDOWS;_USRDLL;FISHLIM_EXPORTS;HAVE_DH_SET0_PQG;HAVE_DH_GET0_KEY;HAVE_DH_SET0_KEY;%(PreprocessorDefinitions) $(DepsRoot)\include;$(Glib);..\..\src\common;$(HexChatLib);%(AdditionalIncludeDirectories) diff --git a/src/common/server.c b/src/common/server.c index 1825117c..f90ce28f 100644 --- a/src/common/server.c +++ b/src/common/server.c @@ -772,7 +772,7 @@ server_connect_success (server *serv) /* it'll be a memory leak, if connection isn't terminated by server_cleanup() */ - if ((err = _SSL_set_verify (serv->ctx, ssl_cb_verify, NULL))) + if ((err = _SSL_set_verify (serv->ctx, ssl_cb_verify))) { EMIT_SIGNAL (XP_TE_CONNFAIL, serv->server_session, err, NULL, NULL, NULL, 0); diff --git a/src/common/ssl.c b/src/common/ssl.c index 0eb78bd7..e7f7e0a8 100644 --- a/src/common/ssl.c +++ b/src/common/ssl.c @@ -321,23 +321,22 @@ _SSL_socket (SSL_CTX *ctx, int sd) char * -_SSL_set_verify (SSL_CTX *ctx, void *verify_callback, char *cacert) +_SSL_set_verify (SSL_CTX *ctx, void *verify_callback) { - if (!SSL_CTX_set_default_verify_paths (ctx)) +#ifdef DEFAULT_CERT_FILE + if (!SSL_CTX_load_verify_locations (ctx, DEFAULT_CERT_FILE, NULL)) { - __SSL_fill_err_buf ("SSL_CTX_set_default_verify_paths"); + __SSL_fill_err_buf ("SSL_CTX_load_verify_locations"); return (err_buf); } -/* - if (cacert) +#else + if (!SSL_CTX_set_default_verify_paths (ctx)) { - if (!SSL_CTX_load_verify_locations (ctx, cacert, NULL)) - { - __SSL_fill_err_buf ("SSL_CTX_load_verify_locations"); - return (err_buf); - } + __SSL_fill_err_buf ("SSL_CTX_set_default_verify_paths"); + return (err_buf); } -*/ +#endif + SSL_CTX_set_verify (ctx, SSL_VERIFY_PEER, verify_callback); return (NULL); diff --git a/src/common/ssl.h b/src/common/ssl.h index e722f831..bea2f440 100644 --- a/src/common/ssl.h +++ b/src/common/ssl.h @@ -45,7 +45,7 @@ SSL_CTX *_SSL_context_init (void (*info_cb_func)); #define _SSL_context_free(a) SSL_CTX_free(a); SSL *_SSL_socket (SSL_CTX *ctx, int sd); -char *_SSL_set_verify (SSL_CTX *ctx, void *(verify_callback), char *cacert); +char *_SSL_set_verify (SSL_CTX *ctx, void *(verify_callback)); /* int SSL_connect(SSL *); int SSL_accept(SSL *); diff --git a/win32/copy/copy.vcxproj b/win32/copy/copy.vcxproj index b26d7e28..2fc7437b 100644 --- a/win32/copy/copy.vcxproj +++ b/win32/copy/copy.vcxproj @@ -40,7 +40,8 @@ - + + @@ -50,7 +51,6 @@ - diff --git a/win32/hexchat.props b/win32/hexchat.props index f40c794a..038873b1 100644 --- a/win32/hexchat.props +++ b/win32/hexchat.props @@ -15,7 +15,7 @@ - GTK_DISABLE_DEPRECATED;GDK_PIXBUF_DISABLE_DEPRECATED;G_DISABLE_SINGLE_INCLUDES;GDK_PIXBUF_DISABLE_SINGLE_INCLUDES;GTK_DISABLE_SINGLE_INCLUDES;HAVE_STRTOULL;strtoull=_strtoui64;strcasecmp=stricmp;strncasecmp=strnicmp;__inline__=__inline + GTK_DISABLE_DEPRECATED;GDK_PIXBUF_DISABLE_DEPRECATED;G_DISABLE_SINGLE_INCLUDES;GDK_PIXBUF_DISABLE_SINGLE_INCLUDES;GTK_DISABLE_SINGLE_INCLUDES;HAVE_X509_GET_SIGNATURE_NID;HAVE_SSL_CTX_GET_SSL_METHOD;DEFAULT_CERT_FILE="cert.pem";HAVE_STRTOULL;strtoull=_strtoui64;strcasecmp=stricmp;strncasecmp=strnicmp;__inline__=__inline $(YourDepsPath)\$(PlatformName)\release $(YourGendefPath) @@ -33,7 +33,7 @@ lua51 $(DepsRoot)\include\glib-2.0;$(DepsRoot)\lib\glib-2.0\include;$(DepsRoot)\include\libxml2 $(DepsRoot)\include\gtk-2.0;$(DepsRoot)\lib\gtk-2.0\include;$(DepsRoot)\include\atk-1.0;$(DepsRoot)\include\cairo;$(DepsRoot)\include\pango-1.0;$(DepsRoot)\include\gdk-pixbuf-2.0 - gtk-win32-2.0.lib;gdk-win32-2.0.lib;atk-1.0.lib;gio-2.0.lib;gdk_pixbuf-2.0.lib;pangowin32-1.0.lib;pangocairo-1.0.lib;pango-1.0.lib;cairo.lib;gobject-2.0.lib;gmodule-2.0.lib;glib-2.0.lib;intl.lib;libxml2.lib;libeay32.lib;ssleay32.lib;wininet.lib;winmm.lib;ws2_32.lib + gtk-win32-2.0.lib;gdk-win32-2.0.lib;atk-1.0.lib;gio-2.0.lib;gdk_pixbuf-2.0.lib;pangowin32-1.0.lib;pangocairo-1.0.lib;pango-1.0.lib;cairo.lib;gobject-2.0.lib;gmodule-2.0.lib;glib-2.0.lib;intl.lib;libxml2.lib;libcrypto.lib;libssl.lib;ssleay32.lib;wininet.lib;winmm.lib;ws2_32.lib $(SolutionDir)..\data\\ $(SolutionDir)..\..\hexchat-build $(HexChatBuild)\$(PlatformName)\bin\ diff --git a/win32/installer/hexchat.iss.tt b/win32/installer/hexchat.iss.tt index be985384..1671988d 100644 --- a/win32/installer/hexchat.iss.tt +++ b/win32/installer/hexchat.iss.tt @@ -138,7 +138,13 @@ Source: "gspawn-win32-helper-console.exe"; DestDir: "{app}"; Flags: ignoreversio Source: "gthread-2.0-0.dll"; DestDir: "{app}"; Flags: ignoreversion; Components: libs Source: "gtk-win32-2.0.dll"; DestDir: "{app}"; Flags: ignoreversion; Components: libs Source: "iconv.dll"; DestDir: "{app}"; Flags: ignoreversion; Components: libs -Source: "libeay32.dll"; DestDir: "{app}"; Flags: ignoreversion; Components: libs +#if APPARCH == "x64" +Source: "libcrypto-1_1-x64.dll"; DestDir: "{app}"; Flags: ignoreversion; Components: libs +Source: "libssl-1_1-x64.dll"; DestDir: "{app}"; Flags: ignoreversion; Components: libs +#else +Source: "libcrypto-1_1.dll"; DestDir: "{app}"; Flags: ignoreversion; Components: libs +Source: "libssl-1_1.dll"; DestDir: "{app}"; Flags: ignoreversion; Components: libs +#endif Source: "libenchant.dll"; DestDir: "{app}"; Flags: ignoreversion; Components: libs Source: "ffi-7.dll"; DestDir: "{app}"; Flags: ignoreversion; Components: libs Source: "intl.dll"; DestDir: "{app}"; Flags: ignoreversion; Components: libs @@ -148,7 +154,6 @@ Source: "pango-1.0-0.dll"; DestDir: "{app}"; Flags: ignoreversion; Components: l Source: "pangocairo-1.0-0.dll"; DestDir: "{app}"; Flags: ignoreversion; Components: libs Source: "pangoft2-1.0-0.dll"; DestDir: "{app}"; Flags: ignoreversion; Components: libs Source: "pangowin32-1.0-0.dll"; DestDir: "{app}"; Flags: ignoreversion; Components: libs -Source: "ssleay32.dll"; DestDir: "{app}"; Flags: ignoreversion; Components: libs Source: "zlib1.dll"; DestDir: "{app}"; Flags: ignoreversion; Components: libs Source: "plugins\hcnotifications-winrt.dll"; DestDir: "{app}\plugins"; Flags: ignoreversion; Components: libs -- cgit 1.4.1 From dd6f53f5040738f1349d4f0147a2204dc6ffab16 Mon Sep 17 00:00:00 2001 From: Ryan Schmidt Date: Fri, 1 Oct 2021 12:18:33 -0700 Subject: Fix user list not tracking mode changes The `PREFIX` key in `ISUPPORT` (usually) takes the form `(modes)prefixes` e.g. `(ov)@+`. The current implementation will therefore set `serv->nick_modes` to a string like `"(ov"` instead of the desired `"ov"`. This causes the nick list to not properly update with which users have which prefix modes. Skip over the initial `'('` so we capture the correct modes and fix that issue. --- src/common/modes.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/common') diff --git a/src/common/modes.c b/src/common/modes.c index 188d2197..756f0858 100644 --- a/src/common/modes.c +++ b/src/common/modes.c @@ -880,7 +880,7 @@ inbound_005 (server * serv, char *word[], const message_tags_data *tags_data) g_free (serv->nick_prefixes); g_free (serv->nick_modes); serv->nick_prefixes = g_strdup (pre + 1); - serv->nick_modes = g_strdup (tokvalue); + serv->nick_modes = g_strdup (tokvalue + 1); } else { /* bad! some ircds don't give us the modes. */ -- cgit 1.4.1 From 9039a5d75ba854d00bfbd9bb5235ec547eeffbe1 Mon Sep 17 00:00:00 2001 From: Nolan Lum Date: Thu, 14 Oct 2021 07:44:11 -0700 Subject: Add -NOOVERRIDE flag to GUI COLOR. (#2644) --- src/common/fe.h | 11 ++++++++++- src/common/outbound.c | 12 +++++++++--- src/fe-gtk/fe-gtk.c | 8 ++++---- src/fe-gtk/maingui.c | 22 +++++++++++++++------- src/fe-text/fe-text.c | 2 +- 5 files changed, 39 insertions(+), 16 deletions(-) (limited to 'src/common') diff --git a/src/common/fe.h b/src/common/fe.h index 6614055b..9da4e230 100644 --- a/src/common/fe.h +++ b/src/common/fe.h @@ -69,7 +69,16 @@ int fe_input_add (int sok, int flags, void *func, void *data); void fe_input_remove (int tag); void fe_idle_add (void *func, void *data); void fe_set_topic (struct session *sess, char *topic, char *stripped_topic); -void fe_set_tab_color (struct session *sess, int col); +typedef enum +{ + FE_COLOR_NONE = 0, + FE_COLOR_NEW_DATA = 1, + FE_COLOR_NEW_MSG = 2, + FE_COLOR_NEW_HILIGHT = 3, + FE_COLOR_FLAG_NOOVERRIDE = 8, +} tabcolor; +#define FE_COLOR_ALLFLAGS (FE_COLOR_FLAG_NOOVERRIDE) +void fe_set_tab_color (struct session *sess, tabcolor col); void fe_flash_window (struct session *sess); void fe_update_mode_buttons (struct session *sess, char mode, char sign); void fe_update_channel_key (struct session *sess); diff --git a/src/common/outbound.c b/src/common/outbound.c index 70fcd436..fcc731e2 100644 --- a/src/common/outbound.c +++ b/src/common/outbound.c @@ -2152,7 +2152,6 @@ cmd_gui (struct session *sess, char *tbuf, char *word[], char *word_eol[]) { case 0x058b836e: fe_ctrl_gui (sess, 8, 0); break; /* APPLY */ case 0xac1eee45: fe_ctrl_gui (sess, 7, 2); break; /* ATTACH */ - case 0x05a72f63: fe_ctrl_gui (sess, 4, atoi (word[3])); break; /* COLOR */ case 0xb06a1793: fe_ctrl_gui (sess, 7, 1); break; /* DETACH */ case 0x05cfeff0: fe_ctrl_gui (sess, 3, 0); break; /* FLASH */ case 0x05d154d8: fe_ctrl_gui (sess, 2, 0); break; /* FOCUS */ @@ -2166,6 +2165,12 @@ cmd_gui (struct session *sess, char *tbuf, char *word[], char *word_eol[]) else return FALSE; break; + case 0x05a72f63: /* COLOR */ + if (!g_ascii_strcasecmp (word[4], "-NOOVERRIDE")) + fe_ctrl_gui (sess, 4, FE_COLOR_FLAG_NOOVERRIDE | atoi (word[3])); + else + fe_ctrl_gui (sess, 4, atoi (word[3])); + break; default: return FALSE; } @@ -4015,8 +4020,9 @@ const struct commands xc_cmds[] = { {"GETINT", cmd_getint, 0, 0, 1, "GETINT "}, {"GETSTR", cmd_getstr, 0, 0, 1, "GETSTR "}, {"GHOST", cmd_ghost, 1, 0, 1, N_("GHOST [password], Kills a ghosted nickname")}, - {"GUI", cmd_gui, 0, 0, 1, "GUI [APPLY|ATTACH|DETACH|SHOW|HIDE|FOCUS|FLASH|ICONIFY|COLOR ]\n" - " GUI [MSGBOX |MENU TOGGLE]"}, + {"GUI", cmd_gui, 0, 0, 1, "GUI [APPLY|ATTACH|DETACH|SHOW|HIDE|FOCUS|FLASH|ICONIFY]\n" + " GUI [MSGBOX |MENU TOGGLE]\n" + " GUI COLOR [-NOOVERRIDE]"}, {"HELP", cmd_help, 0, 0, 1, 0}, {"HOP", cmd_hop, 1, 1, 1, N_("HOP , gives chanhalf-op status to the nick (needs chanop)")}, diff --git a/src/fe-gtk/fe-gtk.c b/src/fe-gtk/fe-gtk.c index 4ed4aac9..3d3c8052 100644 --- a/src/fe-gtk/fe-gtk.c +++ b/src/fe-gtk/fe-gtk.c @@ -664,13 +664,13 @@ fe_print_text (struct session *sess, char *text, time_t stamp, return; if (sess == current_tab) - fe_set_tab_color (sess, 0); + fe_set_tab_color (sess, FE_COLOR_NONE); else if (sess->tab_state & TAB_STATE_NEW_HILIGHT) - fe_set_tab_color (sess, 3); + fe_set_tab_color (sess, FE_COLOR_NEW_HILIGHT); else if (sess->tab_state & TAB_STATE_NEW_MSG) - fe_set_tab_color (sess, 2); + fe_set_tab_color (sess, FE_COLOR_NEW_MSG); else - fe_set_tab_color (sess, 1); + fe_set_tab_color (sess, FE_COLOR_NEW_DATA); } void diff --git a/src/fe-gtk/maingui.c b/src/fe-gtk/maingui.c index b77da59b..61f59856 100644 --- a/src/fe-gtk/maingui.c +++ b/src/fe-gtk/maingui.c @@ -175,20 +175,26 @@ fe_flash_window (session *sess) /* set a tab plain, red, light-red, or blue */ void -fe_set_tab_color (struct session *sess, int col) +fe_set_tab_color (struct session *sess, tabcolor col) { struct session *server_sess = sess->server->server_session; + int col_noflags = (col & ~FE_COLOR_ALLFLAGS); + int col_shouldoverride = !(col & FE_COLOR_FLAG_NOOVERRIDE); + if (sess->res->tab && sess->gui->is_tab && (col == 0 || sess != current_tab)) { - switch (col) + switch (col_noflags) { case 0: /* no particular color (theme default) */ sess->tab_state = TAB_STATE_NONE; chan_set_color (sess->res->tab, plain_list); break; case 1: /* new data has been displayed (dark red) */ - sess->tab_state = TAB_STATE_NEW_DATA; - chan_set_color (sess->res->tab, newdata_list); + if (col_shouldoverride || !((sess->tab_state & TAB_STATE_NEW_MSG) + || (sess->tab_state & TAB_STATE_NEW_HILIGHT))) { + sess->tab_state = TAB_STATE_NEW_DATA; + chan_set_color (sess->res->tab, newdata_list); + } if (chan_is_collapsed (sess->res->tab) && !((server_sess->tab_state & TAB_STATE_NEW_MSG) @@ -201,8 +207,10 @@ fe_set_tab_color (struct session *sess, int col) break; case 2: /* new message arrived in channel (light red) */ - sess->tab_state = TAB_STATE_NEW_MSG; - chan_set_color (sess->res->tab, newmsg_list); + if (col_shouldoverride || !(sess->tab_state & TAB_STATE_NEW_HILIGHT)) { + sess->tab_state = TAB_STATE_NEW_MSG; + chan_set_color (sess->res->tab, newmsg_list); + } if (chan_is_collapsed (sess->res->tab) && !(server_sess->tab_state & TAB_STATE_NEW_HILIGHT) @@ -540,7 +548,7 @@ mg_focus (session *sess) /* when called via mg_changui_new, is_tab might be true, but sess->res->tab is still NULL. */ if (sess->res->tab) - fe_set_tab_color (sess, 0); + fe_set_tab_color (sess, FE_COLOR_NONE); } static int diff --git a/src/fe-text/fe-text.c b/src/fe-text/fe-text.c index 1d411ddf..3673a81f 100644 --- a/src/fe-text/fe-text.c +++ b/src/fe-text/fe-text.c @@ -623,7 +623,7 @@ fe_cleanup (void) { } void -fe_set_tab_color (struct session *sess, int col) +fe_set_tab_color (struct session *sess, tabcolor col) { } void -- cgit 1.4.1 From f42f6af1b96f80280a2e5a5e2431dc32d2b8fd55 Mon Sep 17 00:00:00 2001 From: alicetries <92898519+alicetries@users.noreply.github.com> Date: Thu, 21 Oct 2021 01:56:05 +0100 Subject: Adjust parsing of RPL_WHOISSPECIAL to handle missing : for single-word whois messages This is to support parsing the RPL_WHOISSPECIAL from unrealircd correctly if the whois message is a single word. --- src/common/proto-irc.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/common') diff --git a/src/common/proto-irc.c b/src/common/proto-irc.c index 49017506..a8d997b6 100644 --- a/src/common/proto-irc.c +++ b/src/common/proto-irc.c @@ -627,7 +627,7 @@ process_numeric (session * sess, int n, case 320: /* :is an identified user */ if (!serv->skip_next_whois) EMIT_SIGNAL_TIMESTAMP (XP_TE_WHOIS_ID, whois_sess, word[4], - word_eol[5] + 1, NULL, NULL, 0, + word_eol[5][0] == ':' ? word_eol[5] + 1 : word_eol[5], NULL, NULL, 0, tags_data->timestamp); break; -- cgit 1.4.1 From b54593e7527566e1bb46e404ea8a91ee4e493f57 Mon Sep 17 00:00:00 2001 From: Foxy <52182237+LadyFoxy@users.noreply.github.com> Date: Sat, 30 Oct 2021 10:51:46 -0500 Subject: Update servlist.c (#2648) Added irc.irc-nerds.net to the server list --- src/common/servlist.c | 3 +++ 1 file changed, 3 insertions(+) (limited to 'src/common') diff --git a/src/common/servlist.c b/src/common/servlist.c index a203e702..160cc9e0 100644 --- a/src/common/servlist.c +++ b/src/common/servlist.c @@ -187,6 +187,9 @@ static const struct defaultserver def[] = {"Interlinked", 0, 0, 0, LOGIN_SASL, 0, TRUE}, {0, "irc.interlinked.me"}, + {"Irc-Nerds", 0, 0, 0, LOGIN_SASL, 0, TRUE}, + {0, "irc.irc-nerds.net"}, + {"IRC4Fun", 0, 0, 0, LOGIN_SASL, 0, TRUE}, {0, "irc.irc4fun.net"}, -- cgit 1.4.1 From 8443755772160e61679e3122190da18ba10d8878 Mon Sep 17 00:00:00 2001 From: Patrick Griffis Date: Fri, 12 Nov 2021 12:44:09 -0600 Subject: Fix timer being locale dependent for decimals `/timer .1 echo hi` now works in all locales. --- src/common/plugin-timer.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/common') diff --git a/src/common/plugin-timer.c b/src/common/plugin-timer.c index d0c82c28..17f11ce3 100644 --- a/src/common/plugin-timer.c +++ b/src/common/plugin-timer.c @@ -198,7 +198,7 @@ timer_cb (char *word[], char *word_eol[], void *userdata) offset += 2; } - timeout = atof (word[2 + offset]); + timeout = g_ascii_strtod (word[2 + offset], NULL); command = word_eol[3 + offset]; if (timeout < 0.1 || timeout * 1000 > INT_MAX || !command[0]) -- cgit 1.4.1 From d07e8a8ab27e4677605759468acce11452345ba9 Mon Sep 17 00:00:00 2001 From: Noah Keck Date: Thu, 2 Dec 2021 10:38:58 -0500 Subject: Remove wallchan command This command doesn't have many legitimate, non-spam applications and is easily confused for the similarly named 'wallops'. Moreover, many netowrks now automatically punish or drop users who message many channels at the same time, rendering the command mostly useless. It also is too easy to tab-complete 'wall' into 'wallchan' when you expect 'wallops' to come up first, which can lead to two very different functions. If this is to be reintroduced it should be named something with less similarity to 'wallops' or 'wallchops'. --- src/common/outbound.c | 30 ------------------------------ 1 file changed, 30 deletions(-) (limited to 'src/common') diff --git a/src/common/outbound.c b/src/common/outbound.c index fcc731e2..da57ea33 100644 --- a/src/common/outbound.c +++ b/src/common/outbound.c @@ -3881,34 +3881,6 @@ cmd_wallchop (struct session *sess, char *tbuf, char *word[], return TRUE; } -static int -cmd_wallchan (struct session *sess, char *tbuf, char *word[], - char *word_eol[]) -{ - GSList *list; - - if (*word_eol[2]) - { - list = sess_list; - while (list) - { - sess = list->data; - if (sess->type == SESS_CHANNEL) - { - message_tags_data no_tags = MESSAGE_TAGS_DATA_INIT; - - inbound_chanmsg (sess->server, NULL, sess->channel, - sess->server->nick, word_eol[2], TRUE, FALSE, - &no_tags); - sess->server->p_message (sess->server, sess->channel, word_eol[2]); - } - list = list->next; - } - return TRUE; - } - return FALSE; -} - static int cmd_hop (struct session *sess, char *tbuf, char *word[], char *word_eol[]) { @@ -4147,8 +4119,6 @@ const struct commands xc_cmds[] = { {"USERLIST", cmd_userlist, 1, 1, 1, 0}, {"VOICE", cmd_voice, 1, 1, 1, N_("VOICE , gives voice status to someone (needs chanop)")}, - {"WALLCHAN", cmd_wallchan, 1, 1, 1, - N_("WALLCHAN , writes the message to all channels")}, {"WALLCHOP", cmd_wallchop, 1, 1, 1, N_("WALLCHOP , sends the message to all chanops on the current channel")}, {0, 0, 0, 0, 0, 0} -- cgit 1.4.1 From d889a8e019d29b26813e8ca3bb5989ec1a043a1b Mon Sep 17 00:00:00 2001 From: Biswapriyo Nath Date: Thu, 6 Jan 2022 00:15:52 +0530 Subject: meson: Remove unused wbemcore dependency --- src/common/meson.build | 1 - 1 file changed, 1 deletion(-) (limited to 'src/common') diff --git a/src/common/meson.build b/src/common/meson.build index 6ca0f20c..84e2fca3 100644 --- a/src/common/meson.build +++ b/src/common/meson.build @@ -47,7 +47,6 @@ if host_machine.system() == 'windows' ] common_sysinfo_deps += [ cc.find_library('wbemuuid'), # sysinfo - cc.find_library('wbemcore'), ] common_sources += 'sysinfo/win32/backend.c' -- cgit 1.4.1 From 91adfb5917d31a7c29d6c0536f1e301542577e81 Mon Sep 17 00:00:00 2001 From: Sadie Powell Date: Mon, 17 Jan 2022 12:08:16 +0000 Subject: Fix handling invalid ports. Instead of wrapping around, which is not behaviour any reasonable user would expect, just use the default port if above 65535. Disallow connecting on port 0. This port has special meaning and servers can not listen on it. It is more likely the user just gave an invalid value to the port field as atoi("invalid") == 0. --- src/common/server.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'src/common') diff --git a/src/common/server.c b/src/common/server.c index f90ce28f..c2965eb3 100644 --- a/src/common/server.c +++ b/src/common/server.c @@ -1559,7 +1559,7 @@ server_connect (server *serv, char *hostname, int port, int no_login) if (!hostname[0]) return; - if (port < 0) + if (port < 1 || port > 65535) { /* use default port for this server type */ port = 6667; @@ -1568,7 +1568,6 @@ server_connect (server *serv, char *hostname, int port, int no_login) port = 6697; #endif } - port &= 0xffff; /* wrap around */ if (serv->connected || serv->connecting || serv->recondelay_tag) server_disconnect (sess, TRUE, -1); -- cgit 1.4.1 From 7df34cdcb2039678356f9dd44bb52e670dbcf8ce Mon Sep 17 00:00:00 2001 From: Sadie Powell Date: Mon, 17 Jan 2022 21:51:40 +0000 Subject: Log when the user specifies an invalid port. --- src/common/server.c | 1 + 1 file changed, 1 insertion(+) (limited to 'src/common') diff --git a/src/common/server.c b/src/common/server.c index c2965eb3..e14da237 100644 --- a/src/common/server.c +++ b/src/common/server.c @@ -1567,6 +1567,7 @@ server_connect (server *serv, char *hostname, int port, int no_login) if (serv->use_ssl) port = 6697; #endif + g_debug ("Attempted to connect to invalid port, assuming default port %d", port); } if (serv->connected || serv->connecting || serv->recondelay_tag) -- cgit 1.4.1 From a330c1cf4dc4a5a7be2e44e8622a566f01da594c Mon Sep 17 00:00:00 2001 From: Biswapriyo Nath Date: Fri, 21 Jan 2022 14:05:09 +0530 Subject: sysinfo: Fix architecture detection in AArch64 Windows AArch64 should be detected as 64 bit OS. --- src/common/sysinfo/win32/backend.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'src/common') diff --git a/src/common/sysinfo/win32/backend.c b/src/common/sysinfo/win32/backend.c index 1d88b139..67a0fd2b 100644 --- a/src/common/sysinfo/win32/backend.c +++ b/src/common/sysinfo/win32/backend.c @@ -84,7 +84,8 @@ sysinfo_get_cpu_arch (void) GetNativeSystemInfo (&si); - if (si.wProcessorArchitecture == PROCESSOR_ARCHITECTURE_AMD64) + if (si.wProcessorArchitecture == PROCESSOR_ARCHITECTURE_AMD64 || + si.wProcessorArchitecture == PROCESSOR_ARCHITECTURE_ARM64) { return cpu_arch = 64; } @@ -106,7 +107,8 @@ sysinfo_get_build_arch (void) GetSystemInfo (&si); - if (si.wProcessorArchitecture == PROCESSOR_ARCHITECTURE_AMD64) + if (si.wProcessorArchitecture == PROCESSOR_ARCHITECTURE_AMD64 || + si.wProcessorArchitecture == PROCESSOR_ARCHITECTURE_ARM64) { return build_arch = 64; } -- cgit 1.4.1 From 7cff05c7ac4efe30a34f7f1bc5d5aa7463cb4f16 Mon Sep 17 00:00:00 2001 From: orcus <29999282+orcus-de@users.noreply.github.com> Date: Mon, 24 Jan 2022 18:38:21 +0100 Subject: Add -q/-- flags to /execwrite to EXECWRITE and cmd_execW (#2675) added two flags to EXECWRITE and cmd_execw -q : (quiet) to allow suppressing of additional (debug) output at the text box -- : (stop parsing for further flags) for the edge cases where -q itself migh be part of used data and the user wants to show that at the text box Closes #2666 --- src/common/outbound.c | 25 +++++++++++++++++++++---- 1 file changed, 21 insertions(+), 4 deletions(-) (limited to 'src/common') diff --git a/src/common/outbound.c b/src/common/outbound.c index da57ea33..6f0241be 100644 --- a/src/common/outbound.c +++ b/src/common/outbound.c @@ -1579,9 +1579,26 @@ cmd_execw (struct session *sess, char *tbuf, char *word[], char *word_eol[]) EMIT_SIGNAL (XP_TE_NOCHILD, sess, NULL, NULL, NULL, NULL, 0); return FALSE; } - len = strlen(word_eol[2]); - temp = g_strconcat (word_eol[2], "\n", NULL); - PrintText(sess, temp); + if (strcmp (word[2], "--") == 0) + { + len = strlen(word_eol[3]); + temp = g_strconcat (word_eol[3], "\n", NULL); + PrintText(sess, temp); + } + else + { + if (strcmp (word[2], "-q") == 0) + { + len = strlen(word_eol[3]); + temp = g_strconcat (word_eol[3], "\n", NULL); + } + else + { + len = strlen(word_eol[2]); + temp = g_strconcat (word_eol[2], "\n", NULL); + PrintText(sess, temp); + } + } write(sess->running_exec->myfd, temp, len + 1); g_free(temp); @@ -3977,7 +3994,7 @@ const struct commands xc_cmds[] = { N_("EXECKILL [-9], kills a running exec in the current session. If -9 is given the process is SIGKILL'ed")}, #ifndef __EMX__ {"EXECSTOP", cmd_execs, 0, 0, 1, N_("EXECSTOP, sends the process SIGSTOP")}, - {"EXECWRITE", cmd_execw, 0, 0, 1, N_("EXECWRITE, sends data to the processes stdin")}, + {"EXECWRITE", cmd_execw, 0, 0, 1, N_("EXECWRITE [-q|--], sends data to the processes stdin; use -q flag to quiet/suppress output at text box; use -- flag to stop interpreting arguments as flags, needed if -q itself would occur as data")}, #endif #endif #if 0 -- cgit 1.4.1 From 94efa378f7f7329514b04a2f8dadf2b9d57b9f8e Mon Sep 17 00:00:00 2001 From: Masoud Naservand Date: Thu, 17 Feb 2022 15:39:05 +0330 Subject: Reverse the notify.conf linked list before writing hexchat populates the single linked list `notify_list` defined in `src/common/notify.c` from `notify.conf` file. Each new line read from the file is added to the list by `g_slist_prepend()` which adds it to the front of the list. But in `notify_save()` the list elements are read from the start to end of the list and written to the `notify.conf`. This means everytime hexchat is opened and closed, the contents of `notify.conf` get reversed. This commit creates a temporary glist in `notify_save()` and applies `g_slist_reverse()` on it and writes the contents of this reversed list to `notify.conf`. And solves issue #2680 --- src/common/notify.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'src/common') diff --git a/src/common/notify.c b/src/common/notify.c index b5316c36..ef52889b 100644 --- a/src/common/notify.c +++ b/src/common/notify.c @@ -123,7 +123,11 @@ notify_save (void) { int fh; struct notify *notify; - GSList *list = notify_list; + // while reading the notify.conf file, elements are added by prepending to the + // list. reverse the list before writing to disk to keep the original + // order of the list + GSList *list = g_slist_copy(notify_list); + list = g_slist_reverse(list); fh = hexchat_open_file ("notify.conf", O_TRUNC | O_WRONLY | O_CREAT, 0600, XOF_DOMODE); if (fh != -1) @@ -142,6 +146,7 @@ notify_save (void) } close (fh); } + g_slist_free(list); } void -- cgit 1.4.1 From 133f62806441a5db1156653aa1f077d2e8deeb34 Mon Sep 17 00:00:00 2001 From: Sadie Powell Date: Fri, 1 Apr 2022 17:24:59 +0100 Subject: Display common help numerics as SERVTEXT. This makes it a lot easier for users to actually read. --- src/common/proto-irc.c | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'src/common') diff --git a/src/common/proto-irc.c b/src/common/proto-irc.c index a8d997b6..32cc47f2 100644 --- a/src/common/proto-irc.c +++ b/src/common/proto-irc.c @@ -920,6 +920,14 @@ process_numeric (session * sess, int n, notify_set_online (serv, word[4], tags_data); break; + case 524: // ERR_HELPNOTFOUND + case 704: // RPL_HELPSTART + case 705: // RPL_HELPTXT + case 706: // RPL_ENDOFHELP + EMIT_SIGNAL_TIMESTAMP (XP_TE_SERVTEXT, sess, STRIP_COLON(word, word_eol, 5), NULL, NULL, NULL, + 0, tags_data->timestamp); + break; + case 728: /* +q-list entry */ /* NOTE: FREENODE returns these results inconsistent with e.g. +b */ /* Who else has imlemented MODE_QUIET, I wonder? */ -- cgit 1.4.1