Mercurial > libervia-backend
annotate sat/plugins/plugin_exp_file_sharing_invitation.py @ 2915:d1fcb8e9aced
core: fixed component connexion:
presence announcement has been moved to startConnection, but component don't have presence. This patch fixes it by moving presence announcement to clients only.
author | Goffi <goffi@goffi.org> |
---|---|
date | Sun, 14 Apr 2019 08:21:51 +0200 |
parents | 672e6be3290f |
children |
rev | line source |
---|---|
2913
672e6be3290f
plugins sharing invitation, invitation, list of interest: handle invitation to a file sharing repository
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
1 #!/usr/bin/env python2 |
672e6be3290f
plugins sharing invitation, invitation, list of interest: handle invitation to a file sharing repository
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
2 # -*- coding: utf-8 -*- |
672e6be3290f
plugins sharing invitation, invitation, list of interest: handle invitation to a file sharing repository
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
3 |
672e6be3290f
plugins sharing invitation, invitation, list of interest: handle invitation to a file sharing repository
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
4 # SAT plugin to detect language (experimental) |
672e6be3290f
plugins sharing invitation, invitation, list of interest: handle invitation to a file sharing repository
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
5 # Copyright (C) 2009-2019 Jérôme Poisson (goffi@goffi.org) |
672e6be3290f
plugins sharing invitation, invitation, list of interest: handle invitation to a file sharing repository
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
6 |
672e6be3290f
plugins sharing invitation, invitation, list of interest: handle invitation to a file sharing repository
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
7 # This program is free software: you can redistribute it and/or modify |
672e6be3290f
plugins sharing invitation, invitation, list of interest: handle invitation to a file sharing repository
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
8 # it under the terms of the GNU Affero General Public License as published by |
672e6be3290f
plugins sharing invitation, invitation, list of interest: handle invitation to a file sharing repository
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
9 # the Free Software Foundation, either version 3 of the License, or |
672e6be3290f
plugins sharing invitation, invitation, list of interest: handle invitation to a file sharing repository
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
10 # (at your option) any later version. |
672e6be3290f
plugins sharing invitation, invitation, list of interest: handle invitation to a file sharing repository
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
11 |
672e6be3290f
plugins sharing invitation, invitation, list of interest: handle invitation to a file sharing repository
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
12 # This program is distributed in the hope that it will be useful, |
672e6be3290f
plugins sharing invitation, invitation, list of interest: handle invitation to a file sharing repository
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
13 # but WITHOUT ANY WARRANTY; without even the implied warranty of |
672e6be3290f
plugins sharing invitation, invitation, list of interest: handle invitation to a file sharing repository
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
14 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
672e6be3290f
plugins sharing invitation, invitation, list of interest: handle invitation to a file sharing repository
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
15 # GNU Affero General Public License for more details. |
672e6be3290f
plugins sharing invitation, invitation, list of interest: handle invitation to a file sharing repository
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
16 |
672e6be3290f
plugins sharing invitation, invitation, list of interest: handle invitation to a file sharing repository
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
17 # You should have received a copy of the GNU Affero General Public License |
672e6be3290f
plugins sharing invitation, invitation, list of interest: handle invitation to a file sharing repository
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
18 # along with this program. If not, see <http://www.gnu.org/licenses/>. |
672e6be3290f
plugins sharing invitation, invitation, list of interest: handle invitation to a file sharing repository
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
19 |
672e6be3290f
plugins sharing invitation, invitation, list of interest: handle invitation to a file sharing repository
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
20 from sat.core.i18n import _ |
672e6be3290f
plugins sharing invitation, invitation, list of interest: handle invitation to a file sharing repository
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
21 from sat.core.constants import Const as C |
672e6be3290f
plugins sharing invitation, invitation, list of interest: handle invitation to a file sharing repository
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
22 from sat.core.log import getLogger |
672e6be3290f
plugins sharing invitation, invitation, list of interest: handle invitation to a file sharing repository
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
23 from twisted.internet import defer |
672e6be3290f
plugins sharing invitation, invitation, list of interest: handle invitation to a file sharing repository
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
24 from twisted.words.protocols.jabber import jid |
672e6be3290f
plugins sharing invitation, invitation, list of interest: handle invitation to a file sharing repository
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
25 from wokkel import disco, iwokkel |
672e6be3290f
plugins sharing invitation, invitation, list of interest: handle invitation to a file sharing repository
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
26 from zope.interface import implements |
672e6be3290f
plugins sharing invitation, invitation, list of interest: handle invitation to a file sharing repository
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
27 from twisted.words.protocols.jabber.xmlstream import XMPPHandler |
672e6be3290f
plugins sharing invitation, invitation, list of interest: handle invitation to a file sharing repository
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
28 |
672e6be3290f
plugins sharing invitation, invitation, list of interest: handle invitation to a file sharing repository
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
29 log = getLogger(__name__) |
672e6be3290f
plugins sharing invitation, invitation, list of interest: handle invitation to a file sharing repository
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
30 |
672e6be3290f
plugins sharing invitation, invitation, list of interest: handle invitation to a file sharing repository
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
31 |
672e6be3290f
plugins sharing invitation, invitation, list of interest: handle invitation to a file sharing repository
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
32 PLUGIN_INFO = { |
672e6be3290f
plugins sharing invitation, invitation, list of interest: handle invitation to a file sharing repository
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
33 C.PI_NAME: "File Sharing Invitation", |
672e6be3290f
plugins sharing invitation, invitation, list of interest: handle invitation to a file sharing repository
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
34 C.PI_IMPORT_NAME: "FILE_SHARING_INVITATION", |
672e6be3290f
plugins sharing invitation, invitation, list of interest: handle invitation to a file sharing repository
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
35 C.PI_TYPE: "EXP", |
672e6be3290f
plugins sharing invitation, invitation, list of interest: handle invitation to a file sharing repository
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
36 C.PI_PROTOCOLS: [], |
672e6be3290f
plugins sharing invitation, invitation, list of interest: handle invitation to a file sharing repository
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
37 C.PI_DEPENDENCIES: ["XEP-0329"], |
672e6be3290f
plugins sharing invitation, invitation, list of interest: handle invitation to a file sharing repository
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
38 C.PI_RECOMMENDATIONS: [], |
672e6be3290f
plugins sharing invitation, invitation, list of interest: handle invitation to a file sharing repository
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
39 C.PI_MAIN: "FileSharingInvitation", |
672e6be3290f
plugins sharing invitation, invitation, list of interest: handle invitation to a file sharing repository
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
40 C.PI_HANDLER: "yes", |
672e6be3290f
plugins sharing invitation, invitation, list of interest: handle invitation to a file sharing repository
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
41 C.PI_DESCRIPTION: _(u"Experimental handling of invitations for file sharing"), |
672e6be3290f
plugins sharing invitation, invitation, list of interest: handle invitation to a file sharing repository
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
42 } |
672e6be3290f
plugins sharing invitation, invitation, list of interest: handle invitation to a file sharing repository
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
43 |
672e6be3290f
plugins sharing invitation, invitation, list of interest: handle invitation to a file sharing repository
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
44 NS_FILE_SHARING_INVITATION = "https://salut-a-toi/protocol/file-sharing-invitation:0" |
672e6be3290f
plugins sharing invitation, invitation, list of interest: handle invitation to a file sharing repository
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
45 INVITATION = '/message/invitation[@xmlns="{ns_invit}"]'.format( |
672e6be3290f
plugins sharing invitation, invitation, list of interest: handle invitation to a file sharing repository
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
46 ns_invit=NS_FILE_SHARING_INVITATION |
672e6be3290f
plugins sharing invitation, invitation, list of interest: handle invitation to a file sharing repository
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
47 ) |
672e6be3290f
plugins sharing invitation, invitation, list of interest: handle invitation to a file sharing repository
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
48 |
672e6be3290f
plugins sharing invitation, invitation, list of interest: handle invitation to a file sharing repository
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
49 |
672e6be3290f
plugins sharing invitation, invitation, list of interest: handle invitation to a file sharing repository
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
50 class FileSharingInvitation(object): |
672e6be3290f
plugins sharing invitation, invitation, list of interest: handle invitation to a file sharing repository
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
51 |
672e6be3290f
plugins sharing invitation, invitation, list of interest: handle invitation to a file sharing repository
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
52 def __init__(self, host): |
672e6be3290f
plugins sharing invitation, invitation, list of interest: handle invitation to a file sharing repository
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
53 log.info(_(u"File Sharing Invitation plugin initialization")) |
672e6be3290f
plugins sharing invitation, invitation, list of interest: handle invitation to a file sharing repository
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
54 self.host = host |
672e6be3290f
plugins sharing invitation, invitation, list of interest: handle invitation to a file sharing repository
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
55 |
672e6be3290f
plugins sharing invitation, invitation, list of interest: handle invitation to a file sharing repository
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
56 def getHandler(self, client): |
672e6be3290f
plugins sharing invitation, invitation, list of interest: handle invitation to a file sharing repository
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
57 return FileSharingInvitationHandler(self) |
672e6be3290f
plugins sharing invitation, invitation, list of interest: handle invitation to a file sharing repository
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
58 |
672e6be3290f
plugins sharing invitation, invitation, list of interest: handle invitation to a file sharing repository
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
59 def sendFileSharingInvitation( |
672e6be3290f
plugins sharing invitation, invitation, list of interest: handle invitation to a file sharing repository
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
60 self, client, invitee_jid, service, repos_type=None, namespace=None, |
672e6be3290f
plugins sharing invitation, invitation, list of interest: handle invitation to a file sharing repository
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
61 path=None): |
672e6be3290f
plugins sharing invitation, invitation, list of interest: handle invitation to a file sharing repository
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
62 """Send an invitation in a <message> stanza |
672e6be3290f
plugins sharing invitation, invitation, list of interest: handle invitation to a file sharing repository
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
63 |
672e6be3290f
plugins sharing invitation, invitation, list of interest: handle invitation to a file sharing repository
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
64 @param invitee_jid(jid.JID): entitee to send invitation to |
672e6be3290f
plugins sharing invitation, invitation, list of interest: handle invitation to a file sharing repository
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
65 @param service(jid.JID): file sharing service |
672e6be3290f
plugins sharing invitation, invitation, list of interest: handle invitation to a file sharing repository
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
66 @param repos_type(unicode, None): type of files repository, can be: |
672e6be3290f
plugins sharing invitation, invitation, list of interest: handle invitation to a file sharing repository
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
67 - None, "files": files sharing |
672e6be3290f
plugins sharing invitation, invitation, list of interest: handle invitation to a file sharing repository
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
68 - "photos": photos album |
672e6be3290f
plugins sharing invitation, invitation, list of interest: handle invitation to a file sharing repository
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
69 @param namespace(unicode, None): namespace of the shared repository |
672e6be3290f
plugins sharing invitation, invitation, list of interest: handle invitation to a file sharing repository
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
70 @param path(unicode): pubsub id |
672e6be3290f
plugins sharing invitation, invitation, list of interest: handle invitation to a file sharing repository
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
71 """ |
672e6be3290f
plugins sharing invitation, invitation, list of interest: handle invitation to a file sharing repository
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
72 mess_data = { |
672e6be3290f
plugins sharing invitation, invitation, list of interest: handle invitation to a file sharing repository
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
73 "from": client.jid, |
672e6be3290f
plugins sharing invitation, invitation, list of interest: handle invitation to a file sharing repository
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
74 "to": invitee_jid, |
672e6be3290f
plugins sharing invitation, invitation, list of interest: handle invitation to a file sharing repository
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
75 "uid": "", |
672e6be3290f
plugins sharing invitation, invitation, list of interest: handle invitation to a file sharing repository
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
76 "message": {}, |
672e6be3290f
plugins sharing invitation, invitation, list of interest: handle invitation to a file sharing repository
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
77 "type": C.MESS_TYPE_CHAT, |
672e6be3290f
plugins sharing invitation, invitation, list of interest: handle invitation to a file sharing repository
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
78 "subject": {}, |
672e6be3290f
plugins sharing invitation, invitation, list of interest: handle invitation to a file sharing repository
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
79 "extra": {}, |
672e6be3290f
plugins sharing invitation, invitation, list of interest: handle invitation to a file sharing repository
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
80 } |
672e6be3290f
plugins sharing invitation, invitation, list of interest: handle invitation to a file sharing repository
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
81 client.generateMessageXML(mess_data) |
672e6be3290f
plugins sharing invitation, invitation, list of interest: handle invitation to a file sharing repository
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
82 event_elt = mess_data["xml"].addElement("invitation", NS_FILE_SHARING_INVITATION) |
672e6be3290f
plugins sharing invitation, invitation, list of interest: handle invitation to a file sharing repository
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
83 event_elt[u"service"] = service.full() |
672e6be3290f
plugins sharing invitation, invitation, list of interest: handle invitation to a file sharing repository
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
84 if repos_type is not None: |
672e6be3290f
plugins sharing invitation, invitation, list of interest: handle invitation to a file sharing repository
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
85 event_elt[u"type"] = repos_type |
672e6be3290f
plugins sharing invitation, invitation, list of interest: handle invitation to a file sharing repository
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
86 if namespace is not None: |
672e6be3290f
plugins sharing invitation, invitation, list of interest: handle invitation to a file sharing repository
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
87 event_elt[u"namespace"] = namespace |
672e6be3290f
plugins sharing invitation, invitation, list of interest: handle invitation to a file sharing repository
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
88 if path is not None: |
672e6be3290f
plugins sharing invitation, invitation, list of interest: handle invitation to a file sharing repository
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
89 event_elt[u"path"] = path |
672e6be3290f
plugins sharing invitation, invitation, list of interest: handle invitation to a file sharing repository
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
90 client.send(mess_data[u"xml"]) |
672e6be3290f
plugins sharing invitation, invitation, list of interest: handle invitation to a file sharing repository
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
91 |
672e6be3290f
plugins sharing invitation, invitation, list of interest: handle invitation to a file sharing repository
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
92 @defer.inlineCallbacks |
672e6be3290f
plugins sharing invitation, invitation, list of interest: handle invitation to a file sharing repository
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
93 def onInvitation(self, message_elt, client): |
672e6be3290f
plugins sharing invitation, invitation, list of interest: handle invitation to a file sharing repository
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
94 invitation_elt = message_elt.invitation |
672e6be3290f
plugins sharing invitation, invitation, list of interest: handle invitation to a file sharing repository
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
95 try: |
672e6be3290f
plugins sharing invitation, invitation, list of interest: handle invitation to a file sharing repository
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
96 service = jid.JID(invitation_elt["service"]) |
672e6be3290f
plugins sharing invitation, invitation, list of interest: handle invitation to a file sharing repository
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
97 except (RuntimeError, KeyError): |
672e6be3290f
plugins sharing invitation, invitation, list of interest: handle invitation to a file sharing repository
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
98 log.warning(_(u"Bad invitation, ignoring: {xml}").format( |
672e6be3290f
plugins sharing invitation, invitation, list of interest: handle invitation to a file sharing repository
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
99 xml=message_elt.toXml())) |
672e6be3290f
plugins sharing invitation, invitation, list of interest: handle invitation to a file sharing repository
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
100 return |
672e6be3290f
plugins sharing invitation, invitation, list of interest: handle invitation to a file sharing repository
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
101 |
672e6be3290f
plugins sharing invitation, invitation, list of interest: handle invitation to a file sharing repository
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
102 repos_type = invitation_elt.getAttribute(u"type", u"files") |
672e6be3290f
plugins sharing invitation, invitation, list of interest: handle invitation to a file sharing repository
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
103 namespace = invitation_elt.getAttribute(u"namespace") |
672e6be3290f
plugins sharing invitation, invitation, list of interest: handle invitation to a file sharing repository
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
104 path = invitation_elt.getAttribute(u"path") |
672e6be3290f
plugins sharing invitation, invitation, list of interest: handle invitation to a file sharing repository
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
105 if repos_type == u"files": |
672e6be3290f
plugins sharing invitation, invitation, list of interest: handle invitation to a file sharing repository
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
106 type_human = _(u"file sharing") |
672e6be3290f
plugins sharing invitation, invitation, list of interest: handle invitation to a file sharing repository
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
107 elif repos_type == u"photos": |
672e6be3290f
plugins sharing invitation, invitation, list of interest: handle invitation to a file sharing repository
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
108 type_human = _(u"photos album") |
672e6be3290f
plugins sharing invitation, invitation, list of interest: handle invitation to a file sharing repository
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
109 log.info(_( |
672e6be3290f
plugins sharing invitation, invitation, list of interest: handle invitation to a file sharing repository
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
110 u'{profile} has received an invitation for a files repository ({type_human}) ' |
672e6be3290f
plugins sharing invitation, invitation, list of interest: handle invitation to a file sharing repository
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
111 u'with namespace "{namespace}" at path [{path}]').format( |
672e6be3290f
plugins sharing invitation, invitation, list of interest: handle invitation to a file sharing repository
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
112 profile=client.profile, type_human=type_human, namespace=namespace, path=path) |
672e6be3290f
plugins sharing invitation, invitation, list of interest: handle invitation to a file sharing repository
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
113 ) |
672e6be3290f
plugins sharing invitation, invitation, list of interest: handle invitation to a file sharing repository
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
114 |
672e6be3290f
plugins sharing invitation, invitation, list of interest: handle invitation to a file sharing repository
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
115 |
672e6be3290f
plugins sharing invitation, invitation, list of interest: handle invitation to a file sharing repository
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
116 class FileSharingInvitationHandler(XMPPHandler): |
672e6be3290f
plugins sharing invitation, invitation, list of interest: handle invitation to a file sharing repository
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
117 implements(iwokkel.IDisco) |
672e6be3290f
plugins sharing invitation, invitation, list of interest: handle invitation to a file sharing repository
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
118 |
672e6be3290f
plugins sharing invitation, invitation, list of interest: handle invitation to a file sharing repository
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
119 def __init__(self, plugin_parent): |
672e6be3290f
plugins sharing invitation, invitation, list of interest: handle invitation to a file sharing repository
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
120 self.plugin_parent = plugin_parent |
672e6be3290f
plugins sharing invitation, invitation, list of interest: handle invitation to a file sharing repository
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
121 |
672e6be3290f
plugins sharing invitation, invitation, list of interest: handle invitation to a file sharing repository
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
122 def connectionInitialized(self): |
672e6be3290f
plugins sharing invitation, invitation, list of interest: handle invitation to a file sharing repository
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
123 self.xmlstream.addObserver( |
672e6be3290f
plugins sharing invitation, invitation, list of interest: handle invitation to a file sharing repository
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
124 INVITATION, self.plugin_parent.onInvitation, client=self.parent |
672e6be3290f
plugins sharing invitation, invitation, list of interest: handle invitation to a file sharing repository
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
125 ) |
672e6be3290f
plugins sharing invitation, invitation, list of interest: handle invitation to a file sharing repository
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
126 |
672e6be3290f
plugins sharing invitation, invitation, list of interest: handle invitation to a file sharing repository
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
127 def getDiscoInfo(self, requestor, target, nodeIdentifier=""): |
672e6be3290f
plugins sharing invitation, invitation, list of interest: handle invitation to a file sharing repository
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
128 return [ |
672e6be3290f
plugins sharing invitation, invitation, list of interest: handle invitation to a file sharing repository
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
129 disco.DiscoFeature(NS_FILE_SHARING_INVITATION), |
672e6be3290f
plugins sharing invitation, invitation, list of interest: handle invitation to a file sharing repository
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
130 ] |
672e6be3290f
plugins sharing invitation, invitation, list of interest: handle invitation to a file sharing repository
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
131 |
672e6be3290f
plugins sharing invitation, invitation, list of interest: handle invitation to a file sharing repository
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
132 def getDiscoItems(self, requestor, target, nodeIdentifier=""): |
672e6be3290f
plugins sharing invitation, invitation, list of interest: handle invitation to a file sharing repository
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
133 return [] |