11118
|
1 #include "module.h"
|
|
2
|
11290
|
3 typedef struct {
|
|
4 char *cb;
|
|
5 } GaimPerlUrlData;
|
|
6
|
|
7 void gaim_perl_util_url_cb(void *data, const char *url_data, size_t size) {
|
|
8 GaimPerlUrlData *gpr = (GaimPerlUrlData *)data;
|
|
9 dSP;
|
|
10 ENTER;
|
|
11 SAVETMPS;
|
|
12 PUSHMARK(sp);
|
11118
|
13
|
11290
|
14 XPUSHs(sv_2mortal(newSVpv(url_data, 0)));
|
|
15 PUTBACK;
|
|
16
|
|
17 call_pv(gpr->cb, G_EVAL | G_SCALAR);
|
|
18 SPAGAIN;
|
11118
|
19
|
11290
|
20 PUTBACK;
|
|
21 FREETMPS;
|
|
22 LEAVE;
|
|
23 }
|
11118
|
24
|
11290
|
25
|
11118
|
26 MODULE = Gaim::Util PACKAGE = Gaim::Util PREFIX = gaim_
|
|
27 PROTOTYPES: ENABLE
|
11290
|
28
|
|
29 void
|
|
30 gaim_url_fetch(handle, url, full, user_agent, http11, cb)
|
|
31 Gaim::Plugin handle
|
|
32 const char *url
|
|
33 gboolean full
|
|
34 const char *user_agent
|
|
35 gboolean http11
|
|
36 SV * cb
|
|
37 CODE:
|
|
38 GaimPerlUrlData *gpr;
|
|
39 STRLEN len;
|
|
40 char *basename, *package;
|
|
41
|
|
42 basename = g_path_get_basename(handle->path);
|
|
43 gaim_perl_normalize_script_name(basename);
|
|
44 package = g_strdup_printf("Gaim::Script::%s", basename);
|
|
45 gpr = g_new(GaimPerlUrlData, 1);
|
|
46
|
|
47 gpr->cb = g_strdup_printf("%s::%s", package, SvPV(cb, len));
|
|
48 gaim_url_fetch(url, full, user_agent, http11, gaim_perl_util_url_cb, gpr);
|
11118
|
49
|
|
50 int
|
|
51 gaim_build_dir(path, mode)
|
|
52 const char *path
|
|
53 int mode
|
|
54
|
|
55 const char *
|
|
56 gaim_date()
|
|
57
|
|
58
|
|
59 const char *
|
|
60 gaim_date_full()
|
|
61
|
|
62
|
|
63 gboolean
|
|
64 gaim_email_is_valid(address)
|
|
65 const char *address
|
|
66
|
|
67 const char *
|
|
68 gaim_escape_filename(str)
|
|
69 const char *str
|
|
70
|
|
71 char *
|
|
72 gaim_fd_get_ip(fd)
|
|
73 int fd
|
|
74
|
|
75 const gchar *
|
|
76 gaim_home_dir()
|
|
77
|
|
78
|
|
79 gboolean
|
|
80 gaim_markup_extract_info_field(str, len, dest, start_token, skip, end_token, check_value, no_value_token, display_name, is_link, link_prefix)
|
|
81 const char *str
|
|
82 int len
|
|
83 GString *dest
|
|
84 const char *start_token
|
|
85 int skip
|
|
86 const char *end_token
|
|
87 char check_value
|
|
88 const char *no_value_token
|
|
89 const char *display_name
|
|
90 gboolean is_link
|
|
91 const char *link_prefix
|
|
92
|
|
93 gboolean
|
|
94 gaim_markup_find_tag(needle, haystack, start, end, attributes)
|
|
95 const char *needle
|
|
96 const char *haystack
|
|
97 const char **start
|
|
98 const char **end
|
|
99 GData **attributes
|
|
100
|
|
101 char *
|
|
102 gaim_markup_get_tag_name(tag)
|
|
103 const char *tag
|
|
104
|
|
105 void
|
|
106 gaim_markup_html_to_xhtml(html, dest_xhtml, dest_plain)
|
|
107 const char *html
|
|
108 char **dest_xhtml
|
|
109 char **dest_plain
|
|
110
|
|
111 char *
|
|
112 gaim_markup_linkify(str)
|
|
113 const char *str
|
|
114
|
|
115 char *
|
|
116 gaim_markup_slice(str, x, y)
|
|
117 const char *str
|
|
118 guint x
|
|
119 guint y
|
|
120
|
|
121 char *
|
|
122 gaim_markup_strip_html(str)
|
|
123 const char *str
|
|
124
|
|
125 gboolean
|
|
126 gaim_message_meify(message, len)
|
|
127 char *message
|
|
128 size_t len
|
|
129
|
|
130 FILE *
|
|
131 gaim_mkstemp(path, binary)
|
|
132 char **path
|
|
133 gboolean binary
|
|
134
|
|
135 const char *
|
|
136 gaim_normalize(account, str)
|
|
137 Gaim::Account account
|
|
138 const char *str
|
|
139
|
|
140 gboolean
|
|
141 gaim_program_is_valid(program)
|
|
142 const char *program
|
|
143
|
|
144 char *
|
|
145 gaim_str_add_cr(str)
|
|
146 const char *str
|
|
147
|
|
148 char *
|
|
149 gaim_str_binary_to_ascii(binary, len)
|
|
150 const unsigned char *binary
|
|
151 guint len
|
|
152
|
|
153 gboolean
|
|
154 gaim_str_has_prefix(s, p)
|
|
155 const char *s
|
|
156 const char *p
|
|
157
|
|
158 gboolean
|
|
159 gaim_str_has_suffix(s, x)
|
|
160 const char *s
|
|
161 const char *x
|
|
162
|
|
163 char *
|
|
164 gaim_str_seconds_to_string(sec)
|
|
165 guint sec
|
|
166
|
|
167 char *
|
|
168 gaim_str_size_to_units(size)
|
|
169 size_t size
|
|
170
|
|
171 void
|
|
172 gaim_str_strip_cr(str)
|
|
173 char *str
|
|
174
|
|
175 gchar *
|
|
176 gaim_str_sub_away_formatters(str, name)
|
|
177 const char *str
|
|
178 const char *name
|
|
179
|
|
180 time_t
|
|
181 gaim_str_to_time(timestamp, utc)
|
|
182 const char *timestamp
|
|
183 gboolean utc
|
|
184
|
|
185 gchar *
|
|
186 gaim_strcasereplace(string, delimiter, replacement)
|
|
187 const char *string
|
|
188 const char *delimiter
|
|
189 const char *replacement
|
|
190
|
|
191 const char *
|
|
192 gaim_strcasestr(haystack, needle)
|
|
193 const char *haystack
|
|
194 const char *needle
|
|
195
|
|
196 gchar *
|
|
197 gaim_strdup_withhtml(src)
|
|
198 const gchar *src
|
|
199
|
|
200 size_t
|
|
201 gaim_strftime(s, max, format, tm)
|
|
202 char *s
|
|
203 size_t max
|
|
204 const char *format
|
|
205 const struct tm *tm
|
|
206
|
|
207 gchar *
|
|
208 gaim_strreplace(string, delimiter, replacement)
|
|
209 const char *string
|
|
210 const char *delimiter
|
|
211 const char *replacement
|
|
212
|
|
213 char *
|
|
214 gaim_text_strip_mnemonic(in)
|
|
215 const char *in
|
|
216
|
|
217 time_t
|
|
218 gaim_time_build(year, month, day, hour, min, sec)
|
|
219 int year
|
|
220 int month
|
|
221 int day
|
|
222 int hour
|
|
223 int min
|
|
224 int sec
|
|
225
|
|
226 const char *
|
|
227 gaim_unescape_filename(str)
|
|
228 const char *str
|
|
229
|
|
230 char *
|
|
231 gaim_unescape_html(html)
|
|
232 const char *html
|
|
233
|
|
234 const char *
|
|
235 gaim_url_decode(str)
|
|
236 const char *str
|
|
237
|
|
238 const char *
|
|
239 gaim_url_encode(str)
|
|
240 const char *str
|
|
241
|
|
242
|
|
243
|
|
244 gboolean
|
|
245 gaim_url_parse(url, ret_host, ret_port, ret_path, ret_user, ret_passwd)
|
|
246 const char *url
|
|
247 char **ret_host
|
|
248 int *ret_port
|
|
249 char **ret_path
|
|
250 char **ret_user
|
|
251 char **ret_passwd
|
|
252
|
|
253 const char *
|
|
254 gaim_user_dir()
|
|
255
|
|
256
|
|
257 void
|
|
258 gaim_util_set_user_dir(dir)
|
|
259 const char *dir
|
|
260
|
|
261 gboolean
|
|
262 gaim_util_write_data_to_file(filename, data, size)
|
|
263 const char *filename
|
|
264 const char *data
|
|
265 size_t size
|
|
266
|