changeset 872:a0ddc43b421e

Don't stop when there is no configuration file
author Mikael Berthe <mikael@lilotux.net>
date Thu, 25 May 2006 22:39:37 +0200
parents cb54c9d76853
children ee39f6d94d43
files mcabber/src/main.c mcabber/src/settings.c
diffstat 2 files changed, 10 insertions(+), 8 deletions(-) [+]
line wrap: on
line diff
--- a/mcabber/src/main.c	Thu May 25 21:56:37 2006 +0200
+++ b/mcabber/src/main.c	Thu May 25 22:39:37 2006 +0200
@@ -265,7 +265,7 @@
   /* free() configFile if it has been allocated during options parsing */
   g_free(configFile);
   /* Leave if there was an error in the config. file */
-  if (ret)
+  if (ret == -2)
     exit(EXIT_FAILURE);
 
   optstring = settings_opt_get("tracelog_file");
@@ -273,8 +273,8 @@
     ut_InitDebug(settings_opt_get_int("tracelog_level"), optstring);
 
   /* If no password is stored, we ask for it before entering
-     ncurses mode */
-  if (!settings_opt_get("password")) {
+     ncurses mode -- unless the username is unknown. */
+  if (settings_opt_get("username") && !settings_opt_get("password")) {
     const char *p;
     p = settings_opt_get("server");
     if (p)
@@ -308,11 +308,13 @@
   if (settings_opt_get_int("hide_offline_buddies") > 0)
     buddylist_set_hide_offline_buddies(TRUE);
 
-  /* Connection */
-  if (settings_opt_get("password"))
+  if (ret < 0) {
+    scr_LogPrint(LPRINT_NORMAL, "No configuration file has been found.");
+    scr_ShowBuddyWindow();
+  } else {
+    /* Connection */
     mcabber_connect();
-  else
-    scr_LogPrint(LPRINT_LOGNORM, "Can't connect: no password supplied");
+  }
 
   scr_LogPrint(LPRINT_DEBUG, "Entering into main loop...");
 
--- a/mcabber/src/settings.c	Thu May 25 21:56:37 2006 +0200
+++ b/mcabber/src/settings.c	Thu May 25 22:39:37 2006 +0200
@@ -102,7 +102,7 @@
   } else {
     if ((fp = fopen(filename, "r")) == NULL) {
       perror("Cannot open configuration file");
-      return -1;
+      return -2;
     }
     // Check configuration file permissions (see above)
     checkset_perm(filename, TRUE);