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
9dd2f988
Commit
9dd2f988
authored
Mar 22, 2013
by
JC Brand
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Bugfix.
Couldn't save messages because localStorage wasn't activated for xmppchat.Messages
parent
0f1f4382
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
4 additions
and
51 deletions
+4
-51
converse.js
converse.js
+4
-51
No files found.
converse.js
View file @
9dd2f988
...
...
@@ -262,9 +262,12 @@
});
xmppchat
.
ChatBox
=
Backbone
.
Model
.
extend
({
messages
:
new
xmppchat
.
Messages
(),
initialize
:
function
()
{
if
(
this
.
get
(
'
box_id
'
)
!==
'
controlbox
'
)
{
this
.
messages
=
new
xmppchat
.
Messages
();
this
.
messages
.
localStorage
=
new
Backbone
.
LocalStorage
(
hex_sha1
(
'
converse.messages
'
+
this
.
get
(
'
jid
'
)));
this
.
set
({
'
user_id
'
:
Strophe
.
getNodeFromJid
(
this
.
get
(
'
jid
'
)),
'
box_id
'
:
hex_sha1
(
this
.
get
(
'
jid
'
)),
...
...
@@ -347,7 +350,6 @@
time
=
now
.
toLocaleTimeString
().
substring
(
0
,
5
),
minutes
=
now
.
getMinutes
().
toString
(),
$chat_content
=
this
.
$el
.
find
(
'
.chat-content
'
);
/*
* FIXME: we don't use client storage anymore
var msg = xmppchat.storage.getLastMessage(this.model.get('jid'));
...
...
@@ -409,52 +411,6 @@
return
((
next_date
.
getDate
()
!=
prev_date
.
getDate
())
||
(
next_date
.
getFullYear
()
!=
prev_date
.
getFullYear
())
||
(
next_date
.
getMonth
()
!=
prev_date
.
getMonth
()));
},
insertClientStoredMessages
:
function
()
{
var
msgs
=
xmppchat
.
storage
.
getMessages
(
this
.
model
.
get
(
'
jid
'
)),
msgs_length
=
msgs
.
length
,
$content
=
this
.
$el
.
find
(
'
.chat-content
'
),
prev_date
,
this_date
,
i
;
for
(
i
=
0
;
i
<
msgs_length
;
i
++
)
{
var
msg
=
msgs
[
i
],
msg_array
=
msg
.
split
(
'
'
,
2
),
date
=
msg_array
[
0
];
if
(
i
===
0
)
{
this_date
=
new
Date
(
Date
(
date
));
if
(
this
.
isDifferentDay
(
this_date
,
new
Date
()))
{
$content
.
append
(
$
(
'
<div class="chat-date"></div>
'
).
text
(
this_date
.
toString
().
substring
(
0
,
15
)));
}
}
else
{
prev_date
=
this_date
;
this_date
=
new
Date
(
Date
(
date
));
if
(
this
.
isDifferentDay
(
prev_date
,
this_date
))
{
$content
.
append
(
$
(
'
<div class="chat-date"> </div>
'
));
$content
.
append
(
$
(
'
<div class="chat-date"></div>
'
).
text
(
this_date
.
toString
().
substring
(
0
,
15
)));
}
}
msg
=
xmppchat
.
autoLink
(
String
(
msg
).
replace
(
/
(
.*
?\s
.*
?\s)
/
,
''
));
if
(
msg_array
[
1
]
==
'
to
'
)
{
$content
.
append
(
this
.
message_template
({
'
sender
'
:
'
me
'
,
'
time
'
:
this_date
.
toLocaleTimeString
().
substring
(
0
,
5
),
'
message
'
:
msg
,
'
username
'
:
'
me
'
,
'
extra_classes
'
:
'
delayed
'
}));
}
else
{
$content
.
append
(
this
.
message_template
({
'
sender
'
:
'
them
'
,
'
time
'
:
this_date
.
toLocaleTimeString
().
substring
(
0
,
5
),
'
message
'
:
msg
,
'
username
'
:
this
.
model
.
get
(
'
fullname
'
).
split
(
'
'
)[
0
],
'
extra_classes
'
:
'
delayed
'
}));
}
}
},
addHelpMessages
:
function
(
msgs
)
{
var
$chat_content
=
this
.
$el
.
find
(
'
.chat-content
'
),
i
,
msgs_length
=
msgs
.
length
;
...
...
@@ -545,11 +501,9 @@
initialize
:
function
(){
$
(
'
body
'
).
append
(
this
.
$el
.
hide
());
this
.
model
.
messages
.
on
(
'
add
'
,
function
(
item
)
{
this
.
messageReceived
(
item
);
},
this
);
xmppchat
.
roster
.
on
(
'
change
'
,
function
(
item
,
changed
)
{
var
fullname
=
this
.
model
.
get
(
'
fullname
'
),
chat_status
=
item
.
get
(
'
chat_status
'
);
...
...
@@ -602,7 +556,6 @@
ctx
.
drawImage
(
img
,
0
,
0
,
35
*
ratio
,
35
)
}
img
.
src
=
img_src
;
// this.insertClientStoredMessages();
return
this
;
},
...
...
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