update_card() returns modified card
[moonshot-ui.git] / src / moonshot-identity-manager-app.vala
index c8ad666..a5f04c1 100644 (file)
@@ -192,8 +192,23 @@ public class IdentityManagerApp {
             }
             if (identity == null)
                 identity = request.candidates.nth_data (0);
-            if (identity == null)
-                confirm = true;
+            if ((identity != null) && 
+                ((identity.password == null) || (identity.password == "")))
+                identity.password = request.password;
+            if (identity == null) {
+                if (has_nai) {
+                    // create a temp identity
+                    string[] components = request.nai.split("@", 2);
+                    identity = new IdCard();
+                    identity.display_name = request.nai;
+                    identity.username = components[0];
+                    if (components.length > 1)
+                        identity.issuer = components[1];
+                    identity.password = request.password;
+                } else {
+                    confirm = true;
+                }
+            }
 
             /* TODO: If candidate list empty return fail */
             
@@ -210,7 +225,7 @@ public class IdentityManagerApp {
         Idle.add(
             () => {
                 if (view != null) {
-                    view.check_add_password(identity, request, model);
+                    identity = view.check_add_password(identity, request, model);
                 }
                 request.return_identity (identity);
 // The following occasionally causes the app to exit without sending the dbus
@@ -354,6 +369,7 @@ public static int main(string[] args){
                 stdout.printf(_("Run '%s --help' to see a full list of available options\n"), args[0]);
                 return -1;
             }
+            gtk_available = true;
         }
 
 #if OS_WIN32