annotate finch/plugins/gnttinyurl.c @ 28338:4e7b8902da90

Add a verb to this sentence, as suggested by F Wolff on the translators mailing list on July 14th
author Mark Doliner <mark@kingant.net>
date Sun, 09 Aug 2009 20:34:29 +0000
parents 6aa8e64fdbb7
children 7eaf2561b6dd
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
26582
8986c3804ada Add a gnt TinyURL plugin. Closes #2017
Richard Nelson <wabz@pidgin.im>
parents:
diff changeset
1 /**
8986c3804ada Add a gnt TinyURL plugin. Closes #2017
Richard Nelson <wabz@pidgin.im>
parents:
diff changeset
2 * @file gnttinyurl.c
8986c3804ada Add a gnt TinyURL plugin. Closes #2017
Richard Nelson <wabz@pidgin.im>
parents:
diff changeset
3 *
8986c3804ada Add a gnt TinyURL plugin. Closes #2017
Richard Nelson <wabz@pidgin.im>
parents:
diff changeset
4 * Copyright (C) 2009 Richard Nelson <wabz@whatsbeef.net>
8986c3804ada Add a gnt TinyURL plugin. Closes #2017
Richard Nelson <wabz@pidgin.im>
parents:
diff changeset
5 *
8986c3804ada Add a gnt TinyURL plugin. Closes #2017
Richard Nelson <wabz@pidgin.im>
parents:
diff changeset
6 * This program is free software; you can redistribute it and/or modify
8986c3804ada Add a gnt TinyURL plugin. Closes #2017
Richard Nelson <wabz@pidgin.im>
parents:
diff changeset
7 * it under the terms of the GNU General Public License as published by
8986c3804ada Add a gnt TinyURL plugin. Closes #2017
Richard Nelson <wabz@pidgin.im>
parents:
diff changeset
8 * the Free Software Foundation; either version 2 of the License, or
8986c3804ada Add a gnt TinyURL plugin. Closes #2017
Richard Nelson <wabz@pidgin.im>
parents:
diff changeset
9 * (at your option) any later version.
8986c3804ada Add a gnt TinyURL plugin. Closes #2017
Richard Nelson <wabz@pidgin.im>
parents:
diff changeset
10 *
8986c3804ada Add a gnt TinyURL plugin. Closes #2017
Richard Nelson <wabz@pidgin.im>
parents:
diff changeset
11 * This program is distributed in the hope that it will be useful,
8986c3804ada Add a gnt TinyURL plugin. Closes #2017
Richard Nelson <wabz@pidgin.im>
parents:
diff changeset
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
8986c3804ada Add a gnt TinyURL plugin. Closes #2017
Richard Nelson <wabz@pidgin.im>
parents:
diff changeset
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
8986c3804ada Add a gnt TinyURL plugin. Closes #2017
Richard Nelson <wabz@pidgin.im>
parents:
diff changeset
14 * GNU General Public License for more details.
8986c3804ada Add a gnt TinyURL plugin. Closes #2017
Richard Nelson <wabz@pidgin.im>
parents:
diff changeset
15 *
8986c3804ada Add a gnt TinyURL plugin. Closes #2017
Richard Nelson <wabz@pidgin.im>
parents:
diff changeset
16 * You should have received a copy of the GNU General Public License
8986c3804ada Add a gnt TinyURL plugin. Closes #2017
Richard Nelson <wabz@pidgin.im>
parents:
diff changeset
17 * along with this program; if not, write to the Free Software
8986c3804ada Add a gnt TinyURL plugin. Closes #2017
Richard Nelson <wabz@pidgin.im>
parents:
diff changeset
18 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA
8986c3804ada Add a gnt TinyURL plugin. Closes #2017
Richard Nelson <wabz@pidgin.im>
parents:
diff changeset
19 */
8986c3804ada Add a gnt TinyURL plugin. Closes #2017
Richard Nelson <wabz@pidgin.im>
parents:
diff changeset
20
8986c3804ada Add a gnt TinyURL plugin. Closes #2017
Richard Nelson <wabz@pidgin.im>
parents:
diff changeset
21
8986c3804ada Add a gnt TinyURL plugin. Closes #2017
Richard Nelson <wabz@pidgin.im>
parents:
diff changeset
22 #include "internal.h"
8986c3804ada Add a gnt TinyURL plugin. Closes #2017
Richard Nelson <wabz@pidgin.im>
parents:
diff changeset
23 #include <glib.h>
8986c3804ada Add a gnt TinyURL plugin. Closes #2017
Richard Nelson <wabz@pidgin.im>
parents:
diff changeset
24
8986c3804ada Add a gnt TinyURL plugin. Closes #2017
Richard Nelson <wabz@pidgin.im>
parents:
diff changeset
25 #define PLUGIN_STATIC_NAME TinyURL
8986c3804ada Add a gnt TinyURL plugin. Closes #2017
Richard Nelson <wabz@pidgin.im>
parents:
diff changeset
26 #define PREFS_BASE "/plugins/gnt/tinyurl"
8986c3804ada Add a gnt TinyURL plugin. Closes #2017
Richard Nelson <wabz@pidgin.im>
parents:
diff changeset
27 #define PREF_LENGTH PREFS_BASE "/length"
8986c3804ada Add a gnt TinyURL plugin. Closes #2017
Richard Nelson <wabz@pidgin.im>
parents:
diff changeset
28 #define PREF_URL PREFS_BASE "/url"
8986c3804ada Add a gnt TinyURL plugin. Closes #2017
Richard Nelson <wabz@pidgin.im>
parents:
diff changeset
29
8986c3804ada Add a gnt TinyURL plugin. Closes #2017
Richard Nelson <wabz@pidgin.im>
parents:
diff changeset
30
8986c3804ada Add a gnt TinyURL plugin. Closes #2017
Richard Nelson <wabz@pidgin.im>
parents:
diff changeset
31 #include <conversation.h>
8986c3804ada Add a gnt TinyURL plugin. Closes #2017
Richard Nelson <wabz@pidgin.im>
parents:
diff changeset
32 #include <signals.h>
8986c3804ada Add a gnt TinyURL plugin. Closes #2017
Richard Nelson <wabz@pidgin.im>
parents:
diff changeset
33
8986c3804ada Add a gnt TinyURL plugin. Closes #2017
Richard Nelson <wabz@pidgin.im>
parents:
diff changeset
34 #include <glib.h>
8986c3804ada Add a gnt TinyURL plugin. Closes #2017
Richard Nelson <wabz@pidgin.im>
parents:
diff changeset
35
8986c3804ada Add a gnt TinyURL plugin. Closes #2017
Richard Nelson <wabz@pidgin.im>
parents:
diff changeset
36 #include <plugin.h>
8986c3804ada Add a gnt TinyURL plugin. Closes #2017
Richard Nelson <wabz@pidgin.im>
parents:
diff changeset
37 #include <version.h>
8986c3804ada Add a gnt TinyURL plugin. Closes #2017
Richard Nelson <wabz@pidgin.im>
parents:
diff changeset
38 #include <debug.h>
8986c3804ada Add a gnt TinyURL plugin. Closes #2017
Richard Nelson <wabz@pidgin.im>
parents:
diff changeset
39 #include <notify.h>
8986c3804ada Add a gnt TinyURL plugin. Closes #2017
Richard Nelson <wabz@pidgin.im>
parents:
diff changeset
40
8986c3804ada Add a gnt TinyURL plugin. Closes #2017
Richard Nelson <wabz@pidgin.im>
parents:
diff changeset
41 #include <gntconv.h>
8986c3804ada Add a gnt TinyURL plugin. Closes #2017
Richard Nelson <wabz@pidgin.im>
parents:
diff changeset
42
8986c3804ada Add a gnt TinyURL plugin. Closes #2017
Richard Nelson <wabz@pidgin.im>
parents:
diff changeset
43 #include <gntplugin.h>
8986c3804ada Add a gnt TinyURL plugin. Closes #2017
Richard Nelson <wabz@pidgin.im>
parents:
diff changeset
44 #include <gnttextview.h>
8986c3804ada Add a gnt TinyURL plugin. Closes #2017
Richard Nelson <wabz@pidgin.im>
parents:
diff changeset
45
8986c3804ada Add a gnt TinyURL plugin. Closes #2017
Richard Nelson <wabz@pidgin.im>
parents:
diff changeset
46 static int tag_num = 0;
8986c3804ada Add a gnt TinyURL plugin. Closes #2017
Richard Nelson <wabz@pidgin.im>
parents:
diff changeset
47
8986c3804ada Add a gnt TinyURL plugin. Closes #2017
Richard Nelson <wabz@pidgin.im>
parents:
diff changeset
48 typedef struct
8986c3804ada Add a gnt TinyURL plugin. Closes #2017
Richard Nelson <wabz@pidgin.im>
parents:
diff changeset
49 {
8986c3804ada Add a gnt TinyURL plugin. Closes #2017
Richard Nelson <wabz@pidgin.im>
parents:
diff changeset
50 PurpleConversation *conv;
8986c3804ada Add a gnt TinyURL plugin. Closes #2017
Richard Nelson <wabz@pidgin.im>
parents:
diff changeset
51 gchar *tag;
8986c3804ada Add a gnt TinyURL plugin. Closes #2017
Richard Nelson <wabz@pidgin.im>
parents:
diff changeset
52 int num;
8986c3804ada Add a gnt TinyURL plugin. Closes #2017
Richard Nelson <wabz@pidgin.im>
parents:
diff changeset
53 } CbInfo;
8986c3804ada Add a gnt TinyURL plugin. Closes #2017
Richard Nelson <wabz@pidgin.im>
parents:
diff changeset
54
8986c3804ada Add a gnt TinyURL plugin. Closes #2017
Richard Nelson <wabz@pidgin.im>
parents:
diff changeset
55 /* 3 functions from util.c */
8986c3804ada Add a gnt TinyURL plugin. Closes #2017
Richard Nelson <wabz@pidgin.im>
parents:
diff changeset
56 static gboolean
8986c3804ada Add a gnt TinyURL plugin. Closes #2017
Richard Nelson <wabz@pidgin.im>
parents:
diff changeset
57 badchar(char c)
8986c3804ada Add a gnt TinyURL plugin. Closes #2017
Richard Nelson <wabz@pidgin.im>
parents:
diff changeset
58 {
8986c3804ada Add a gnt TinyURL plugin. Closes #2017
Richard Nelson <wabz@pidgin.im>
parents:
diff changeset
59 switch (c) {
8986c3804ada Add a gnt TinyURL plugin. Closes #2017
Richard Nelson <wabz@pidgin.im>
parents:
diff changeset
60 case ' ':
8986c3804ada Add a gnt TinyURL plugin. Closes #2017
Richard Nelson <wabz@pidgin.im>
parents:
diff changeset
61 case ',':
8986c3804ada Add a gnt TinyURL plugin. Closes #2017
Richard Nelson <wabz@pidgin.im>
parents:
diff changeset
62 case '\0':
8986c3804ada Add a gnt TinyURL plugin. Closes #2017
Richard Nelson <wabz@pidgin.im>
parents:
diff changeset
63 case '\n':
8986c3804ada Add a gnt TinyURL plugin. Closes #2017
Richard Nelson <wabz@pidgin.im>
parents:
diff changeset
64 case '\r':
8986c3804ada Add a gnt TinyURL plugin. Closes #2017
Richard Nelson <wabz@pidgin.im>
parents:
diff changeset
65 case '<':
8986c3804ada Add a gnt TinyURL plugin. Closes #2017
Richard Nelson <wabz@pidgin.im>
parents:
diff changeset
66 case '>':
8986c3804ada Add a gnt TinyURL plugin. Closes #2017
Richard Nelson <wabz@pidgin.im>
parents:
diff changeset
67 case '"':
8986c3804ada Add a gnt TinyURL plugin. Closes #2017
Richard Nelson <wabz@pidgin.im>
parents:
diff changeset
68 case '\'':
8986c3804ada Add a gnt TinyURL plugin. Closes #2017
Richard Nelson <wabz@pidgin.im>
parents:
diff changeset
69 return TRUE;
8986c3804ada Add a gnt TinyURL plugin. Closes #2017
Richard Nelson <wabz@pidgin.im>
parents:
diff changeset
70 default:
8986c3804ada Add a gnt TinyURL plugin. Closes #2017
Richard Nelson <wabz@pidgin.im>
parents:
diff changeset
71 return FALSE;
8986c3804ada Add a gnt TinyURL plugin. Closes #2017
Richard Nelson <wabz@pidgin.im>
parents:
diff changeset
72 }
8986c3804ada Add a gnt TinyURL plugin. Closes #2017
Richard Nelson <wabz@pidgin.im>
parents:
diff changeset
73 }
8986c3804ada Add a gnt TinyURL plugin. Closes #2017
Richard Nelson <wabz@pidgin.im>
parents:
diff changeset
74
8986c3804ada Add a gnt TinyURL plugin. Closes #2017
Richard Nelson <wabz@pidgin.im>
parents:
diff changeset
75 static gboolean
8986c3804ada Add a gnt TinyURL plugin. Closes #2017
Richard Nelson <wabz@pidgin.im>
parents:
diff changeset
76 badentity(const char *c)
8986c3804ada Add a gnt TinyURL plugin. Closes #2017
Richard Nelson <wabz@pidgin.im>
parents:
diff changeset
77 {
8986c3804ada Add a gnt TinyURL plugin. Closes #2017
Richard Nelson <wabz@pidgin.im>
parents:
diff changeset
78 if (!g_ascii_strncasecmp(c, "&lt;", 4) ||
8986c3804ada Add a gnt TinyURL plugin. Closes #2017
Richard Nelson <wabz@pidgin.im>
parents:
diff changeset
79 !g_ascii_strncasecmp(c, "&gt;", 4) ||
8986c3804ada Add a gnt TinyURL plugin. Closes #2017
Richard Nelson <wabz@pidgin.im>
parents:
diff changeset
80 !g_ascii_strncasecmp(c, "&quot;", 6)) {
8986c3804ada Add a gnt TinyURL plugin. Closes #2017
Richard Nelson <wabz@pidgin.im>
parents:
diff changeset
81 return TRUE;
8986c3804ada Add a gnt TinyURL plugin. Closes #2017
Richard Nelson <wabz@pidgin.im>
parents:
diff changeset
82 }
8986c3804ada Add a gnt TinyURL plugin. Closes #2017
Richard Nelson <wabz@pidgin.im>
parents:
diff changeset
83 return FALSE;
8986c3804ada Add a gnt TinyURL plugin. Closes #2017
Richard Nelson <wabz@pidgin.im>
parents:
diff changeset
84 }
8986c3804ada Add a gnt TinyURL plugin. Closes #2017
Richard Nelson <wabz@pidgin.im>
parents:
diff changeset
85
8986c3804ada Add a gnt TinyURL plugin. Closes #2017
Richard Nelson <wabz@pidgin.im>
parents:
diff changeset
86 static GList *extract_urls(char *text) {
8986c3804ada Add a gnt TinyURL plugin. Closes #2017
Richard Nelson <wabz@pidgin.im>
parents:
diff changeset
87 const char *t, *c, *q = NULL;
8986c3804ada Add a gnt TinyURL plugin. Closes #2017
Richard Nelson <wabz@pidgin.im>
parents:
diff changeset
88 char *url_buf;
8986c3804ada Add a gnt TinyURL plugin. Closes #2017
Richard Nelson <wabz@pidgin.im>
parents:
diff changeset
89 GList *ret = NULL;
8986c3804ada Add a gnt TinyURL plugin. Closes #2017
Richard Nelson <wabz@pidgin.im>
parents:
diff changeset
90 gboolean inside_html = FALSE;
8986c3804ada Add a gnt TinyURL plugin. Closes #2017
Richard Nelson <wabz@pidgin.im>
parents:
diff changeset
91 int inside_paren = 0;
8986c3804ada Add a gnt TinyURL plugin. Closes #2017
Richard Nelson <wabz@pidgin.im>
parents:
diff changeset
92 c = text;
8986c3804ada Add a gnt TinyURL plugin. Closes #2017
Richard Nelson <wabz@pidgin.im>
parents:
diff changeset
93 while (*c) {
8986c3804ada Add a gnt TinyURL plugin. Closes #2017
Richard Nelson <wabz@pidgin.im>
parents:
diff changeset
94 if (*c == '(' && !inside_html) {
8986c3804ada Add a gnt TinyURL plugin. Closes #2017
Richard Nelson <wabz@pidgin.im>
parents:
diff changeset
95 inside_paren++;
8986c3804ada Add a gnt TinyURL plugin. Closes #2017
Richard Nelson <wabz@pidgin.im>
parents:
diff changeset
96 c++;
8986c3804ada Add a gnt TinyURL plugin. Closes #2017
Richard Nelson <wabz@pidgin.im>
parents:
diff changeset
97 }
8986c3804ada Add a gnt TinyURL plugin. Closes #2017
Richard Nelson <wabz@pidgin.im>
parents:
diff changeset
98 if (inside_html) {
8986c3804ada Add a gnt TinyURL plugin. Closes #2017
Richard Nelson <wabz@pidgin.im>
parents:
diff changeset
99 if (*c == '>') {
8986c3804ada Add a gnt TinyURL plugin. Closes #2017
Richard Nelson <wabz@pidgin.im>
parents:
diff changeset
100 inside_html = FALSE;
8986c3804ada Add a gnt TinyURL plugin. Closes #2017
Richard Nelson <wabz@pidgin.im>
parents:
diff changeset
101 } else if (!q && (*c == '\"' || *c == '\'')) {
8986c3804ada Add a gnt TinyURL plugin. Closes #2017
Richard Nelson <wabz@pidgin.im>
parents:
diff changeset
102 q = c;
8986c3804ada Add a gnt TinyURL plugin. Closes #2017
Richard Nelson <wabz@pidgin.im>
parents:
diff changeset
103 } else if(q) {
8986c3804ada Add a gnt TinyURL plugin. Closes #2017
Richard Nelson <wabz@pidgin.im>
parents:
diff changeset
104 if(*c == *q)
8986c3804ada Add a gnt TinyURL plugin. Closes #2017
Richard Nelson <wabz@pidgin.im>
parents:
diff changeset
105 q = NULL;
8986c3804ada Add a gnt TinyURL plugin. Closes #2017
Richard Nelson <wabz@pidgin.im>
parents:
diff changeset
106 }
8986c3804ada Add a gnt TinyURL plugin. Closes #2017
Richard Nelson <wabz@pidgin.im>
parents:
diff changeset
107 } else if (*c == '<') {
8986c3804ada Add a gnt TinyURL plugin. Closes #2017
Richard Nelson <wabz@pidgin.im>
parents:
diff changeset
108 inside_html = TRUE;
8986c3804ada Add a gnt TinyURL plugin. Closes #2017
Richard Nelson <wabz@pidgin.im>
parents:
diff changeset
109 if (!g_ascii_strncasecmp(c, "<A", 2)) {
8986c3804ada Add a gnt TinyURL plugin. Closes #2017
Richard Nelson <wabz@pidgin.im>
parents:
diff changeset
110 while (1) {
8986c3804ada Add a gnt TinyURL plugin. Closes #2017
Richard Nelson <wabz@pidgin.im>
parents:
diff changeset
111 if (*c == '>') {
8986c3804ada Add a gnt TinyURL plugin. Closes #2017
Richard Nelson <wabz@pidgin.im>
parents:
diff changeset
112 inside_html = FALSE;
8986c3804ada Add a gnt TinyURL plugin. Closes #2017
Richard Nelson <wabz@pidgin.im>
parents:
diff changeset
113 break;
8986c3804ada Add a gnt TinyURL plugin. Closes #2017
Richard Nelson <wabz@pidgin.im>
parents:
diff changeset
114 }
8986c3804ada Add a gnt TinyURL plugin. Closes #2017
Richard Nelson <wabz@pidgin.im>
parents:
diff changeset
115 c++;
8986c3804ada Add a gnt TinyURL plugin. Closes #2017
Richard Nelson <wabz@pidgin.im>
parents:
diff changeset
116 if (!(*c))
8986c3804ada Add a gnt TinyURL plugin. Closes #2017
Richard Nelson <wabz@pidgin.im>
parents:
diff changeset
117 break;
8986c3804ada Add a gnt TinyURL plugin. Closes #2017
Richard Nelson <wabz@pidgin.im>
parents:
diff changeset
118 }
8986c3804ada Add a gnt TinyURL plugin. Closes #2017
Richard Nelson <wabz@pidgin.im>
parents:
diff changeset
119 }
8986c3804ada Add a gnt TinyURL plugin. Closes #2017
Richard Nelson <wabz@pidgin.im>
parents:
diff changeset
120 } else if ((*c=='h') && (!g_ascii_strncasecmp(c, "http://", 7) ||
8986c3804ada Add a gnt TinyURL plugin. Closes #2017
Richard Nelson <wabz@pidgin.im>
parents:
diff changeset
121 (!g_ascii_strncasecmp(c, "https://", 8)))) {
8986c3804ada Add a gnt TinyURL plugin. Closes #2017
Richard Nelson <wabz@pidgin.im>
parents:
diff changeset
122 t = c;
8986c3804ada Add a gnt TinyURL plugin. Closes #2017
Richard Nelson <wabz@pidgin.im>
parents:
diff changeset
123 while (1) {
8986c3804ada Add a gnt TinyURL plugin. Closes #2017
Richard Nelson <wabz@pidgin.im>
parents:
diff changeset
124 if (badchar(*t) || badentity(t)) {
8986c3804ada Add a gnt TinyURL plugin. Closes #2017
Richard Nelson <wabz@pidgin.im>
parents:
diff changeset
125
8986c3804ada Add a gnt TinyURL plugin. Closes #2017
Richard Nelson <wabz@pidgin.im>
parents:
diff changeset
126 if ((!g_ascii_strncasecmp(c, "http://", 7) && (t - c == 7)) ||
8986c3804ada Add a gnt TinyURL plugin. Closes #2017
Richard Nelson <wabz@pidgin.im>
parents:
diff changeset
127 (!g_ascii_strncasecmp(c, "https://", 8) && (t - c == 8))) {
8986c3804ada Add a gnt TinyURL plugin. Closes #2017
Richard Nelson <wabz@pidgin.im>
parents:
diff changeset
128 break;
8986c3804ada Add a gnt TinyURL plugin. Closes #2017
Richard Nelson <wabz@pidgin.im>
parents:
diff changeset
129 }
8986c3804ada Add a gnt TinyURL plugin. Closes #2017
Richard Nelson <wabz@pidgin.im>
parents:
diff changeset
130
8986c3804ada Add a gnt TinyURL plugin. Closes #2017
Richard Nelson <wabz@pidgin.im>
parents:
diff changeset
131 if (*(t) == ',' && (*(t + 1) != ' ')) {
8986c3804ada Add a gnt TinyURL plugin. Closes #2017
Richard Nelson <wabz@pidgin.im>
parents:
diff changeset
132 t++;
8986c3804ada Add a gnt TinyURL plugin. Closes #2017
Richard Nelson <wabz@pidgin.im>
parents:
diff changeset
133 continue;
8986c3804ada Add a gnt TinyURL plugin. Closes #2017
Richard Nelson <wabz@pidgin.im>
parents:
diff changeset
134 }
8986c3804ada Add a gnt TinyURL plugin. Closes #2017
Richard Nelson <wabz@pidgin.im>
parents:
diff changeset
135
8986c3804ada Add a gnt TinyURL plugin. Closes #2017
Richard Nelson <wabz@pidgin.im>
parents:
diff changeset
136 if (*(t - 1) == '.')
8986c3804ada Add a gnt TinyURL plugin. Closes #2017
Richard Nelson <wabz@pidgin.im>
parents:
diff changeset
137 t--;
8986c3804ada Add a gnt TinyURL plugin. Closes #2017
Richard Nelson <wabz@pidgin.im>
parents:
diff changeset
138 if ((*(t - 1) == ')' && (inside_paren > 0))) {
8986c3804ada Add a gnt TinyURL plugin. Closes #2017
Richard Nelson <wabz@pidgin.im>
parents:
diff changeset
139 t--;
8986c3804ada Add a gnt TinyURL plugin. Closes #2017
Richard Nelson <wabz@pidgin.im>
parents:
diff changeset
140 }
8986c3804ada Add a gnt TinyURL plugin. Closes #2017
Richard Nelson <wabz@pidgin.im>
parents:
diff changeset
141
8986c3804ada Add a gnt TinyURL plugin. Closes #2017
Richard Nelson <wabz@pidgin.im>
parents:
diff changeset
142 url_buf = g_strndup(c, t - c);
26584
f9a923fde1e4 Remove usage of g_strcmp0 (which would bump the glib version requirement) where strcmp will do nicely
Richard Nelson <wabz@pidgin.im>
parents: 26582
diff changeset
143 if (!g_list_find_custom(ret, url_buf, (GCompareFunc)strcmp)) {
26582
8986c3804ada Add a gnt TinyURL plugin. Closes #2017
Richard Nelson <wabz@pidgin.im>
parents:
diff changeset
144 purple_debug_info("TinyURL", "Added URL %s\n", url_buf);
8986c3804ada Add a gnt TinyURL plugin. Closes #2017
Richard Nelson <wabz@pidgin.im>
parents:
diff changeset
145 ret = g_list_append(ret, g_strdup(url_buf));
8986c3804ada Add a gnt TinyURL plugin. Closes #2017
Richard Nelson <wabz@pidgin.im>
parents:
diff changeset
146 }
8986c3804ada Add a gnt TinyURL plugin. Closes #2017
Richard Nelson <wabz@pidgin.im>
parents:
diff changeset
147 c = t;
8986c3804ada Add a gnt TinyURL plugin. Closes #2017
Richard Nelson <wabz@pidgin.im>
parents:
diff changeset
148 break;
8986c3804ada Add a gnt TinyURL plugin. Closes #2017
Richard Nelson <wabz@pidgin.im>
parents:
diff changeset
149 }
8986c3804ada Add a gnt TinyURL plugin. Closes #2017
Richard Nelson <wabz@pidgin.im>
parents:
diff changeset
150 t++;
8986c3804ada Add a gnt TinyURL plugin. Closes #2017
Richard Nelson <wabz@pidgin.im>
parents:
diff changeset
151
8986c3804ada Add a gnt TinyURL plugin. Closes #2017
Richard Nelson <wabz@pidgin.im>
parents:
diff changeset
152 }
8986c3804ada Add a gnt TinyURL plugin. Closes #2017
Richard Nelson <wabz@pidgin.im>
parents:
diff changeset
153 } else if (!g_ascii_strncasecmp(c, "www.", 4) && (c == text || badchar(c[-1]) || badentity(c-1))) {
8986c3804ada Add a gnt TinyURL plugin. Closes #2017
Richard Nelson <wabz@pidgin.im>
parents:
diff changeset
154 if (c[4] != '.') {
8986c3804ada Add a gnt TinyURL plugin. Closes #2017
Richard Nelson <wabz@pidgin.im>
parents:
diff changeset
155 t = c;
8986c3804ada Add a gnt TinyURL plugin. Closes #2017
Richard Nelson <wabz@pidgin.im>
parents:
diff changeset
156 while (1) {
8986c3804ada Add a gnt TinyURL plugin. Closes #2017
Richard Nelson <wabz@pidgin.im>
parents:
diff changeset
157 if (badchar(*t) || badentity(t)) {
8986c3804ada Add a gnt TinyURL plugin. Closes #2017
Richard Nelson <wabz@pidgin.im>
parents:
diff changeset
158 if (t - c == 4) {
8986c3804ada Add a gnt TinyURL plugin. Closes #2017
Richard Nelson <wabz@pidgin.im>
parents:
diff changeset
159 break;
8986c3804ada Add a gnt TinyURL plugin. Closes #2017
Richard Nelson <wabz@pidgin.im>
parents:
diff changeset
160 }
8986c3804ada Add a gnt TinyURL plugin. Closes #2017
Richard Nelson <wabz@pidgin.im>
parents:
diff changeset
161
8986c3804ada Add a gnt TinyURL plugin. Closes #2017
Richard Nelson <wabz@pidgin.im>
parents:
diff changeset
162 if (*(t) == ',' && (*(t + 1) != ' ')) {
8986c3804ada Add a gnt TinyURL plugin. Closes #2017
Richard Nelson <wabz@pidgin.im>
parents:
diff changeset
163 t++;
8986c3804ada Add a gnt TinyURL plugin. Closes #2017
Richard Nelson <wabz@pidgin.im>
parents:
diff changeset
164 continue;
8986c3804ada Add a gnt TinyURL plugin. Closes #2017
Richard Nelson <wabz@pidgin.im>
parents:
diff changeset
165 }
8986c3804ada Add a gnt TinyURL plugin. Closes #2017
Richard Nelson <wabz@pidgin.im>
parents:
diff changeset
166
8986c3804ada Add a gnt TinyURL plugin. Closes #2017
Richard Nelson <wabz@pidgin.im>
parents:
diff changeset
167 if (*(t - 1) == '.')
8986c3804ada Add a gnt TinyURL plugin. Closes #2017
Richard Nelson <wabz@pidgin.im>
parents:
diff changeset
168 t--;
8986c3804ada Add a gnt TinyURL plugin. Closes #2017
Richard Nelson <wabz@pidgin.im>
parents:
diff changeset
169 if ((*(t - 1) == ')' && (inside_paren > 0))) {
8986c3804ada Add a gnt TinyURL plugin. Closes #2017
Richard Nelson <wabz@pidgin.im>
parents:
diff changeset
170 t--;
8986c3804ada Add a gnt TinyURL plugin. Closes #2017
Richard Nelson <wabz@pidgin.im>
parents:
diff changeset
171 }
8986c3804ada Add a gnt TinyURL plugin. Closes #2017
Richard Nelson <wabz@pidgin.im>
parents:
diff changeset
172 url_buf = g_strndup(c, t - c);
26584
f9a923fde1e4 Remove usage of g_strcmp0 (which would bump the glib version requirement) where strcmp will do nicely
Richard Nelson <wabz@pidgin.im>
parents: 26582
diff changeset
173 if (!g_list_find_custom(ret, url_buf, (GCompareFunc)strcmp)) {
26582
8986c3804ada Add a gnt TinyURL plugin. Closes #2017
Richard Nelson <wabz@pidgin.im>
parents:
diff changeset
174 purple_debug_info("TinyURL", "Added URL %s\n", url_buf);
8986c3804ada Add a gnt TinyURL plugin. Closes #2017
Richard Nelson <wabz@pidgin.im>
parents:
diff changeset
175 ret = g_list_append(ret, url_buf);
8986c3804ada Add a gnt TinyURL plugin. Closes #2017
Richard Nelson <wabz@pidgin.im>
parents:
diff changeset
176 }
8986c3804ada Add a gnt TinyURL plugin. Closes #2017
Richard Nelson <wabz@pidgin.im>
parents:
diff changeset
177 c = t;
8986c3804ada Add a gnt TinyURL plugin. Closes #2017
Richard Nelson <wabz@pidgin.im>
parents:
diff changeset
178 break;
8986c3804ada Add a gnt TinyURL plugin. Closes #2017
Richard Nelson <wabz@pidgin.im>
parents:
diff changeset
179 }
8986c3804ada Add a gnt TinyURL plugin. Closes #2017
Richard Nelson <wabz@pidgin.im>
parents:
diff changeset
180 t++;
8986c3804ada Add a gnt TinyURL plugin. Closes #2017
Richard Nelson <wabz@pidgin.im>
parents:
diff changeset
181 }
8986c3804ada Add a gnt TinyURL plugin. Closes #2017
Richard Nelson <wabz@pidgin.im>
parents:
diff changeset
182 }
8986c3804ada Add a gnt TinyURL plugin. Closes #2017
Richard Nelson <wabz@pidgin.im>
parents:
diff changeset
183 }
8986c3804ada Add a gnt TinyURL plugin. Closes #2017
Richard Nelson <wabz@pidgin.im>
parents:
diff changeset
184 if (*c == ')' && !inside_html) {
8986c3804ada Add a gnt TinyURL plugin. Closes #2017
Richard Nelson <wabz@pidgin.im>
parents:
diff changeset
185 inside_paren--;
8986c3804ada Add a gnt TinyURL plugin. Closes #2017
Richard Nelson <wabz@pidgin.im>
parents:
diff changeset
186 c++;
8986c3804ada Add a gnt TinyURL plugin. Closes #2017
Richard Nelson <wabz@pidgin.im>
parents:
diff changeset
187 }
8986c3804ada Add a gnt TinyURL plugin. Closes #2017
Richard Nelson <wabz@pidgin.im>
parents:
diff changeset
188 if (*c == 0)
8986c3804ada Add a gnt TinyURL plugin. Closes #2017
Richard Nelson <wabz@pidgin.im>
parents:
diff changeset
189 break;
8986c3804ada Add a gnt TinyURL plugin. Closes #2017
Richard Nelson <wabz@pidgin.im>
parents:
diff changeset
190 c++;
8986c3804ada Add a gnt TinyURL plugin. Closes #2017
Richard Nelson <wabz@pidgin.im>
parents:
diff changeset
191 }
8986c3804ada Add a gnt TinyURL plugin. Closes #2017
Richard Nelson <wabz@pidgin.im>
parents:
diff changeset
192 return ret;
8986c3804ada Add a gnt TinyURL plugin. Closes #2017
Richard Nelson <wabz@pidgin.im>
parents:
diff changeset
193 }
8986c3804ada Add a gnt TinyURL plugin. Closes #2017
Richard Nelson <wabz@pidgin.im>
parents:
diff changeset
194
8986c3804ada Add a gnt TinyURL plugin. Closes #2017
Richard Nelson <wabz@pidgin.im>
parents:
diff changeset
195 static void url_fetched(PurpleUtilFetchUrlData *url_data, gpointer cb_data,
8986c3804ada Add a gnt TinyURL plugin. Closes #2017
Richard Nelson <wabz@pidgin.im>
parents:
diff changeset
196 const gchar *url_text, gsize len, const gchar *error_message)
8986c3804ada Add a gnt TinyURL plugin. Closes #2017
Richard Nelson <wabz@pidgin.im>
parents:
diff changeset
197 {
8986c3804ada Add a gnt TinyURL plugin. Closes #2017
Richard Nelson <wabz@pidgin.im>
parents:
diff changeset
198 CbInfo *data = (CbInfo *)cb_data;
8986c3804ada Add a gnt TinyURL plugin. Closes #2017
Richard Nelson <wabz@pidgin.im>
parents:
diff changeset
199 PurpleConversation *conv = data->conv;
8986c3804ada Add a gnt TinyURL plugin. Closes #2017
Richard Nelson <wabz@pidgin.im>
parents:
diff changeset
200 GList *convs = purple_get_conversations();
8986c3804ada Add a gnt TinyURL plugin. Closes #2017
Richard Nelson <wabz@pidgin.im>
parents:
diff changeset
201 /* ensure the conversation still exists */
8986c3804ada Add a gnt TinyURL plugin. Closes #2017
Richard Nelson <wabz@pidgin.im>
parents:
diff changeset
202 for (; convs; convs = convs->next) {
8986c3804ada Add a gnt TinyURL plugin. Closes #2017
Richard Nelson <wabz@pidgin.im>
parents:
diff changeset
203 if ((PurpleConversation *)(convs->data) == conv) {
8986c3804ada Add a gnt TinyURL plugin. Closes #2017
Richard Nelson <wabz@pidgin.im>
parents:
diff changeset
204 FinchConv *fconv = FINCH_CONV(conv);
8986c3804ada Add a gnt TinyURL plugin. Closes #2017
Richard Nelson <wabz@pidgin.im>
parents:
diff changeset
205 gchar *str = g_strdup_printf("[%d] %s", data->num, url_text);
8986c3804ada Add a gnt TinyURL plugin. Closes #2017
Richard Nelson <wabz@pidgin.im>
parents:
diff changeset
206 GntTextView *tv = GNT_TEXT_VIEW(fconv->tv);
8986c3804ada Add a gnt TinyURL plugin. Closes #2017
Richard Nelson <wabz@pidgin.im>
parents:
diff changeset
207 gnt_text_view_tag_change(tv, data->tag, str, FALSE);
8986c3804ada Add a gnt TinyURL plugin. Closes #2017
Richard Nelson <wabz@pidgin.im>
parents:
diff changeset
208 g_free(str);
8986c3804ada Add a gnt TinyURL plugin. Closes #2017
Richard Nelson <wabz@pidgin.im>
parents:
diff changeset
209 g_free(data->tag);
8986c3804ada Add a gnt TinyURL plugin. Closes #2017
Richard Nelson <wabz@pidgin.im>
parents:
diff changeset
210 return;
8986c3804ada Add a gnt TinyURL plugin. Closes #2017
Richard Nelson <wabz@pidgin.im>
parents:
diff changeset
211 }
8986c3804ada Add a gnt TinyURL plugin. Closes #2017
Richard Nelson <wabz@pidgin.im>
parents:
diff changeset
212 }
8986c3804ada Add a gnt TinyURL plugin. Closes #2017
Richard Nelson <wabz@pidgin.im>
parents:
diff changeset
213 g_free(data->tag);
8986c3804ada Add a gnt TinyURL plugin. Closes #2017
Richard Nelson <wabz@pidgin.im>
parents:
diff changeset
214 purple_debug_info("TinyURL", "Conversation no longer exists... :(\n");
8986c3804ada Add a gnt TinyURL plugin. Closes #2017
Richard Nelson <wabz@pidgin.im>
parents:
diff changeset
215 }
8986c3804ada Add a gnt TinyURL plugin. Closes #2017
Richard Nelson <wabz@pidgin.im>
parents:
diff changeset
216
8986c3804ada Add a gnt TinyURL plugin. Closes #2017
Richard Nelson <wabz@pidgin.im>
parents:
diff changeset
217 static void free_urls(gpointer data, gpointer null)
8986c3804ada Add a gnt TinyURL plugin. Closes #2017
Richard Nelson <wabz@pidgin.im>
parents:
diff changeset
218 {
8986c3804ada Add a gnt TinyURL plugin. Closes #2017
Richard Nelson <wabz@pidgin.im>
parents:
diff changeset
219 g_free(data);
8986c3804ada Add a gnt TinyURL plugin. Closes #2017
Richard Nelson <wabz@pidgin.im>
parents:
diff changeset
220 }
8986c3804ada Add a gnt TinyURL plugin. Closes #2017
Richard Nelson <wabz@pidgin.im>
parents:
diff changeset
221
8986c3804ada Add a gnt TinyURL plugin. Closes #2017
Richard Nelson <wabz@pidgin.im>
parents:
diff changeset
222 static gboolean receiving_msg(PurpleAccount *account, char **sender, char **message,
8986c3804ada Add a gnt TinyURL plugin. Closes #2017
Richard Nelson <wabz@pidgin.im>
parents:
diff changeset
223 PurpleConversation *conv, PurpleMessageFlags *flags) {
8986c3804ada Add a gnt TinyURL plugin. Closes #2017
Richard Nelson <wabz@pidgin.im>
parents:
diff changeset
224 GString *t;
8986c3804ada Add a gnt TinyURL plugin. Closes #2017
Richard Nelson <wabz@pidgin.im>
parents:
diff changeset
225 GList *iter, *urls;
8986c3804ada Add a gnt TinyURL plugin. Closes #2017
Richard Nelson <wabz@pidgin.im>
parents:
diff changeset
226 int c = 0;
8986c3804ada Add a gnt TinyURL plugin. Closes #2017
Richard Nelson <wabz@pidgin.im>
parents:
diff changeset
227
8986c3804ada Add a gnt TinyURL plugin. Closes #2017
Richard Nelson <wabz@pidgin.im>
parents:
diff changeset
228 if (!(*flags & PURPLE_MESSAGE_RECV) || *flags & PURPLE_MESSAGE_INVISIBLE)
8986c3804ada Add a gnt TinyURL plugin. Closes #2017
Richard Nelson <wabz@pidgin.im>
parents:
diff changeset
229 return FALSE;
8986c3804ada Add a gnt TinyURL plugin. Closes #2017
Richard Nelson <wabz@pidgin.im>
parents:
diff changeset
230
8986c3804ada Add a gnt TinyURL plugin. Closes #2017
Richard Nelson <wabz@pidgin.im>
parents:
diff changeset
231 urls = purple_conversation_get_data(conv, "TinyURLs");
8986c3804ada Add a gnt TinyURL plugin. Closes #2017
Richard Nelson <wabz@pidgin.im>
parents:
diff changeset
232 if (urls != NULL) /* message was cancelled somewhere? Reset. */
8986c3804ada Add a gnt TinyURL plugin. Closes #2017
Richard Nelson <wabz@pidgin.im>
parents:
diff changeset
233 g_list_foreach(urls, free_urls, NULL);
8986c3804ada Add a gnt TinyURL plugin. Closes #2017
Richard Nelson <wabz@pidgin.im>
parents:
diff changeset
234 g_list_free(urls);
27031
0f1b41c2f835 Reduce work if there is no URL in the incoming message.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 26589
diff changeset
235 urls = extract_urls(*message);
0f1b41c2f835 Reduce work if there is no URL in the incoming message.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 26589
diff changeset
236 if (!urls)
0f1b41c2f835 Reduce work if there is no URL in the incoming message.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 26589
diff changeset
237 return FALSE;
0f1b41c2f835 Reduce work if there is no URL in the incoming message.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 26589
diff changeset
238
0f1b41c2f835 Reduce work if there is no URL in the incoming message.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 26589
diff changeset
239 t = g_string_new(*message);
26582
8986c3804ada Add a gnt TinyURL plugin. Closes #2017
Richard Nelson <wabz@pidgin.im>
parents:
diff changeset
240 g_free(*message);
8986c3804ada Add a gnt TinyURL plugin. Closes #2017
Richard Nelson <wabz@pidgin.im>
parents:
diff changeset
241 for (iter = urls; iter; iter = iter->next) {
8986c3804ada Add a gnt TinyURL plugin. Closes #2017
Richard Nelson <wabz@pidgin.im>
parents:
diff changeset
242 if (g_utf8_strlen((char *)iter->data, -1) >= purple_prefs_get_int(PREF_LENGTH)) {
8986c3804ada Add a gnt TinyURL plugin. Closes #2017
Richard Nelson <wabz@pidgin.im>
parents:
diff changeset
243 int pos, x = 0;
8986c3804ada Add a gnt TinyURL plugin. Closes #2017
Richard Nelson <wabz@pidgin.im>
parents:
diff changeset
244 gchar *j, *s, *str, *orig;
8986c3804ada Add a gnt TinyURL plugin. Closes #2017
Richard Nelson <wabz@pidgin.im>
parents:
diff changeset
245 glong len = g_utf8_strlen(iter->data, -1);
8986c3804ada Add a gnt TinyURL plugin. Closes #2017
Richard Nelson <wabz@pidgin.im>
parents:
diff changeset
246 s = g_strdup(t->str);
8986c3804ada Add a gnt TinyURL plugin. Closes #2017
Richard Nelson <wabz@pidgin.im>
parents:
diff changeset
247 orig = s;
8986c3804ada Add a gnt TinyURL plugin. Closes #2017
Richard Nelson <wabz@pidgin.im>
parents:
diff changeset
248 str = g_strdup_printf("[%d]", ++c);
8986c3804ada Add a gnt TinyURL plugin. Closes #2017
Richard Nelson <wabz@pidgin.im>
parents:
diff changeset
249 while ((j = strstr(s, iter->data))) { /* replace all occurrences */
8986c3804ada Add a gnt TinyURL plugin. Closes #2017
Richard Nelson <wabz@pidgin.im>
parents:
diff changeset
250 pos = j - orig + (x++ * 3);
8986c3804ada Add a gnt TinyURL plugin. Closes #2017
Richard Nelson <wabz@pidgin.im>
parents:
diff changeset
251 s = j + len;
8986c3804ada Add a gnt TinyURL plugin. Closes #2017
Richard Nelson <wabz@pidgin.im>
parents:
diff changeset
252 t = g_string_insert(t, pos + len, str);
8986c3804ada Add a gnt TinyURL plugin. Closes #2017
Richard Nelson <wabz@pidgin.im>
parents:
diff changeset
253 if (*s == '\0') break;
8986c3804ada Add a gnt TinyURL plugin. Closes #2017
Richard Nelson <wabz@pidgin.im>
parents:
diff changeset
254 }
8986c3804ada Add a gnt TinyURL plugin. Closes #2017
Richard Nelson <wabz@pidgin.im>
parents:
diff changeset
255 g_free(orig);
8986c3804ada Add a gnt TinyURL plugin. Closes #2017
Richard Nelson <wabz@pidgin.im>
parents:
diff changeset
256 g_free(str);
8986c3804ada Add a gnt TinyURL plugin. Closes #2017
Richard Nelson <wabz@pidgin.im>
parents:
diff changeset
257 continue;
8986c3804ada Add a gnt TinyURL plugin. Closes #2017
Richard Nelson <wabz@pidgin.im>
parents:
diff changeset
258 } else {
8986c3804ada Add a gnt TinyURL plugin. Closes #2017
Richard Nelson <wabz@pidgin.im>
parents:
diff changeset
259 if (iter->prev) {
8986c3804ada Add a gnt TinyURL plugin. Closes #2017
Richard Nelson <wabz@pidgin.im>
parents:
diff changeset
260 iter = iter->prev;
8986c3804ada Add a gnt TinyURL plugin. Closes #2017
Richard Nelson <wabz@pidgin.im>
parents:
diff changeset
261 g_free(iter->next->data);
8986c3804ada Add a gnt TinyURL plugin. Closes #2017
Richard Nelson <wabz@pidgin.im>
parents:
diff changeset
262 urls = g_list_delete_link(urls, iter->next);
8986c3804ada Add a gnt TinyURL plugin. Closes #2017
Richard Nelson <wabz@pidgin.im>
parents:
diff changeset
263 } else {
8986c3804ada Add a gnt TinyURL plugin. Closes #2017
Richard Nelson <wabz@pidgin.im>
parents:
diff changeset
264 g_free(iter->data);
8986c3804ada Add a gnt TinyURL plugin. Closes #2017
Richard Nelson <wabz@pidgin.im>
parents:
diff changeset
265 g_list_free(urls);
8986c3804ada Add a gnt TinyURL plugin. Closes #2017
Richard Nelson <wabz@pidgin.im>
parents:
diff changeset
266 urls = NULL;
8986c3804ada Add a gnt TinyURL plugin. Closes #2017
Richard Nelson <wabz@pidgin.im>
parents:
diff changeset
267 }
8986c3804ada Add a gnt TinyURL plugin. Closes #2017
Richard Nelson <wabz@pidgin.im>
parents:
diff changeset
268 }
8986c3804ada Add a gnt TinyURL plugin. Closes #2017
Richard Nelson <wabz@pidgin.im>
parents:
diff changeset
269 }
8986c3804ada Add a gnt TinyURL plugin. Closes #2017
Richard Nelson <wabz@pidgin.im>
parents:
diff changeset
270 *message = t->str;
8986c3804ada Add a gnt TinyURL plugin. Closes #2017
Richard Nelson <wabz@pidgin.im>
parents:
diff changeset
271 g_string_free(t, FALSE);
8986c3804ada Add a gnt TinyURL plugin. Closes #2017
Richard Nelson <wabz@pidgin.im>
parents:
diff changeset
272 if (conv == NULL)
8986c3804ada Add a gnt TinyURL plugin. Closes #2017
Richard Nelson <wabz@pidgin.im>
parents:
diff changeset
273 conv = purple_conversation_new(PURPLE_CONV_TYPE_IM, account, *sender);
8986c3804ada Add a gnt TinyURL plugin. Closes #2017
Richard Nelson <wabz@pidgin.im>
parents:
diff changeset
274 purple_conversation_set_data(conv, "TinyURLs", urls);
8986c3804ada Add a gnt TinyURL plugin. Closes #2017
Richard Nelson <wabz@pidgin.im>
parents:
diff changeset
275 return FALSE;
8986c3804ada Add a gnt TinyURL plugin. Closes #2017
Richard Nelson <wabz@pidgin.im>
parents:
diff changeset
276 }
8986c3804ada Add a gnt TinyURL plugin. Closes #2017
Richard Nelson <wabz@pidgin.im>
parents:
diff changeset
277
8986c3804ada Add a gnt TinyURL plugin. Closes #2017
Richard Nelson <wabz@pidgin.im>
parents:
diff changeset
278 static void received_msg(PurpleAccount *account, char *sender, char *message,
8986c3804ada Add a gnt TinyURL plugin. Closes #2017
Richard Nelson <wabz@pidgin.im>
parents:
diff changeset
279 PurpleConversation *conv, PurpleMessageFlags flags) {
8986c3804ada Add a gnt TinyURL plugin. Closes #2017
Richard Nelson <wabz@pidgin.im>
parents:
diff changeset
280 int c;
8986c3804ada Add a gnt TinyURL plugin. Closes #2017
Richard Nelson <wabz@pidgin.im>
parents:
diff changeset
281 GList *urls, *iter;
8986c3804ada Add a gnt TinyURL plugin. Closes #2017
Richard Nelson <wabz@pidgin.im>
parents:
diff changeset
282 FinchConv *fconv = FINCH_CONV(conv);
8986c3804ada Add a gnt TinyURL plugin. Closes #2017
Richard Nelson <wabz@pidgin.im>
parents:
diff changeset
283 GntTextView *tv = GNT_TEXT_VIEW(fconv->tv);
8986c3804ada Add a gnt TinyURL plugin. Closes #2017
Richard Nelson <wabz@pidgin.im>
parents:
diff changeset
284
8986c3804ada Add a gnt TinyURL plugin. Closes #2017
Richard Nelson <wabz@pidgin.im>
parents:
diff changeset
285 urls = purple_conversation_get_data(conv, "TinyURLs");
8986c3804ada Add a gnt TinyURL plugin. Closes #2017
Richard Nelson <wabz@pidgin.im>
parents:
diff changeset
286 if (!(flags & PURPLE_MESSAGE_RECV) || urls == NULL)
8986c3804ada Add a gnt TinyURL plugin. Closes #2017
Richard Nelson <wabz@pidgin.im>
parents:
diff changeset
287 return;
8986c3804ada Add a gnt TinyURL plugin. Closes #2017
Richard Nelson <wabz@pidgin.im>
parents:
diff changeset
288
8986c3804ada Add a gnt TinyURL plugin. Closes #2017
Richard Nelson <wabz@pidgin.im>
parents:
diff changeset
289 for (iter = urls, c = 0; iter; iter = iter->next) {
8986c3804ada Add a gnt TinyURL plugin. Closes #2017
Richard Nelson <wabz@pidgin.im>
parents:
diff changeset
290 int i;
8986c3804ada Add a gnt TinyURL plugin. Closes #2017
Richard Nelson <wabz@pidgin.im>
parents:
diff changeset
291 CbInfo *cbdata;
8986c3804ada Add a gnt TinyURL plugin. Closes #2017
Richard Nelson <wabz@pidgin.im>
parents:
diff changeset
292 gchar *url, *str, *tmp;
8986c3804ada Add a gnt TinyURL plugin. Closes #2017
Richard Nelson <wabz@pidgin.im>
parents:
diff changeset
293 cbdata = g_new(CbInfo, 1);
8986c3804ada Add a gnt TinyURL plugin. Closes #2017
Richard Nelson <wabz@pidgin.im>
parents:
diff changeset
294 cbdata->num = ++c;
8986c3804ada Add a gnt TinyURL plugin. Closes #2017
Richard Nelson <wabz@pidgin.im>
parents:
diff changeset
295 cbdata->tag = g_strdup_printf("%s%d", "tiny_", tag_num++);
8986c3804ada Add a gnt TinyURL plugin. Closes #2017
Richard Nelson <wabz@pidgin.im>
parents:
diff changeset
296 cbdata->conv = conv;
8986c3804ada Add a gnt TinyURL plugin. Closes #2017
Richard Nelson <wabz@pidgin.im>
parents:
diff changeset
297 tmp = purple_unescape_html((char *)iter->data);
8986c3804ada Add a gnt TinyURL plugin. Closes #2017
Richard Nelson <wabz@pidgin.im>
parents:
diff changeset
298 if (g_ascii_strncasecmp(tmp, "http://", 7) && g_ascii_strncasecmp(tmp, "https://", 8)) {
26589
c5920a8cf83f encode urls passed to tinyurl
Richard Nelson <wabz@pidgin.im>
parents: 26584
diff changeset
299 url = g_strdup_printf("%shttp%%3A%%2F%%2F%s", purple_prefs_get_string(PREF_URL), purple_url_encode(tmp));
26582
8986c3804ada Add a gnt TinyURL plugin. Closes #2017
Richard Nelson <wabz@pidgin.im>
parents:
diff changeset
300 } else {
26589
c5920a8cf83f encode urls passed to tinyurl
Richard Nelson <wabz@pidgin.im>
parents: 26584
diff changeset
301 url = g_strdup_printf("%s%s", purple_prefs_get_string(PREF_URL), purple_url_encode(tmp));
26582
8986c3804ada Add a gnt TinyURL plugin. Closes #2017
Richard Nelson <wabz@pidgin.im>
parents:
diff changeset
302 }
8986c3804ada Add a gnt TinyURL plugin. Closes #2017
Richard Nelson <wabz@pidgin.im>
parents:
diff changeset
303 g_free(tmp);
8986c3804ada Add a gnt TinyURL plugin. Closes #2017
Richard Nelson <wabz@pidgin.im>
parents:
diff changeset
304 purple_util_fetch_url(url, TRUE, "finch", FALSE, url_fetched, cbdata);
8986c3804ada Add a gnt TinyURL plugin. Closes #2017
Richard Nelson <wabz@pidgin.im>
parents:
diff changeset
305 i = gnt_text_view_get_lines_below(tv);
8986c3804ada Add a gnt TinyURL plugin. Closes #2017
Richard Nelson <wabz@pidgin.im>
parents:
diff changeset
306 str = g_strdup_printf(_("\nFetching TinyURL..."));
8986c3804ada Add a gnt TinyURL plugin. Closes #2017
Richard Nelson <wabz@pidgin.im>
parents:
diff changeset
307 gnt_text_view_append_text_with_tag((tv), str, GNT_TEXT_FLAG_DIM, cbdata->tag);
8986c3804ada Add a gnt TinyURL plugin. Closes #2017
Richard Nelson <wabz@pidgin.im>
parents:
diff changeset
308 g_free(str);
8986c3804ada Add a gnt TinyURL plugin. Closes #2017
Richard Nelson <wabz@pidgin.im>
parents:
diff changeset
309 if (i == 0)
8986c3804ada Add a gnt TinyURL plugin. Closes #2017
Richard Nelson <wabz@pidgin.im>
parents:
diff changeset
310 gnt_text_view_scroll(tv, 0);
8986c3804ada Add a gnt TinyURL plugin. Closes #2017
Richard Nelson <wabz@pidgin.im>
parents:
diff changeset
311 g_free(iter->data);
8986c3804ada Add a gnt TinyURL plugin. Closes #2017
Richard Nelson <wabz@pidgin.im>
parents:
diff changeset
312 g_free(url);
8986c3804ada Add a gnt TinyURL plugin. Closes #2017
Richard Nelson <wabz@pidgin.im>
parents:
diff changeset
313 }
8986c3804ada Add a gnt TinyURL plugin. Closes #2017
Richard Nelson <wabz@pidgin.im>
parents:
diff changeset
314 g_list_free(urls);
8986c3804ada Add a gnt TinyURL plugin. Closes #2017
Richard Nelson <wabz@pidgin.im>
parents:
diff changeset
315 purple_conversation_set_data(conv, "TinyURLs", NULL);
8986c3804ada Add a gnt TinyURL plugin. Closes #2017
Richard Nelson <wabz@pidgin.im>
parents:
diff changeset
316 }
8986c3804ada Add a gnt TinyURL plugin. Closes #2017
Richard Nelson <wabz@pidgin.im>
parents:
diff changeset
317
8986c3804ada Add a gnt TinyURL plugin. Closes #2017
Richard Nelson <wabz@pidgin.im>
parents:
diff changeset
318 static void
8986c3804ada Add a gnt TinyURL plugin. Closes #2017
Richard Nelson <wabz@pidgin.im>
parents:
diff changeset
319 free_conv_urls(PurpleConversation *conv)
8986c3804ada Add a gnt TinyURL plugin. Closes #2017
Richard Nelson <wabz@pidgin.im>
parents:
diff changeset
320 {
8986c3804ada Add a gnt TinyURL plugin. Closes #2017
Richard Nelson <wabz@pidgin.im>
parents:
diff changeset
321 GList *urls = purple_conversation_get_data(conv, "TinyURLs");
8986c3804ada Add a gnt TinyURL plugin. Closes #2017
Richard Nelson <wabz@pidgin.im>
parents:
diff changeset
322 if (urls)
8986c3804ada Add a gnt TinyURL plugin. Closes #2017
Richard Nelson <wabz@pidgin.im>
parents:
diff changeset
323 g_list_foreach(urls, free_urls, NULL);
8986c3804ada Add a gnt TinyURL plugin. Closes #2017
Richard Nelson <wabz@pidgin.im>
parents:
diff changeset
324 g_list_free(urls);
8986c3804ada Add a gnt TinyURL plugin. Closes #2017
Richard Nelson <wabz@pidgin.im>
parents:
diff changeset
325 }
8986c3804ada Add a gnt TinyURL plugin. Closes #2017
Richard Nelson <wabz@pidgin.im>
parents:
diff changeset
326
8986c3804ada Add a gnt TinyURL plugin. Closes #2017
Richard Nelson <wabz@pidgin.im>
parents:
diff changeset
327 static gboolean
8986c3804ada Add a gnt TinyURL plugin. Closes #2017
Richard Nelson <wabz@pidgin.im>
parents:
diff changeset
328 plugin_load(PurplePlugin *plugin) {
8986c3804ada Add a gnt TinyURL plugin. Closes #2017
Richard Nelson <wabz@pidgin.im>
parents:
diff changeset
329 purple_signal_connect(purple_conversations_get_handle(),
8986c3804ada Add a gnt TinyURL plugin. Closes #2017
Richard Nelson <wabz@pidgin.im>
parents:
diff changeset
330 "wrote-im-msg",
8986c3804ada Add a gnt TinyURL plugin. Closes #2017
Richard Nelson <wabz@pidgin.im>
parents:
diff changeset
331 plugin, PURPLE_CALLBACK(received_msg), NULL);
8986c3804ada Add a gnt TinyURL plugin. Closes #2017
Richard Nelson <wabz@pidgin.im>
parents:
diff changeset
332 purple_signal_connect(purple_conversations_get_handle(),
8986c3804ada Add a gnt TinyURL plugin. Closes #2017
Richard Nelson <wabz@pidgin.im>
parents:
diff changeset
333 "wrote-chat-msg",
8986c3804ada Add a gnt TinyURL plugin. Closes #2017
Richard Nelson <wabz@pidgin.im>
parents:
diff changeset
334 plugin, PURPLE_CALLBACK(received_msg), NULL);
8986c3804ada Add a gnt TinyURL plugin. Closes #2017
Richard Nelson <wabz@pidgin.im>
parents:
diff changeset
335 purple_signal_connect(purple_conversations_get_handle(),
8986c3804ada Add a gnt TinyURL plugin. Closes #2017
Richard Nelson <wabz@pidgin.im>
parents:
diff changeset
336 "receiving-im-msg",
8986c3804ada Add a gnt TinyURL plugin. Closes #2017
Richard Nelson <wabz@pidgin.im>
parents:
diff changeset
337 plugin, PURPLE_CALLBACK(receiving_msg), NULL);
8986c3804ada Add a gnt TinyURL plugin. Closes #2017
Richard Nelson <wabz@pidgin.im>
parents:
diff changeset
338 purple_signal_connect(purple_conversations_get_handle(),
8986c3804ada Add a gnt TinyURL plugin. Closes #2017
Richard Nelson <wabz@pidgin.im>
parents:
diff changeset
339 "receiving-chat-msg",
8986c3804ada Add a gnt TinyURL plugin. Closes #2017
Richard Nelson <wabz@pidgin.im>
parents:
diff changeset
340 plugin, PURPLE_CALLBACK(receiving_msg), NULL);
8986c3804ada Add a gnt TinyURL plugin. Closes #2017
Richard Nelson <wabz@pidgin.im>
parents:
diff changeset
341 purple_signal_connect(purple_conversations_get_handle(),
8986c3804ada Add a gnt TinyURL plugin. Closes #2017
Richard Nelson <wabz@pidgin.im>
parents:
diff changeset
342 "deleting-conversation",
8986c3804ada Add a gnt TinyURL plugin. Closes #2017
Richard Nelson <wabz@pidgin.im>
parents:
diff changeset
343 plugin, PURPLE_CALLBACK(free_conv_urls), NULL);
8986c3804ada Add a gnt TinyURL plugin. Closes #2017
Richard Nelson <wabz@pidgin.im>
parents:
diff changeset
344
8986c3804ada Add a gnt TinyURL plugin. Closes #2017
Richard Nelson <wabz@pidgin.im>
parents:
diff changeset
345 return TRUE;
8986c3804ada Add a gnt TinyURL plugin. Closes #2017
Richard Nelson <wabz@pidgin.im>
parents:
diff changeset
346 }
8986c3804ada Add a gnt TinyURL plugin. Closes #2017
Richard Nelson <wabz@pidgin.im>
parents:
diff changeset
347
8986c3804ada Add a gnt TinyURL plugin. Closes #2017
Richard Nelson <wabz@pidgin.im>
parents:
diff changeset
348 static PurplePluginPrefFrame *
8986c3804ada Add a gnt TinyURL plugin. Closes #2017
Richard Nelson <wabz@pidgin.im>
parents:
diff changeset
349 get_plugin_pref_frame(PurplePlugin *plugin) {
8986c3804ada Add a gnt TinyURL plugin. Closes #2017
Richard Nelson <wabz@pidgin.im>
parents:
diff changeset
350
8986c3804ada Add a gnt TinyURL plugin. Closes #2017
Richard Nelson <wabz@pidgin.im>
parents:
diff changeset
351 PurplePluginPrefFrame *frame;
8986c3804ada Add a gnt TinyURL plugin. Closes #2017
Richard Nelson <wabz@pidgin.im>
parents:
diff changeset
352 PurplePluginPref *pref;
8986c3804ada Add a gnt TinyURL plugin. Closes #2017
Richard Nelson <wabz@pidgin.im>
parents:
diff changeset
353
8986c3804ada Add a gnt TinyURL plugin. Closes #2017
Richard Nelson <wabz@pidgin.im>
parents:
diff changeset
354 frame = purple_plugin_pref_frame_new();
8986c3804ada Add a gnt TinyURL plugin. Closes #2017
Richard Nelson <wabz@pidgin.im>
parents:
diff changeset
355
8986c3804ada Add a gnt TinyURL plugin. Closes #2017
Richard Nelson <wabz@pidgin.im>
parents:
diff changeset
356 pref = purple_plugin_pref_new_with_name(PREF_LENGTH);
28337
6aa8e64fdbb7 Capitalize the abbreviation "URL," as suggested by F Wolff on the
Mark Doliner <mark@kingant.net>
parents: 27031
diff changeset
357 purple_plugin_pref_set_label(pref, _("Only create TinyURL for URLs"
26582
8986c3804ada Add a gnt TinyURL plugin. Closes #2017
Richard Nelson <wabz@pidgin.im>
parents:
diff changeset
358 " of this length or greater"));
8986c3804ada Add a gnt TinyURL plugin. Closes #2017
Richard Nelson <wabz@pidgin.im>
parents:
diff changeset
359 purple_plugin_pref_frame_add(frame, pref);
8986c3804ada Add a gnt TinyURL plugin. Closes #2017
Richard Nelson <wabz@pidgin.im>
parents:
diff changeset
360 pref = purple_plugin_pref_new_with_name(PREF_URL);
8986c3804ada Add a gnt TinyURL plugin. Closes #2017
Richard Nelson <wabz@pidgin.im>
parents:
diff changeset
361 purple_plugin_pref_set_label(pref, _("TinyURL (or other) address prefix"));
8986c3804ada Add a gnt TinyURL plugin. Closes #2017
Richard Nelson <wabz@pidgin.im>
parents:
diff changeset
362 purple_plugin_pref_frame_add(frame, pref);
8986c3804ada Add a gnt TinyURL plugin. Closes #2017
Richard Nelson <wabz@pidgin.im>
parents:
diff changeset
363
8986c3804ada Add a gnt TinyURL plugin. Closes #2017
Richard Nelson <wabz@pidgin.im>
parents:
diff changeset
364 return frame;
8986c3804ada Add a gnt TinyURL plugin. Closes #2017
Richard Nelson <wabz@pidgin.im>
parents:
diff changeset
365 }
8986c3804ada Add a gnt TinyURL plugin. Closes #2017
Richard Nelson <wabz@pidgin.im>
parents:
diff changeset
366
8986c3804ada Add a gnt TinyURL plugin. Closes #2017
Richard Nelson <wabz@pidgin.im>
parents:
diff changeset
367 static PurplePluginUiInfo prefs_info = {
8986c3804ada Add a gnt TinyURL plugin. Closes #2017
Richard Nelson <wabz@pidgin.im>
parents:
diff changeset
368 get_plugin_pref_frame,
8986c3804ada Add a gnt TinyURL plugin. Closes #2017
Richard Nelson <wabz@pidgin.im>
parents:
diff changeset
369 0, /* page_num (Reserved) */
8986c3804ada Add a gnt TinyURL plugin. Closes #2017
Richard Nelson <wabz@pidgin.im>
parents:
diff changeset
370 NULL, /* frame (Reserved) */
8986c3804ada Add a gnt TinyURL plugin. Closes #2017
Richard Nelson <wabz@pidgin.im>
parents:
diff changeset
371
8986c3804ada Add a gnt TinyURL plugin. Closes #2017
Richard Nelson <wabz@pidgin.im>
parents:
diff changeset
372 /* padding */
8986c3804ada Add a gnt TinyURL plugin. Closes #2017
Richard Nelson <wabz@pidgin.im>
parents:
diff changeset
373 NULL,
8986c3804ada Add a gnt TinyURL plugin. Closes #2017
Richard Nelson <wabz@pidgin.im>
parents:
diff changeset
374 NULL,
8986c3804ada Add a gnt TinyURL plugin. Closes #2017
Richard Nelson <wabz@pidgin.im>
parents:
diff changeset
375 NULL,
8986c3804ada Add a gnt TinyURL plugin. Closes #2017
Richard Nelson <wabz@pidgin.im>
parents:
diff changeset
376 NULL
8986c3804ada Add a gnt TinyURL plugin. Closes #2017
Richard Nelson <wabz@pidgin.im>
parents:
diff changeset
377 };
8986c3804ada Add a gnt TinyURL plugin. Closes #2017
Richard Nelson <wabz@pidgin.im>
parents:
diff changeset
378
8986c3804ada Add a gnt TinyURL plugin. Closes #2017
Richard Nelson <wabz@pidgin.im>
parents:
diff changeset
379 static PurplePluginInfo info =
8986c3804ada Add a gnt TinyURL plugin. Closes #2017
Richard Nelson <wabz@pidgin.im>
parents:
diff changeset
380 {
8986c3804ada Add a gnt TinyURL plugin. Closes #2017
Richard Nelson <wabz@pidgin.im>
parents:
diff changeset
381 PURPLE_PLUGIN_MAGIC,
8986c3804ada Add a gnt TinyURL plugin. Closes #2017
Richard Nelson <wabz@pidgin.im>
parents:
diff changeset
382 PURPLE_MAJOR_VERSION,
8986c3804ada Add a gnt TinyURL plugin. Closes #2017
Richard Nelson <wabz@pidgin.im>
parents:
diff changeset
383 PURPLE_MINOR_VERSION,
8986c3804ada Add a gnt TinyURL plugin. Closes #2017
Richard Nelson <wabz@pidgin.im>
parents:
diff changeset
384 PURPLE_PLUGIN_STANDARD,
8986c3804ada Add a gnt TinyURL plugin. Closes #2017
Richard Nelson <wabz@pidgin.im>
parents:
diff changeset
385 FINCH_PLUGIN_TYPE,
8986c3804ada Add a gnt TinyURL plugin. Closes #2017
Richard Nelson <wabz@pidgin.im>
parents:
diff changeset
386 0,
8986c3804ada Add a gnt TinyURL plugin. Closes #2017
Richard Nelson <wabz@pidgin.im>
parents:
diff changeset
387 NULL,
8986c3804ada Add a gnt TinyURL plugin. Closes #2017
Richard Nelson <wabz@pidgin.im>
parents:
diff changeset
388 PURPLE_PRIORITY_DEFAULT,
8986c3804ada Add a gnt TinyURL plugin. Closes #2017
Richard Nelson <wabz@pidgin.im>
parents:
diff changeset
389 "TinyURL",
8986c3804ada Add a gnt TinyURL plugin. Closes #2017
Richard Nelson <wabz@pidgin.im>
parents:
diff changeset
390 N_("TinyURL"),
8986c3804ada Add a gnt TinyURL plugin. Closes #2017
Richard Nelson <wabz@pidgin.im>
parents:
diff changeset
391 DISPLAY_VERSION,
8986c3804ada Add a gnt TinyURL plugin. Closes #2017
Richard Nelson <wabz@pidgin.im>
parents:
diff changeset
392 N_("TinyURL plugin"),
28338
4e7b8902da90 Add a verb to this sentence, as suggested by F Wolff on the translators
Mark Doliner <mark@kingant.net>
parents: 28337
diff changeset
393 N_("When receiving a message with URL(s), use TinyURL for easier copying"),
26582
8986c3804ada Add a gnt TinyURL plugin. Closes #2017
Richard Nelson <wabz@pidgin.im>
parents:
diff changeset
394 "Richard Nelson <wabz@whatsbeef.net>",
8986c3804ada Add a gnt TinyURL plugin. Closes #2017
Richard Nelson <wabz@pidgin.im>
parents:
diff changeset
395 PURPLE_WEBSITE,
8986c3804ada Add a gnt TinyURL plugin. Closes #2017
Richard Nelson <wabz@pidgin.im>
parents:
diff changeset
396 plugin_load,
8986c3804ada Add a gnt TinyURL plugin. Closes #2017
Richard Nelson <wabz@pidgin.im>
parents:
diff changeset
397 NULL,
8986c3804ada Add a gnt TinyURL plugin. Closes #2017
Richard Nelson <wabz@pidgin.im>
parents:
diff changeset
398 NULL,
8986c3804ada Add a gnt TinyURL plugin. Closes #2017
Richard Nelson <wabz@pidgin.im>
parents:
diff changeset
399 NULL,
8986c3804ada Add a gnt TinyURL plugin. Closes #2017
Richard Nelson <wabz@pidgin.im>
parents:
diff changeset
400 NULL,
8986c3804ada Add a gnt TinyURL plugin. Closes #2017
Richard Nelson <wabz@pidgin.im>
parents:
diff changeset
401 &prefs_info, /**< prefs_info */
8986c3804ada Add a gnt TinyURL plugin. Closes #2017
Richard Nelson <wabz@pidgin.im>
parents:
diff changeset
402 NULL,
8986c3804ada Add a gnt TinyURL plugin. Closes #2017
Richard Nelson <wabz@pidgin.im>
parents:
diff changeset
403
8986c3804ada Add a gnt TinyURL plugin. Closes #2017
Richard Nelson <wabz@pidgin.im>
parents:
diff changeset
404 /* padding */
8986c3804ada Add a gnt TinyURL plugin. Closes #2017
Richard Nelson <wabz@pidgin.im>
parents:
diff changeset
405 NULL,
8986c3804ada Add a gnt TinyURL plugin. Closes #2017
Richard Nelson <wabz@pidgin.im>
parents:
diff changeset
406 NULL,
8986c3804ada Add a gnt TinyURL plugin. Closes #2017
Richard Nelson <wabz@pidgin.im>
parents:
diff changeset
407 NULL,
8986c3804ada Add a gnt TinyURL plugin. Closes #2017
Richard Nelson <wabz@pidgin.im>
parents:
diff changeset
408 NULL
8986c3804ada Add a gnt TinyURL plugin. Closes #2017
Richard Nelson <wabz@pidgin.im>
parents:
diff changeset
409 };
8986c3804ada Add a gnt TinyURL plugin. Closes #2017
Richard Nelson <wabz@pidgin.im>
parents:
diff changeset
410
8986c3804ada Add a gnt TinyURL plugin. Closes #2017
Richard Nelson <wabz@pidgin.im>
parents:
diff changeset
411 static void
8986c3804ada Add a gnt TinyURL plugin. Closes #2017
Richard Nelson <wabz@pidgin.im>
parents:
diff changeset
412 init_plugin(PurplePlugin *plugin) {
8986c3804ada Add a gnt TinyURL plugin. Closes #2017
Richard Nelson <wabz@pidgin.im>
parents:
diff changeset
413 purple_prefs_add_none(PREFS_BASE);
8986c3804ada Add a gnt TinyURL plugin. Closes #2017
Richard Nelson <wabz@pidgin.im>
parents:
diff changeset
414 purple_prefs_add_int(PREF_LENGTH, 30);
8986c3804ada Add a gnt TinyURL plugin. Closes #2017
Richard Nelson <wabz@pidgin.im>
parents:
diff changeset
415 purple_prefs_add_string(PREF_URL, "http://tinyurl.com/api-create.php?url=");
8986c3804ada Add a gnt TinyURL plugin. Closes #2017
Richard Nelson <wabz@pidgin.im>
parents:
diff changeset
416 }
8986c3804ada Add a gnt TinyURL plugin. Closes #2017
Richard Nelson <wabz@pidgin.im>
parents:
diff changeset
417
8986c3804ada Add a gnt TinyURL plugin. Closes #2017
Richard Nelson <wabz@pidgin.im>
parents:
diff changeset
418 PURPLE_INIT_PLUGIN(PLUGIN_STATIC_NAME, init_plugin, info)