chiark / gitweb /
pop up login box on startup if no password yet
authorRichard Kettlewell <richard@deodand>
Sun, 9 Dec 2007 23:00:41 +0000 (23:00 +0000)
committerRichard Kettlewell <richard@deodand>
Sun, 9 Dec 2007 23:00:41 +0000 (23:00 +0000)
disobedience/disobedience.c
lib/eclient.c

index d6b346d05cdf9c1672c035c1946d080ef800b599..5efcc00c3d195b6a03041408e06259e7c03053ac 100644 (file)
@@ -492,6 +492,9 @@ int main(int argc, char **argv) {
   /* See if RTP play supported */
   check_rtp_address();
   suppress_actions = 0;
+  /* If no password is set yet pop up a login box */
+  if(!config->password)
+    login_box();
   D(("enter main loop"));
   MTAG("misc");
   g_main_loop_run(mainloop);
index d93412aeefd6ce2f851f655bff68b31871c1c342..2bf86e9dff3192863aa72212c2dced66b7e1c733 100644 (file)
@@ -236,10 +236,6 @@ disorder_eclient *disorder_eclient_new(const disorder_eclient_callbacks *cb,
   vector_init(&c->vec);
   dynstr_init(&c->input);
   dynstr_init(&c->output);
-  if(!config->password) {
-    error(0, "no password set");
-    return 0;
-  }
   return c;
 }
 
@@ -340,6 +336,11 @@ void disorder_eclient_polled(disorder_eclient *c, unsigned mode) {
 
   if(c->state == state_disconnected) {
     D(("state_disconnected"));
+    /* If there is no password yet then we cannot connect */
+    if(!config->password) {
+      comms_error(c, "no password is configured");
+      return;
+    }
     with_sockaddr(c, start_connect);
     /* might now be state_disconnected (on error), state_connecting (slow
      * connect) or state_connected (fast connect).  If state_disconnected then