Mercurial > pidgin
comparison src/util.c @ 9670:ed3bbf36de75
[gaim-migrate @ 10522]
(10:17:53) datallah:
http://www.butfer.com/gaim-patches/dnd_robustness+multiple_file_fix.patch
should fix 1003589 and also make us support DND of multiple files to
transfer - also makes us not try to transfer directories
committer: Tailor Script <tailor@pidgin.im>
| author | Luke Schierer <lschiere@pidgin.im> |
|---|---|
| date | Thu, 05 Aug 2004 14:17:03 +0000 |
| parents | 8901ef16f310 |
| children | a57fa78e5752 |
comparison
equal
deleted
inserted
replaced
| 9669:287d900e2c03 | 9670:ed3bbf36de75 |
|---|---|
| 2942 if (*(c - 1) == '-') return FALSE; | 2942 if (*(c - 1) == '-') return FALSE; |
| 2943 | 2943 |
| 2944 return ((c - domain) > 3 ? TRUE : FALSE); | 2944 return ((c - domain) > 3 ? TRUE : FALSE); |
| 2945 } | 2945 } |
| 2946 | 2946 |
| 2947 /** Stolen from gnome_uri_list_extract_uris **/ | |
| 2948 GList* gaim_uri_list_extract_uris (const gchar* uri_list) { | |
| 2949 const gchar *p, *q; | |
| 2950 gchar *retval; | |
| 2951 GList *result = NULL; | |
| 2952 | |
| 2953 g_return_val_if_fail (uri_list != NULL, NULL); | |
| 2954 | |
| 2955 p = uri_list; | |
| 2956 | |
| 2957 /* We don't actually try to validate the URI according to RFC | |
| 2958 * 2396, or even check for allowed characters - we just ignore | |
| 2959 * comments and trim whitespace off the ends. We also | |
| 2960 * allow LF delimination as well as the specified CRLF. | |
| 2961 */ | |
| 2962 while (p) { | |
| 2963 if (*p != '#') { | |
| 2964 while (isspace(*p)) | |
| 2965 p++; | |
| 2966 | |
| 2967 q = p; | |
| 2968 while (*q && (*q != '\n') && (*q != '\r')) | |
| 2969 q++; | |
| 2970 | |
| 2971 if (q > p) { | |
| 2972 q--; | |
| 2973 while (q > p && isspace(*q)) | |
| 2974 q--; | |
| 2975 | |
| 2976 retval = (gchar*)g_malloc (q - p + 2); | |
| 2977 strncpy (retval, p, q - p + 1); | |
| 2978 retval[q - p + 1] = '\0'; | |
| 2979 | |
| 2980 result = g_list_prepend (result, retval); | |
| 2981 } | |
| 2982 } | |
| 2983 p = strchr (p, '\n'); | |
| 2984 if (p) | |
| 2985 p++; | |
| 2986 } | |
| 2987 | |
| 2988 return g_list_reverse (result); | |
| 2989 } | |
| 2990 | |
| 2991 | |
| 2992 /** Stolen from gaim_uri_list_extract_filenames **/ | |
| 2993 GList* gaim_uri_list_extract_filenames (const gchar* uri_list) { | |
| 2994 GList *tmp_list, *node, *result; | |
| 2995 | |
| 2996 g_return_val_if_fail (uri_list != NULL, NULL); | |
| 2997 | |
| 2998 result = gaim_uri_list_extract_uris (uri_list); | |
| 2999 | |
| 3000 tmp_list = result; | |
| 3001 while (tmp_list) { | |
| 3002 gchar *s = (gchar*)tmp_list->data; | |
| 3003 | |
| 3004 node = tmp_list; | |
| 3005 tmp_list = tmp_list->next; | |
| 3006 | |
| 3007 if (!strncmp (s, "file:", 5)) { | |
| 3008 node->data = g_filename_from_uri (s, NULL, NULL); | |
| 3009 /* not sure if this fallback is useful at all */ | |
| 3010 if (!node->data) node->data = g_strdup (s+5); | |
| 3011 } else { | |
| 3012 result = g_list_remove_link(result, node); | |
| 3013 g_list_free_1 (node); | |
| 3014 } | |
| 3015 g_free (s); | |
| 3016 } | |
| 3017 return result; | |
| 3018 } | |
| 2947 | 3019 |
| 2948 /************************************************************************** | 3020 /************************************************************************** |
| 2949 * UTF8 String Functions | 3021 * UTF8 String Functions |
| 2950 **************************************************************************/ | 3022 **************************************************************************/ |
| 2951 gchar * | 3023 gchar * |
