#!/usr/bin/python # -*- coding: utf-8 -*- # SAT plugin for managing xep-0249 # Copyright (C) 2009, 2010, 2011, 2012, 2013 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 logging import debug, info, warning, error from twisted.words.xish import domish from twisted.internet import protocol, defer from twisted.words.protocols.jabber import client, jid, xmlstream from zope.interface import implements from wokkel import disco, iwokkel, data_form 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"], "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_default': AUTOJOIN_VALUES[0], 'param_options': ['