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
e3d59afd
Commit
e3d59afd
authored
Nov 02, 2016
by
JC Brand
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Use `converse` instead of `this`, or `that` instead of bind
parent
ec9ed965
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
36 additions
and
31 deletions
+36
-31
src/converse-controlbox.js
src/converse-controlbox.js
+1
-1
src/converse-core.js
src/converse-core.js
+35
-29
src/converse-rosterview.js
src/converse-rosterview.js
+0
-1
No files found.
src/converse-controlbox.js
View file @
e3d59afd
...
@@ -127,7 +127,7 @@
...
@@ -127,7 +127,7 @@
clearSession
:
function
()
{
clearSession
:
function
()
{
this
.
__super__
.
clearSession
.
apply
(
this
,
arguments
);
this
.
__super__
.
clearSession
.
apply
(
this
,
arguments
);
if
(
typeof
this
.
connection
!==
'
undefined
'
&&
this
.
connection
.
connected
)
{
if
(
_
.
isUndefined
(
this
.
connection
)
&&
this
.
connection
.
connected
)
{
this
.
chatboxes
.
get
(
'
controlbox
'
).
save
({
'
connected
'
:
false
});
this
.
chatboxes
.
get
(
'
controlbox
'
).
save
({
'
connected
'
:
false
});
}
}
},
},
...
...
src/converse-core.js
View file @
e3d59afd
...
@@ -390,13 +390,15 @@
...
@@ -390,13 +390,15 @@
this
.
reconnect
=
_
.
debounce
(
function
(
condition
)
{
this
.
reconnect
=
_
.
debounce
(
function
(
condition
)
{
converse
.
connection
.
reconnecting
=
true
;
converse
.
connection
.
disconnect
(
'
re-connecting
'
);
converse
.
connection
.
reset
();
converse
.
log
(
'
The connection has dropped, attempting to reconnect.
'
);
converse
.
log
(
'
The connection has dropped, attempting to reconnect.
'
);
converse
.
giveFeedback
(
converse
.
giveFeedback
(
__
(
"
Reconnecting
"
),
'
warn
'
,
__
(
'
The connection has dropped, attempting to reconnect.
'
)
__
(
"
Reconnecting
"
),
'
warn
'
,
__
(
'
The connection has dropped, attempting to reconnect.
'
)
);
);
converse
.
connection
.
reconnecting
=
true
;
converse
.
connection
.
disconnect
(
'
re-connecting
'
);
converse
.
connection
.
reset
();
converse
.
clearSession
();
converse
.
clearSession
();
converse
.
_tearDown
();
converse
.
_tearDown
();
if
(
converse
.
authentication
!==
"
prebind
"
)
{
if
(
converse
.
authentication
!==
"
prebind
"
)
{
...
@@ -566,7 +568,6 @@
...
@@ -566,7 +568,6 @@
converse
.
clearMsgCounter
();
converse
.
clearMsgCounter
();
}
}
converse
.
windowState
=
state
;
converse
.
windowState
=
state
;
};
};
this
.
registerGlobalEventHandlers
=
function
()
{
this
.
registerGlobalEventHandlers
=
function
()
{
...
@@ -684,15 +685,15 @@
...
@@ -684,15 +685,15 @@
};
};
this
.
onStatusInitialized
=
function
()
{
this
.
onStatusInitialized
=
function
()
{
this
.
registerIntervalHandler
();
converse
.
registerIntervalHandler
();
this
.
initRoster
();
converse
.
initRoster
();
this
.
populateRoster
();
converse
.
populateRoster
();
this
.
chatboxes
.
onConnected
();
converse
.
chatboxes
.
onConnected
();
this
.
registerPresenceHandler
();
converse
.
registerPresenceHandler
();
this
.
giveFeedback
(
__
(
'
Contacts
'
));
converse
.
giveFeedback
(
__
(
'
Contacts
'
));
if
(
typeof
this
.
callback
===
'
function
'
)
{
if
(
typeof
converse
.
callback
===
'
function
'
)
{
// XXX: Deprecate in favor of init_deferred
// XXX: Deprecate in favor of init_deferred
this
.
callback
();
converse
.
callback
();
}
}
if
(
converse
.
connection
.
service
===
'
jasmine tests
'
)
{
if
(
converse
.
connection
.
service
===
'
jasmine tests
'
)
{
init_deferred
.
resolve
(
converse
);
init_deferred
.
resolve
(
converse
);
...
@@ -702,10 +703,17 @@
...
@@ -702,10 +703,17 @@
converse
.
emit
(
'
initialized
'
);
converse
.
emit
(
'
initialized
'
);
};
};
this
.
setUserJid
=
function
()
{
converse
.
jid
=
converse
.
connection
.
jid
;
converse
.
bare_jid
=
Strophe
.
getBareJidFromJid
(
converse
.
connection
.
jid
);
converse
.
resource
=
Strophe
.
getResourceFromJid
(
converse
.
connection
.
jid
);
converse
.
domain
=
Strophe
.
getDomainFromJid
(
converse
.
connection
.
jid
);
};
this
.
onConnected
=
function
(
callback
)
{
this
.
onConnected
=
function
(
callback
)
{
/
/ When reconnecting, there might be some open chat boxes. We don't
/
* Called as soon as a new connection has been established, either
// know whether these boxes are of the same account or not, so we
* by logging in or by attaching to an existing BOSH session.
// close them now.
*/
// XXX: ran into an issue where a returned PubSub BOSH response was
// XXX: ran into an issue where a returned PubSub BOSH response was
// not received by the browser. The solution was to flush the
// not received by the browser. The solution was to flush the
// connection early on. I don't know what the underlying cause of
// connection early on. I don't know what the underlying cause of
...
@@ -715,17 +723,14 @@
...
@@ -715,17 +723,14 @@
// In any case, flushing here (sending out a new BOSH request)
// In any case, flushing here (sending out a new BOSH request)
// solves the problem.
// solves the problem.
converse
.
connection
.
flush
();
converse
.
connection
.
flush
();
/* Called as soon as a new connection has been established, either
// When reconnecting, there might be some open chat boxes. We don't
* by logging in or by attaching to an existing BOSH session.
// know whether these boxes are of the same account or not, so we
*/
// close them now.
this
.
chatboxviews
.
closeAllChatBoxes
();
converse
.
chatboxviews
.
closeAllChatBoxes
();
this
.
jid
=
this
.
connection
.
jid
;
converse
.
setUserJid
();
this
.
bare_jid
=
Strophe
.
getBareJidFromJid
(
this
.
connection
.
jid
);
converse
.
features
=
new
converse
.
Features
();
this
.
resource
=
Strophe
.
getResourceFromJid
(
this
.
connection
.
jid
);
converse
.
enableCarbons
();
this
.
domain
=
Strophe
.
getDomainFromJid
(
this
.
connection
.
jid
);
converse
.
initStatus
().
done
(
converse
.
onStatusInitialized
);
this
.
features
=
new
this
.
Features
();
this
.
enableCarbons
();
this
.
initStatus
().
done
(
_
.
bind
(
this
.
onStatusInitialized
,
this
));
converse
.
emit
(
'
connected
'
);
converse
.
emit
(
'
connected
'
);
converse
.
emit
(
'
ready
'
);
// BBB: Will be removed.
converse
.
emit
(
'
ready
'
);
// BBB: Will be removed.
};
};
...
@@ -1367,11 +1372,12 @@
...
@@ -1367,11 +1372,12 @@
* This method gets overridden entirely in src/converse-controlbox.js
* This method gets overridden entirely in src/converse-controlbox.js
* if the controlbox plugin is active.
* if the controlbox plugin is active.
*/
*/
var
that
=
this
;
collection
.
each
(
function
(
chatbox
)
{
collection
.
each
(
function
(
chatbox
)
{
if
(
th
is
.
chatBoxMayBeShown
(
chatbox
))
{
if
(
th
at
.
chatBoxMayBeShown
(
chatbox
))
{
chatbox
.
trigger
(
'
show
'
);
chatbox
.
trigger
(
'
show
'
);
}
}
}
.
bind
(
this
)
);
});
converse
.
emit
(
'
chatBoxesFetched
'
);
converse
.
emit
(
'
chatBoxesFetched
'
);
},
},
...
...
src/converse-rosterview.js
View file @
e3d59afd
...
@@ -392,7 +392,6 @@
...
@@ -392,7 +392,6 @@
);
);
},
},
onGroupAdd
:
function
(
group
)
{
onGroupAdd
:
function
(
group
)
{
var
view
=
new
converse
.
RosterGroupView
({
model
:
group
});
var
view
=
new
converse
.
RosterGroupView
({
model
:
group
});
this
.
add
(
group
.
get
(
'
name
'
),
view
.
render
());
this
.
add
(
group
.
get
(
'
name
'
),
view
.
render
());
...
...
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