fe7cd64
This disables actions -- they're mostly useless anyways, and possess a security
fe7cd64
hazard (in past, configuation file with broken escaping was created, and we
fe7cd64
have to ignore it).
fe7cd64
fe7cd64
Lubomir Rintel <lkundrak@v3.sk>
fe7cd64
fe7cd64
diff -urp centerim-4.22.6.orig/src/centerim.cc centerim-4.22.6/src/centerim.cc
fe7cd64
--- centerim-4.22.6.orig/src/centerim.cc	2008-10-26 16:53:16.000000000 +0100
fe7cd64
+++ centerim-4.22.6/src/centerim.cc	2009-01-07 23:36:20.000000000 +0100
fe7cd64
@@ -755,7 +755,7 @@ void centerim::checkmail() {
fe7cd64
 
fe7cd64
 void centerim::checkconfigs() {
fe7cd64
     static const char *configs[] = {
fe7cd64
-	"sounds", "colorscheme", "actions", "external", "keybindings", 0
fe7cd64
+	"sounds", "colorscheme", "external", "keybindings", 0
fe7cd64
     };
fe7cd64
 
fe7cd64
     struct stat st;
fe7cd64
@@ -778,12 +778,9 @@ void centerim::checkconfigs() {
fe7cd64
 			face.redraw();
fe7cd64
 			break;
fe7cd64
 		    case 2:
fe7cd64
-			conf->loadactions();
fe7cd64
-			break;
fe7cd64
-		    case 3:
fe7cd64
 			external.load();
fe7cd64
 			break;
fe7cd64
-		    case 4:
fe7cd64
+		    case 3:
fe7cd64
 			conf->loadkeys();
fe7cd64
 			break;
fe7cd64
 		}
fe7cd64
@@ -1147,8 +1144,13 @@ icqface::eventviewresult centerim::reade
fe7cd64
 	    break;
fe7cd64
 
fe7cd64
 	case icqface::open:
fe7cd64
-	    if(const imurl *m = static_cast<const imurl *>(&ev))
fe7cd64
-		conf->execaction("openurl", m->geturl());
fe7cd64
+	    if(const imurl *m = static_cast<const imurl *>(&ev)) {
fe7cd64
+		if (fork () == 0) {
fe7cd64
+		    face.log (m->geturl());
fe7cd64
+		    execlp("xdg-open", "xdg-open", m->geturl().c_str(), NULL);
fe7cd64
+		    exit (-1);
fe7cd64
+		}
fe7cd64
+	    }
fe7cd64
 	    break;
fe7cd64
 
fe7cd64
 	case icqface::accept:
fe7cd64
diff -urp centerim-4.22.6.orig/src/icqconf.cc centerim-4.22.6/src/icqconf.cc
fe7cd64
--- centerim-4.22.6.orig/src/icqconf.cc	2008-10-26 16:53:16.000000000 +0100
fe7cd64
+++ centerim-4.22.6/src/icqconf.cc	2009-01-07 23:39:35.000000000 +0100
fe7cd64
@@ -274,7 +274,6 @@ void icqconf::load() {
fe7cd64
     loadmainconfig();
fe7cd64
     loadkeys();
fe7cd64
     loadcolors();
fe7cd64
-    loadactions();
fe7cd64
     loadcaptcha();
fe7cd64
     external.load();
fe7cd64
 }
fe7cd64
@@ -1240,74 +1239,6 @@ void icqconf::setcpconvert(protocolname 
fe7cd64
     cpconvert[pname] = fcpconvert;
fe7cd64
 }
fe7cd64
 
fe7cd64
-string icqconf::execaction(const string &name, const string &param) {
fe7cd64
-    int inpipe[2], outpipe[2], pid, npos;
fe7cd64
-    struct sigaction sact, osact;
fe7cd64
-    string torun = actions[name], out;
fe7cd64
-    fd_set rfds;
fe7cd64
-    char ch;
fe7cd64
-
fe7cd64
-    if(name == "openurl")
fe7cd64
-    {
fe7cd64
-	string url = param;
fe7cd64
-	int pos = 0, fnd = -1;
fe7cd64
-	
fe7cd64
-	char enc[4];
fe7cd64
-	
fe7cd64
-	while( ((fnd = url.find("'", pos)) != -1) || ((fnd = url.find("\"", pos)) != -1) ) {
fe7cd64
-		snprintf(enc, 4, "%%%02X", url[fnd]);
fe7cd64
-	    url.replace(fnd, 1, enc);
fe7cd64
-    	pos = fnd+3;
fe7cd64
-	}
fe7cd64
-	
fe7cd64
-	while((npos = torun.find("$url$")) != -1)
fe7cd64
-	    torun.replace(npos, 5, url);
fe7cd64
-    }
fe7cd64
-
fe7cd64
-    if(!pipe(inpipe) && !pipe(outpipe)) {
fe7cd64
-	memset(&sact, 0, sizeof(sact));
fe7cd64
-	sigaction(SIGCHLD, &sact, &osact);
fe7cd64
-	pid = fork();
fe7cd64
-
fe7cd64
-	if(!pid) {
fe7cd64
-	    dup2(inpipe[1], STDOUT_FILENO);
fe7cd64
-	    dup2(outpipe[0], STDIN_FILENO);
fe7cd64
-
fe7cd64
-	    close(inpipe[1]);
fe7cd64
-	    close(inpipe[0]);
fe7cd64
-	    close(outpipe[0]);
fe7cd64
-	    close(outpipe[1]);
fe7cd64
-
fe7cd64
-	    execl("/bin/sh", "/bin/sh", "-c", torun.c_str(), (char *)NULL );
fe7cd64
-	    _exit(0);
fe7cd64
-	} else {
fe7cd64
-	    close(outpipe[0]);
fe7cd64
-	    close(inpipe[1]);
fe7cd64
-
fe7cd64
-	    while(1) {
fe7cd64
-		FD_ZERO(&rfds);
fe7cd64
-		FD_SET(inpipe[0], &rfds);
fe7cd64
-
fe7cd64
-		if(select(inpipe[0]+1, &rfds, 0, 0, 0) < 0) break; else {
fe7cd64
-		    if(FD_ISSET(inpipe[0], &rfds)) {
fe7cd64
-			if(read(inpipe[0], &ch, 1) != 1) break; else {
fe7cd64
-			    out += ch;
fe7cd64
-			}
fe7cd64
-		    }
fe7cd64
-		}
fe7cd64
-	    }
fe7cd64
-
fe7cd64
-	    waitpid(pid, 0, 0);
fe7cd64
-	    close(inpipe[0]);
fe7cd64
-	    close(outpipe[1]);
fe7cd64
-	}
fe7cd64
-
fe7cd64
-	sigaction(SIGCHLD, &osact, 0);
fe7cd64
-    }
fe7cd64
-    face.log(_("+ launched the %s action command"), name.c_str());
fe7cd64
-    return out;
fe7cd64
-}
fe7cd64
-
fe7cd64
 string icqconf::getprotocolname(protocolname pname) const {
fe7cd64
     static const string ptextnames[protocolname_size] = {
fe7cd64
 	"icq", "yahoo", "msn", "aim", "irc", "jab", "rss", "lj", "gg", "infocard"
fe7cd64
diff -urp centerim-4.22.6.orig/src/icqconf.h centerim-4.22.6/src/icqconf.h
fe7cd64
--- centerim-4.22.6.orig/src/icqconf.h	2008-10-26 16:53:16.000000000 +0100
fe7cd64
+++ centerim-4.22.6/src/icqconf.h	2009-01-07 23:39:15.000000000 +0100
fe7cd64
@@ -344,8 +344,6 @@ class icqconf {
fe7cd64
 	bool getshowopenedchats() const { return showopenedchats; }
fe7cd64
 	void setshowopenedchats(bool fsoc);
fe7cd64
 
fe7cd64
-	string execaction(const string &action, const string &param = "");
fe7cd64
-
fe7cd64
 	imstatus getstatus(protocolname pname);
fe7cd64
 	void savestatus(protocolname pname, imstatus st);
fe7cd64
 	void setavatar(protocolname pname, const string &ava);
fe7cd64
diff -urp centerim-4.22.6.orig/src/icqdialogs.cc centerim-4.22.6/src/icqdialogs.cc
fe7cd64
--- centerim-4.22.6.orig/src/icqdialogs.cc	2008-10-26 16:53:16.000000000 +0100
fe7cd64
+++ centerim-4.22.6/src/icqdialogs.cc	2009-01-07 23:38:51.000000000 +0100
fe7cd64
@@ -1284,7 +1284,6 @@ bool icqface::updateconf(icqconf::regsou
fe7cd64
 
fe7cd64
 	i = t.addnode(_(" Communications "));
fe7cd64
 	t.addleaff(i, 0, 19, _(" SMTP server : %s "), smtp.c_str());
fe7cd64
-	t.addleaff(i, 0, 31, _(" HTTP browser : %s "), browser.c_str());
fe7cd64
 	t.addleaff(i, 0, 24, _(" HTTP proxy server : %s "), httpproxy.c_str());
fe7cd64
 
fe7cd64
 	if(!httpproxy.empty())
fe7cd64
@@ -1438,10 +1437,6 @@ bool icqface::updateconf(icqconf::regsou
fe7cd64
 		    case 30:
fe7cd64
 			cm = (cm == icqconf::cmproto ? icqconf::cmstatus : icqconf::cmproto );
fe7cd64
 			break;
fe7cd64
-		    case 31:
fe7cd64
-		        tmp = inputstr(_("HTTP browser to use: "), browser);
fe7cd64
-			if(!tmp.empty()) browser = tmp;
fe7cd64
-		        break;
fe7cd64
 		    case 32:    
fe7cd64
 		        conf->setleftpanelwidth(atol(inputstr(_("Left panel width: "), 
fe7cd64
 		            strint(conf->getleftpanelwidth())).c_str()));
fe7cd64
@@ -2083,7 +2078,6 @@ bool icqface::setljparams(imxmlevent *ev
fe7cd64
 			break;
fe7cd64
 
fe7cd64
 		    case 20: LJP_LIST("mood", moods, _("(none/custom)")); break;
fe7cd64
-		    case 21: LJP_STR("music", _("Currently playing: ")); break;
fe7cd64
 		    case 22: LJP_LIST("picture", pictures, _("(default)")); break;
fe7cd64
 		    case 23: LJP_STR("mood", _("Current mood: ")); break;
fe7cd64
 		    case 25: LJP_STR("taglist", _("Tags for the entry: ")); break;
fe7cd64
@@ -2093,9 +2087,6 @@ bool icqface::setljparams(imxmlevent *ev
fe7cd64
 		    case 33: LJP_BOOL("backdated"); break;
fe7cd64
 		}
fe7cd64
 
fe7cd64
-	    } else if(b == 1) {
fe7cd64
-		ev->setfield("music", conf->execaction("detectmusic"));
fe7cd64
-
fe7cd64
 	    } else if(b == 2) {
fe7cd64
 		r = true;
fe7cd64
 
fe7cd64
diff -urp centerim-4.22.6.orig/src/icqface.cc centerim-4.22.6/src/icqface.cc
fe7cd64
--- centerim-4.22.6.orig/src/icqface.cc	2008-10-26 16:53:16.000000000 +0100
fe7cd64
+++ centerim-4.22.6/src/icqface.cc	2009-01-07 23:38:19.000000000 +0100
fe7cd64
@@ -2371,8 +2371,13 @@ void icqface::showextractedurls() {
fe7cd64
 	for(i = extractedurls.begin(); i != extractedurls.end(); ++i)
fe7cd64
 	    m.additem(" " + *i);
fe7cd64
 
fe7cd64
-	if(n = m.open())
fe7cd64
-	    conf->execaction("openurl", extractedurls[n-1]);
fe7cd64
+	if(n = m.open()) {
fe7cd64
+	    if (fork () == 0) {
fe7cd64
+		log (extractedurls[n-1]);
fe7cd64
+		execlp("xdg-open", "xdg-open", extractedurls[n-1].c_str(), NULL);
fe7cd64
+		exit (-1);
fe7cd64
+	    }
fe7cd64
+	}
fe7cd64
 
fe7cd64
 	restoreworkarea();
fe7cd64
     }