changeset 27031:0f1b41c2f835

Reduce work if there is no URL in the incoming message.
author Sadrul Habib Chowdhury <imadil@gmail.com>
date Mon, 25 May 2009 17:18:26 +0000
parents 7e6c8fed6ffa
children d9f2a7f18759 bc2aa262a567 33b81994d74c
files finch/plugins/gnttinyurl.c
diffstat 1 files changed, 5 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/finch/plugins/gnttinyurl.c	Mon May 25 03:06:12 2009 +0000
+++ b/finch/plugins/gnttinyurl.c	Mon May 25 17:18:26 2009 +0000
@@ -228,12 +228,15 @@
 	if (!(*flags & PURPLE_MESSAGE_RECV) || *flags & PURPLE_MESSAGE_INVISIBLE)
 		return FALSE;
 
-	t = g_string_new(*message);
 	urls = purple_conversation_get_data(conv, "TinyURLs");
 	if (urls != NULL) /* message was cancelled somewhere? Reset. */
 		g_list_foreach(urls, free_urls, NULL);
 	g_list_free(urls);
-	urls = extract_urls(t->str);
+	urls = extract_urls(*message);
+	if (!urls)
+		return FALSE;
+
+	t = g_string_new(*message);
 	g_free(*message);
 	for (iter = urls; iter; iter = iter->next) {
 		if (g_utf8_strlen((char *)iter->data, -1) >= purple_prefs_get_int(PREF_LENGTH)) {