Source

ZXMPP / demo.php

The default branch has multiple heads

Full commit
  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
<!DOCTYPE html>
<!--
 * (c) 2010 Ivan Vucica
 * License is located in the LICENSE file
 * in Z-XMPP distribution/repository.
 * Use not complying to those terms is a
 * violation of various national and
 * international copyright laws.
-->

<!--
This example is NOT the perfect way to use Z-XMPP, and it in fact uses some
pretty nasty JS code. It is a hack that was created for development purposes.

It should give you the idea of what you can do and where to get started with
Z-XMPP.

I suggest you start looking at the onload handler, the function 'loadhandler()'.
-->

<html>
<head>
<title>Z-XMPP</title>

<link href="application.css" rel="stylesheet" type="text/css">
<script>
var module;
</script>
<!--<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.4.3/jquery.min.js"></script>-->

<?php
// while you could manually list all required scripts,
// to facilitate easier upgrade, you should prefer using
// scriptlist.php which returns list of scripts as a handy
// php array. 
//
// if you don't use php, then just add the script references
// manually.
//
// for default GUI, there's also a list of stylesheets that
// need to be included.
require_once 'scriptlist.php';
$zxp = "./"; // zxmpp path, including trailing slash
foreach(zxmppGetStylesheets() as $fn)
{
	echo '<link href="' . $zxp . $fn . '" rel="stylesheet" type="text/css">' . "\n";
}

foreach(zxmppGetAllScripts() as $fn)
{
	echo '<script type="text/javascript" src="' . $zxp . $fn . '"></script>' . "\n";
}

foreach(zxmppGetScriptsForExtensions() as $fn)
{
	echo '<script type="text/javascript" src="' . $zxp . $fn . '"></script>' . "\n";
}
?>
</head>
<body onunload="unloadhandler();" onload="loadhandler();">
<div id="zxmpp_root"></div>

<a href="?a=<?=isset($_GET["a"]) ? intval($_GET["a"])+1 : "0"?>">advance</a><br>

<input id="usr" value="<?=isset($_GET["usr"]) ? $_GET["usr"] : "perica"?>"><input type="password" id="pwd" value="<?=isset($_GET["pwd"]) ? $_GET["pwd"] : "123"?>">

<button onclick="go();">go</button>
<button onclick="dumppresences();">dump presences</button>
<button onclick="dumpstreamfeatures();">dump stream features</button>
<button onclick="logoff();">logoff</button>
<button onclick="serialize();">serialize</button>
<button onclick="reserialize();">reserialize</button>
<button onclick="restore();">restore</button>
<button onclick="terminate();">unclean terminate</button>
<button onclick="enablevideo();">enable video</button>
<button onclick="enableaudio();">enable audio</button>
<button onclick="enablenotifications();" style="display: none;" id="notificationsbtn">enable webkit notifications</button><br>
<input id="calldestination"><button onclick="call();">call</button><button onclick="if(jingleCall) jingleCall.close(); jingleCall = undefined;">hang up</button>
<br>
<textarea cols="80" rows="15" id="serialized_output"></textarea>
<video id="monitor"></video><audio id="player"></audio>
<script defer="defer">
var zxmpp;
var webrtc_videostream;
var webrtc_audiostream;
function createzxmpp()
{
	var zatecfg = {
		"bind-url": "punjab-bind/", //"z-http-bind/",
		"route": "xmpp:zatemas.zrs.hr:5222",
		"domain": "zatemas.zrs.hr",
		"boshwait": 15
	};
	var relativecfg = {
		"bind-url": "http-bind/",
		"route": "xmpp:" + window.location.hostname + ":5222",
		"domain": window.location.hostname,
		"boshwait": 15
	};
	var gtalkcfg = {
		"bind-url": "punjab-bind/",
		"route": "xmpp:talk.google.com:5222",
		"domain": "gmail.com",
		"boshwait": 15
	}
	var punjabcfg = {
		"bind-url": "punjab-bind/",
		"route": "xmpp:" + <?=isset($_GET["route"]) ? '"' . $_GET["route"] . '"' : "window.location.hostname"?> + ":5222",
		"domain": <?=isset($_GET["domain"]) ? '"' . $_GET["domain"] . '"' : "window.location.hostname"?>,
		"boshwait": 15
	}
	var cfg = <?=isset($_GET["cfg"]) ? $_GET["cfg"] : "relativecfg"?>;

	zxmpp = new zxmppClass();
	zxmpp.onConnectionTerminate.push(handler_connectionterminate);
	zxmpp.onPresenceUpdate.push(handler_presenceupdate);
	zxmpp.onRosterUpdate.push(handler_rosterupdate);
	zxmpp.onMessage.push(handler_message);
	zxmpp.onPacket.push(handler_packet);
	zxmpp.addIqParser("jingle#urn:xmpp:jingle:1", handler_jingle); // we could also register just "jingle", but this is more specific!
	zxmpp.clientDebugMode = true; // currently only randomizes clientVersion to facilitate easier switching of caps

	// we could register additions extensions this way
	var fakeGingle=false;
	var fakeJingle=false;
	var fakeiChatAV=false;
	if(fakeGingle)
	{
		// must be "voice-v1", "video-v1" and "camera-v1".
		// allowed to mix these
		zxmpp.clientFeatureExtensions["voice-v1"]=["http://www.google.com/xmpp/protocol/voice/v1"];
		zxmpp.clientFeatureExtensions["video-v1"]=["http://www.google.com/xmpp/protocol/video/v1"];
		zxmpp.clientFeatureExtensions["camera-v1"]=["http://www.google.com/xmpp/protocol/camera/v1"];
	}
	if(fakeJingle)
	{
		// commonly under "core client features"
		zxmpp.clientFeatureExtensions["jingle"]=[
			"urn:xmpp:jingle:1", 
			"urn:xmpp:jingle:transports:ice-udp:1", 
			"urn:xmpp:jingle:apps:rtp:1", 
			"urn:xmpp:jingle:apps:rtp:audio", 
			"urn:xmpp:jingle:apps:rtp:video"
		];
	}
	if(fakeiChatAV)
	{
		// these are core iChat features, not extensions
		zxmpp.clientFeatureExtensions["AppleiChatAV"] = [
			"apple:profile:bundle-transfer",
			"apple:profile:efh-transfer",
			"apple:profile:transfer-extensions:rsrcfork",
			"http://www.apple.com/xmpp/message-attachments"];

		// these are iChat extensions
		zxmpp.clientFeatureExtensions["ice"] = ["apple:iq:vc:ice"];
		zxmpp.clientFeatureExtensions["recauth"] = ["apple:iq:vc:recauth"];
		zxmpp.clientFeatureExtensions["rdserver"] = ["apple:iq:rd:server"];
		zxmpp.clientFeatureExtensions["maudio"] = ["apple:iq:vc:multiaudio"];
		zxmpp.clientFeatureExtensions["audio"] = ["apple:iq:vc:audio"];
		zxmpp.clientFeatureExtensions["rdclient"] = ["apple:iq:rd:client"];
		zxmpp.clientFeatureExtensions["mvideo"] = ["apple:iq:vc:multivideo"];
		zxmpp.clientFeatureExtensions["auxvideo"] = ["apple:iq:vc:auxvideo"];
		zxmpp.clientFeatureExtensions["rdmuxing"] = ["apple:iq:rd:muxing"];
		zxmpp.clientFeatureExtensions["avcap"] = ["apple:iq:vc:capable"];
		zxmpp.clientFeatureExtensions["avavail"] = ["apple:iq:vc:available"];
		zxmpp.clientFeatureExtensions["video"] = ["apple:iq:vc:video"];
	}

	// setup Z-XMPP extensions
	zxmpp_xep0166_init(zxmpp);
	zxmpp_gingle_init(zxmpp);

	if(webrtc_audiostream)
	{
		zxmpp.enableClientFeatureExtension("jingle-audio");
		zxmpp.enableClientFeatureExtension("voice-v1");
	}
	if(webrtc_videostream)
	{
		zxmpp.enableClientFeatureExtension("jingle-video");
		zxmpp.enableClientFeatureExtension("video-v1");
		zxmpp.enableClientFeatureExtension("camera-v1");
	}

	window.zxmppui = new zxmpp.ui;
	window.zxmppui.backend = zxmpp;
	window.zxmppui.inject('body');
	
	return cfg;
}

function go()
{
	var cfg = createzxmpp();
	zxmpp.main(cfg, document.getElementById("usr").value, document.getElementById("pwd").value);
	//var pack = new zxmpp.packet(zxmpp);



}
function restore()
{
	createzxmpp();
	zxmpp.deserialize(document.getElementById("serialized_output").value);
}

function unloadhandler()
{
	if(window.sessionStorage)
	{
		if(zxmpp && zxmpp.stream && zxmpp.stream.hasFullConnection) 
		{
			window.sessionStorage["zxmpp"] = zxmpp.serialized();
		}
		else {
			window.sessionStorage["zxmpp"] = undefined;
			delete window.sessionStorage["zxmpp"];
		}
	}
}
function loadhandler()
{
	// by delaying load slightly, we are preventing continuous
	// "loading" display on some browsers such as safari
	setTimeout(function(){loadhandler_delayed();}, 1);
}
function loadhandler_delayed()
{
	if(window.sessionStorage)
	{
		if(window.sessionStorage["zxmpp"] && window.sessionStorage["zxmpp"]!="undefined")
		{
			createzxmpp();
			zxmpp.deserialize(window.sessionStorage["zxmpp"]);

			// because features may have changed between loads,
			// you may want to consider retransmitting presence
			// even if no other property changed.

			

			return;
		}
		//go();
	}
	else
	{
		console.log("No session storage");
	}
}


function enablevideo()
{
	if(!navigator.webkitGetUserMedia)
	{
		alert("No WebRTC support");
		return;
	}
	navigator.webkitGetUserMedia("video", videoGotStream, videoNoStream);
}
function enableaudio()
{
	if(!navigator.webkitGetUserMedia)
	{
		alert("No WebRTC support");
		return;
	}
	navigator.webkitGetUserMedia("audio", audioGotStream, audioNoStream);
}
function videoGotStream(stream)
{
	webrtc_videostream = stream;

	var monitor = document.getElementById("monitor");
	monitor.src = webkitURL.createObjectURL(stream);
	monitor.onerror = function()
	{
		webrtc_videostream = null;
		monitor.stop();
		alert("Video error");
		if(zxmpp)
		{
			zxmpp.disableClientFeatureExtension("jingle-video");
			zxmpp.disableClientFeatureExtension("video-v1");
			zxmpp.disableClientFeatureExtension("camera-v1");
		}
	}

	monitor.play();
	if(zxmpp)
	{
		zxmpp.enableClientFeatureExtension("jingle-video");
		zxmpp.enableClientFeatureExtension("video-v1");
		zxmpp.enableClientFeatureExtension("camera-v1");
	}
}
function videoNoStream()
{
	alert("No video support");
	if(zxmpp)
	{
		zxmpp.disableClientFeatureExtension("jingle-video");
		zxmpp.disableClientFeatureExtension("video-v1");
		zxmpp.disableClientFeatureExtension("camera-v1");
	}
}
function audioGotStream(stream)
{
	webrtc_audiostream = stream;

	if(zxmpp)
	{
		zxmpp.enableClientFeatureExtension("jingle-audio");
		zxmpp.enableClientFeatureExtension("voice-v1");
	}
}
function audioNoStream()
{
	alert("No audio support");
	if(zxmpp)
	{
		zxmpp.disableClientFeatureExtension("jingle-audio");
		zxmpp.disableClientFeatureExtension("voice-v1");
	}
}

function jingleSendSignaling(sdp)
{
	if(!zxmpp) zxmpp = new zxmppClass();
	console.log("SHOULD SEND SIGNALIN");
	console.log(sdp);
	translation = SDPToJingle.createJingleStanza(sdp);
	var audioDoc = zxmpp.util.parsedXMLDocument(translation.audio);
	var audioContent = audioDoc.firstChild;
	audioDoc.removeChild(audioContent);
	
	var contentGenerator = function demo_call_contentGen(zxmpp, destination, sessionId, packet)
	{
		/*
		for(var i in audioContent.childNodes)
		{
			if(audioContent.childNodes[i].localName == "transport")
				audioContent.removeChild(audioContent.childNodes[i]);
		}

		var transportNode = packet.xml.createElementNS("http://www.google.com/transport/p2p", "transport");

		audioContent.appendChild(transportNode);
		*/
		//audioContent.setAttribute("senders", "both");
		return audioContent;
	}


	console.log("this: " + this);
	zxmpp_xep0166_sessioninitiate(
			zxmpp, 
			document.getElementById("calldestination").value,
			/* session id */ "a" + Math.round(Math.random()*10000),
			contentGenerator,
			jingleCall);
}
var jingleCall;
function call()
{
	jingleCall = new /*zmpp_xep0166_PeerConnection*/ webkitDeprecatedPeerConnection("STUN stun.l.google.com:19302", jingleSendSignaling);
	if(webrtc_videostream) jingleCall.addStream(webrtc_videostream);
	if(webrtc_audiostream) jingleCall.addStream(webrtc_audiostream);
	console.log("made jingle call");

	return;
	var contentGenerator = function demo_call_contentGen(zxmpp, destination, sessionId, packet)
	{
		console.log("content gen");
		var contentNode = packet.xml.createElementNS("urn:xmpp:jingle:1", "content");
		contentNode.setAttribute("name", "call");
		contentNode.setAttribute("creator", "initiator");
		contentNode.setAttribute("senders", "both");
		
		var descriptionNode = packet.xml.createElementNS("urn:xmpp:jingle:apps:rtp:1", "description");
		contentNode.appendChild(descriptionNode);
		descriptionNode.setAttribute("media", "audio");
		var payloadNode = packet.xml.createElementNS("urn:xmpp:jingle:apps:rtp:1", "payload-type");
		descriptionNode.appendChild(payloadNode);
		payloadNode.setAttribute("id", "110");
		payloadNode.setAttribute("name", "SPEEX");
		payloadNode.setAttribute("clockrate", "16000");

		var transportNode = packet.xml.createElementNS("urn:xmpp:jingle:transports:ice-udp:1", "transport");
		contentNode.appendChild(transportNode);
		transportNode.setAttribute("pwd", "iLJD6bqjXfrAq1N6ILEDxW"); // FIX THIS
		transportNode.setAttribute("ufrag", "Zzk8"); // FIX THIS
		var candidateNode = packet.xml.createElementNS("urn:xmpp:jingle:transports:ice-udp:1", "transport");
		transportNode.appendChild(candidateNode);
		candidateNode.setAttribute("component", "1");
		candidateNode.setAttribute("foundation", "1");
		candidateNode.setAttribute("generation", "0");
		candidateNode.setAttribute("id", "daofaf"); // FIX THIS
		candidateNode.setAttribute("ip", "127.0.0.1"); // FIX THIS
		candidateNode.setAttribute("network", "1");
		candidateNode.setAttribute("port", "4552");
		candidateNode.setAttribute("priority", "4589572");
		candidateNode.setAttribute("protocol", "udp");
		candidateNode.setAttribute("type", "host");

			
		return contentNode;
	}

	zxmpp_xep0166_sessioninitiate(
			zxmpp, 
			document.getElementById("calldestination").value,
			/* session id */ Math.round(Math.random()*10000),
			contentGenerator);
}


function terminate()
{
	zxmpp.stream.terminate();
}
function dumppresences()
{
	zxmpp._debugDumpPresences();
}
function dumpstreamfeatures()
{
	zxmpp._debugDumpStreamFeatures();
}

function enablenotifications()
{
	if(!window.webkitNotifications)
		return;

	// this enables html5 notifications as per 
        //  http://www.html5rocks.com/tutorials/notifications/quick/
	// this function is called from a button handler; above url
	// doesn't want implementations to provide notification
	// api enabled from anything but user input handlers.
	// (chrome does allow you to enable this if you create
	//  a "chrome app" an request permission in manifest file)

	if (window.webkitNotifications.checkPermission() == 0) { // 0 is PERMISSION_ALLOWED
		// all is well, nothing to do except hide btn
		document.getElementById('notificationsbtn').style.display = 'none';
	} else {
		window.webkitNotifications.requestPermission();
	}
}

function shownotification(icon, title, msg)
{
	if(!window.webkitNotifications)
		return;
	if (window.webkitNotifications.checkPermission() == 0) // 0 is PERMISSION_ALLOWED
	{
		// all is well
	}
	else
	{
		// user must enable notifications by clicking a button
		// (otherwise notification permission request won't work)
		// it might be a good idea to display htem a dialog; here we won't :)
		document.getElementById('notificationsbtn').style.display = 'inherit';
		return;
	}

	if(!icon)
		icon = zxmpplogo;

        var popup = window.webkitNotifications.createNotification(icon, title, msg);
        popup.show();
	setTimeout(function(popup)
		{
			popup.cancel(); 
		}, 2000, popup);

}

function logoff()
{
	try {
		zxmpp.stream.logoff();
	} catch(e) { }
	zxmpp = undefined;
}

function serialize()
{
	if(zxmpp)
		document.getElementById("serialized_output").value = zxmpp.util.prettyJson(zxmpp.serialized());
}
function reserialize()
{
	document.getElementById("serialized_output").value = zxmpp.util.prettyJson(JSON.stringify(zxmpp.deserializeInternal(document.getElementById("serialized_output").value)));
}

function handler_connectionterminate(sender, code, humanreadable)
{
	codesplit=code.split("/");
	switch(codesplit[0])
	{
		case "terminate":
		switch(codesplit[1])
		{
			default:
			shownotification(undefined, "Connection terminated", "Server has disconnected you with code \'" + code + "\'\n\n" + humanreadable);
			alert("Server has disconnected you with code \'" + code + "\'\n\n" + humanreadable);
			break;
		}
		break;
		
		case "saslfailure":
		switch(codesplit[1])
		{
			case "not-authorized":
			shownotification(undefined, "Connection terminated", "Wrong username or password!\n\n" + humanreadable);
			alert("Wrong username or password!\n\n" + humanreadable);
			break;
			
			case "account-disabled":
			shownotification(undefined, "Connection terminated", "Your account has been disabled!\n\n" + humanreadable);
			alert("Your account has been disabled!\n\n" + humanreadable);
			break;

			default:
			shownotification(undefined, "Connection terminated", "Login error with code \'" + code + "\'\n\n" + humanreadable);
			alert("Login error with code \'" + code + "\'\n\n" + humanreadable);
		}
		break;
		
		default:
		shownotification(undefined, "Connection terminated", "Termination with code \'" + code + "\'\n\n" + humanreadable);
		alert("Termination with code \'" + code + "\'\n\n" + humanreadable);
		break;
	}
	window.sessionStorage["zxmpp"] = undefined;
	delete window.sessionStorage["zxmpp"];
}
function handler_presenceupdate(sender, presence)
{
/*	console.log("INDEX.PHP: Presence update: ");
	console.log(" -> " + presence.fullJid);
	console.log("   Icon: " + presence.show);
	console.log("   Status: " + presence.status);
*/

	var toppresence = sender.getTopPresenceForBareJid(presence.bareJid);
	if(toppresence)
	{
		//console.log("Updating " + toppresence.bareJid);
		zxmppui.presenceUpdate(toppresence.bareJid, toppresence.show, false, toppresence.status);
	}
	
	if(presence.show == "avail")
		shownotification(undefined, presence.fullJid + " is now online", presence.status);

	/////////////////////
	// development hack:

	// to facilitate easier testing of call functionality,
	// last presence to send presence update will be filled into
	// the call destination inputbox.
	document.getElementById("calldestination").value = presence.fullJid;
}
function handler_rosterupdate(sender, item)
{
/*	console.log("INDEX.PHP: Roster update: ");
	console.log(" -> " + item.bareJid);
	console.log("   Subscription: " + item.subscription); 
	console.log("   Groups:");

	for(var i in item.groups)
	{
		console.log("     " + item.groups[i]);
	}
	*/
	var presence = sender.getTopPresenceForBareJid(item.bareJid);
/*	if(presence)
	{
		console.log("Presence icon: " + presence.show);
	}
*/
	if(item.subscription != "removed" && item.subscription != "none")
	{
		var presenceShow = presence ? presence.show : "unavailable";
		var display = item.name ? item.name : item.bareJid.split('@')[0];
		var presenceStatus = presence ? presence.status : "";

		var vcard = sender.vCards[item.bareJid];
		if(vcard && vcard.fn)
			display = vcard.fn;

		zxmppui.rosterAdded(item.bareJid, presenceShow, display, presenceStatus);
		
	}
	else
	{
		zxmppui.rosterRemoved(item.bareJid);
	}
}
function handler_message(sender, messagestanza)
{
	console.log("> " + messagestanza.from + ": " + messagestanza.body);
	if(messagestanza.body)
	{
		var text = messagestanza.body;
		if(messagestanza.type == "error")
			text = "ERROR with message: " + text;
		shownotification(undefined, messagestanza.from, text);
	}

	zxmppui.messageStanzaReceived(messagestanza);
}
function handler_packet(sender, packet)
{	
	if(packet && packet.incomingStanza && packet.incomingStanza.iqXML)
	{
		for(var childId in packet.incomingStanza.iqXML.childNodes)
		{
			var child = packet.incomingStanza.iqXML.childNodes[childId];

			if(child.nodeName == "jingle")
			{
				// do whatever you want ;-)

				// note that the iq may or may not be handled, and 
				// the error may or may not be dispatched already.
				// act accordingly. this mechanism is not really a
				// good way to implement jingle, considering zxmpp
				// has already dispatched an iq error message.

			}
		}
	}

}
function handler_jingle(sender, iqStanza, xml)
{	
	// this might be a good place to implement jingle.
	// however, instead, it's better to implement it as
	// a plugin instead of in your own code.
	return false;
}

// for use in notifications:
var zxmpplogo = 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAIAAAD8GO2jAAAAAXNSR0IArs4c6QAAAARnQU1BAACx'+
'jwv8YQUAAAAgY0hSTQAAeiYAAICEAAD6AAAAgOgAAHUwAADqYAAAOpgAABdwnLpRPAAAAQdJREFU'+
'SEvdlUkShSAMRPk39+bKXAnpII3F5lusNPbLzO++73D0iYCjTziqntLzL4AQK7122IhTihaluxnF'+
'2AGEi6hcNeWC2ACkRF0BHFsYRv29TcfIshN0DbwfvqvPIgBVQb4Xs0lM+BtUt8mRZgOjgwFgUX0Y'+
'IAnQChq9rm4ntCu5AEodrgD0UkQA22belwsT2gAb6nU8J1syzo2TOHe52o50gyirgQXYrseANvOq'+
'TRcSmiMTEzf5pbiuASmityPW0asxWBV4p+pF21wzrmD/qN3otVzOWz1jDniAN48O4ztAVqW2pswe'+
'D1D7wFxBKlFyDlhQTwj8sXydXTgsz7PnLtgN6nHAA0wtfhnz+3TSAAAAAElFTkSuQmCC';

//go();
</script>
</body>
</html>