#!/usr/bin/python # -*- coding: utf-8 -*- # SAT plugin for managing xep-0249 # Copyright (C) 2009, 2010, 2011, 2012, 2013, 2014 Jérôme Poisson (goffi@goffi.org) # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU Affero General Public License as published by # the Free Software Foundation, either version 3 of the License, or # (at your option) any later version. # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU Affero General Public License for more details. # You should have received a copy of the GNU Affero General Public License # along with this program. If not, see . from sat.core.i18n import _ from sat.core.constants import Const as C from sat.core.log import getLogger log = getLogger(__name__) from twisted.words.xish import domish from twisted.words.protocols.jabber import jid from zope.interface import implements from wokkel import disco, iwokkel try: from twisted.words.protocols.xmlstream import XMPPHandler except ImportError: from wokkel.subprotocols import XMPPHandler MESSAGE = '/message' NS_DIRECT_MUC_INVITATION = 'jabber:x:conference' DIRECT_MUC_INVITATION_REQUEST = MESSAGE + '/x[@xmlns="' + NS_DIRECT_MUC_INVITATION + '"]' AUTOJOIN_KEY = "Misc" AUTOJOIN_NAME = "Auto-join MUC on invitation" AUTOJOIN_VALUES = ["ask", "always", "never"] PLUGIN_INFO = { "name": "XEP 0249 Plugin", "import_name": "XEP-0249", "type": "XEP", "protocols": ["XEP-0249"], "dependencies": ["XEP-0045"], "recommendations": [C.TEXT_CMDS], "main": "XEP_0249", "handler": "yes", "description": _("""Implementation of Direct MUC Invitations""") } class XEP_0249(object): params = """ %(param_options)s """ % { 'category_name': AUTOJOIN_KEY, 'category_label': _("Misc"), 'param_name': AUTOJOIN_NAME, 'param_label': _("Auto-join MUC on invitation"), 'param_options': '\n'.join(['