+
+qwebirc.util.composeAnd = function() {
+ var xargs = arguments;
+
+ return function() {
+ for(var i=0;i<xargs.length;i++)
+ if(!xargs[i].apply(this, arguments))
+ return false;
+
+ return true;
+ }
+}
+
+qwebirc.util.invertFn = function(fn) {
+ return function() {
+ return !fn.apply(this, arguments);
+ }
+}
+
+qwebirc.util.deviceHasKeyboard = function() {
+ var determine = function() {
+ if(Browser.Engine.ipod)
+ return true;
+
+ var MOBILE_UAs = ["Nintendo Wii", " PIE", "BlackBerry", "IEMobile", "Windows CE", "Nokia", "Opera Mini", "Mobile", "mobile", "Pocket", "pocket", "Android"];
+ /* safari not included because iphones/ipods send that, and we checked for iphone/ipod specifically above */
+ var DESKTOP_UAs = ["Chrome", "Firefox", "Camino", "Iceweasel", "K-Meleon", "Konqueror", "SeaMonkey", "Windows NT", "Windows 9"];
+
+ var ua = navigator.userAgent;
+
+ var contains = function(v) {
+ return ua.indexOf(v) > -1;
+ }
+
+ for(var i=0;i<MOBILE_UAs.length;i++)
+ if(contains(MOBILE_UAs[i]))
+ return false;
+
+ for(var i=0;i<DESKTOP_UAs.length;i++)
+ if(contains(DESKTOP_UAs[i]))
+ return true;
+
+ return false;
+ };
+ var v = determine();
+
+ qwebirc.util.deviceHasKeyboard = function() {
+ return v;
+ }
+
+ return v;
+}
+
+qwebirc.util.generateID_ID = 0;
+qwebirc.util.generateID = function() {
+ return "qqa-" + qwebirc.util.generateID_ID++;
+};
+
+qwebirc.util.arrayCmp = function(a, b) {
+ for(var p=0;p<a.length;p++) {
+ var ap = a[p];
+ var bp = b[p];
+ if(ap == bp)
+ continue;
+
+ if(ap < bp)
+ return -1;
+
+ return 1;
+ }
+ return 0;
+};