diff options
Diffstat (limited to 'src/common')
-rw-r--r-- | src/common/cfgfiles.c | 2 | ||||
-rw-r--r-- | src/common/dbus/example-gdbus.py | 32 | ||||
-rw-r--r-- | src/common/dbus/example.py | 6 | ||||
-rw-r--r-- | src/common/fe.h | 5 | ||||
-rw-r--r-- | src/common/hexchat.h | 3 | ||||
-rw-r--r-- | src/common/inbound.c | 72 | ||||
-rw-r--r-- | src/common/modes.c | 4 | ||||
-rw-r--r-- | src/common/outbound.c | 42 | ||||
-rw-r--r-- | src/common/proto-irc.c | 33 | ||||
-rw-r--r-- | src/common/server.c | 25 | ||||
-rw-r--r-- | src/common/servlist.c | 18 | ||||
-rw-r--r-- | src/common/ssl.c | 6 | ||||
-rw-r--r-- | src/common/text.c | 83 | ||||
-rw-r--r-- | src/common/text.h | 6 | ||||
-rw-r--r-- | src/common/textevents.in | 2 | ||||
-rw-r--r-- | src/common/url.c | 4 |
16 files changed, 175 insertions, 168 deletions
diff --git a/src/common/cfgfiles.c b/src/common/cfgfiles.c index 243371b0..cca2267a 100644 --- a/src/common/cfgfiles.c +++ b/src/common/cfgfiles.c @@ -450,7 +450,6 @@ const struct prefs vars[] = {"gui_tab_icons", P_OFFINT (hex_gui_tab_icons), TYPE_BOOL}, {"gui_tab_layout", P_OFFINT (hex_gui_tab_layout), TYPE_INT}, {"gui_tab_newtofront", P_OFFINT (hex_gui_tab_newtofront), TYPE_INT}, - {"gui_tab_notices", P_OFFINT (hex_gui_tab_notices), TYPE_BOOL}, {"gui_tab_pos", P_OFFINT (hex_gui_tab_pos), TYPE_INT}, {"gui_tab_server", P_OFFINT (hex_gui_tab_server), TYPE_BOOL}, {"gui_tab_small", P_OFFINT (hex_gui_tab_small), TYPE_INT}, @@ -524,6 +523,7 @@ const struct prefs vars[] = {"irc_nick3", P_OFFSET (hex_irc_nick3), TYPE_STR}, {"irc_nick_hilight", P_OFFSET (hex_irc_nick_hilight), TYPE_STR}, {"irc_no_hilight", P_OFFSET (hex_irc_no_hilight), TYPE_STR}, + {"irc_notice_pos", P_OFFINT (hex_irc_notice_pos), TYPE_INT}, {"irc_part_reason", P_OFFSET (hex_irc_part_reason), TYPE_STR}, {"irc_quit_reason", P_OFFSET (hex_irc_quit_reason), TYPE_STR}, {"irc_raw_modes", P_OFFINT (hex_irc_raw_modes), TYPE_BOOL}, diff --git a/src/common/dbus/example-gdbus.py b/src/common/dbus/example-gdbus.py new file mode 100644 index 00000000..3c25771b --- /dev/null +++ b/src/common/dbus/example-gdbus.py @@ -0,0 +1,32 @@ +#!/usr/bin/python + +from gi.repository import Gio + +bus = Gio.bus_get_sync(Gio.BusType.SESSION, None) +connection = Gio.DBusProxy.new_sync(bus, Gio.DBusProxyFlags.NONE, None, + 'org.hexchat.service', '/org/hexchat/Remote', 'org.hexchat.connection', None) +path = connection.Connect('(ssss)', + 'example.py', + 'Python example', + 'Example of a D-Bus client written in python', + '1.0') +hexchat = Gio.DBusProxy.new_sync(bus, Gio.DBusProxyFlags.NONE, None, + 'org.hexchat.service', path, 'org.hexchat.plugin', None) + +# Note the type before every arguement, this must be done. +# Type requirements are listed in our docs and characters are listed in the dbus docs. +# s = string, u = uint, i = int, etc. + +channels = hexchat.ListGet ('(s)', "channels") +while hexchat.ListNext ('(u)', channels): + name = hexchat.ListStr ('(us)', channels, "channel") + print("------- " + name + " -------") + hexchat.SetContext ('(u)', hexchat.ListInt ('(us)', channels, "context")) + hexchat.EmitPrint ('(sas)', "Channel Message", ["John", "Hi there", "@"]) + users = hexchat.ListGet ('(s)', "users") + while hexchat.ListNext ('(u)', users): + print("Nick: " + hexchat.ListStr ('(us)', users, "nick")) + hexchat.ListFree ('(u)', users) +hexchat.ListFree ('(u)', channels) + +print(hexchat.Strip ('(sii)', "\00312Blue\003 \002Bold!\002", -1, 1|2)) diff --git a/src/common/dbus/example.py b/src/common/dbus/example.py index 49855784..f326e98a 100644 --- a/src/common/dbus/example.py +++ b/src/common/dbus/example.py @@ -15,14 +15,14 @@ hexchat = dbus.Interface(proxy, 'org.hexchat.plugin') channels = hexchat.ListGet ("channels") while hexchat.ListNext (channels): name = hexchat.ListStr (channels, "channel") - print "------- " + name + " -------" + print("------- " + name + " -------") hexchat.SetContext (hexchat.ListInt (channels, "context")) hexchat.EmitPrint ("Channel Message", ["John", "Hi there", "@"]) users = hexchat.ListGet ("users") while hexchat.ListNext (users): - print "Nick: " + hexchat.ListStr (users, "nick") + print("Nick: " + hexchat.ListStr (users, "nick")) hexchat.ListFree (users) hexchat.ListFree (channels) -print hexchat.Strip ("\00312Blue\003 \002Bold!\002", -1, 1|2) +print(hexchat.Strip ("\00312Blue\003 \002Bold!\002", -1, 1|2)) diff --git a/src/common/fe.h b/src/common/fe.h index 4903ef0e..337c4b47 100644 --- a/src/common/fe.h +++ b/src/common/fe.h @@ -59,9 +59,8 @@ int fe_is_chanwindow (struct server *serv); void fe_add_chan_list (struct server *serv, char *chan, char *users, char *topic); void fe_chan_list_end (struct server *serv); -int fe_is_banwindow (struct session *sess); -void fe_add_ban_list (struct session *sess, char *mask, char *who, char *when, int is_exemption); -void fe_ban_list_end (struct session *sess, int is_exemption); +gboolean fe_add_ban_list (struct session *sess, char *mask, char *who, char *when, int rplcode); +gboolean fe_ban_list_end (struct session *sess, int rplcode); void fe_notify_update (char *name); void fe_notify_ask (char *name, char *networks); void fe_text_clear (struct session *sess, int lines); diff --git a/src/common/hexchat.h b/src/common/hexchat.h index fad61938..e234c976 100644 --- a/src/common/hexchat.h +++ b/src/common/hexchat.h @@ -146,7 +146,6 @@ struct hexchatprefs unsigned int hex_gui_tab_dialogs; unsigned int hex_gui_tab_dots; unsigned int hex_gui_tab_icons; - unsigned int hex_gui_tab_notices; unsigned int hex_gui_tab_server; unsigned int hex_gui_tab_sort; unsigned int hex_gui_tab_utils; @@ -277,6 +276,7 @@ struct hexchatprefs int hex_input_balloon_time; int hex_irc_ban_type; int hex_irc_join_delay; + int hex_irc_notice_pos; int hex_net_ping_timeout; int hex_net_proxy_port; int hex_net_proxy_type; /* 0=disabled, 1=wingate 2=socks4, 3=socks5, 4=http */ @@ -576,6 +576,7 @@ typedef struct server unsigned int have_idmsg:1; /* freenode's IDENTIFY-MSG */ unsigned int have_sasl:1; /* SASL capability */ unsigned int have_except:1; /* ban exemptions +e */ + unsigned int have_invite:1; /* invite exemptions +I */ unsigned int using_cp1255:1; /* encoding is CP1255/WINDOWS-1255? */ unsigned int using_irc:1; /* encoding is "IRC" (CP1252/UTF-8 hybrid)? */ unsigned int use_who:1; /* whether to use WHO command to get dcc_ip */ diff --git a/src/common/inbound.c b/src/common/inbound.c index 54e5bff0..dae919b8 100644 --- a/src/common/inbound.c +++ b/src/common/inbound.c @@ -155,6 +155,7 @@ void inbound_privmsg (server *serv, char *from, char *ip, char *text, int id) { session *sess; + struct User *user; char idtext[64]; sess = find_dialog (serv, from); @@ -197,6 +198,10 @@ inbound_privmsg (server *serv, char *from, char *ip, char *text, int id) EMIT_SIGNAL (XP_TE_PRIVMSG, sess, from, text, idtext, NULL, 0); return; } + + user = userlist_find (sess, from); + if (user) + user->lasttalk = time (0); if (sess->type == SESS_DIALOG) EMIT_SIGNAL (XP_TE_DPRIVMSG, sess, from, text, idtext, NULL, 0); @@ -867,7 +872,27 @@ inbound_notice (server *serv, char *to, char *nick, char *msg, char *ip, int id) if (!sess) { ptr = 0; - if (prefs.hex_gui_tab_notices) + if (prefs.hex_irc_notice_pos == 0) + { + /* paranoia check */ + if (msg[0] == '[' && (!serv->have_idmsg || id)) + { + /* guess where chanserv meant to post this -sigh- */ + if (!g_ascii_strcasecmp (nick, "ChanServ") && !find_dialog (serv, nick)) + { + char *dest = strdup (msg + 1); + char *end = strchr (dest, ']'); + if (end) + { + *end = 0; + sess = find_channel (serv, dest); + } + free (dest); + } + } + if (!sess) + sess = find_session_from_nick (nick, serv); + } else if (prefs.hex_irc_notice_pos == 1) { int stype = server_notice ? SESS_SNOTICES : SESS_NOTICES; sess = find_session_from_type (stype, serv); @@ -888,25 +913,9 @@ inbound_notice (server *serv, char *to, char *nick, char *msg, char *ip, int id) msg += 14; } else { - /* paranoia check */ - if (msg[0] == '[' && (!serv->have_idmsg || id)) - { - /* guess where chanserv meant to post this -sigh- */ - if (!g_ascii_strcasecmp (nick, "ChanServ") && !find_dialog (serv, nick)) - { - char *dest = strdup (msg + 1); - char *end = strchr (dest, ']'); - if (end) - { - *end = 0; - sess = find_channel (serv, dest); - } - free (dest); - } - } - if (!sess) - sess = find_session_from_nick (nick, serv); + sess = serv->front_session; } + if (!sess) { if (server_notice) @@ -1030,6 +1039,7 @@ check_autojoin_channels (server *serv) free (serv->autojoin); serv->autojoin = NULL; + i++; } /* this is really only for re-connects when you @@ -1053,8 +1063,17 @@ check_autojoin_channels (server *serv) if (po) *po = 0; - channels = g_slist_append (channels, g_strdup (sess->waitchannel)); - keys = g_slist_append (keys, g_strdup (sess->channelkey)); + /* There can be no gap between keys, list keyed chans first. */ + if (sess->channelkey[0] != 0) + { + channels = g_slist_prepend (channels, g_strdup (sess->waitchannel)); + keys = g_slist_prepend (keys, g_strdup (sess->channelkey)); + } + else + { + channels = g_slist_append (channels, g_strdup (sess->waitchannel)); + keys = g_slist_append (keys, g_strdup (sess->channelkey)); + } i++; } } @@ -1258,12 +1277,14 @@ inbound_user_info (session *sess, char *chan, char *user, char *host, } int -inbound_banlist (session *sess, time_t stamp, char *chan, char *mask, char *banner, int is_exemption) +inbound_banlist (session *sess, time_t stamp, char *chan, char *mask, char *banner, int rplcode) { char *time_str = ctime (&stamp); server *serv = sess->server; + char *nl; - time_str[19] = 0; /* get rid of the \n */ + if ((nl = strchr (time_str, '\n'))) + *nl = 0; if (stamp == 0) time_str = ""; @@ -1274,18 +1295,17 @@ inbound_banlist (session *sess, time_t stamp, char *chan, char *mask, char *bann goto nowindow; } - if (!fe_is_banwindow (sess)) + if (!fe_add_ban_list (sess, mask, banner, time_str, rplcode)) { nowindow: /* let proto-irc.c do the 'goto def' for exemptions */ - if (is_exemption) + if (rplcode != 367) /* RPL_EXCEPTLIST */ return FALSE; EMIT_SIGNAL (XP_TE_BANLIST, sess, chan, mask, banner, time_str, 0); return TRUE; } - fe_add_ban_list (sess, mask, banner, time_str, is_exemption); return TRUE; } diff --git a/src/common/modes.c b/src/common/modes.c index 6caa46b9..7326b6fe 100644 --- a/src/common/modes.c +++ b/src/common/modes.c @@ -824,6 +824,10 @@ inbound_005 (server * serv, char *word[]) #ifndef WIN32 serv->have_except = TRUE; #endif + } else if (strcmp (word[w], "INVEX") == 0) + { + /* supports mode letter +I, default channel invite */ + serv->have_invite = TRUE; } else if (strncmp (word[w], "ELIST=", 6) == 0) { /* supports LIST >< min/max user counts? */ diff --git a/src/common/outbound.c b/src/common/outbound.c index c146c2ac..c543997a 100644 --- a/src/common/outbound.c +++ b/src/common/outbound.c @@ -2272,7 +2272,7 @@ cmd_ignore (struct session *sess, char *tbuf, char *word[], char *word_eol[]) return TRUE; } if (!*word[3]) - return FALSE; + word[3] = "ALL"; i = 3; while (1) @@ -2873,7 +2873,7 @@ open_query (server *serv, char *nick, gboolean focus_existing) sess = find_dialog (serv, nick); if (!sess) - new_ircwindow (serv, nick, SESS_DIALOG, 1); + new_ircwindow (serv, nick, SESS_DIALOG, focus_existing); else if (focus_existing) fe_ctrl_gui (sess, 2, 0); /* bring-to-front */ } @@ -3066,7 +3066,7 @@ cmd_splay (struct session *sess, char *tbuf, char *word[], char *word_eol[]) } static int -parse_irc_url (char *url, char *server_name[], char *port[], char *channel[], int *use_ssl) +parse_irc_url (char *url, char *server_name[], char *port[], char *channel[], char *key[], int *use_ssl) { char *co; #ifdef USE_OPENSSL @@ -3104,6 +3104,15 @@ urlserv: *channel = co; } + /* check for key - mirc style */ + co = strchr (co + 1, '?'); + if (co) + { + *co = 0; + co++; + *key = co; + } + return TRUE; } return FALSE; @@ -3117,6 +3126,7 @@ cmd_server (struct session *sess, char *tbuf, char *word[], char *word_eol[]) char *port = NULL; char *pass = NULL; char *channel = NULL; + char *key = NULL; int use_ssl = FALSE; int is_url = TRUE; server *serv = sess->server; @@ -3130,7 +3140,7 @@ cmd_server (struct session *sess, char *tbuf, char *word[], char *word_eol[]) } #endif - if (!parse_irc_url (word[2 + offset], &server_name, &port, &channel, &use_ssl)) + if (!parse_irc_url (word[2 + offset], &server_name, &port, &channel, &key, &use_ssl)) { is_url = FALSE; server_name = word[2 + offset]; @@ -3156,6 +3166,8 @@ cmd_server (struct session *sess, char *tbuf, char *word[], char *word_eol[]) { sess->willjoinchannel[0] = '#'; safe_strcpy ((sess->willjoinchannel + 1), channel, (CHANLEN - 1)); + if (key) + safe_strcpy (sess->channelkey, key, 64); } /* support +7000 style ports like mIRC */ @@ -3277,6 +3289,12 @@ cmd_unignore (struct session *sess, char *tbuf, char *word[], char *arg = word[3]; if (*mask) { + if (strchr (mask, '?') == NULL && strchr (mask, '*') == NULL) + { + mask = tbuf; + snprintf (tbuf, TBUFSIZE, "%s!*@*", word[2]); + } + if (ignore_del (mask, NULL)) { if (g_ascii_strcasecmp (arg, "QUIET")) @@ -3356,15 +3374,18 @@ find_server_from_net (void *net) } static void -url_join_only (server *serv, char *tbuf, char *channel) +url_join_only (server *serv, char *tbuf, char *channel, char *key) { - /* already connected, JOIN only. FIXME: support keys? */ + /* already connected, JOIN only. */ if (channel == NULL) return; tbuf[0] = '#'; /* tbuf is 4kb */ safe_strcpy ((tbuf + 1), channel, 256); - serv->p_join (serv, tbuf, ""); + if (key) + serv->p_join (serv, tbuf, key); + else + serv->p_join (serv, tbuf, ""); } static int @@ -3375,12 +3396,13 @@ cmd_url (struct session *sess, char *tbuf, char *word[], char *word_eol[]) char *server_name = NULL; char *port = NULL; char *channel = NULL; + char *key = NULL; char *url = g_strdup (word[2]); int use_ssl = FALSE; void *net; server *serv; - if (parse_irc_url (url, &server_name, &port, &channel, &use_ssl)) + if (parse_irc_url (url, &server_name, &port, &channel, &key, &use_ssl)) { /* maybe we're already connected to this net */ @@ -3396,7 +3418,7 @@ cmd_url (struct session *sess, char *tbuf, char *word[], char *word_eol[]) serv = find_server_from_net (net); if (serv) { - url_join_only (serv, tbuf, channel); + url_join_only (serv, tbuf, channel, key); g_free (url); return TRUE; } @@ -3407,7 +3429,7 @@ cmd_url (struct session *sess, char *tbuf, char *word[], char *word_eol[]) serv = find_server_from_hostname (server_name); if (serv) { - url_join_only (serv, tbuf, channel); + url_join_only (serv, tbuf, channel, key); g_free (url); return TRUE; } diff --git a/src/common/proto-irc.c b/src/common/proto-irc.c index 18015607..13147016 100644 --- a/src/common/proto-irc.c +++ b/src/common/proto-irc.c @@ -778,8 +778,18 @@ 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)) + goto def; + break; + + case 347: /* end of invite list */ + if (!fe_ban_list_end (sess, 347)) + goto def; + break; + case 348: /* +e-list entry */ - if (!inbound_banlist (sess, atol (word[7]), word[4], word[5], word[6], TRUE)) + if (!inbound_banlist (sess, atol (word[7]), word[4], word[5], word[6], 348)) goto def; break; @@ -790,9 +800,8 @@ process_numeric (session * sess, int n, sess = serv->front_session; goto def; } - if (!fe_is_banwindow (sess)) + if (!fe_ban_list_end (sess, 349)) goto def; - fe_ban_list_end (sess, TRUE); break; case 353: /* NAMES */ @@ -806,7 +815,8 @@ process_numeric (session * sess, int n, break; case 367: /* banlist entry */ - inbound_banlist (sess, atol (word[7]), word[4], word[5], word[6], FALSE); + if (!inbound_banlist (sess, atol (word[7]), word[4], word[5], word[6], 367)) + goto def; break; case 368: @@ -816,9 +826,8 @@ process_numeric (session * sess, int n, sess = serv->front_session; goto def; } - if (!fe_is_banwindow (sess)) + if (!fe_ban_list_end (sess, 368)) goto def; - fe_ban_list_end (sess, FALSE); break; case 369: /* WHOWAS end */ @@ -881,6 +890,18 @@ process_numeric (session * sess, int n, notify_set_online (serv, word[4]); break; + case 728: /* +q-list entry */ + /* NOTE: FREENODE returns these results inconsistent with e.g. +b */ + /* Who else has imlemented MODE_QUIET, I wonder? */ + if (!inbound_banlist (sess, atol (word[8]), word[4], word[6], word[7], 728)) + goto def; + break; + + case 729: /* end of quiet list */ + if (!fe_ban_list_end (sess, 729)) + goto def; + break; + case 903: /* successful SASL auth */ case 904: /* aborted SASL auth */ case 905: /* failed SASL auth */ diff --git a/src/common/server.c b/src/common/server.c index 6ddaa18d..8ad1d6ca 100644 --- a/src/common/server.c +++ b/src/common/server.c @@ -313,13 +313,6 @@ server_inline (server *serv, char *line, int len) { char *utf_line_allocated = NULL; -#ifdef WIN32 -#if 0 - char *cleaned_line; - int cleaned_len; -#endif -#endif - /* Checks whether we're set to use UTF-8 charset */ if (serv->using_irc || /* 1. using CP1252/UTF-8 Hybrid */ (serv->encoding == NULL && prefs.utf8_locale) || /* OR 2. using system default->UTF-8 */ @@ -406,28 +399,11 @@ server_inline (server *serv, char *line, int len) } } -#ifdef WIN32 -#if 0 - cleaned_line = text_replace_non_bmp (line, len, &cleaned_len); - if (cleaned_line != NULL ) { - line = cleaned_line; - len = cleaned_len; - } -#endif - text_replace_non_bmp2 (line); -#endif - fe_add_rawlog (serv, line, len, FALSE); /* let proto-irc.c handle it */ serv->p_inline (serv, line, len); -#ifdef WIN32 -#if 0 - g_free (cleaned_line); -#endif -#endif - if (utf_line_allocated != NULL) /* only if a special copy was allocated */ g_free (utf_line_allocated); } @@ -1914,6 +1890,7 @@ server_set_defaults (server *serv) serv->have_idmsg = FALSE; serv->have_sasl = FALSE; serv->have_except = FALSE; + serv->have_invite = FALSE; } char * diff --git a/src/common/servlist.c b/src/common/servlist.c index f4208f61..96fa4557 100644 --- a/src/common/servlist.c +++ b/src/common/servlist.c @@ -1047,7 +1047,19 @@ servlist_load (void) char *tmp; ircnet *net = NULL; - fp = hexchat_fopen_file ("servlist_.conf", "r", 0); + /* simple migration we will keep for a short while */ + char *oldfile = g_build_filename (get_xdir (), "servlist_.conf", NULL); + char *newfile = g_build_filename (get_xdir (), "servlist.conf", NULL); + + if (g_file_test (oldfile, G_FILE_TEST_EXISTS) && !g_file_test (newfile, G_FILE_TEST_EXISTS)) + { + g_rename (oldfile, newfile); + } + + g_free (oldfile); + g_free (newfile); + + fp = hexchat_fopen_file ("servlist.conf", "r", 0); if (!fp) return FALSE; @@ -1178,12 +1190,12 @@ servlist_save (void) #ifndef WIN32 int first = FALSE; - buf = g_strdup_printf ("%s/servlist_.conf", get_xdir ()); + buf = g_strdup_printf ("%s/servlist.conf", get_xdir ()); if (g_access (buf, F_OK) != 0) first = TRUE; #endif - fp = hexchat_fopen_file ("servlist_.conf", "w", 0); + fp = hexchat_fopen_file ("servlist.conf", "w", 0); if (!fp) { #ifndef WIN32 diff --git a/src/common/ssl.c b/src/common/ssl.c index 75a81250..742da619 100644 --- a/src/common/ssl.c +++ b/src/common/ssl.c @@ -31,7 +31,7 @@ #include "ssl.h" /* struct cert_info */ #ifndef HAVE_SNPRINTF -#include <glib.h> +#include <glib.h> #include <glib/gprintf.h> #define snprintf g_snprintf #endif @@ -77,7 +77,7 @@ _SSL_context_init (void (*info_cb_func), int server) SSLeay_add_ssl_algorithms (); SSL_load_error_strings (); - ctx = SSL_CTX_new (server ? SSLv3_server_method() : SSLv3_client_method ()); + ctx = SSL_CTX_new (server ? SSLv23_server_method() : SSLv23_client_method ()); SSL_CTX_set_session_cache_mode (ctx, SSL_SESS_CACHE_BOTH); SSL_CTX_set_timeout (ctx, 300); @@ -288,7 +288,7 @@ _SSL_socket (SSL_CTX *ctx, int sd) __SSL_critical_error ("SSL_new"); SSL_set_fd (ssl, sd); - if (ctx->method == SSLv3_client_method()) + if (ctx->method == SSLv23_client_method()) SSL_set_connect_state (ssl); else SSL_set_accept_state(ssl); diff --git a/src/common/text.c b/src/common/text.c index fdf08b90..8196cc03 100644 --- a/src/common/text.c +++ b/src/common/text.c @@ -307,21 +307,9 @@ scrollback_load (session *sess) { text = strip_color (text + 1, -1, STRIP_COLOR); } -#ifdef WIN32 -#if 0 - cleaned_text = text_replace_non_bmp (text, -1, &cleaned_len); - if (cleaned_text != NULL) - { - if (prefs.hex_text_stripcolor_replay) - { - g_free (text); - } - text = cleaned_text; - } -#endif - text_replace_non_bmp2 (text); -#endif + fe_print_text (sess, text, stamp); + if (prefs.hex_text_stripcolor_replay) { g_free (text); @@ -833,71 +821,6 @@ iso_8859_1_to_utf8 (unsigned char *text, int len, gsize *bytes_written) return res; } -#ifdef WIN32 -/* replace characters outside of the Basic Multilingual Plane with - * replacement characters (0xFFFD) */ -#if 0 -char * -text_replace_non_bmp (char *utf8_input, int input_length, glong *output_length) -{ - gunichar *ucs4_text; - gunichar suspect; - gchar *utf8_text; - glong ucs4_length; - glong index; - - ucs4_text = g_utf8_to_ucs4_fast (utf8_input, input_length, &ucs4_length); - - /* replace anything not in the Basic Multilingual Plane - * (code points above 0xFFFF) with the replacement - * character */ - for (index = 0; index < ucs4_length; index++) - { - suspect = ucs4_text[index]; - if ((suspect >= 0x1D173 && suspect <= 0x1D17A) - || (suspect >= 0xE0001 && suspect <= 0xE007F)) - { - ucs4_text[index] = 0xFFFD; /* replacement character */ - } - } - - utf8_text = g_ucs4_to_utf8 ( - ucs4_text, - ucs4_length, - NULL, - output_length, - NULL - ); - g_free (ucs4_text); - - return utf8_text; -} -#endif - -void -text_replace_non_bmp2 (char *utf8_input) -{ - char *tmp = utf8_input, *next; - gunichar suspect; - - while (tmp != NULL && *tmp) - { - next = g_utf8_next_char(tmp); - suspect = g_utf8_get_char_validated(tmp, next - tmp); - if ((suspect >= 0x1D173 && suspect <= 0x1D17A) || (suspect >= 0xE0001 && suspect <= 0xE007F)) - { - /* 0xFFFD - replacement character */ - *tmp = 0xEF; - *(++tmp) = 0xBF; - *(++tmp) = 0xBD; - *(++tmp) = 0x1A; /* ASCII Sub to fill the 4th non-BMP byte */ - } - - tmp = next; - } -} -#endif - char * text_validate (char **text, int *len) { @@ -1857,6 +1780,8 @@ format_event (session *sess, int index, char **args, char *o, int sizeofo, unsig printf ("arg[%d] is NULL in print event\n", a + 1); } else { + if (strlen (ar) > sizeofo - oi - 4) + ar[sizeofo - oi - 4] = 0; /* Avoid buffer overflow */ if (stripcolor_args & ARG_FLAG(a + 1)) len = strip_color2 (ar, -1, &o[oi], STRIP_ALL); else len = strip_hidden_attribute (ar, &o[oi]); oi += len; diff --git a/src/common/text.h b/src/common/text.h index e018c769..103e294d 100644 --- a/src/common/text.h +++ b/src/common/text.h @@ -29,12 +29,6 @@ void pevent_make_pntevts (void); int text_color_of (char *name); void text_emit (int index, session *sess, char *a, char *b, char *c, char *d); int text_emit_by_name (char *name, session *sess, char *a, char *b, char *c, char *d); -#ifdef WIN32 -#if 0 -char *text_replace_non_bmp (char *utf8_input, int input_length, glong *output_length); -#endif -void text_replace_non_bmp2 (char *utf8_input); -#endif char *text_validate (char **text, int *len); int get_stamp_str (char *fmt, time_t tim, char **ret); void format_event (session *sess, int index, char **args, char *o, int sizeofo, unsigned int stripcolor_args); diff --git a/src/common/textevents.in b/src/common/textevents.in index 69d42526..ff1fd9c9 100644 --- a/src/common/textevents.in +++ b/src/common/textevents.in @@ -187,7 +187,7 @@ pevt_chansetlimit_help Channel UnBan XP_TE_CHANUNBAN pevt_chanunban_help -%C22*%O$t%C26$1%O removes ban on %C24$2%O +%C22*%O$t%C26$1%O removes ban on %C18$2%O 2 Channel Voice diff --git a/src/common/url.c b/src/common/url.c index 6bd7d9ff..2007b600 100644 --- a/src/common/url.c +++ b/src/common/url.c @@ -515,8 +515,8 @@ re_channel (void) /* PATH description --- */ #ifdef WIN32 -/* Windows path can be C: D: etc */ -#define PATH "^([a-z]:).*" +/* Windows path can be .\ ..\ or C: D: etc */ +#define PATH "^(\\.{1,2}\\\\|[a-z]:).*" #else /* Linux path can be / or ./ or ../ etc */ #define PATH "^(/|\\./|\\.\\./).*" |