Mercurial > eldonilo > lightstring
diff plugins/presence.js @ 30:1506992c33e2
Split plugins.js into multiple plugins.
author | Emmanuel Gil Peyrot <linkmauve@linkmauve.fr> |
---|---|
date | Sat, 28 Jan 2012 01:50:22 +0100 |
parents | |
children | fbb08a31921d |
line wrap: on
line diff
new file mode 100644 --- /dev/null +++ b/plugins/presence.js @@ -0,0 +1,30 @@ +'use strict'; + +/** + Copyright (c) 2011, Sonny Piers <sonny at fastmail dot net> + + Permission to use, copy, modify, and/or distribute this software for any + purpose with or without fee is hereby granted, provided that the above + copyright notice and this permission notice appear in all copies. + + THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES + WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF + MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR + ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES + WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN + ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF + OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. +*/ + +//////////// +//Presence// http://xmpp.org/rfcs/rfc6121.html#presence +//////////// +Lightstring.stanza.presence = function(aPriority) { + if(aPriority) + return "<presence><priority>"+aPriority+"</priority></presence>"; + else + return "<presence/>"; +}; +Lightstring.presence = function(aConnection, aPriority) { + aConnection.send(Lightstring.stanza.presence(aPriority)); +};