summaryrefslogtreecommitdiff
path: root/community/deja-dup/new-u1backend-support.patch
blob: 08b918cb9b6471275e75586b84023e049432664f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
=== modified file 'common/BackendU1.vala'
--- common/BackendU1.vala	2012-08-06 22:41:13 +0000
+++ common/BackendU1.vala	2012-11-03 21:35:53 +0000
@@ -212,21 +212,41 @@
 
   public override async void get_envp() throws Error
   {
-    bool found = false;
     var obj = get_creds_proxy();
     if (obj.get_name_owner() == null) {
       ask_password();
       return;
     }
 
+    var found = false;
+    var envp = new List<string>();
     var listener = new Listener(obj, "find_credentials", null, (name, args) => {
-      if (name == "CredentialsFound")
-        found = true;
+      if (name == "CredentialsFound") {
+        VariantIter iter;
+        args.get("(a{ss})", out iter);
+        string key, val;
+        string consumer_key = null, consumer_secret = null, token = null, token_secret = null;
+        while (iter.next("{ss}", out key, out val)) {
+          if (key == "consumer_key")
+            consumer_key = val;
+          else if (key == "consumer_secret")
+            consumer_secret = val;
+          else if (key == "token")
+            token = val;
+          else if (key == "token_secret")
+            token_secret = val;
+        }
+        if (consumer_key != null && consumer_secret != null && token != null && token_secret != null) {
+          warning("appending: %s", "FTP_PASSWORD=%s:%s:%s:%s".printf(consumer_key, consumer_secret, token, token_secret));
+          envp.append("FTP_PASSWORD=%s:%s:%s:%s".printf(consumer_key, consumer_secret, token, token_secret));
+          found = true;
+        }
+      }
     });
     listener.run();
 
     if (found)
-      envp_ready(true, null);
+      envp_ready(true, envp);
     else
       ask_password();
   }