Sun, 20 May 2007 06:19:49 +0000
merge of 'b98e72d4089afb8a1879e5fe9627cfb132ee88de'
and 'b2836a24d81e7a1bd1d21b3aea8794b094391344'
| 11118 | 1 | #include "module.h" |
| 2 | ||
| 11290 | 3 | typedef struct { |
| 4 | char *cb; | |
| 5 | } GaimPerlUrlData; | |
| 6 | ||
|
14426
8d4f164c4979
[gaim-migrate @ 17070]
Daniel Atallah <datallah@pidgin.im>
parents:
14417
diff
changeset
|
7 | static void gaim_perl_util_url_cb(GaimUtilFetchUrlData *url_data, void *user_data, const gchar *url_text, size_t size, const gchar *error_message) { |
|
14417
5b0b76a8dee4
[gaim-migrate @ 17061]
Mark Doliner <markdoliner@pidgin.im>
parents:
14254
diff
changeset
|
8 | GaimPerlUrlData *gpr = (GaimPerlUrlData *)user_data; |
| 12783 | 9 | dSP; |
| 10 | ENTER; | |
| 11 | SAVETMPS; | |
|
14426
8d4f164c4979
[gaim-migrate @ 17070]
Daniel Atallah <datallah@pidgin.im>
parents:
14417
diff
changeset
|
12 | PUSHMARK(SP); |
| 11118 | 13 | |
|
14426
8d4f164c4979
[gaim-migrate @ 17070]
Daniel Atallah <datallah@pidgin.im>
parents:
14417
diff
changeset
|
14 | XPUSHs(sv_2mortal(newSVpvn(url_text, size))); |
| 12783 | 15 | PUTBACK; |
| 11290 | 16 | |
| 12783 | 17 | call_pv(gpr->cb, G_EVAL | G_SCALAR); |
| 18 | SPAGAIN; | |
| 11118 | 19 | |
|
14426
8d4f164c4979
[gaim-migrate @ 17070]
Daniel Atallah <datallah@pidgin.im>
parents:
14417
diff
changeset
|
20 | g_free(gpr->cb); |
|
8d4f164c4979
[gaim-migrate @ 17070]
Daniel Atallah <datallah@pidgin.im>
parents:
14417
diff
changeset
|
21 | g_free(gpr); |
|
8d4f164c4979
[gaim-migrate @ 17070]
Daniel Atallah <datallah@pidgin.im>
parents:
14417
diff
changeset
|
22 | |
| 12783 | 23 | PUTBACK; |
| 24 | FREETMPS; | |
| 25 | LEAVE; | |
| 11290 | 26 | } |
| 11118 | 27 | |
| 28 | MODULE = Gaim::Util PACKAGE = Gaim::Util PREFIX = gaim_ | |
| 12783 | 29 | PROTOTYPES: ENABLE |
| 11290 | 30 | |
| 31 | void | |
|
14417
5b0b76a8dee4
[gaim-migrate @ 17061]
Mark Doliner <markdoliner@pidgin.im>
parents:
14254
diff
changeset
|
32 | gaim_util_fetch_url(handle, url, full, user_agent, http11, cb) |
| 12783 | 33 | Gaim::Plugin handle |
| 34 | const char *url | |
| 35 | gboolean full | |
| 36 | const char *user_agent | |
| 37 | gboolean http11 | |
| 38 | SV * cb | |
| 11290 | 39 | CODE: |
| 12783 | 40 | GaimPerlUrlData *gpr; |
| 41 | STRLEN len; | |
|
14426
8d4f164c4979
[gaim-migrate @ 17070]
Daniel Atallah <datallah@pidgin.im>
parents:
14417
diff
changeset
|
42 | char *basename; |
| 11290 | 43 | |
| 12783 | 44 | basename = g_path_get_basename(handle->path); |
| 45 | gaim_perl_normalize_script_name(basename); | |
| 46 | gpr = g_new(GaimPerlUrlData, 1); | |
| 11290 | 47 | |
|
14426
8d4f164c4979
[gaim-migrate @ 17070]
Daniel Atallah <datallah@pidgin.im>
parents:
14417
diff
changeset
|
48 | gpr->cb = g_strdup_printf("Gaim::Script::%s::%s", basename, SvPV(cb, len)); |
|
8d4f164c4979
[gaim-migrate @ 17070]
Daniel Atallah <datallah@pidgin.im>
parents:
14417
diff
changeset
|
49 | g_free(basename); |
|
14417
5b0b76a8dee4
[gaim-migrate @ 17061]
Mark Doliner <markdoliner@pidgin.im>
parents:
14254
diff
changeset
|
50 | gaim_util_fetch_url(url, full, user_agent, http11, gaim_perl_util_url_cb, gpr); |
| 11118 | 51 | |
| 12783 | 52 | int |
| 11118 | 53 | gaim_build_dir(path, mode) |
| 54 | const char *path | |
| 55 | int mode | |
| 56 | ||
|
13105
8f9c66e4af87
[gaim-migrate @ 15466]
Richard Laager <rlaager@pidgin.im>
parents:
13033
diff
changeset
|
57 | const char * |
|
13120
c25222322810
[gaim-migrate @ 15481]
Richard Laager <rlaager@pidgin.im>
parents:
13105
diff
changeset
|
58 | gaim_date_format_full(tm) |
|
c25222322810
[gaim-migrate @ 15481]
Richard Laager <rlaager@pidgin.im>
parents:
13105
diff
changeset
|
59 | const struct tm *tm |
|
13105
8f9c66e4af87
[gaim-migrate @ 15466]
Richard Laager <rlaager@pidgin.im>
parents:
13033
diff
changeset
|
60 | |
|
8f9c66e4af87
[gaim-migrate @ 15466]
Richard Laager <rlaager@pidgin.im>
parents:
13033
diff
changeset
|
61 | const char * |
|
8f9c66e4af87
[gaim-migrate @ 15466]
Richard Laager <rlaager@pidgin.im>
parents:
13033
diff
changeset
|
62 | gaim_date_format_long(tm) |
|
8f9c66e4af87
[gaim-migrate @ 15466]
Richard Laager <rlaager@pidgin.im>
parents:
13033
diff
changeset
|
63 | const struct tm *tm |
|
8f9c66e4af87
[gaim-migrate @ 15466]
Richard Laager <rlaager@pidgin.im>
parents:
13033
diff
changeset
|
64 | |
|
8f9c66e4af87
[gaim-migrate @ 15466]
Richard Laager <rlaager@pidgin.im>
parents:
13033
diff
changeset
|
65 | const char * |
|
8f9c66e4af87
[gaim-migrate @ 15466]
Richard Laager <rlaager@pidgin.im>
parents:
13033
diff
changeset
|
66 | gaim_date_format_short(tm) |
|
8f9c66e4af87
[gaim-migrate @ 15466]
Richard Laager <rlaager@pidgin.im>
parents:
13033
diff
changeset
|
67 | const struct tm *tm |
|
8f9c66e4af87
[gaim-migrate @ 15466]
Richard Laager <rlaager@pidgin.im>
parents:
13033
diff
changeset
|
68 | |
| 12783 | 69 | gboolean |
| 11118 | 70 | gaim_email_is_valid(address) |
| 71 | const char *address | |
| 72 | ||
| 73 | const char * | |
| 74 | gaim_escape_filename(str) | |
| 75 | const char *str | |
| 76 | ||
|
15165
0ff631dfbbca
[gaim-migrate @ 17889]
Daniel Atallah <datallah@pidgin.im>
parents:
14426
diff
changeset
|
77 | gchar_own * |
| 11118 | 78 | gaim_fd_get_ip(fd) |
| 79 | int fd | |
| 80 | ||
| 81 | const gchar * | |
| 82 | gaim_home_dir() | |
| 83 | ||
| 12783 | 84 | gboolean |
|
15266
a168574c18d2
[gaim-migrate @ 17994]
Daniel Atallah <datallah@pidgin.im>
parents:
15165
diff
changeset
|
85 | gaim_markup_extract_info_field(str, len, user_info, start_token, skip, end_token, check_value, no_value_token, display_name, is_link, link_prefix, format_cb) |
| 11118 | 86 | const char *str |
| 87 | int len | |
|
15266
a168574c18d2
[gaim-migrate @ 17994]
Daniel Atallah <datallah@pidgin.im>
parents:
15165
diff
changeset
|
88 | Gaim::NotifyUserInfo user_info |
| 11118 | 89 | const char *start_token |
| 90 | int skip | |
| 91 | const char *end_token | |
| 92 | char check_value | |
| 93 | const char *no_value_token | |
| 94 | const char *display_name | |
| 95 | gboolean is_link | |
| 96 | const char *link_prefix | |
|
13105
8f9c66e4af87
[gaim-migrate @ 15466]
Richard Laager <rlaager@pidgin.im>
parents:
13033
diff
changeset
|
97 | Gaim::Util::InfoFieldFormatCallback format_cb |
| 11118 | 98 | |
| 12783 | 99 | gboolean |
| 11118 | 100 | gaim_markup_find_tag(needle, haystack, start, end, attributes) |
| 101 | const char *needle | |
| 102 | const char *haystack | |
| 103 | const char **start | |
| 104 | const char **end | |
| 105 | GData **attributes | |
| 106 | ||
|
15165
0ff631dfbbca
[gaim-migrate @ 17889]
Daniel Atallah <datallah@pidgin.im>
parents:
14426
diff
changeset
|
107 | gchar_own * |
| 11118 | 108 | gaim_markup_get_tag_name(tag) |
| 109 | const char *tag | |
| 110 | ||
| 12783 | 111 | void |
| 11118 | 112 | gaim_markup_html_to_xhtml(html, dest_xhtml, dest_plain) |
| 113 | const char *html | |
| 114 | char **dest_xhtml | |
| 115 | char **dest_plain | |
| 116 | ||
|
15165
0ff631dfbbca
[gaim-migrate @ 17889]
Daniel Atallah <datallah@pidgin.im>
parents:
14426
diff
changeset
|
117 | gchar_own * |
| 11118 | 118 | gaim_markup_linkify(str) |
| 119 | const char *str | |
| 120 | ||
|
15165
0ff631dfbbca
[gaim-migrate @ 17889]
Daniel Atallah <datallah@pidgin.im>
parents:
14426
diff
changeset
|
121 | gchar_own * |
| 11118 | 122 | gaim_markup_slice(str, x, y) |
| 123 | const char *str | |
| 124 | guint x | |
| 125 | guint y | |
| 126 | ||
|
15165
0ff631dfbbca
[gaim-migrate @ 17889]
Daniel Atallah <datallah@pidgin.im>
parents:
14426
diff
changeset
|
127 | gchar_own * |
| 11118 | 128 | gaim_markup_strip_html(str) |
| 129 | const char *str | |
| 130 | ||
| 12783 | 131 | gboolean |
| 11118 | 132 | gaim_message_meify(message, len) |
| 133 | char *message | |
| 134 | size_t len | |
| 135 | ||
| 136 | FILE * | |
| 137 | gaim_mkstemp(path, binary) | |
| 138 | char **path | |
| 139 | gboolean binary | |
| 140 | ||
| 141 | const char * | |
| 142 | gaim_normalize(account, str) | |
| 143 | Gaim::Account account | |
| 144 | const char *str | |
| 145 | ||
| 12783 | 146 | gboolean |
| 11118 | 147 | gaim_program_is_valid(program) |
| 148 | const char *program | |
| 149 | ||
|
15165
0ff631dfbbca
[gaim-migrate @ 17889]
Daniel Atallah <datallah@pidgin.im>
parents:
14426
diff
changeset
|
150 | gchar_own * |
| 11118 | 151 | gaim_str_add_cr(str) |
| 152 | const char *str | |
| 153 | ||
|
15165
0ff631dfbbca
[gaim-migrate @ 17889]
Daniel Atallah <datallah@pidgin.im>
parents:
14426
diff
changeset
|
154 | gchar_own * |
| 11118 | 155 | gaim_str_binary_to_ascii(binary, len) |
| 156 | const unsigned char *binary | |
| 157 | guint len | |
| 158 | ||
| 12783 | 159 | gboolean |
| 11118 | 160 | gaim_str_has_prefix(s, p) |
| 161 | const char *s | |
| 162 | const char *p | |
| 163 | ||
| 12783 | 164 | gboolean |
| 11118 | 165 | gaim_str_has_suffix(s, x) |
| 166 | const char *s | |
| 167 | const char *x | |
| 168 | ||
|
15165
0ff631dfbbca
[gaim-migrate @ 17889]
Daniel Atallah <datallah@pidgin.im>
parents:
14426
diff
changeset
|
169 | gchar_own * |
| 11118 | 170 | gaim_str_seconds_to_string(sec) |
| 171 | guint sec | |
| 172 | ||
|
15165
0ff631dfbbca
[gaim-migrate @ 17889]
Daniel Atallah <datallah@pidgin.im>
parents:
14426
diff
changeset
|
173 | gchar_own * |
| 11118 | 174 | gaim_str_size_to_units(size) |
| 175 | size_t size | |
| 176 | ||
| 12783 | 177 | void |
|
11920
be80617ec59b
[gaim-migrate @ 14211]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
11290
diff
changeset
|
178 | gaim_str_strip_char(str, thechar) |
| 11118 | 179 | char *str |
|
11920
be80617ec59b
[gaim-migrate @ 14211]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
11290
diff
changeset
|
180 | char thechar |
| 11118 | 181 | |
| 12783 | 182 | time_t |
|
13120
c25222322810
[gaim-migrate @ 15481]
Richard Laager <rlaager@pidgin.im>
parents:
13105
diff
changeset
|
183 | gaim_str_to_time(timestamp, utc = FALSE, tm = NULL, tz_off = NULL, rest = NULL) |
| 11118 | 184 | const char *timestamp |
| 185 | gboolean utc | |
|
13120
c25222322810
[gaim-migrate @ 15481]
Richard Laager <rlaager@pidgin.im>
parents:
13105
diff
changeset
|
186 | struct tm *tm |
|
c25222322810
[gaim-migrate @ 15481]
Richard Laager <rlaager@pidgin.im>
parents:
13105
diff
changeset
|
187 | long *tz_off |
|
c25222322810
[gaim-migrate @ 15481]
Richard Laager <rlaager@pidgin.im>
parents:
13105
diff
changeset
|
188 | const char **rest |
| 11118 | 189 | |
|
15165
0ff631dfbbca
[gaim-migrate @ 17889]
Daniel Atallah <datallah@pidgin.im>
parents:
14426
diff
changeset
|
190 | gchar_own * |
| 11118 | 191 | gaim_strcasereplace(string, delimiter, replacement) |
| 192 | const char *string | |
| 193 | const char *delimiter | |
| 194 | const char *replacement | |
| 195 | ||
| 196 | const char * | |
| 197 | gaim_strcasestr(haystack, needle) | |
| 198 | const char *haystack | |
| 199 | const char *needle | |
| 200 | ||
|
15165
0ff631dfbbca
[gaim-migrate @ 17889]
Daniel Atallah <datallah@pidgin.im>
parents:
14426
diff
changeset
|
201 | gchar_own * |
| 11118 | 202 | gaim_strdup_withhtml(src) |
| 203 | const gchar *src | |
| 204 | ||
|
15165
0ff631dfbbca
[gaim-migrate @ 17889]
Daniel Atallah <datallah@pidgin.im>
parents:
14426
diff
changeset
|
205 | gchar_own * |
| 11118 | 206 | gaim_strreplace(string, delimiter, replacement) |
| 207 | const char *string | |
| 208 | const char *delimiter | |
| 209 | const char *replacement | |
| 210 | ||
|
15165
0ff631dfbbca
[gaim-migrate @ 17889]
Daniel Atallah <datallah@pidgin.im>
parents:
14426
diff
changeset
|
211 | gchar_own * |
| 11118 | 212 | gaim_text_strip_mnemonic(in) |
| 213 | const char *in | |
| 214 | ||
| 12783 | 215 | time_t |
| 11118 | 216 | gaim_time_build(year, month, day, hour, min, sec) |
| 217 | int year | |
| 218 | int month | |
| 219 | int day | |
| 220 | int hour | |
| 221 | int min | |
| 222 | int sec | |
| 223 | ||
| 224 | const char * | |
|
13105
8f9c66e4af87
[gaim-migrate @ 15466]
Richard Laager <rlaager@pidgin.im>
parents:
13033
diff
changeset
|
225 | gaim_time_format(tm) |
|
8f9c66e4af87
[gaim-migrate @ 15466]
Richard Laager <rlaager@pidgin.im>
parents:
13033
diff
changeset
|
226 | const struct tm *tm |
|
8f9c66e4af87
[gaim-migrate @ 15466]
Richard Laager <rlaager@pidgin.im>
parents:
13033
diff
changeset
|
227 | |
|
8f9c66e4af87
[gaim-migrate @ 15466]
Richard Laager <rlaager@pidgin.im>
parents:
13033
diff
changeset
|
228 | const char * |
| 11118 | 229 | gaim_unescape_filename(str) |
| 230 | const char *str | |
| 231 | ||
|
15165
0ff631dfbbca
[gaim-migrate @ 17889]
Daniel Atallah <datallah@pidgin.im>
parents:
14426
diff
changeset
|
232 | gchar_own * |
| 11118 | 233 | gaim_unescape_html(html) |
| 234 | const char *html | |
| 235 | ||
| 236 | const char * | |
| 237 | gaim_url_decode(str) | |
| 238 | const char *str | |
| 239 | ||
| 240 | const char * | |
| 241 | gaim_url_encode(str) | |
| 242 | const char *str | |
| 243 | ||
| 12783 | 244 | gboolean |
| 11118 | 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 | ||
|
13105
8f9c66e4af87
[gaim-migrate @ 15466]
Richard Laager <rlaager@pidgin.im>
parents:
13033
diff
changeset
|
256 | const char * |
|
8f9c66e4af87
[gaim-migrate @ 15466]
Richard Laager <rlaager@pidgin.im>
parents:
13033
diff
changeset
|
257 | gaim_utf8_strftime(const char *format, const struct tm *tm); |
|
8f9c66e4af87
[gaim-migrate @ 15466]
Richard Laager <rlaager@pidgin.im>
parents:
13033
diff
changeset
|
258 | |
| 12783 | 259 | void |
| 11118 | 260 | gaim_util_set_user_dir(dir) |
| 261 | const char *dir | |
| 262 | ||
| 12783 | 263 | gboolean |
| 11118 | 264 | gaim_util_write_data_to_file(filename, data, size) |
| 265 | const char *filename | |
| 266 | const char *data | |
| 267 | size_t size |