Commit e7e4f662 authored by Vivek's avatar Vivek

jabberclient: made offline contacts visible. added password reset. updated error handling.

parent c18d9b9e
......@@ -135,8 +135,9 @@
<ul data-role="listview" data-inset="true">\n
{{#each contact}}\n
<li>\n
{{#if status}}\n
{{#if url}}\n
<a href="{{url}}">\n
<a href="{{url}}" class="ui-btn ui-btn-icon-left ui-icon-check">\n
{{#if new_message}}\n
<span class="ui-li-count">!</span>\n
{{/if}}\n
......@@ -144,6 +145,17 @@
{{else}}\n
{{jid}}\n
{{/if}}\n
{{else}}\n
{{#if url}}\n
<a href="{{url}}" class="ui-btn ui-btn-icon-left ui-icon-forbidden">\n
{{#if new_message}}\n
<span class="ui-li-count">!</span>\n
{{/if}}\n
{{jid}}</a>\n
{{else}}\n
{{jid}}\n
{{/if}}\n
{{/if}}\n
</li>\n
{{/each}}\n
</ul>\n
......@@ -207,10 +219,37 @@
</div>\n
</script>\n
\n
<script class="reset-password-template" type="text/x-handlebars-template">\n
<div class="ui-grid-b ui-responsive">\n
<div class="ui-block-a"></div>\n
<div class="ui-block-b">\n
<h2>Reset Password</h2>\n
<form class="reset-password-form">\n
<div class="ui-field-contain">\n
<label>Server URL</label>\n
<input type="text" name="server" placeholder="Server URL" value="tiolive.com" required>\n
</div>\n
<div class="ui-field-contain">\n
<label>New Password</label>\n
<input type="password" name="new_passwd" placeholder="New Password" value="" required>\n
</div>\n
<div class="ui-field-contain">\n
<label>Repeat Password</label>\n
<input type="password" name="repeat_passwd" placeholder="Repeat Password" value="" required>\n
</div>\n
<input data-inline="true" type="submit" value="Submit" data-theme="b">\n
</form>\n
<pre style="white-space: pre-wrap;">{{message}}</pre>\n
</div>\n
<div class="ui-block-c">\n
</div>\n
</div>\n
</script>\n
<script class="message-template" type="text/x-handlebars-template"><li data-theme="{{theme}}" style="{{style}}"><pre style="white-space: pre-wrap;">{{text}}</pre></li></script>\n
\n
<script class="history-template" type="text/x-handlebars-template"><pre style="white-space: pre-wrap;">{{text}}</pre></script>\n
\n
<script class="error-template" type="text/x-handlebars-template"><pre style="white-space: pre-wrap;">{{error_message}}</pre></script>\n
<script class="header-template" type="text/x-handlebars-template">\n
{{#if left_url}}\n
<a href="{{left_url}}" class="ui-btn-left ui-btn ui-btn-inline ui-mini ui-corner-all">{{left_title}}</a>\n
......@@ -368,7 +407,7 @@
</item>
<item>
<key> <string>actor</string> </key>
<value> <string>klaus.woelfel</string> </value>
<value> <string>zope</string> </value>
</item>
<item>
<key> <string>comment</string> </key>
......@@ -382,7 +421,7 @@
</item>
<item>
<key> <string>serial</string> </key>
<value> <string>942.15924.54448.8823</string> </value>
<value> <string>944.5553.6477.32460</string> </value>
</item>
<item>
<key> <string>state</string> </key>
......@@ -400,8 +439,8 @@
</tuple>
<state>
<tuple>
<float>1428669417.76</float>
<string>UTC</string>
<float>1435739472.1</float>
<string>GMT</string>
</tuple>
</state>
</object>
......
......@@ -347,45 +347,69 @@
deferServerConnection(this);\n
})\n
\n
// .declareMethod(\'fetchRoster\', function () {\n
// var defer = RSVP.defer();\n
// \n
// function jsonifyResponse(domElt) {\n
// try {\n
// var result = [],\n
// elt,\n
// json_elt,\n
// len,\n
// i,\n
// len2,\n
// j,\n
// item_list = domElt.querySelectorAll("item");\n
// len = item_list.length;\n
// for (i = 0; i < len; i += 1) {\n
// elt = item_list[i];\n
// len2 = elt.attributes.length;\n
// json_elt = {};\n
// for (j = 0; j < len2; j += 1) {\n
// json_elt[elt.attributes[j].name] = elt.attributes[j].value;\n
// }\n
// result.push(json_elt);\n
// }\n
// defer.resolve(result);\n
// } catch (error) {\n
// defer.reject(error);\n
// }\n
// }\n
// \n
// this.props.connection.sendIQ(\n
// $iq({type: "get"}).c("query", {xmlns: Strophe.NS.ROSTER}),\n
// jsonifyResponse,\n
// defer.reject\n
// );\n
// \n
// return defer.promise;\n
// \n
// })\n
.declareMethod(\'fetchRoster\', function () {\n
var defer = RSVP.defer();\n
function jsonifyResponse(domElt) {\n
try {\n
var result = [],\n
elt,\n
json_elt,\n
len,\n
i,\n
len2,\n
j,\n
item_list = domElt.querySelectorAll("item");\n
len = item_list.length;\n
for (i = 0; i < len; i += 1) {\n
elt = item_list[i];\n
len2 = elt.attributes.length;\n
json_elt = {};\n
for (j = 0; j < len2; j += 1) {\n
json_elt[elt.attributes[j].name] = elt.attributes[j].value;\n
}\n
result.push(json_elt);\n
}\n
defer.resolve(result);\n
} catch (error) {\n
defer.reject(error);\n
}\n
}\n
this.props.connection.sendIQ(\n
$iq({type: "get"}).c("query", {xmlns: Strophe.NS.ROSTER}),\n
jsonifyResponse,\n
defer.reject\n
);\n
return defer.promise;\n
})\n
\n
.declareMethod(\'resetPassword\', function (server, new_passwd) {\n
var defer = RSVP.defer();\n
function jsonifyResponse(domElt) {\n
try {\n
var result = [],\n
type = domElt.getAttribute(\'type\');\n
if(type === "result") {\n
result.push("Password Reset Success.");\n
}\n
else {\n
throw new Error("Password Reset Failure.");\n
}\n
defer.resolve(result);\n
} catch (error) {\n
defer.reject(error);\n
}\n
}\n
var uid = this.props.jid.split(\'@\')[0];\n
this.props.connection.sendIQ(\n
$iq({to: server, type: "set"})\n
.c("query", {xmlns: "jabber:iq:register"})\n
.c("username").t(uid).up()\n
.c("password").t(new_passwd).up(),\n
jsonifyResponse,\n
defer.reject\n
);\n
return defer.promise;\n
})\n
.declareMethod(\'sendPresence\', function () {\n
this.props.connection.send(\n
$pres().tree()\n
......@@ -545,7 +569,7 @@
</item>
<item>
<key> <string>actor</string> </key>
<value> <string>romain</string> </value>
<value> <string>zope</string> </value>
</item>
<item>
<key> <string>comment</string> </key>
......@@ -559,7 +583,7 @@
</item>
<item>
<key> <string>serial</string> </key>
<value> <string>939.33961.3512.52974</string> </value>
<value> <string>944.5651.30805.18688</string> </value>
</item>
<item>
<key> <string>state</string> </key>
......@@ -577,7 +601,7 @@
</tuple>
<state>
<tuple>
<float>1418214516.59</float>
<float>1435744650.8</float>
<string>GMT</string>
</tuple>
</state>
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment