-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathgroupchatconfig.html
112 lines (92 loc) · 3.06 KB
/
groupchatconfig.html
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
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<title>JWChat - Channel Config for</title>
<meta http-equiv="content-type" content="text/html; charset=utf-8">
<script src="shared.js"></script>
<script src="jabber_x_data.js"></script>
<script src="switchStyle.js"></script>
<script src="jsjac.js"></script>
<script>
<!--
function doSub() {
var els = document.forms[0].elements;
var iq = new JSJaCIQ();
iq.setType('set');
iq.setTo(opener.jid);
var query = iq.setQuery('http://jabber.org/protocol/muc#owner');
var xmldoc = XmlDocument.create('body','foo');
xmldoc.loadXML('<body>'+genJabberXDataReply(document.forms[0])+'</body>');
for (var i=0; i<xmldoc.firstChild.childNodes.length; i++)
query.appendChild(xmldoc.firstChild.childNodes.item(i).cloneNode(true));
srcW.Debug.log(iq.getDoc().xml,2);
srcW.con.send(iq);
window.close();
return false;
}
function destroy() {
reason = prompt("Really destroy this room?\n\nReason:","");
if (!reason)
return false;
var iq = new JSJaCIQ();
iq.setType('set');
iq.setTo(opener.jid);
var query = iq.setQuery('http://jabber.org/protocol/muc#owner');
query.appendChild(iq.getDoc().createElement('destroy')).appendChild(iq.getDoc().createElement('reason')).appendChild(iq.getDoc().createTextNode(reason));
srcW.con.send(iq);
window.close();
return false;
}
function handleConfig(iq) {
srcW.Debug.log(iq.getDoc().xml,2);
if (iq.getType() == 'error')
return;
if (iq.getNode().getElementsByTagName('x').length && iq.getNode().getElementsByTagName('x').item(0).getAttribute('xmlns') == 'jabber:x:data')
document.getElementById("jabberXDataForm").innerHTML = genJabberXDataTable(iq.getNode().getElementsByTagName('x').item(0));
}
var srcW;
function init() {
// determine source window
srcW = opener.srcW;
document.title += " " + opener.jid;
var roster = srcW.roster;
var iq = new JSJaCIQ();
iq.setTo(opener.jid);
iq.setType('get');
iq.setQuery('http://jabber.org/protocol/muc#owner');
me = this;
srcW.con.send(iq, me.handleConfig);
}
function keyPressed(e) {
if (e.keyCode == 13)
return doSub();
if (e.keyCode == 27)
window.close();
return true;
}
onkeydown = keyPressed;
onload = init;
//-->
</script>
<script for="document" event="onkeydown()" language="JScript">
<!--
return keyPressed(window.event);
//-->
</script>
<style type="text/css">
/*<![CDATA[*/
th { font-size: 80%; text-align: right; font-weight: normal; }
/*]]>*/
</style>
</head>
<body style="margin:8px;">
<form name="sub" onsubmit="return doSub();">
<div id="jabberXDataForm">
</div>
<hr noshade size="1" size="100%">
<div align="right" id="buttonbox">
<button onClick="return destroy();">Destroy</button> <button onClick="window.close();">Cancel</button> <button type="submit">OK</button>
</div>
</form>
</body>
</html>