summaryrefslogtreecommitdiffstats
path: root/test/uscxml/test-instant-messaging.scxml
blob: dccaa75954456c0c8f531fcfbbbbf9c2c025d8fa (plain)
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
<scxml datamodel="ecmascript">
	<script>
//<![CDATA[
		someBinaryData = new ArrayBuffer(256);
		var view = new Uint8Array(someBinaryData);
		for (var i = 0; i < view.length; i++) {
			view[i] = i;
		}
//]]>
	</script>

	<script src="http://uscxml.tk.informatik.tu-darmstadt.de/scripts/dump.js" />
	<state id="idle">
		<onentry>
			<!-- <send event="dump" delay="100ms" /> -->
		</onentry>
		
		<invoke type="instant-messaging" id="im">
			<param name="username" expr="'uscxml@diogenes.local'" />
			<param name="password" expr="'uscxml'" />
			<param name="protocol" expr="'prpl-jabber'" />
			<finalize>
				<script>
					print("-----------------\n"); 
					dump(_event);</script>
			</finalize>
		</invoke>

		<!-- <state id="dump">
			<transition event="dump" target="dump">
				<send event="dump" delay="1000ms" />
				<script>//dump(_invokers['im']);</script>
			</transition>
		</state> -->

		<transition event="im.buddy.status.changed">
			<!-- <script>print("\n\n"); dump(_invokers['im']);</script> -->
		</transition>
		
		<transition event="im.signed.on">
			<!-- <send target="#_im" event="im.buddy.add">
				<param name="name" expr="'sradomski@diogenes.local'" />
				<param name="msg" expr="'Please add me as a contact!'" />
			</send> -->
			<!-- <script>print("\n\n"); dump(_invokers['im']);</script> -->
			<send target="#_im" event="im.send">
				<param name="receiver" expr="'sradomski@diogenes.local'" />
				<param name="data" expr="someBinaryData" /> <!-- Unsupported :( -->
				<content><![CDATA[Have a look <a href="http://www.heise.de">here</a>]]></content>
			</send>
		</transition>

	</state>
</scxml>