diff --git a/src/modules/everything/Evry.h b/src/modules/everything/Evry.h
index 51981b8d0..505eb4579 100644
--- a/src/modules/everything/Evry.h
+++ b/src/modules/everything/Evry.h
@@ -420,6 +420,7 @@ EAPI Evas_Object *evry_icon_theme_get(const char *icon, Evas *e);
EAPI int evry_fuzzy_match(const char *str, const char *match);
EAPI Eina_List *evry_fuzzy_match_sort(Eina_List *items);
EAPI int evry_util_exec_app(const Evry_Item *it_app, const Evry_Item *it_file);
+EAPI char *evry_util_url_escape(const char *string, int inlength);
EAPI char *evry_util_unescape(const char *string, int length);
EAPI void evry_util_file_detail_set(Evry_Item_File *file);
EAPI Eina_Bool evry_util_module_config_check(const char *module_name, int conf, int epoch, int version);
diff --git a/src/modules/everything/evry_util.c b/src/modules/everything/evry_util.c
index 6ffe7bc3e..5240a5354 100644
--- a/src/modules/everything/evry_util.c
+++ b/src/modules/everything/evry_util.c
@@ -447,6 +447,61 @@ evry_util_exec_app(const Evry_Item *it_app, const Evry_Item *it_file)
return 1;
}
+static int
+_conf_timer(void *data)
+{
+ /* e_util_dialog_internal(title, */
+ e_util_dialog_internal(_("Configuration Updated"), data);
+ return 0;
+}
+
+EAPI Eina_Bool
+evry_util_module_config_check(const char *module_name, int conf, int epoch, int version)
+{
+ if ((conf >> 16) < epoch)
+ {
+ char *too_old =
+ _("%s Configuration data needed "
+ "upgrading. Your old configuration
has been"
+ " wiped and a new set of defaults initialized. "
+ "This
will happen regularly during "
+ "development, so don't report a
bug. "
+ "This simply means the module needs "
+ "new configuration
data by default for "
+ "usable functionality that your old
"
+ "configuration simply lacks. This new set of "
+ "defaults will fix
that by adding it in. "
+ "You can re-configure things now to your
"
+ "liking. Sorry for the inconvenience.
");
+
+ char buf[4096];
+ snprintf(buf, sizeof(buf), too_old, module_name);
+ ecore_timer_add(1.0, _conf_timer, buf);
+ return EINA_FALSE;
+ }
+ else if (conf > version)
+ {
+ char *too_new =
+ _("Your %s Module configuration is NEWER "
+ "than the module version. This is "
+ "very
strange. This should not happen unless"
+ " you downgraded
the module or "
+ "copied the configuration from a place where"
+ "
a newer version of the module "
+ "was running. This is bad and
as a "
+ "precaution your configuration has been now "
+ "restored to
defaults. Sorry for the "
+ "inconvenience.
");
+
+ char buf[4096];
+ snprintf(buf, sizeof(buf), too_new, module_name);
+ ecore_timer_add(1.0, _conf_timer, buf);
+ return EINA_FALSE;
+ }
+
+ return EINA_TRUE;
+}
+
/* taken from curl:
*
* Copyright (C) 1998 - 2010, Daniel Stenberg, , et
@@ -499,59 +554,74 @@ evry_util_unescape(const char *string, int length)
#undef ISXDIGIT
-
-
-static int
-_conf_timer(void *data)
+static Eina_Bool
+_isalnum(unsigned char in)
{
- /* e_util_dialog_internal(title, */
- e_util_dialog_internal(_("Configuration Updated"), data);
- return 0;
+ switch (in) {
+ case '0': case '1': case '2': case '3': case '4':
+ case '5': case '6': case '7': case '8': case '9':
+ case 'a': case 'b': case 'c': case 'd': case 'e':
+ case 'f': case 'g': case 'h': case 'i': case 'j':
+ case 'k': case 'l': case 'm': case 'n': case 'o':
+ case 'p': case 'q': case 'r': case 's': case 't':
+ case 'u': case 'v': case 'w': case 'x': case 'y': case 'z':
+ case 'A': case 'B': case 'C': case 'D': case 'E':
+ case 'F': case 'G': case 'H': case 'I': case 'J':
+ case 'K': case 'L': case 'M': case 'N': case 'O':
+ case 'P': case 'Q': case 'R': case 'S': case 'T':
+ case 'U': case 'V': case 'W': case 'X': case 'Y': case 'Z':
+ return EINA_TRUE;
+ default:
+ break;
+ }
+ return EINA_FALSE;
}
-
-EAPI Eina_Bool
-evry_util_module_config_check(const char *module_name, int conf, int epoch, int version)
+EAPI char *
+evry_util_url_escape(const char *string, int inlength)
{
- if ((conf >> 16) < epoch)
- {
- char *too_old =
- _("%s Configuration data needed "
- "upgrading. Your old configuration
has been"
- " wiped and a new set of defaults initialized. "
- "This
will happen regularly during "
- "development, so don't report a
bug. "
- "This simply means the module needs "
- "new configuration
data by default for "
- "usable functionality that your old
"
- "configuration simply lacks. This new set of "
- "defaults will fix
that by adding it in. "
- "You can re-configure things now to your
"
- "liking. Sorry for the inconvenience.
");
+ size_t alloc = (inlength?(size_t)inlength:strlen(string))+1;
+ char *ns;
+ char *testing_ptr = NULL;
+ unsigned char in; /* we need to treat the characters unsigned */
+ size_t newlen = alloc;
+ int strindex=0;
+ size_t length;
- char buf[4096];
- snprintf(buf, sizeof(buf), too_old, module_name);
- ecore_timer_add(1.0, _conf_timer, buf);
- return EINA_FALSE;
- }
- else if (conf > version)
- {
- char *too_new =
- _("Your %s Module configuration is NEWER "
- "than the module version. This is "
- "very
strange. This should not happen unless"
- " you downgraded
the module or "
- "copied the configuration from a place where"
- "
a newer version of the module "
- "was running. This is bad and
as a "
- "precaution your configuration has been now "
- "restored to
defaults. Sorry for the "
- "inconvenience.
");
+ ns = malloc(alloc);
+ if(!ns)
+ return NULL;
- char buf[4096];
- snprintf(buf, sizeof(buf), too_new, module_name);
- ecore_timer_add(1.0, _conf_timer, buf);
- return EINA_FALSE;
- }
+ length = alloc-1;
+ while(length--) {
+ in = *string;
- return EINA_TRUE;
+ if (_isalnum(in)) {
+ /* just copy this */
+ ns[strindex++]=in;
+ }
+ else {
+ /* encode it */
+ newlen += 2; /* the size grows with two, since this'll become a %XX */
+ if(newlen > alloc) {
+ alloc *= 2;
+ testing_ptr = realloc(ns, alloc);
+ if(!testing_ptr) {
+ free( ns );
+ return NULL;
+ }
+ else {
+ ns = testing_ptr;
+ }
+ }
+
+ snprintf(&ns[strindex], 4, "%%%02X", in);
+
+ strindex+=3;
+ }
+ string++;
+ }
+ ns[strindex]=0; /* terminate it */
+ return ns;
}
+
+