Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
O
officejs
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
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
nexedi
officejs
Commits
6ab46856
Commit
6ab46856
authored
Aug 22, 2014
by
Thibaut Frain
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Corrected bug (no detection of some login error)
parent
75d7758a
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
53 additions
and
14 deletions
+53
-14
dev/jabberclient/jabberclient.js
dev/jabberclient/jabberclient.js
+12
-1
dev/jabberclient_connection/jabberclient_connection.js
dev/jabberclient_connection/jabberclient_connection.js
+12
-5
src/jabberclient/jabberclient.js
src/jabberclient/jabberclient.js
+16
-1
src/jabberclient_connection/jabberclient_connection.js
src/jabberclient_connection/jabberclient_connection.js
+13
-7
No files found.
dev/jabberclient/jabberclient.js
View file @
6ab46856
...
...
@@ -27,6 +27,9 @@
function
isMessage
(
input
)
{
return
input
.
nodeName
===
"
message
"
;
}
function
getHash
(
gadget
,
options
)
{
return
gadget
.
aq_pleasePublishMyState
(
options
);
}
rJS
(
window
).
allowPublicAcquisition
(
"
manageService
"
,
function
(
params
)
{
this
.
props
.
app_services
.
monitor
(
params
[
0
]);
}).
allowPublicAcquisition
(
"
send
"
,
function
(
datas
)
{
...
...
@@ -84,8 +87,16 @@
return
this
.
getDeclaredGadget
(
"
connection
"
).
push
(
function
(
connection_gadget
)
{
return
connection_gadget
.
getConnectionJID
();
});
}).
allowPublicAcquisition
(
"
redirectOptions
"
,
function
(
options
)
{
var
gadget
=
this
;
return
getHash
(
this
,
options
[
0
]).
push
(
function
(
hash
)
{
if
(
"
#
"
+
window
.
location
.
href
.
split
(
"
#
"
)[
1
]
===
hash
)
{
return
gadget
.
render
(
options
[
0
]);
}
window
.
location
=
hash
;
});
}).
allowPublicAcquisition
(
"
getHash
"
,
function
(
options
)
{
return
this
.
aq_pleasePublishMyState
(
options
[
0
]);
return
getHash
(
this
,
options
[
0
]);
}).
declareAcquiredMethod
(
"
pleaseRedirectMyHash
"
,
"
pleaseRedirectMyHash
"
).
allowPublicAcquisition
(
"
messagesAreRead
"
,
function
(
jid
)
{
return
this
.
getDeclaredGadget
(
"
contactlist
"
).
push
(
function
(
contactlist_gadget
)
{
return
contactlist_gadget
.
messagesAreRead
(
jid
[
0
]);
...
...
dev/jabberclient_connection/jabberclient_connection.js
View file @
6ab46856
/*global window, rJS, Strophe, $, $iq, Handlebars,
/*global window, rJS, Strophe, $, $iq, Handlebars,
console,
XMLSerializer, DOMParser, RSVP, sessionStorage, promiseEventListener*/
/*jslint nomen: true*/
(
function
(
$
,
Strophe
,
rJS
,
Handlebars
)
{
...
...
@@ -13,6 +13,7 @@
function
logout
(
gadget
,
authfail
)
{
sessionStorage
.
removeItem
(
"
connection_params
"
);
return
gadget
.
render
({
page
:
"
connection
"
,
authfail
:
authfail
});
}
...
...
@@ -86,9 +87,13 @@
if
(
status
===
Strophe
.
Status
.
DISCONNECTED
)
{
return
logout
(
gadget
,
authfail
);
}
if
(
status
===
Strophe
.
Status
.
CONNFAIL
||
status
===
Strophe
.
Status
.
AUTHFAIL
)
{
if
(
status
===
Strophe
.
Status
.
CONNFAIL
)
{
authfail
=
true
;
}
if
(
status
===
Strophe
.
Status
.
AUTHFAIL
)
{
authfail
=
true
;
connection
.
disconnect
();
}
}).
fail
(
function
(
e
)
{
reject
(
e
);
});
...
...
@@ -102,7 +107,7 @@
server
:
options
.
server
};
return
new
RSVP
.
Queue
().
push
(
function
()
{
if
(
options
&&
options
.
authfail
)
{
if
(
options
&&
(
options
.
authfail
===
"
true
"
||
options
.
authfail
===
true
)
)
{
params
.
authfail
=
true
;
}
$
(
gadget
.
__element
).
html
(
login_template
(
params
));
...
...
@@ -135,10 +140,12 @@
}
}).
ready
(
function
(
g
)
{
g
.
props
=
{};
}).
declareAcquiredMethod
(
"
pleaseRedirectMyHash
"
,
"
pleaseRedirectMyHash
"
).
declareAcquiredMethod
(
"
getHash
"
,
"
getHash
"
).
declareMethod
(
"
render
"
,
function
(
options
)
{
}).
declareAcquiredMethod
(
"
pleaseRedirectMyHash
"
,
"
pleaseRedirectMyHash
"
).
declareAcquiredMethod
(
"
redirectOptions
"
,
"
redirectOptions
"
).
declareMethod
(
"
render
"
,
function
(
options
)
{
console
.
log
(
"
render connection
"
);
console
.
log
(
options
);
if
(
options
.
server
===
undefined
)
{
options
.
server
=
"
https://mail.tiolive.com/chat/http-bind/
"
;
return
this
.
getHash
(
options
).
push
(
this
.
pleaseRedirectMyHash
.
bind
(
this
)
);
return
this
.
redirectOptions
(
options
);
}
if
(
this
.
props
.
connection
&&
this
.
props
.
connection
.
authenticated
)
{
return
showLogout
(
this
);
...
...
src/jabberclient/jabberclient.js
View file @
6ab46856
...
...
@@ -36,6 +36,10 @@
return
input
.
nodeName
===
"
message
"
;
}
function
getHash
(
gadget
,
options
)
{
return
gadget
.
aq_pleasePublishMyState
(
options
);
}
rJS
(
window
)
.
allowPublicAcquisition
(
'
manageService
'
,
function
(
params
)
{
...
...
@@ -122,8 +126,19 @@
});
})
.
allowPublicAcquisition
(
"
redirectOptions
"
,
function
(
options
)
{
var
gadget
=
this
;
return
getHash
(
this
,
options
[
0
])
.
push
(
function
(
hash
)
{
if
(
"
#
"
+
window
.
location
.
href
.
split
(
"
#
"
)[
1
]
===
hash
)
{
return
gadget
.
render
(
options
[
0
]);
}
window
.
location
=
hash
;
});
})
.
allowPublicAcquisition
(
'
getHash
'
,
function
(
options
)
{
return
this
.
aq_pleasePublishMyState
(
options
[
0
]);
return
getHash
(
this
,
options
[
0
]);
})
.
declareAcquiredMethod
(
"
pleaseRedirectMyHash
"
,
"
pleaseRedirectMyHash
"
)
...
...
src/jabberclient_connection/jabberclient_connection.js
View file @
6ab46856
...
...
@@ -24,7 +24,10 @@
function
logout
(
gadget
,
authfail
)
{
sessionStorage
.
removeItem
(
"
connection_params
"
);
return
gadget
.
render
({
authfail
:
authfail
});
return
gadget
.
render
({
page
:
"
connection
"
,
authfail
:
authfail
});
}
function
showLogout
(
gadget
)
{
...
...
@@ -123,9 +126,12 @@
if
(
status
===
Strophe
.
Status
.
DISCONNECTED
)
{
return
logout
(
gadget
,
authfail
);
}
if
(
status
===
Strophe
.
Status
.
CONNFAIL
||
status
===
Strophe
.
Status
.
AUTHFAIL
)
{
if
(
status
===
Strophe
.
Status
.
CONNFAIL
)
{
authfail
=
true
;
}
if
(
status
===
Strophe
.
Status
.
AUTHFAIL
)
{
authfail
=
true
;
connection
.
disconnect
();
}
})
.
fail
(
function
(
e
)
{
...
...
@@ -143,7 +149,8 @@
};
return
new
RSVP
.
Queue
()
.
push
(
function
()
{
if
(
options
&&
options
.
authfail
)
{
if
(
options
&&
(
options
.
authfail
===
"
true
"
||
options
.
authfail
===
true
))
{
params
.
authfail
=
true
;
}
$
(
gadget
.
__element
).
html
(
login_template
(
params
));
...
...
@@ -210,13 +217,12 @@
.
declareAcquiredMethod
(
'
pleaseRedirectMyHash
'
,
'
pleaseRedirectMyHash
'
)
.
declareAcquiredMethod
(
'
getHash
'
,
'
getHash
'
)
.
declareAcquiredMethod
(
'
redirectOptions
'
,
'
redirectOptions
'
)
.
declareMethod
(
'
render
'
,
function
(
options
)
{
if
(
options
.
server
===
undefined
)
{
options
.
server
=
"
https://mail.tiolive.com/chat/http-bind/
"
;
return
this
.
getHash
(
options
)
.
push
(
this
.
pleaseRedirectMyHash
.
bind
(
this
));
return
this
.
redirectOptions
(
options
);
}
if
(
this
.
props
.
connection
&&
this
.
props
.
connection
.
authenticated
)
{
...
...
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