summaryrefslogtreecommitdiffstats
path: root/apps/samples/http2im/http2im.scxml
blob: 369c6a640e94b6cdc8068a0c888a55bdf32ab146 (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
<scxml datamodel="ecmascript" name="http2im">

	<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>

		<transition event="http.get">
			<script>
				print("-----------------\n"); 
				dump(_event);</script>
			<respond status="200" to="_event.origin" />
			<send target="#_im" event="im.send">
				<param name="receiver" expr="'benedikt@diogenes.local'" />
				<content expr="_event.data.query.msg" />
			</send>
		</transition>

		<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'" />
				<content><![CDATA[Have a look <a href="http://www.heise.de">here</a>]]></content>
			</send>
		</transition>

	</state>
</scxml>