;; jabber-muc.el - advanced MUC functions ;; $Id: jabber-muc.el,v 1.1 2004/03/02 13:08:25 legoscia Exp $ ;; Copyright (C) 2002, 2003, 2004 - tom berger - object@intelectronica.net ;; Copyright (C) 2003, 2004 - Magnus Henoch - mange@freemail.hu ;; This file is a part of jabber.el. ;; This program is free software; you can redistribute it and/or modify ;; it under the terms of the GNU General Public License as published by ;; the Free Software Foundation; either version 2 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 General Public License for more details. ;; You should have received a copy of the GNU General Public License ;; along with this program; if not, write to the Free Software ;; Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA ;; Basic MUC/groupchat functionality is handled in jabber-chat.el. (require 'jabber-widget) (add-to-list 'jabber-jid-muc-menu (cons "Configure groupchat" 'jabber-groupchat-get-config)) (defun jabber-groupchat-get-config (group) "Ask for MUC configuration form" (interactive (list (jabber-read-jid-completing "group: "))) (jabber-send-iq group "get" '(query ((xmlns . "http://jabber.org/protocol/muc#owner"))) #'jabber-process-data #'jabber-groupchat-render-config #'jabber-process-data "MUC configuration request failed")) (defun jabber-groupchat-render-config (xml-data) "Render MUC configuration form" (let ((query (jabber-iq-query xml-data)) xdata) (dolist (x (jabber-xml-get-children query 'x)) (if (string= (jabber-xml-get-attribute x 'xmlns) "jabber:x:data") (setq xdata x))) (if (not xdata) (insert "No configuration possible.\n") (jabber-init-widget-buffer (jabber-xml-get-attribute xml-data 'from)) (jabber-render-xdata-form xdata) (widget-create 'push-button :notify #'jabber-groupchat-submit-config "Submit") (widget-insert "\t") (widget-create 'push-button :notify #'jabber-groupchat-cancel-config "Cancel") (widget-insert "\n") (widget-setup) (widget-minor-mode 1)))) (defun jabber-groupchat-submit-config (&rest ignore) "Submit MUC configuration form." (jabber-send-iq jabber-submit-to "set" `(query ((xmlns . "http://jabber.org/protocol/muc#owner")) ,(jabber-parse-xdata-form)) #'jabber-report-success "MUC configuration" #'jabber-report-success "MUC configuration")) (defun jabber-groupchat-cancel-config (&rest ignore) "Cancel MUC configuration form." (jabber-send-iq jabber-submit-to "set" '(query ((xmlns . "http://jabber.org/protocol/muc#owner")) (x ((xmlns . "jabber:x:data") (type . "cancel")))) nil nil nil nil)) (provide 'jabber-muc)