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