Mercurial > libervia-backend
annotate src/plugins/plugin_exp_parrot.py @ 531:3bd8f84f920d
primitivus: fixed info messages timestamp
author | Goffi <goffi@goffi.org> |
---|---|
date | Sun, 28 Oct 2012 17:59:24 +0100 |
parents | c18e0e108925 |
children | ca13633d3b6b |
rev | line source |
---|---|
526
d67f0ce83530
new plugin: Parrot is an experimental plugin which repeat messages between 2 entities
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
1 #!/usr/bin/python |
d67f0ce83530
new plugin: Parrot is an experimental plugin which repeat messages between 2 entities
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
2 # -*- coding: utf-8 -*- |
d67f0ce83530
new plugin: Parrot is an experimental plugin which repeat messages between 2 entities
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
3 |
d67f0ce83530
new plugin: Parrot is an experimental plugin which repeat messages between 2 entities
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
4 """ |
d67f0ce83530
new plugin: Parrot is an experimental plugin which repeat messages between 2 entities
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
5 SAT plugin for parrot mode (experimental) |
d67f0ce83530
new plugin: Parrot is an experimental plugin which repeat messages between 2 entities
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
6 Copyright (C) 2009, 2010, 2011, 2012 Jérôme Poisson (goffi@goffi.org) |
d67f0ce83530
new plugin: Parrot is an experimental plugin which repeat messages between 2 entities
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
7 |
d67f0ce83530
new plugin: Parrot is an experimental plugin which repeat messages between 2 entities
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
8 This program is free software: you can redistribute it and/or modify |
d67f0ce83530
new plugin: Parrot is an experimental plugin which repeat messages between 2 entities
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
9 it under the terms of the GNU Affero General Public License as published by |
d67f0ce83530
new plugin: Parrot is an experimental plugin which repeat messages between 2 entities
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
10 the Free Software Foundation, either version 3 of the License, or |
d67f0ce83530
new plugin: Parrot is an experimental plugin which repeat messages between 2 entities
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
11 (at your option) any later version. |
d67f0ce83530
new plugin: Parrot is an experimental plugin which repeat messages between 2 entities
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
12 |
d67f0ce83530
new plugin: Parrot is an experimental plugin which repeat messages between 2 entities
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
13 This program is distributed in the hope that it will be useful, |
d67f0ce83530
new plugin: Parrot is an experimental plugin which repeat messages between 2 entities
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
14 but WITHOUT ANY WARRANTY; without even the implied warranty of |
d67f0ce83530
new plugin: Parrot is an experimental plugin which repeat messages between 2 entities
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
15 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
d67f0ce83530
new plugin: Parrot is an experimental plugin which repeat messages between 2 entities
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
16 GNU Affero General Public License for more details. |
d67f0ce83530
new plugin: Parrot is an experimental plugin which repeat messages between 2 entities
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
17 |
d67f0ce83530
new plugin: Parrot is an experimental plugin which repeat messages between 2 entities
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
18 You should have received a copy of the GNU Affero General Public License |
d67f0ce83530
new plugin: Parrot is an experimental plugin which repeat messages between 2 entities
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
19 along with this program. If not, see <http://www.gnu.org/licenses/>. |
d67f0ce83530
new plugin: Parrot is an experimental plugin which repeat messages between 2 entities
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
20 """ |
d67f0ce83530
new plugin: Parrot is an experimental plugin which repeat messages between 2 entities
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
21 |
d67f0ce83530
new plugin: Parrot is an experimental plugin which repeat messages between 2 entities
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
22 from logging import debug, info, warning, error |
d67f0ce83530
new plugin: Parrot is an experimental plugin which repeat messages between 2 entities
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
23 from twisted.words.protocols.jabber import jid |
d67f0ce83530
new plugin: Parrot is an experimental plugin which repeat messages between 2 entities
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
24 |
d67f0ce83530
new plugin: Parrot is an experimental plugin which repeat messages between 2 entities
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
25 |
d67f0ce83530
new plugin: Parrot is an experimental plugin which repeat messages between 2 entities
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
26 from sat.core.exceptions import UnknownEntityError |
d67f0ce83530
new plugin: Parrot is an experimental plugin which repeat messages between 2 entities
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
27 from sat.tools.misc import SkipOtherTriggers |
d67f0ce83530
new plugin: Parrot is an experimental plugin which repeat messages between 2 entities
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
28 |
d67f0ce83530
new plugin: Parrot is an experimental plugin which repeat messages between 2 entities
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
29 PLUGIN_INFO = { |
d67f0ce83530
new plugin: Parrot is an experimental plugin which repeat messages between 2 entities
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
30 "name": "Parrot Plugin", |
d67f0ce83530
new plugin: Parrot is an experimental plugin which repeat messages between 2 entities
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
31 "import_name": "EXP-PARROT", |
d67f0ce83530
new plugin: Parrot is an experimental plugin which repeat messages between 2 entities
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
32 "type": "EXP", |
d67f0ce83530
new plugin: Parrot is an experimental plugin which repeat messages between 2 entities
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
33 "protocols": [], |
d67f0ce83530
new plugin: Parrot is an experimental plugin which repeat messages between 2 entities
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
34 "dependencies": ["XEP-0045"], |
d67f0ce83530
new plugin: Parrot is an experimental plugin which repeat messages between 2 entities
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
35 "main": "Exp_Parrot", |
d67f0ce83530
new plugin: Parrot is an experimental plugin which repeat messages between 2 entities
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
36 "handler": "no", |
d67f0ce83530
new plugin: Parrot is an experimental plugin which repeat messages between 2 entities
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
37 "description": _("""Implementation of parrot mode (repeat messages between 2 entities)""") |
d67f0ce83530
new plugin: Parrot is an experimental plugin which repeat messages between 2 entities
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
38 } |
d67f0ce83530
new plugin: Parrot is an experimental plugin which repeat messages between 2 entities
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
39 |
d67f0ce83530
new plugin: Parrot is an experimental plugin which repeat messages between 2 entities
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
40 class Exp_Parrot(): |
d67f0ce83530
new plugin: Parrot is an experimental plugin which repeat messages between 2 entities
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
41 """Parrot mode plugin: repeat messages from one entity or MUC room to another one""" |
d67f0ce83530
new plugin: Parrot is an experimental plugin which repeat messages between 2 entities
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
42 #XXX: This plugin can be potentially dangerous if we don't trust entities linked |
d67f0ce83530
new plugin: Parrot is an experimental plugin which repeat messages between 2 entities
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
43 # this is specially true if we have other triggers. |
d67f0ce83530
new plugin: Parrot is an experimental plugin which repeat messages between 2 entities
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
44 # sendMessageTrigger avoid other triggers execution, it's deactivated to allow |
d67f0ce83530
new plugin: Parrot is an experimental plugin which repeat messages between 2 entities
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
45 # /unparrot command in text commands plugin. |
d67f0ce83530
new plugin: Parrot is an experimental plugin which repeat messages between 2 entities
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
46 |
d67f0ce83530
new plugin: Parrot is an experimental plugin which repeat messages between 2 entities
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
47 def __init__(self, host): |
d67f0ce83530
new plugin: Parrot is an experimental plugin which repeat messages between 2 entities
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
48 info(_("Plugin Parrot initialization")) |
d67f0ce83530
new plugin: Parrot is an experimental plugin which repeat messages between 2 entities
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
49 self.host = host |
d67f0ce83530
new plugin: Parrot is an experimental plugin which repeat messages between 2 entities
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
50 host.trigger.add("MessageReceived", self.MessageReceivedTrigger, priority=100) |
d67f0ce83530
new plugin: Parrot is an experimental plugin which repeat messages between 2 entities
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
51 #host.trigger.add("sendMessage", self.sendMessageTrigger, priority=100) |
d67f0ce83530
new plugin: Parrot is an experimental plugin which repeat messages between 2 entities
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
52 |
d67f0ce83530
new plugin: Parrot is an experimental plugin which repeat messages between 2 entities
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
53 #def sendMessageTrigger(self, mess_data, profile): |
d67f0ce83530
new plugin: Parrot is an experimental plugin which repeat messages between 2 entities
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
54 # """ Deactivate other triggers if recipient is in parrot links """ |
d67f0ce83530
new plugin: Parrot is an experimental plugin which repeat messages between 2 entities
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
55 # client = self.host.getClient(profile) |
d67f0ce83530
new plugin: Parrot is an experimental plugin which repeat messages between 2 entities
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
56 # try: |
d67f0ce83530
new plugin: Parrot is an experimental plugin which repeat messages between 2 entities
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
57 # _links = client.parrot_links |
d67f0ce83530
new plugin: Parrot is an experimental plugin which repeat messages between 2 entities
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
58 # except AttributeError: |
d67f0ce83530
new plugin: Parrot is an experimental plugin which repeat messages between 2 entities
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
59 # return True |
d67f0ce83530
new plugin: Parrot is an experimental plugin which repeat messages between 2 entities
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
60 # |
d67f0ce83530
new plugin: Parrot is an experimental plugin which repeat messages between 2 entities
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
61 # if mess_data['to'].userhostJID() in _links.values(): |
d67f0ce83530
new plugin: Parrot is an experimental plugin which repeat messages between 2 entities
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
62 # debug("Parrot link detected, skipping other triggers") |
d67f0ce83530
new plugin: Parrot is an experimental plugin which repeat messages between 2 entities
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
63 # raise SkipOtherTriggers |
d67f0ce83530
new plugin: Parrot is an experimental plugin which repeat messages between 2 entities
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
64 |
d67f0ce83530
new plugin: Parrot is an experimental plugin which repeat messages between 2 entities
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
65 def MessageReceivedTrigger(self, message, profile): |
d67f0ce83530
new plugin: Parrot is an experimental plugin which repeat messages between 2 entities
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
66 """ Check if source is linked and repeat message, else do nothing """ |
d67f0ce83530
new plugin: Parrot is an experimental plugin which repeat messages between 2 entities
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
67 client = self.host.getClient(profile) |
d67f0ce83530
new plugin: Parrot is an experimental plugin which repeat messages between 2 entities
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
68 from_jid = jid.JID(message["from"]) |
d67f0ce83530
new plugin: Parrot is an experimental plugin which repeat messages between 2 entities
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
69 |
d67f0ce83530
new plugin: Parrot is an experimental plugin which repeat messages between 2 entities
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
70 try: |
d67f0ce83530
new plugin: Parrot is an experimental plugin which repeat messages between 2 entities
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
71 _links = client.parrot_links |
d67f0ce83530
new plugin: Parrot is an experimental plugin which repeat messages between 2 entities
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
72 except AttributeError: |
d67f0ce83530
new plugin: Parrot is an experimental plugin which repeat messages between 2 entities
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
73 return True |
d67f0ce83530
new plugin: Parrot is an experimental plugin which repeat messages between 2 entities
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
74 |
d67f0ce83530
new plugin: Parrot is an experimental plugin which repeat messages between 2 entities
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
75 if not from_jid.userhostJID() in _links: |
d67f0ce83530
new plugin: Parrot is an experimental plugin which repeat messages between 2 entities
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
76 return True |
d67f0ce83530
new plugin: Parrot is an experimental plugin which repeat messages between 2 entities
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
77 |
d67f0ce83530
new plugin: Parrot is an experimental plugin which repeat messages between 2 entities
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
78 for e in message.elements(): |
d67f0ce83530
new plugin: Parrot is an experimental plugin which repeat messages between 2 entities
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
79 if e.name == "body": |
d67f0ce83530
new plugin: Parrot is an experimental plugin which repeat messages between 2 entities
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
80 mess_body = e.children[0] if e.children else "" |
d67f0ce83530
new plugin: Parrot is an experimental plugin which repeat messages between 2 entities
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
81 |
d67f0ce83530
new plugin: Parrot is an experimental plugin which repeat messages between 2 entities
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
82 try: |
d67f0ce83530
new plugin: Parrot is an experimental plugin which repeat messages between 2 entities
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
83 entity_type = self.host.memory.getEntityData(from_jid, ['type'], profile)["type"] |
d67f0ce83530
new plugin: Parrot is an experimental plugin which repeat messages between 2 entities
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
84 except (UnknownEntityError, KeyError): |
d67f0ce83530
new plugin: Parrot is an experimental plugin which repeat messages between 2 entities
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
85 entity_type = "contact" |
d67f0ce83530
new plugin: Parrot is an experimental plugin which repeat messages between 2 entities
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
86 if entity_type == 'chatroom': |
d67f0ce83530
new plugin: Parrot is an experimental plugin which repeat messages between 2 entities
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
87 src_txt = from_jid.resource |
d67f0ce83530
new plugin: Parrot is an experimental plugin which repeat messages between 2 entities
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
88 if src_txt == self.host.plugins["XEP-0045"].getRoomNick(from_jid.userhost(), profile): |
d67f0ce83530
new plugin: Parrot is an experimental plugin which repeat messages between 2 entities
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
89 #we won't repeat our own messages |
d67f0ce83530
new plugin: Parrot is an experimental plugin which repeat messages between 2 entities
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
90 return True |
d67f0ce83530
new plugin: Parrot is an experimental plugin which repeat messages between 2 entities
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
91 else: |
d67f0ce83530
new plugin: Parrot is an experimental plugin which repeat messages between 2 entities
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
92 src_txt = from_jid.user |
d67f0ce83530
new plugin: Parrot is an experimental plugin which repeat messages between 2 entities
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
93 msg = "[%s] %s" % (src_txt, mess_body) |
d67f0ce83530
new plugin: Parrot is an experimental plugin which repeat messages between 2 entities
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
94 |
d67f0ce83530
new plugin: Parrot is an experimental plugin which repeat messages between 2 entities
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
95 linked = _links[from_jid.userhostJID()] |
d67f0ce83530
new plugin: Parrot is an experimental plugin which repeat messages between 2 entities
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
96 |
d67f0ce83530
new plugin: Parrot is an experimental plugin which repeat messages between 2 entities
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
97 self.host.sendMessage(unicode(linked), msg, None, "auto", profile_key=profile) |
d67f0ce83530
new plugin: Parrot is an experimental plugin which repeat messages between 2 entities
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
98 else: |
d67f0ce83530
new plugin: Parrot is an experimental plugin which repeat messages between 2 entities
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
99 warning("No body element found in message, following normal behaviour") |
d67f0ce83530
new plugin: Parrot is an experimental plugin which repeat messages between 2 entities
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
100 |
d67f0ce83530
new plugin: Parrot is an experimental plugin which repeat messages between 2 entities
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
101 return True |
d67f0ce83530
new plugin: Parrot is an experimental plugin which repeat messages between 2 entities
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
102 |
d67f0ce83530
new plugin: Parrot is an experimental plugin which repeat messages between 2 entities
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
103 def addParrot(self, source_jid, dest_jid, profile): |
d67f0ce83530
new plugin: Parrot is an experimental plugin which repeat messages between 2 entities
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
104 """Add a parrot link from one entity to another one |
d67f0ce83530
new plugin: Parrot is an experimental plugin which repeat messages between 2 entities
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
105 @param source_jid: entity from who messages will be repeated |
d67f0ce83530
new plugin: Parrot is an experimental plugin which repeat messages between 2 entities
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
106 @param dest_jid: entity where the messages will be repeated |
d67f0ce83530
new plugin: Parrot is an experimental plugin which repeat messages between 2 entities
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
107 @param profile: %(doc_profile_key)s""" |
d67f0ce83530
new plugin: Parrot is an experimental plugin which repeat messages between 2 entities
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
108 client = self.host.getClient(profile) |
d67f0ce83530
new plugin: Parrot is an experimental plugin which repeat messages between 2 entities
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
109 try: |
d67f0ce83530
new plugin: Parrot is an experimental plugin which repeat messages between 2 entities
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
110 _links = client.parrot_links |
d67f0ce83530
new plugin: Parrot is an experimental plugin which repeat messages between 2 entities
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
111 except AttributeError: |
d67f0ce83530
new plugin: Parrot is an experimental plugin which repeat messages between 2 entities
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
112 _links = client.parrot_links = {} |
d67f0ce83530
new plugin: Parrot is an experimental plugin which repeat messages between 2 entities
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
113 |
d67f0ce83530
new plugin: Parrot is an experimental plugin which repeat messages between 2 entities
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
114 _links[source_jid.userhostJID()] = dest_jid |
d67f0ce83530
new plugin: Parrot is an experimental plugin which repeat messages between 2 entities
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
115 info("Parrot mode: %s will be repeated to %s" % (source_jid.userhost(), unicode(dest_jid))) |
d67f0ce83530
new plugin: Parrot is an experimental plugin which repeat messages between 2 entities
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
116 |
d67f0ce83530
new plugin: Parrot is an experimental plugin which repeat messages between 2 entities
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
117 def removeParrot(self, source_jid, profile): |
d67f0ce83530
new plugin: Parrot is an experimental plugin which repeat messages between 2 entities
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
118 """Remove parrot link |
d67f0ce83530
new plugin: Parrot is an experimental plugin which repeat messages between 2 entities
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
119 @param source_jid: this entity will no more be repeated |
d67f0ce83530
new plugin: Parrot is an experimental plugin which repeat messages between 2 entities
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
120 @param profile: %(doc_profile_key)s""" |
d67f0ce83530
new plugin: Parrot is an experimental plugin which repeat messages between 2 entities
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
121 client = self.host.getClient(profile) |
d67f0ce83530
new plugin: Parrot is an experimental plugin which repeat messages between 2 entities
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
122 try: |
d67f0ce83530
new plugin: Parrot is an experimental plugin which repeat messages between 2 entities
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
123 del client.parrot_links[source_jid.userhostJID()] |
d67f0ce83530
new plugin: Parrot is an experimental plugin which repeat messages between 2 entities
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
124 except (AttributeError, KeyError): |
d67f0ce83530
new plugin: Parrot is an experimental plugin which repeat messages between 2 entities
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
125 pass |
d67f0ce83530
new plugin: Parrot is an experimental plugin which repeat messages between 2 entities
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
126 |
d67f0ce83530
new plugin: Parrot is an experimental plugin which repeat messages between 2 entities
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
127 |