//>>built // wrapped by build app define("dojox/xmpp/util", ["dijit","dojo","dojox","dojo/require!dojox/string/Builder,dojox/encoding/base64"], function(dijit,dojo,dojox){ dojo.provide("dojox.xmpp.util"); dojo.require("dojox.string.Builder"); dojo.require("dojox.encoding.base64"); dojox.xmpp.util.xmlEncode = function(str) { if(str) { str = str.replace("&", "&").replace(">", ">").replace("<", "<").replace("'", "'").replace('"', """); } return str; } dojox.xmpp.util.encodeJid = function(jid) { var buffer = new dojox.string.Builder(); for(var i =0; i < jid.length; i++) { var ch = jid.charAt(i); var rep = ch; switch(ch){ case ' ' : rep = "\\20"; break; case '"' : rep = "\\22"; break; case '#' : rep = "\\23"; break; case '&' : rep = "\\26"; break; case "'" : rep = "\\27"; break; case '/' : rep = "\\2f"; break; case ':' : rep = "\\3a"; break; case '<' : rep = "\\3c"; break; case '>' : rep = "\\3e"; break; } buffer.append(rep); } return buffer.toString(); } dojox.xmpp.util.decodeJid = function(jid) { jid = jid.replace(/\\([23][02367acef])/g, function(match) { switch(match){ case "\\20" : return ' '; case "\\22" : return '"'; case "\\23" : return '#' ; case "\\26" : return '&'; case "\\27" : return "'"; case "\\2f" : return '/'; case "\\3a" : return ':' ; case "\\3c" : return '<'; case "\\3e" : return '>'; } return "ARG"; }); return jid; } dojox.xmpp.util.createElement = function(tag, attributes, terminal){ var elem = new dojox.string.Builder("<"); elem.append(tag + " "); for (var attr in attributes){ elem.append(attr + '="'); elem.append(attributes[attr]); elem.append('" '); } if (terminal){ elem.append("/>"); }else{ elem.append(">"); } return elem.toString(); } dojox.xmpp.util.stripHtml = function(str){ // summary // Strips all HTML, including attributes and brackets // |