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