-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmessage.html
139 lines (119 loc) · 4.13 KB
/
message.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
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
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<title>JWChat - Show Message</title>
<meta http-equiv="content-type" content="text/html; charset=utf-8">
<script src="emoticons.js"></script>
<script src="shared.js"></script>
<script src="switchStyle.js"></script>
<script>
<!--
var messages = new Array();
var curMSG = lastMSG = 0;
var jid;
var srcW;
function showMSG() {
/*set subject */
if (messages[curMSG].getSubject())
document.getElementById('subject').innerHTML = messages[curMSG].getSubject();
/* set date */
var date;
if (messages[curMSG].jwcTimestamp)
date = messages[curMSG].jwcTimestamp;
else
date = new Date();
document.getElementById('date').innerHTML = date.toLocaleString();
/* set body */
msgbox.document.body.innerHTML = msgFormat(messages[curMSG].getBody());
/* set buttons */
if (curMSG == 0)
document.forms[0].elements["prevButton"].disabled = true;
else
document.forms[0].elements["prevButton"].disabled = false;
if (curMSG+1==lastMSG && opener.roster.getUserByJID(jid).messages.length == 0)
document.forms[0].elements["nextButton"].disabled = true;
else
document.forms[0].elements["nextButton"].disabled = false;
// disabled by now - sent message to [email protected] to clarify
// format of this messages
// if (messages[curMSG].getType() == 'headline')
// document.getElementById('reply_buttons').style.display = 'none';
// else
// document.getElementById('reply_buttons').style.display = '';
msgbox.scrollTo(0,0); // scroll to top
}
function getNextMSG() { // gets message from roster
var user = srcW.roster.getUserByJID(jid);
if (srcW.is.ie5||srcW.is.op) {
messages[lastMSG++] = user.messages[0];
user.messages = user.messages.slice(1,user.messages.length);
} else
messages[lastMSG++] = user.messages.shift();
// remove blinking message icon if this was last messages
if (user.messages.length == 0 && user.chatmsgs.length == 0) {
var images = srcW.roster.getUserIcons(jid);
for (var i=0; i<images.length; i++)
images[i].src = user.lastsrc;
user.lastsrc = null;
if (srcW.usersHidden && user.status == 'unavailable') // remove user from roster if not available any more
srcW.roster.print();
}
}
function next() {
curMSG++;
if (curMSG == lastMSG) {
if (srcW.roster.getUserByJID(jid).messages.length > 0)
getNextMSG();
else
curMSG--;
}
showMSG();
return false;
}
function prev() {
curMSG--;
if (curMSG < 0)
curMSG = 0;
showMSG();
return false;
}
function reply(quote) {
var url = 'send.html?jid='+escape(jid);
if(quote)
url += '&body=' + escape(messages[curMSG].getBody());
open(url,'sw','width=320,height=200');
return false;
}
function openChat() {
srcW.roster.openChat(jid);
return false;
}
function init() {
srcW = opener.top;
getArgs();
jid = passedArgs['jid'];
var user = srcW.roster.getUserByJID(jid);
if (user.messages.length > 0) {
// show messages
document.title = "Message from "+user.name; // set title
getNextMSG();
showMSG();
}
}
onload = init;
//-->
</script>
</head>
<body style="margin:8px;">
<form name="msg">
<table width="100%" height="100%" border=0 cellpadding=0 cellspacing=0>
<tr><td><b>Subject:</b> <span id="subject"></span></td></tr>
<tr><td><b>Date:</b> <span id="date"></span></td></tr>
<tr height="100%"><td style="padding-top: 4px;"><iframe src="chat_iframe.html" id="msgbox" name="msgbox" scrolling="auto" style="width: 100%; height: 100%;"></iframe></td></tr>
<tr><td><hr noshade size="1"></td></tr>
<tr id="reply_buttons"><td align="right"><button onClick="return reply(true);">Quote</button> <button onClick="return reply();">Reply</button> <button onClick="return openChat();">Start Chat</button></td></tr>
<tr><td align="right" style="padding-top: 4px;"><button onClick="return prev();" id="prevButton">prev</button> <button onClick="return next();" id="nextButton">next</button> <button onClick="window.close();">Close</button></td></tr>
</table>
</form>
</body>
</html>