Commit 36efb61a authored by André's avatar André Committed by Philipp Hörist
Browse files

Remote control: fix some errors

parent f5a52c52
...@@ -29,7 +29,6 @@ ...@@ -29,7 +29,6 @@
import os import os
import base64 import base64
import mimetypes import mimetypes
from time import time
from gi.repository import GLib from gi.repository import GLib
from gi.repository import Gio from gi.repository import Gio
...@@ -58,7 +57,8 @@ def get_dbus_struct(obj): ...@@ -58,7 +57,8 @@ def get_dbus_struct(obj):
if isinstance(obj, bool): if isinstance(obj, bool):
return GLib.Variant('b', obj) return GLib.Variant('b', obj)
if isinstance(obj, (list, tuple)): if isinstance(obj, (list, tuple)):
result = GLib.Variant('av', [get_dbus_struct(i) for i in obj]) lst = [get_dbus_struct(i) for i in obj if i is not None]
result = GLib.Variant('av', lst)
return result return result
if isinstance(obj, dict): if isinstance(obj, dict):
result = GLib.VariantDict() result = GLib.VariantDict()
...@@ -335,7 +335,7 @@ def on_message_sent(self, obj): ...@@ -335,7 +335,7 @@ def on_message_sent(self, obj):
try: try:
chatstate = obj.chatstate chatstate = obj.chatstate
except AttributeError: except AttributeError:
chatstate = "" chatstate = ''
self.raise_signal('MessageSent', (obj.conn.name, [ self.raise_signal('MessageSent', (obj.conn.name, [
obj.jid, obj.message, obj.keyID, chatstate])) obj.jid, obj.message, obj.keyID, chatstate]))
...@@ -877,7 +877,8 @@ def _contacts_as_dbus_structure(self, contacts): ...@@ -877,7 +877,8 @@ def _contacts_as_dbus_structure(self, contacts):
if prim_contact is None or contact.priority > prim_contact.priority: if prim_contact is None or contact.priority > prim_contact.priority:
prim_contact = contact prim_contact = contact
contact_dict = {} contact_dict = {}
contact_dict['name'] = GLib.Variant('s', prim_contact.name) name = prim_contact.name if prim_contact.name is not None else ''
contact_dict['name'] = GLib.Variant('s', name)
contact_dict['show'] = GLib.Variant('s', prim_contact.show) contact_dict['show'] = GLib.Variant('s', prim_contact.show)
contact_dict['jid'] = GLib.Variant('s', prim_contact.jid) contact_dict['jid'] = GLib.Variant('s', prim_contact.jid)
if prim_contact.keyID: if prim_contact.keyID:
...@@ -892,11 +893,13 @@ def _contacts_as_dbus_structure(self, contacts): ...@@ -892,11 +893,13 @@ def _contacts_as_dbus_structure(self, contacts):
for contact in contacts: for contact in contacts:
resource_props = (contact.resource, int(contact.priority), resource_props = (contact.resource, int(contact.priority),
contact.status) contact.status)
resources.add_value(GLib.Variant("(sis)", resource_props)) resources.add_value(GLib.Variant('(sis)', resource_props))
contact_dict['resources'] = resources.end() contact_dict['resources'] = resources.end()
#contact_dict['groups'] = [] # TODO
#for group in prim_contact.groups: groups = GLib.VariantBuilder(GLib.VariantType('as'))
# contact_dict['groups'].append((group, )) for group in prim_contact.groups:
groups.add_value(GLib.Variant('s', group))
contact_dict['groups'] = groups.end()
return contact_dict return contact_dict
def get_unread_msgs_number(self): def get_unread_msgs_number(self):
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment