cvs: embed /php-irssi php-core.c

[email protected] ("Wez Furlong") Mon, 31 Mar 2003 23:47:32 -0000
Newsgroups php.embed.cvs
Message-ID <cvswez1049154452@cvsserver>
wez		Mon Mar 31 18:47:32 2003 EDT

  Modified files:              
    /embed/php-irssi	php-core.c 
  Log:
  Tidy up the settings stuff.
  
  
  
Index: embed/php-irssi/php-core.c
diff -u embed/php-irssi/php-core.c:1.19 embed/php-irssi/php-core.c:1.20
--- embed/php-irssi/php-core.c:1.19	Mon Mar 31 18:23:52 2003
+++ embed/php-irssi/php-core.c	Mon Mar 31 18:47:31 2003
@@ -15,7 +15,7 @@
   | Authors: Wez Furlong <[email protected]>                                   |
   |          Tal Peer <[email protected]>                                      | 
   +----------------------------------------------------------------------+
-  $Id: php-core.c,v 1.19 2003/03/31 23:23:52 wez Exp $
+  $Id: php-core.c,v 1.20 2003/03/31 23:47:31 wez Exp $
 */
 #define MODULE_NAME "php/core"
 #include "common.h"
@@ -274,6 +274,7 @@
 		default:
 			printtext_window(active_win, MSGLEVEL_CLIENTCRAP, "-!- php: autoload bailed out status=%d", EG(exit_status));
 	}
+	settings_check();
 }
 
 /* "irssi init finished" event handler.
@@ -304,9 +305,16 @@
 	command_bind("php version", NULL, (SIGNAL_FUNC)cmd_php_version);
 	command_bind("php set", NULL, (SIGNAL_FUNC)cmd_php_set);
 	
-	spprintf(&include_path, -1, "%s/scripts:%s", get_irssi_dir(), SCRIPTDIR);
-	settings_add_str("php", "php_include_path", include_path);
-	efree(include_path);
+	include_path = settings_get_str("php_include_path");
+
+	if (include_path == NULL) {
+		char *tmp;
+		spprintf(&tmp, -1, "%s/scripts:%s", get_irssi_dir(), SCRIPTDIR);
+		include_path = g_strdup(tmp);
+		efree(tmp);
+
+		settings_add_str("php", "php_include_path", include_path);
+	}
 	
 	php_set_ini_entry("include_path", (char*)settings_get_str("php_include_path"), PHP_INI_STAGE_ACTIVATE);
 	php_set_ini_entry("html_errors", "0", PHP_INI_STAGE_ACTIVATE);
@@ -317,7 +325,6 @@
 	} else {
 		/* otherwise arrange for it to be run when init is completed */
 		signal_add("irssi init finished", (SIGNAL_FUNC)sig_autorun);
-		settings_check();
 	}
 	
 	/* Tell irssi that we are loaded and ready */