Setting proxy and protocols'options
authorRagner Magalhaes <ragner.magalhaes@openbossa.org>
Tue, 2 Dec 2008 20:37:28 +0000 (20:37 +0000)
committerAnderson Briglia <anderson.briglia@openbossa.org>
Sat, 28 Feb 2009 21:11:12 +0000 (17:11 -0400)
Setting proxy and protocols'options

Signed-off-by: Ragner Magalhaes <ragner.magalhaes@indt.org.br>

git-svn-id: https://garage.maemo.org/svn/carman/branches/carman-0.7-beta2/python-purple@1327 596f6dd7-e928-0410-a184-9e12fd12cf7e

nullclient.py

index bd428d0..6e717c3 100644 (file)
@@ -138,16 +138,31 @@ class NullClient:
         self.p.purple_init(cbs)
 
     def set_protocol(self, protocol):
         self.p.purple_init(cbs)
 
     def set_protocol(self, protocol):
-        for i in self.p.get_protocols():
-            if i[1] == protocol:
+        for p in self.p.get_protocols():
+            if p.get_name() == protocol:
                 print "-- NULLCLIENT --: Choosing %s as protocol" % protocol
                 print "-- NULLCLIENT --: Choosing %s as protocol" % protocol
-                self.protocol = i[0]
-                print "-- NULLCLIENT --: Protocol successfully chosen: %s" % i[0]
+                self.protocol = p
+                print "-- NULLCLIENT --: Protocol successfully chosen: %s" % p.get_id()
                 return
 
     def new_account(self, username, protocol, password):
                 return
 
     def new_account(self, username, protocol, password):
-        self.account = purple.Account(username, protocol)
+        self.account = purple.Account(username, protocol.get_id())
         self.account.set_password(password)
         self.account.set_password(password)
+
+        proxy = self.account.get_proxyinfo()
+        if proxy is None:
+            print "None"
+            proxy = purple.ProxyInfo()
+            proxy.cnew()
+
+        proxy.set_type(purple.ProxyInfoType().HTTP())
+        proxy.set_host("172.18.216.211")
+        proxy.set_port(8080)
+
+        self.account.set_proxyinfo(proxy)
+
+        self.account.get_protocol_options()
+
         self.account.set_enabled("carman-purple-python", True)
     def get_buddies(self):
         buddies = self.account.get_buddies_online()
         self.account.set_enabled("carman-purple-python", True)
     def get_buddies(self):
         buddies = self.account.get_buddies_online()