Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
C
converse.js
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
nexedi
converse.js
Commits
65e0ad4d
Commit
65e0ad4d
authored
Jun 19, 2012
by
JC Brand
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add initial code to ask the jabber server for archived messages.
parent
281d93eb
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
33 additions
and
8 deletions
+33
-8
collective.xmpp.chat.js
collective.xmpp.chat.js
+33
-8
No files found.
collective.xmpp.chat.js
View file @
65e0ad4d
...
...
@@ -70,9 +70,34 @@ var xmppchat = (function ($, console) {
});
};
obj
.
handleCollectionRetrieval
=
function
(
iq
)
{
// Get the last collection.
return
false
;
};
obj
.
retrieveCollections
=
function
()
{
/*
* FIXME: XEP-0136 specifies 'urn:xmpp:archive' but the mod_archive_odbc
* add-on for ejabberd wants the URL below. This might break for other
* Jabber servers.
*/
var
uri
=
'
http://www.xmpp.org/extensions/xep-0136.html#ns
'
;
var
iq
=
$iq
({
'
type
'
:
'
get
'
})
.
c
(
'
list
'
,
{
'
start
'
:
'
1469-07-21T02:00:00Z
'
,
'
xmlns
'
:
uri
})
.
c
(
'
set
'
,
{
'
xmlns
'
:
'
http://jabber.org/protocol/rsm
'
})
.
c
(
'
max
'
)
.
t
(
'
30
'
);
jarnxmpp
.
connection
.
addHandler
(
this
.
handleCollectionRetrieval
,
uri
,
"
iq
"
);
jarnxmpp
.
connection
.
send
(
iq
);
};
obj
.
createChatBox
=
function
(
jid
)
{
var
path
=
xmppchat
.
sanitizePath
(
'
/@@render_chat_box
'
),
chat_id
=
this
.
hash
(
jid
);
chat_id
=
this
.
hash
(
jid
),
that
=
this
;
$
.
ajax
({
url
:
path
,
cache
:
false
,
...
...
@@ -99,11 +124,7 @@ var xmppchat = (function ($, console) {
date
.
setMinutes
(
minutes
);
jthis
.
replaceWith
(
date
.
toLocaleTimeString
().
substring
(
0
,
5
));
});
var
last_msg_date
=
$
(
'
div#
'
+
chat_id
).
attr
(
'
last_msg_date
'
);
if
((
last_msg_date
!==
undefined
)
&&
(
last_msg_date
>
global_received_date
))
{
global_received_date
=
last_msg_date
;
sent_since_date
=
[];
}
that
.
retrieveCollections
();
}
});
return
$
(
'
#
'
+
chat_id
);
...
...
@@ -193,6 +214,11 @@ var xmppchat = (function ($, console) {
};
obj
.
receiveMessage
=
function
(
event
)
{
/* XXX: event.mtype should be 'xhtml' for XHTML-IM messages,
but I only seem to get 'text'.
XXX: Some messages might be delayed, we must get the time from the event.
*/
var
user_id
=
Strophe
.
getNodeFromJid
(
event
.
from
),
jid
=
Strophe
.
getBareJidFromJid
(
event
.
from
),
text
=
event
.
body
.
replace
(
/<br
\/
>/g
,
""
),
...
...
@@ -339,7 +365,6 @@ var xmppchat = (function ($, console) {
jQuery
(
textarea
).
css
(
'
overflow
'
,
'
auto
'
);
}
};
return
obj
;
})(
jQuery
,
console
||
{
log
:
function
(){}}
);
...
...
@@ -348,7 +373,7 @@ $(document).bind('jarnxmpp.message', function (event) {
xmppchat
.
receiveMessage
(
event
);
});
$
(
document
).
ready
(
function
()
{
$
(
document
).
bind
(
'
jarnxmpp.connected
'
,
function
()
{
var
chatdata
=
jQuery
(
'
span#babble-client-chatdata
'
);
var
cookie
=
jQuery
.
cookie
(
'
chats-open-
'
+
chatdata
.
attr
(
'
username
'
));
var
open_chats
=
[],
chat_id
;
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment