Enlightenment CVS committal
Author : kiwi
Project : e_modules
Module : news
Dir : e_modules/news/src/module
Modified Files:
news_config.c news_utils.c news_utils.h
Log Message:
auto detect proxy settings on first load
===================================================================
RCS file: /cvs/e/e_modules/news/src/module/news_config.c,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -3 -r1.2 -r1.3
--- news_config.c 23 May 2007 23:32:36 -0000 1.2
+++ news_config.c 24 May 2007 11:32:43 -0000 1.3
@@ -138,7 +138,13 @@
c->feed.langs = news_util_lang_detect();
c->feed.langs_all = NEWS_FEED_LANG_ALL_DEFAULT;
c->feed.langs_notset = 1;
- c->proxy.port = NEWS_FEED_PROXY_PORT_DEFAULT;
+ if (news_util_proxy_detect())
+ c->proxy.enable = 1;
+ else
+ {
+ c->proxy.host = NULL;
+ c->proxy.port = NEWS_FEED_PROXY_PORT_DEFAULT;
+ }
c->browser.wich = NEWS_UTIL_BROWSER_DEFAULT;
===================================================================
RCS file: /cvs/e/e_modules/news/src/module/news_utils.c,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -3 -r1.2 -r1.3
--- news_utils.c 23 May 2007 23:32:37 -0000 1.2
+++ news_utils.c 24 May 2007 11:32:43 -0000 1.3
@@ -121,6 +121,28 @@
return list;
}
+int
+news_util_proxy_detect(void)
+{
+ News_Config *c;
+ const char *proxy;
+ char *port;
+ char buf[1024];
+
+ c = news->config;
+ proxy = getenv("HTTP_PROXY");
+ if (!proxy) return 0;
+ strncpy(buf, proxy, sizeof(buf));
+ port = strrchr(buf, ':');
+ if (!port || (port == buf)) return 0;
+ if (!sscanf(port+1, "%d", &c->proxy.port)) return 0;
+ *port = '\0';
+ if (c->proxy.host) evas_stringshare_del(c->proxy.host);
+ c->proxy.host = evas_stringshare_add(buf);
+
+ return 1;
+}
+
/*
* Private functions
*
===================================================================
RCS file: /cvs/e/e_modules/news/src/module/news_utils.h,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -3 -r1.2 -r1.3
--- news_utils.h 23 May 2007 23:32:37 -0000 1.2
+++ news_utils.h 24 May 2007 11:32:43 -0000 1.3
@@ -46,6 +46,7 @@
int news_util_datecmp(struct tm *t1, struct tm *t2);
int news_util_browser_open(const char *url);
Evas_List *news_util_lang_detect(void);
+int news_util_proxy_detect(void);
#endif
#endif
-------------------------------------------------------------------------
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
_______________________________________________
enlightenment-cvs mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/enlightenment-cvs