Mercurial > libervia-web
comparison libervia.tac @ 201:aa76793da353
server + browser: message warning level/sending refactoring:
- widgets now manage themselves warning level
- widgets now manage themselves text entered (if they are selectable, onTextEntered must be present)
- Unibox now default to selected widget/status bar, except if a hook syntax is used (e.g. "@@: public microblog")
- warning message is now GROUP (in blue with default theme) when sending a message to a MUC room (instead of green before)
- "@.*: " syntaxes are now fully managed by browser, no more by server
author | Goffi <goffi@goffi.org> |
---|---|
date | Sun, 07 Apr 2013 22:33:55 +0200 |
parents | 8475a29d7214 |
children | 2bc6cf004e61 |
comparison
equal
deleted
inserted
replaced
200:0f5c2f799913 | 201:aa76793da353 |
---|---|
183 """Change the status""" | 183 """Change the status""" |
184 profile = ISATSession(self.session).profile | 184 profile = ISATSession(self.session).profile |
185 self.sat_host.bridge.setPresence('', '', 0, {'':status}, profile) | 185 self.sat_host.bridge.setPresence('', '', 0, {'':status}, profile) |
186 | 186 |
187 | 187 |
188 def jsonrpc_sendMessage(self, to_jid, msg, subject, type): | 188 def jsonrpc_sendMessage(self, to_jid, msg, subject, _type): |
189 """send message""" | 189 """send message""" |
190 profile = ISATSession(self.session).profile | 190 profile = ISATSession(self.session).profile |
191 return self.sat_host.bridge.sendMessage(to_jid, msg, subject, type, profile) | 191 return self.sat_host.bridge.sendMessage(to_jid, msg, subject, _type, profile) |
192 | 192 |
193 def jsonrpc_sendMblog(self, raw_text): | 193 def jsonrpc_sendMblog(self, _type, dest, text): |
194 """Parse raw_text of the microblog box, and send message consequently""" | 194 """ Send microblog message |
195 profile = ISATSession(self.session).profile | 195 @param _type: one of "PUBLIC", "GROUP" |
196 match = re.match(r'@(.+?): *(.*$)', raw_text) | 196 @param dest: destinees (list of groups, ignored for "PUBLIC") |
197 if match: | 197 @param text: microblog's text |
198 recip = match.group(1) | 198 """ |
199 text = match.group(2) | 199 profile = ISATSession(self.session).profile |
200 #if recip == '@' and text: | 200 if _type in ("PUBLIC", "GROUP") and text: |
201 # #This text if for the public microblog | 201 if _type == "PUBLIC": |
202 # return self.sat_host.bridge.sendPersonalEvent("MICROBLOG", {'content':text}, profile) | |
203 if recip == '@' and text: | |
204 #This text if for the public microblog | 202 #This text if for the public microblog |
205 print "sending public blog" | 203 print "sending public blog" |
206 return self.sat_host.bridge.sendGroupBlog("PUBLIC", [], text, profile) | 204 return self.sat_host.bridge.sendGroupBlog("PUBLIC", [], text, profile) |
207 else: | 205 else: |
208 print "sending group blog" | 206 print "sending group blog" |
209 return self.sat_host.bridge.sendGroupBlog("GROUP", [recip], text, profile) | 207 return self.sat_host.bridge.sendGroupBlog("GROUP", [dest], text, profile) |
208 else: | |
209 raise Exception("Invalid data") | |
210 | 210 |
211 def jsonrpc_getLastMblogs(self, publisher_jid, max_item): | 211 def jsonrpc_getLastMblogs(self, publisher_jid, max_item): |
212 """Get last microblogs posted by a contact | 212 """Get last microblogs posted by a contact |
213 @param publisher_jid: jid of the publisher | 213 @param publisher_jid: jid of the publisher |
214 @param max_item: number of items to ask | 214 @param max_item: number of items to ask |