annotate frontends/quick_frontend/quick_app.py @ 64:d46f849664aa

SàT: multi-profile, plugins updated - core: 2 new convenient methods: getJidNStream and getClient - new param in plugin info: "handler" to know if there is a handler to plug on profiles clients - plugins with handler now use an other class which is returned to profile client with the new method "getHandler" and pluged when connecting
author Goffi <goffi@goffi.org>
date Sat, 30 Jan 2010 16:17:33 +1100
parents a5b5fb5fc9fd
children 8147b4f40809
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
0
goffi@necton2
parents:
diff changeset
1 #!/usr/bin/python
goffi@necton2
parents:
diff changeset
2 # -*- coding: utf-8 -*-
goffi@necton2
parents:
diff changeset
3
goffi@necton2
parents:
diff changeset
4 """
goffi@necton2
parents:
diff changeset
5 helper class for making a SAT frontend
57
a5b5fb5fc9fd updated README and copyright note
Goffi <goffi@goffi.org>
parents: 53
diff changeset
6 Copyright (C) 2009, 2010 Jérôme Poisson (goffi@goffi.org)
0
goffi@necton2
parents:
diff changeset
7
goffi@necton2
parents:
diff changeset
8 This program is free software: you can redistribute it and/or modify
goffi@necton2
parents:
diff changeset
9 it under the terms of the GNU General Public License as published by
goffi@necton2
parents:
diff changeset
10 the Free Software Foundation, either version 3 of the License, or
goffi@necton2
parents:
diff changeset
11 (at your option) any later version.
goffi@necton2
parents:
diff changeset
12
goffi@necton2
parents:
diff changeset
13 This program is distributed in the hope that it will be useful,
goffi@necton2
parents:
diff changeset
14 but WITHOUT ANY WARRANTY; without even the implied warranty of
goffi@necton2
parents:
diff changeset
15 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
goffi@necton2
parents:
diff changeset
16 GNU General Public License for more details.
goffi@necton2
parents:
diff changeset
17
goffi@necton2
parents:
diff changeset
18 You should have received a copy of the GNU General Public License
goffi@necton2
parents:
diff changeset
19 along with this program. If not, see <http://www.gnu.org/licenses/>.
goffi@necton2
parents:
diff changeset
20 """
goffi@necton2
parents:
diff changeset
21
goffi@necton2
parents:
diff changeset
22 from logging import debug, info, error
goffi@necton2
parents:
diff changeset
23 from tools.jid import JID
goffi@necton2
parents:
diff changeset
24 from sat_bridge_frontend.DBus import DBusBridgeFrontend
51
8c67ea98ab91 frontend improved to take into account new SàT features
Goffi <goffi@goffi.org>
parents: 28
diff changeset
25 import pdb
0
goffi@necton2
parents:
diff changeset
26
goffi@necton2
parents:
diff changeset
27 class QuickApp():
goffi@necton2
parents:
diff changeset
28 """This class contain the main methods needed for the frontend"""
goffi@necton2
parents:
diff changeset
29
goffi@necton2
parents:
diff changeset
30 def __init__(self):
goffi@necton2
parents:
diff changeset
31 self.rosterList = {}
goffi@necton2
parents:
diff changeset
32
goffi@necton2
parents:
diff changeset
33 ## bridge ##
goffi@necton2
parents:
diff changeset
34 self.bridge=DBusBridgeFrontend()
52
6455fb62ff83 Connection/disconnection signals
Goffi <goffi@goffi.org>
parents: 51
diff changeset
35 self.bridge.register("connected", self.connected)
6455fb62ff83 Connection/disconnection signals
Goffi <goffi@goffi.org>
parents: 51
diff changeset
36 self.bridge.register("disconnected", self.disconnected)
0
goffi@necton2
parents:
diff changeset
37 self.bridge.register("newContact", self.newContact)
goffi@necton2
parents:
diff changeset
38 self.bridge.register("newMessage", self.newMessage)
goffi@necton2
parents:
diff changeset
39 self.bridge.register("presenceUpdate", self.presenceUpdate)
51
8c67ea98ab91 frontend improved to take into account new SàT features
Goffi <goffi@goffi.org>
parents: 28
diff changeset
40 self.bridge.register("subscribe", self.subscribe)
0
goffi@necton2
parents:
diff changeset
41 self.bridge.register("paramUpdate", self.paramUpdate)
goffi@necton2
parents:
diff changeset
42 self.bridge.register("contactDeleted", self.contactDeleted)
51
8c67ea98ab91 frontend improved to take into account new SàT features
Goffi <goffi@goffi.org>
parents: 28
diff changeset
43 self.bridge.register("updatedValue", self.updatedValue, "request")
0
goffi@necton2
parents:
diff changeset
44 self.bridge.register("askConfirmation", self.askConfirmation, "request")
22
bb72c29f3432 added action cb mechanism for buttons. Tested with a temporary new user registration button.
Goffi <goffi@goffi.org>
parents: 18
diff changeset
45 self.bridge.register("actionResult", self.actionResult, "request")
25
53e921c8a357 new plugin: gateways plugin, and first implementation of findGateways
Goffi <goffi@goffi.org>
parents: 22
diff changeset
46 self.bridge.register("actionResultExt", self.actionResult, "request")
0
goffi@necton2
parents:
diff changeset
47
goffi@necton2
parents:
diff changeset
48 ###now we get the essential params###
22
bb72c29f3432 added action cb mechanism for buttons. Tested with a temporary new user registration button.
Goffi <goffi@goffi.org>
parents: 18
diff changeset
49 self.whoami=JID(self.bridge.getParamA("JabberID","Connection"))
bb72c29f3432 added action cb mechanism for buttons. Tested with a temporary new user registration button.
Goffi <goffi@goffi.org>
parents: 18
diff changeset
50 self.watched=self.bridge.getParamA("Watched", "Misc").split() #TODO: put this in a plugin
0
goffi@necton2
parents:
diff changeset
51
goffi@necton2
parents:
diff changeset
52 ## misc ##
22
bb72c29f3432 added action cb mechanism for buttons. Tested with a temporary new user registration button.
Goffi <goffi@goffi.org>
parents: 18
diff changeset
53 self.current_action_ids = set()
28
c2b131e4e262 wix: new gateways manager
Goffi <goffi@goffi.org>
parents: 25
diff changeset
54 self.current_action_ids_cb = {}
0
goffi@necton2
parents:
diff changeset
55 self.onlineContact = set() #FIXME: temporary
goffi@necton2
parents:
diff changeset
56
goffi@necton2
parents:
diff changeset
57 if self.bridge.isConnected():
goffi@necton2
parents:
diff changeset
58 self.setStatusOnline(True)
52
6455fb62ff83 Connection/disconnection signals
Goffi <goffi@goffi.org>
parents: 51
diff changeset
59 else:
6455fb62ff83 Connection/disconnection signals
Goffi <goffi@goffi.org>
parents: 51
diff changeset
60 self.setStatusOnline(False)
6455fb62ff83 Connection/disconnection signals
Goffi <goffi@goffi.org>
parents: 51
diff changeset
61 return
0
goffi@necton2
parents:
diff changeset
62
goffi@necton2
parents:
diff changeset
63 ### now we fill the contact list ###
goffi@necton2
parents:
diff changeset
64 for contact in self.bridge.getContacts():
goffi@necton2
parents:
diff changeset
65 self.newContact(contact[0], contact[1], contact[2])
goffi@necton2
parents:
diff changeset
66
51
8c67ea98ab91 frontend improved to take into account new SàT features
Goffi <goffi@goffi.org>
parents: 28
diff changeset
67 presences = self.bridge.getPresenceStatus()
8c67ea98ab91 frontend improved to take into account new SàT features
Goffi <goffi@goffi.org>
parents: 28
diff changeset
68 for contact in presences:
8c67ea98ab91 frontend improved to take into account new SàT features
Goffi <goffi@goffi.org>
parents: 28
diff changeset
69 for res in presences[contact]:
8c67ea98ab91 frontend improved to take into account new SàT features
Goffi <goffi@goffi.org>
parents: 28
diff changeset
70 jabber_id = contact+('/'+res if res else '')
8c67ea98ab91 frontend improved to take into account new SàT features
Goffi <goffi@goffi.org>
parents: 28
diff changeset
71 show = presences[contact][res][0]
8c67ea98ab91 frontend improved to take into account new SàT features
Goffi <goffi@goffi.org>
parents: 28
diff changeset
72 priority = presences[contact][res][1]
8c67ea98ab91 frontend improved to take into account new SàT features
Goffi <goffi@goffi.org>
parents: 28
diff changeset
73 statuses = presences[contact][res][2]
8c67ea98ab91 frontend improved to take into account new SàT features
Goffi <goffi@goffi.org>
parents: 28
diff changeset
74 self.presenceUpdate(jabber_id, show, priority, statuses)
8c67ea98ab91 frontend improved to take into account new SàT features
Goffi <goffi@goffi.org>
parents: 28
diff changeset
75
8c67ea98ab91 frontend improved to take into account new SàT features
Goffi <goffi@goffi.org>
parents: 28
diff changeset
76 waitingSub = self.bridge.getWaitingSub()
8c67ea98ab91 frontend improved to take into account new SàT features
Goffi <goffi@goffi.org>
parents: 28
diff changeset
77 for sub in waitingSub:
8c67ea98ab91 frontend improved to take into account new SàT features
Goffi <goffi@goffi.org>
parents: 28
diff changeset
78 self.subscribe(waitingSub[sub], sub)
0
goffi@necton2
parents:
diff changeset
79
goffi@necton2
parents:
diff changeset
80
52
6455fb62ff83 Connection/disconnection signals
Goffi <goffi@goffi.org>
parents: 51
diff changeset
81 def connected(self):
6455fb62ff83 Connection/disconnection signals
Goffi <goffi@goffi.org>
parents: 51
diff changeset
82 """called when the connection is made"""
6455fb62ff83 Connection/disconnection signals
Goffi <goffi@goffi.org>
parents: 51
diff changeset
83 debug("Connected")
6455fb62ff83 Connection/disconnection signals
Goffi <goffi@goffi.org>
parents: 51
diff changeset
84 self.setStatusOnline(True)
6455fb62ff83 Connection/disconnection signals
Goffi <goffi@goffi.org>
parents: 51
diff changeset
85
6455fb62ff83 Connection/disconnection signals
Goffi <goffi@goffi.org>
parents: 51
diff changeset
86 def disconnected(self):
6455fb62ff83 Connection/disconnection signals
Goffi <goffi@goffi.org>
parents: 51
diff changeset
87 """called when the connection is closed"""
6455fb62ff83 Connection/disconnection signals
Goffi <goffi@goffi.org>
parents: 51
diff changeset
88 debug("Disconnected")
6455fb62ff83 Connection/disconnection signals
Goffi <goffi@goffi.org>
parents: 51
diff changeset
89 self.CM.clear()
6455fb62ff83 Connection/disconnection signals
Goffi <goffi@goffi.org>
parents: 51
diff changeset
90 self.contactList.clear_contacts()
6455fb62ff83 Connection/disconnection signals
Goffi <goffi@goffi.org>
parents: 51
diff changeset
91 self.setStatusOnline(False)
6455fb62ff83 Connection/disconnection signals
Goffi <goffi@goffi.org>
parents: 51
diff changeset
92
0
goffi@necton2
parents:
diff changeset
93 def newContact(self, JabberId, attributes, groups):
51
8c67ea98ab91 frontend improved to take into account new SàT features
Goffi <goffi@goffi.org>
parents: 28
diff changeset
94 entity=JID(JabberId)
8c67ea98ab91 frontend improved to take into account new SàT features
Goffi <goffi@goffi.org>
parents: 28
diff changeset
95 self.rosterList[entity.short]=(dict(attributes), list(groups))
0
goffi@necton2
parents:
diff changeset
96
goffi@necton2
parents:
diff changeset
97 def newMessage(self, from_jid, msg, type, to_jid):
goffi@necton2
parents:
diff changeset
98 sender=JID(from_jid)
goffi@necton2
parents:
diff changeset
99 addr=JID(to_jid)
goffi@necton2
parents:
diff changeset
100 win = addr if sender.short == self.whoami.short else sender
goffi@necton2
parents:
diff changeset
101 self.chat_wins[win.short].printMessage(sender, msg)
goffi@necton2
parents:
diff changeset
102
goffi@necton2
parents:
diff changeset
103 def setStatusOnline(self, online=True):
goffi@necton2
parents:
diff changeset
104 pass
goffi@necton2
parents:
diff changeset
105
51
8c67ea98ab91 frontend improved to take into account new SàT features
Goffi <goffi@goffi.org>
parents: 28
diff changeset
106 def presenceUpdate(self, jabber_id, show, priority, statuses):
8c67ea98ab91 frontend improved to take into account new SàT features
Goffi <goffi@goffi.org>
parents: 28
diff changeset
107 debug ("presence update for %s (show=%s, statuses=%s)", jabber_id, show, statuses);
8c67ea98ab91 frontend improved to take into account new SàT features
Goffi <goffi@goffi.org>
parents: 28
diff changeset
108 from_jid=JID(jabber_id)
8c67ea98ab91 frontend improved to take into account new SàT features
Goffi <goffi@goffi.org>
parents: 28
diff changeset
109 debug ("from_jid.short=%s whoami.short=%s", from_jid.short, self.whoami.short)
0
goffi@necton2
parents:
diff changeset
110
51
8c67ea98ab91 frontend improved to take into account new SàT features
Goffi <goffi@goffi.org>
parents: 28
diff changeset
111 if from_jid.short==self.whoami.short:
0
goffi@necton2
parents:
diff changeset
112 if not type:
goffi@necton2
parents:
diff changeset
113 self.setStatusOnline(True)
goffi@necton2
parents:
diff changeset
114 elif type=="unavailable":
goffi@necton2
parents:
diff changeset
115 self.setStatusOnline(False)
goffi@necton2
parents:
diff changeset
116 return
goffi@necton2
parents:
diff changeset
117
51
8c67ea98ab91 frontend improved to take into account new SàT features
Goffi <goffi@goffi.org>
parents: 28
diff changeset
118 if show != 'unavailable':
0
goffi@necton2
parents:
diff changeset
119 name=""
53
6dfe5bb10008 Wix: groups in contact list, first draft
Goffi <goffi@goffi.org>
parents: 52
diff changeset
120 groups = []
51
8c67ea98ab91 frontend improved to take into account new SàT features
Goffi <goffi@goffi.org>
parents: 28
diff changeset
121 if self.rosterList.has_key(from_jid.short):
8c67ea98ab91 frontend improved to take into account new SàT features
Goffi <goffi@goffi.org>
parents: 28
diff changeset
122 if self.rosterList[from_jid.short][0].has_key("name"):
8c67ea98ab91 frontend improved to take into account new SàT features
Goffi <goffi@goffi.org>
parents: 28
diff changeset
123 name=self.rosterList[from_jid.short][0]["name"]
53
6dfe5bb10008 Wix: groups in contact list, first draft
Goffi <goffi@goffi.org>
parents: 52
diff changeset
124 groups=self.rosterList[from_jid.short][1]
0
goffi@necton2
parents:
diff changeset
125
goffi@necton2
parents:
diff changeset
126 #FIXME: must be moved in a plugin
51
8c67ea98ab91 frontend improved to take into account new SàT features
Goffi <goffi@goffi.org>
parents: 28
diff changeset
127 if from_jid.short in self.watched and not from_jid.short in self.onlineContact:
8c67ea98ab91 frontend improved to take into account new SàT features
Goffi <goffi@goffi.org>
parents: 28
diff changeset
128 self.showAlert("Watched jid [%s] is connected !" % from_jid.short)
0
goffi@necton2
parents:
diff changeset
129
51
8c67ea98ab91 frontend improved to take into account new SàT features
Goffi <goffi@goffi.org>
parents: 28
diff changeset
130 self.onlineContact.add(from_jid) #FIXME onlineContact is useless with CM, must be removed
8c67ea98ab91 frontend improved to take into account new SàT features
Goffi <goffi@goffi.org>
parents: 28
diff changeset
131 self.CM.add(from_jid)
8c67ea98ab91 frontend improved to take into account new SàT features
Goffi <goffi@goffi.org>
parents: 28
diff changeset
132 self.CM.update(from_jid, 'name', name)
8c67ea98ab91 frontend improved to take into account new SàT features
Goffi <goffi@goffi.org>
parents: 28
diff changeset
133 self.CM.update(from_jid, 'show', show)
8c67ea98ab91 frontend improved to take into account new SàT features
Goffi <goffi@goffi.org>
parents: 28
diff changeset
134 self.CM.update(from_jid, 'statuses', statuses)
53
6dfe5bb10008 Wix: groups in contact list, first draft
Goffi <goffi@goffi.org>
parents: 52
diff changeset
135 self.CM.update(from_jid, 'groups', groups)
64
d46f849664aa SàT: multi-profile, plugins updated
Goffi <goffi@goffi.org>
parents: 57
diff changeset
136 cache = self.bridge.getCardCache(from_jid)
51
8c67ea98ab91 frontend improved to take into account new SàT features
Goffi <goffi@goffi.org>
parents: 28
diff changeset
137 if cache.has_key('nick'):
8c67ea98ab91 frontend improved to take into account new SàT features
Goffi <goffi@goffi.org>
parents: 28
diff changeset
138 self.CM.update(from_jid, 'nick', cache['nick'])
8c67ea98ab91 frontend improved to take into account new SàT features
Goffi <goffi@goffi.org>
parents: 28
diff changeset
139 if cache.has_key('avatar'):
8c67ea98ab91 frontend improved to take into account new SàT features
Goffi <goffi@goffi.org>
parents: 28
diff changeset
140 self.CM.update(from_jid, 'avatar', self.bridge.getAvatarFile(cache['avatar']))
8c67ea98ab91 frontend improved to take into account new SàT features
Goffi <goffi@goffi.org>
parents: 28
diff changeset
141 self.contactList.replace(from_jid)
0
goffi@necton2
parents:
diff changeset
142
51
8c67ea98ab91 frontend improved to take into account new SàT features
Goffi <goffi@goffi.org>
parents: 28
diff changeset
143 if show=="unavailable" and from_jid in self.onlineContact:
8c67ea98ab91 frontend improved to take into account new SàT features
Goffi <goffi@goffi.org>
parents: 28
diff changeset
144 self.onlineContact.remove(from_jid)
8c67ea98ab91 frontend improved to take into account new SàT features
Goffi <goffi@goffi.org>
parents: 28
diff changeset
145 self.CM.remove(from_jid)
8c67ea98ab91 frontend improved to take into account new SàT features
Goffi <goffi@goffi.org>
parents: 28
diff changeset
146 if not self.CM.isConnected(from_jid):
8c67ea98ab91 frontend improved to take into account new SàT features
Goffi <goffi@goffi.org>
parents: 28
diff changeset
147 self.contactList.disconnect(from_jid)
0
goffi@necton2
parents:
diff changeset
148
51
8c67ea98ab91 frontend improved to take into account new SàT features
Goffi <goffi@goffi.org>
parents: 28
diff changeset
149 def subscribe(self, type, raw_jid):
8c67ea98ab91 frontend improved to take into account new SàT features
Goffi <goffi@goffi.org>
parents: 28
diff changeset
150 """Called when a subsciption maangement signal is received"""
8c67ea98ab91 frontend improved to take into account new SàT features
Goffi <goffi@goffi.org>
parents: 28
diff changeset
151 entity = JID(raw_jid)
8c67ea98ab91 frontend improved to take into account new SàT features
Goffi <goffi@goffi.org>
parents: 28
diff changeset
152 if type=="subscribed":
8c67ea98ab91 frontend improved to take into account new SàT features
Goffi <goffi@goffi.org>
parents: 28
diff changeset
153 # this is a subscription confirmation, we just have to inform user
8c67ea98ab91 frontend improved to take into account new SàT features
Goffi <goffi@goffi.org>
parents: 28
diff changeset
154 self.showDialog("The contact %s has accepted your subscription" % entity.short, 'Subscription confirmation')
8c67ea98ab91 frontend improved to take into account new SàT features
Goffi <goffi@goffi.org>
parents: 28
diff changeset
155 elif type=="unsubscribed":
8c67ea98ab91 frontend improved to take into account new SàT features
Goffi <goffi@goffi.org>
parents: 28
diff changeset
156 # this is a subscription refusal, we just have to inform user
8c67ea98ab91 frontend improved to take into account new SàT features
Goffi <goffi@goffi.org>
parents: 28
diff changeset
157 self.showDialog("The contact %s has refused your subscription" % entity.short, 'Subscription refusal', 'error')
8c67ea98ab91 frontend improved to take into account new SàT features
Goffi <goffi@goffi.org>
parents: 28
diff changeset
158 elif type=="subscribe":
8c67ea98ab91 frontend improved to take into account new SàT features
Goffi <goffi@goffi.org>
parents: 28
diff changeset
159 # this is a subscriptionn request, we have to ask for user confirmation
8c67ea98ab91 frontend improved to take into account new SàT features
Goffi <goffi@goffi.org>
parents: 28
diff changeset
160 answer = self.showDialog("The contact %s wants to subscribe to your presence.\nDo you accept ?" % entity.short, 'Subscription confirmation', 'yes/no')
8c67ea98ab91 frontend improved to take into account new SàT features
Goffi <goffi@goffi.org>
parents: 28
diff changeset
161 if answer:
8c67ea98ab91 frontend improved to take into account new SàT features
Goffi <goffi@goffi.org>
parents: 28
diff changeset
162 self.bridge.subscription("subscribed", entity.short)
8c67ea98ab91 frontend improved to take into account new SàT features
Goffi <goffi@goffi.org>
parents: 28
diff changeset
163 else:
8c67ea98ab91 frontend improved to take into account new SàT features
Goffi <goffi@goffi.org>
parents: 28
diff changeset
164 self.bridge.subscribed("unsubscribed", entity.short)
0
goffi@necton2
parents:
diff changeset
165
goffi@necton2
parents:
diff changeset
166 def showDialog(self, message, title, type="info"):
goffi@necton2
parents:
diff changeset
167 raise NotImplementedError
goffi@necton2
parents:
diff changeset
168
goffi@necton2
parents:
diff changeset
169 def showAlert(self, message):
goffi@necton2
parents:
diff changeset
170 pass #FIXME
goffi@necton2
parents:
diff changeset
171
goffi@necton2
parents:
diff changeset
172 def paramUpdate(self, name, value, namespace):
goffi@necton2
parents:
diff changeset
173 debug("param update: [%s] %s = %s", namespace, name, value)
goffi@necton2
parents:
diff changeset
174 if (namespace,name) == ("Connection", "JabberID"):
goffi@necton2
parents:
diff changeset
175 debug ("Changing ID to %s", value)
goffi@necton2
parents:
diff changeset
176 self.whoami=JID(value)
goffi@necton2
parents:
diff changeset
177 elif (namespace,name) == ("Misc", "Watched"):
goffi@necton2
parents:
diff changeset
178 self.watched=value.split()
goffi@necton2
parents:
diff changeset
179
goffi@necton2
parents:
diff changeset
180 def contactDeleted(self, jid):
goffi@necton2
parents:
diff changeset
181 target = JID(jid)
51
8c67ea98ab91 frontend improved to take into account new SàT features
Goffi <goffi@goffi.org>
parents: 28
diff changeset
182 self.CM.remove(target)
8c67ea98ab91 frontend improved to take into account new SàT features
Goffi <goffi@goffi.org>
parents: 28
diff changeset
183 self.contactList.remove(self.CM.get_full(target))
0
goffi@necton2
parents:
diff changeset
184 try:
goffi@necton2
parents:
diff changeset
185 self.onlineContact.remove(target.short)
goffi@necton2
parents:
diff changeset
186 except KeyError:
goffi@necton2
parents:
diff changeset
187 pass
51
8c67ea98ab91 frontend improved to take into account new SàT features
Goffi <goffi@goffi.org>
parents: 28
diff changeset
188
8c67ea98ab91 frontend improved to take into account new SàT features
Goffi <goffi@goffi.org>
parents: 28
diff changeset
189 def updatedValue(self, name, data):
8c67ea98ab91 frontend improved to take into account new SàT features
Goffi <goffi@goffi.org>
parents: 28
diff changeset
190 if name == "profile_nick":
8c67ea98ab91 frontend improved to take into account new SàT features
Goffi <goffi@goffi.org>
parents: 28
diff changeset
191 target = JID(data['jid'])
8c67ea98ab91 frontend improved to take into account new SàT features
Goffi <goffi@goffi.org>
parents: 28
diff changeset
192 self.CM.update(target, 'nick', data['nick'])
8c67ea98ab91 frontend improved to take into account new SàT features
Goffi <goffi@goffi.org>
parents: 28
diff changeset
193 self.contactList.replace(target)
8c67ea98ab91 frontend improved to take into account new SàT features
Goffi <goffi@goffi.org>
parents: 28
diff changeset
194 elif name == "profile_avatar":
8c67ea98ab91 frontend improved to take into account new SàT features
Goffi <goffi@goffi.org>
parents: 28
diff changeset
195 target = JID(data['jid'])
8c67ea98ab91 frontend improved to take into account new SàT features
Goffi <goffi@goffi.org>
parents: 28
diff changeset
196 filename = self.bridge.getAvatarFile(data['avatar'])
8c67ea98ab91 frontend improved to take into account new SàT features
Goffi <goffi@goffi.org>
parents: 28
diff changeset
197 self.CM.update(target, 'avatar', filename)
8c67ea98ab91 frontend improved to take into account new SàT features
Goffi <goffi@goffi.org>
parents: 28
diff changeset
198 self.contactList.replace(target)
8c67ea98ab91 frontend improved to take into account new SàT features
Goffi <goffi@goffi.org>
parents: 28
diff changeset
199
0
goffi@necton2
parents:
diff changeset
200 def askConfirmation(self, type, id, data):
goffi@necton2
parents:
diff changeset
201 raise NotImplementedError
22
bb72c29f3432 added action cb mechanism for buttons. Tested with a temporary new user registration button.
Goffi <goffi@goffi.org>
parents: 18
diff changeset
202
bb72c29f3432 added action cb mechanism for buttons. Tested with a temporary new user registration button.
Goffi <goffi@goffi.org>
parents: 18
diff changeset
203 def actionResult(self, type, id, data):
bb72c29f3432 added action cb mechanism for buttons. Tested with a temporary new user registration button.
Goffi <goffi@goffi.org>
parents: 18
diff changeset
204 raise NotImplementedError