Revision: mange@freemail.hu--2005/emacs-jabber--cvs-head--0--patch-238

Creator:  Magnus Henoch <mange@freemail.hu>

Handle XMPP URIs
This commit is contained in:
Magnus Henoch 2006-06-22 23:54:54 +00:00 committed by Kirill A. Korinskiy
parent 50f86f3397
commit d436734a27
3 changed files with 85 additions and 2 deletions

View File

@ -434,6 +434,22 @@ See section 9.3 of XMPP Core."
(signal 'jabber-error
(list error-type condition text app-specific)))
(defun jabber-handle-uri (uri)
"Handle XMPP links according to draft-saintandre-xmpp-iri-04.
See Info node `(jabber)XMPP URIs'."
(interactive "sEnter XMPP URI: ")
(when (string-match "//" uri)
(error "URIs with authority part are not supported"))
(unless (string-match "^xmpp:\\([^?]+\\)\\(\\?.*\\)?" uri)
(error "Invalid XMPP URI '%s'" uri))
;; XXX: should remove hex-coding
(let ((jid (match-string 1 uri))
(method (match-string 2 uri)))
;; we ignore method for now...
(jabber-chat-with jid)))
(provide 'jabber-util)
;;; arch-tag: cfbb73ac-e2d7-4652-a08d-dc789bcded8a

View File

@ -51,6 +51,7 @@ this permission notice are preserved on all copies.
* Message history::
* Message events::
* Roster import and export::
* XMPP URIs::
* Customization::
* Hacking and extending::
* Protocol support::
@ -859,7 +860,7 @@ the variables @code{jabber-events-confirm-delivered},
not to request such information by customizing
@code{jabber-events-request-these}.
@node Roster import and export, Customization, Message events, Top
@node Roster import and export, XMPP URIs, Message events, Top
@chapter Roster import and export
@findex jabber-export-roster
@ -884,7 +885,66 @@ imported data. Subscriptions will be updated.
The format of the roster files is the XML used by roster pushes in the
XMPP protocol, in UTF-8 encoding.
@node Customization, Hacking and extending, Roster import and export, Top
@node XMPP URIs, Customization, Roster import and export, Top
@chapter XMPP URIs
@cindex URIs
@cindex URLs
@cindex links
@cindex xmpp: links
@cindex Mozilla integration
@cindex web browser integration
@cindex browser integration
@findex jabber-handle-uri
Many web page authors use links starting with @samp{xmpp:} for JIDs.
Your web browser could be made to pass such links to jabber.el, so that
such links are actually useful and not just decoration. How to do that
depends on your operating system and web browser.
@section Mozilla and Unix
If you use a Mozilla-based web browser on a Unix-like operating system,
follow these steps.
@enumerate
@item
Make sure you are running the Emacs server. @xref{Emacs Server, , Using
Emacs as a Server, emacs, GNU Emacs Manual}.
@item
Note the path of the @file{xmppuri.sh} file in the jabber.el
distribution, and make sure it is executable.
@item
Set the Mozilla preference @samp{network.protocol-handler.app.xmpp} to
the path of @file{xmppuri.sh}. There are two ways to do this:
@itemize
@item
Go to the URL @samp{about:config}, right-click in the list, choose ``New
string'', and enter @samp{network.protocol-handler.app.xmpp} and the
path in the following dialogs.
@item
Open or create the file @file{user.js} in your Mozilla profile directory
(in the same directory as @file{prefs.js}), and add the following line:
@example
user_pref("network.protocol-handler.app.xmpp", "@var{/path/to}/xmppuri.sh");
@end example
Restart Mozilla for this change to take effect.
@end itemize
@end enumerate
@section Other systems
If you know how to pass an XMPP URI from your browser to the function
@code{jabber-handle-uri}, your contribution for this section would be
appreciated.
@node Customization, Hacking and extending, XMPP URIs, Top
@chapter Customization
@findex jabber-customize

7
xmppuri.sh Executable file
View File

@ -0,0 +1,7 @@
#!/bin/sh
# Pass XMPP URIs to jabber.el. See `(jabber)XMPP URIs'.
emacsclient -e "(jabber-handle-uri \"$1\")"
# arch-tag: 3b655d90-0247-11db-86ba-000a95c2fcd0