summary refs log tree commit diff stats
path: root/src/common
diff options
context:
space:
mode:
Diffstat (limited to 'src/common')
-rw-r--r--src/common/cfgfiles.c22
-rw-r--r--src/common/plugin.c3
-rw-r--r--src/common/server.c2
-rw-r--r--src/common/textevents.in10
-rw-r--r--src/common/url.c44
5 files changed, 61 insertions, 20 deletions
diff --git a/src/common/cfgfiles.c b/src/common/cfgfiles.c
index b31d7e37..68bad7a9 100644
--- a/src/common/cfgfiles.c
+++ b/src/common/cfgfiles.c
@@ -844,23 +844,23 @@ int
 save_config (void)
 {
 	int fh, i;
-	char *new_config, *config;
+	char *config, *new_config;
 
 	check_prefs_dir ();
 
 	config = default_file ();
-	new_config = g_strdup_printf ("%s.new", config);
+	new_config = g_strconcat (config, ".new", NULL);
 	
 	fh = g_open (new_config, OFLAGS | O_TRUNC | O_WRONLY | O_CREAT, 0600);
 	if (fh == -1)
 	{
-		free (new_config);
+		g_free (new_config);
 		return 0;
 	}
 
 	if (!cfg_put_str (fh, "version", PACKAGE_VERSION))
 	{
-		free (new_config);
+		g_free (new_config);
 		return 0;
 	}
 		
@@ -872,7 +872,7 @@ save_config (void)
 		case TYPE_STR:
 			if (!cfg_put_str (fh, vars[i].name, (char *) &prefs + vars[i].offset))
 			{
-				free (new_config);
+				g_free (new_config);
 				return 0;
 			}
 			break;
@@ -880,7 +880,7 @@ save_config (void)
 		case TYPE_BOOL:
 			if (!cfg_put_int (fh, *((int *) &prefs + vars[i].offset), vars[i].name))
 			{
-				free (new_config);
+				g_free (new_config);
 				return 0;
 			}
 		}
@@ -890,19 +890,19 @@ save_config (void)
 
 	if (close (fh) == -1)
 	{
-		free (new_config);
+		g_free (new_config);
 		return 0;
 	}
 
 #ifdef WIN32
-	unlink (config);	/* win32 can't rename to an existing file */
+	g_unlink (config);	/* win32 can't rename to an existing file */
 #endif
-	if (rename (new_config, config) == -1)
+	if (g_rename (new_config, config) == -1)
 	{
-		free (new_config);
+		g_free (new_config);
 		return 0;
 	}
-	free (new_config);
+	g_free (new_config);
 
 	return 1;
 }
diff --git a/src/common/plugin.c b/src/common/plugin.c
index fb677325..ade7fce4 100644
--- a/src/common/plugin.c
+++ b/src/common/plugin.c
@@ -472,12 +472,9 @@ plugin_auto_load (session *sess)
 	for_files (".\\plugins", "hcexec.dll", plugin_auto_load_cb);
 	for_files (".\\plugins", "hcfishlim.dll", plugin_auto_load_cb);
 	for_files (".\\plugins", "hchextray.dll", plugin_auto_load_cb);
-	for_files (".\\plugins", "hclua.dll", plugin_auto_load_cb);
 	for_files (".\\plugins", "hcmpcinfo.dll", plugin_auto_load_cb);
 	for_files (".\\plugins", "hcperl.dll", plugin_auto_load_cb);
 	for_files (".\\plugins", "hcpython.dll", plugin_auto_load_cb);
-	/* for_files (".\\plugins", "hcsasl.dll", plugin_auto_load_cb); we have this built-in */
-	for_files (".\\plugins", "hctcl.dll", plugin_auto_load_cb);
 	for_files (".\\plugins", "hcupd.dll", plugin_auto_load_cb);
 	for_files (".\\plugins", "hcwinamp.dll", plugin_auto_load_cb);
 	for_files (".\\plugins", "hcsysinfo.dll", plugin_auto_load_cb);
diff --git a/src/common/server.c b/src/common/server.c
index dbfdcdd8..3e694c43 100644
--- a/src/common/server.c
+++ b/src/common/server.c
@@ -157,6 +157,8 @@ server_send_real (server *serv, char *buf, int len)
 {
 	fe_add_rawlog (serv, buf, len, TRUE);
 
+	url_check_line (buf, len);
+
 	return tcp_send_real (serv->ssl, serv->sok, serv->encoding, serv->using_irc,
 								 buf, len);
 }
diff --git a/src/common/textevents.in b/src/common/textevents.in
index f481a9ad..827900ff 100644
--- a/src/common/textevents.in
+++ b/src/common/textevents.in
@@ -13,7 +13,7 @@ pevt_banlist_help
 Banned
 XP_TE_BANNED
 pevt_generic_channel_help
-%C22*%O$tCannot join%C22 $1 %O(%C20You are banned%O).
+%C22*%O$tCannot join %C22$1 %O(%C20You are banned%O).
 1
 
 Beep
@@ -91,7 +91,7 @@ pevt_chandevoice_help
 Channel Exempt
 XP_TE_CHANEXEMPT
 pevt_chanexempt_help
-%C22*%O$t%C26 $1%C sets exempt on %C18$2%O
+%C22*%O$t%C26$1%C sets exempt on %C18$2%O
 2
 
 Channel Half-Operator
@@ -103,7 +103,7 @@ pevt_chanhop_help
 Channel INVITE
 XP_TE_CHANINVITE
 pevt_chaninvite_help
-%C22*%O$t%C26 $1%C sets invite on %C18$2%O
+%C22*%O$t%C26$1%C sets invite on %C18$2%O
 2
 
 Channel List
@@ -157,7 +157,7 @@ pevt_chanrmexempt_help
 Channel Remove Invite
 XP_TE_CHANRMINVITE
 pevt_chanrminvite_help
-%C22*%O$t%C26 $1%O removes invite on %C18$2%O
+%C22*%O$t%C26$1%O removes invite on %C18$2%O
 2
 
 Channel Remove Keyword
@@ -601,7 +601,7 @@ pevt_partreason_help
 Ping Reply
 XP_TE_PINGREP
 pevt_pingrep_help
-%C24*%O$tPing reply from%C18 $1%C: %C24$2%O second(s)
+%C24*%O$tPing reply from %C18$1%C: %C24$2%O second(s)
 2
 
 Ping Timeout
diff --git a/src/common/url.c b/src/common/url.c
index 0a4c3609..52e37daa 100644
--- a/src/common/url.c
+++ b/src/common/url.c
@@ -331,12 +331,53 @@ url_check_word (const char *word, int len)
 	return 0;
 }
 
+/* List of IRC commands for which contents (and thus possible URLs)
+ * are visible to the user.  NOTE:  Trailing blank required in each. */
+static char *commands[] = {
+	"NOTICE ",
+	"PRIVMSG ",
+	"TOPIC ",
+	"332 ",		/* RPL_TOPIC */
+	"372 "		/* RPL_MOTD */
+};
+
+#define ARRAY_SIZE(a) (sizeof (a) / sizeof ((a)[0]))
+
 void
 url_check_line (char *buf, int len)
 {
 	char *po = buf;
 	char *start;
-	int wlen;
+	int i, wlen;
+
+	/* Skip over message prefix */
+	if (*po == ':')
+	{
+		po = strchr (po, ' ');
+		if (!po)
+			return;
+		po++;
+	}
+	/* Allow only commands from the above list */
+	for (i = 0; i < ARRAY_SIZE (commands); i++)
+	{
+		char *cmd = commands[i];
+		int len = strlen (cmd);
+
+		if (strncmp (cmd, po, len) == 0)
+		{
+			po += len;
+			break;
+		}
+	}
+	if (i == ARRAY_SIZE (commands))
+		return;
+
+	/* Skip past the channel name or user nick */
+	po = strchr (po, ' ');
+	if (!po)
+		return;
+	po++;
 
 	if (buf[0] == ':' && buf[1] != 0)
 		po++;
@@ -350,6 +391,7 @@ url_check_line (char *buf, int len)
 		{
 		case 0:
 		case ' ':
+		case '\r':
 
 			wlen = po - start;
 			if (wlen > 2)