Enlightenment CVS committal

Author  : englebass
Project : e_modules
Module  : forecasts

Dir     : e_modules/forecasts


Modified Files:
        e_mod_main.c 


Log Message:
better check for http_proxy env
don't create popup when missing location

===================================================================
RCS file: /cvs/e/e_modules/forecasts/e_mod_main.c,v
retrieving revision 1.18
retrieving revision 1.19
diff -u -3 -r1.18 -r1.19
--- e_mod_main.c        16 Jun 2008 22:59:24 -0000      1.18
+++ e_mod_main.c        13 Aug 2008 05:34:00 -0000      1.19
@@ -102,7 +102,9 @@
 {
    const char *host;
    int port;
-} proxy;
+} proxy = {
+   NULL, 0
+};
 
 /* Module Function Protos */
 static void _forecasts_cb_mouse_down(void *data, Evas * e, Evas_Object * obj,
@@ -512,16 +514,17 @@
 static void
 _forecasts_get_proxy(void)
 {
-   char env[128];
+   char *env;
    char *host = NULL;
    char *p;
    int port = 0;
 
-   snprintf(env, sizeof(env), "%s", getenv("http_proxy"));
-   if (!env[0])
-     snprintf(env, sizeof(env), "%s", getenv("HTTP_PROXY"));
-   if (strncmp(env, "http://";, 7)) return;
+   env = getenv ("http_proxy");
+   if ((!env) || (!*env)) env = getenv ("HTTP_PROXY");
+   if ((!env) || (!*env)) return;
+   if (strncmp (env, "http://";, 7)) return;
 
+   env = strdup(env);
    host = strchr(env, ':');
    host += 3;
    p = strchr(host, ':');
@@ -534,9 +537,11 @@
      }
    if ((host) && (port))
      {
+       if (proxy.host) evas_stringshare_del(proxy.host);
        proxy.host = evas_stringshare_add(host);
        proxy.port = port;
      }
+   free(env);
 }
 
 static int
@@ -948,6 +953,8 @@
    char buf[4096];
    int row = 0, i;
    int w, h;
+
+   if (!inst->location) return;
 
    inst->popup = e_gadcon_popup_new(inst->gcc, _forecasts_popup_resize);
 



-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
_______________________________________________
enlightenment-cvs mailing list
enlightenment-cvs@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/enlightenment-cvs

Reply via email to