Browse Source

version "(10) Kreuz Köln-West": more fields in "message", fix a bug in from_json<pep_identity*>

refactor-result-recursion
Roker 6 years ago
parent
commit
29355d358f
4 changed files with 36 additions and 5 deletions
  1. +1
    -1
      html/index.html
  2. +28
    -1
      html/interactive.js
  3. +2
    -1
      server/mt-server.cc
  4. +5
    -2
      server/pep-types.cc

+ 1
- 1
html/index.html View File

@ -52,7 +52,7 @@
</form>
<form id="frm_2" name="frm_2">
<textarea placeholder="Just a scratchboard for text copy & paste :-)" rows="20" columns="66">
<textarea placeholder="Just a scratchboard for text copy & paste :-)" rows="20" cols="66">
</textarea>
</form>


+ 28
- 1
html/interactive.js View File

@ -84,11 +84,16 @@ var Param2Form =
},
Message : function(nr, pp, value)
{
if(pp.direction=='Out')
return 'Message (output)';
return 'Message:<table class="smalltable">'
+ '<tr><td>id: </td><td>' + genInput('inp_param_' + nr + '_id', 16, pp.direction, "id") + '</td></tr>'
+ '<tr><td>shortmsg: </td><td>' + genInput('inp_param_' + nr + '_smsg', 25, pp.direction, "shortmsg") + '</td></tr>'
+ '<tr><td>longmsg: </td><td>' + genInput('inp_param_' + nr + '_lmsg', 25, pp.direction, "longmsg") + '</td></tr>'
+ '<tr><td>from: </td><td>' + Param2Form.Identity( nr + '_from', pp.direction, "(from)") + '</td></tr>'
+ '<tr><td>to: </td><td>' + Param2Form.IdentityList( nr + '_to', pp.direction, "(to)") + '</td></tr>'
+ '</table>';
},
Identity : function(nr, pp, value)
@ -100,6 +105,15 @@ var Param2Form =
+ '<tr><td>fingerprint: </td><td>' + genInput('inp_param_' + nr + '_fpr', 25, pp.direction, "fingerprint") + '</td></tr>'
+ '</table>';
},
IdentityList : function(nr, pp, value)
{
return 'IdentityList (only 1 entry supported here):<table class="smalltable">'
+ '<tr><td>user_id: </td><td>' + genInput('inp_param_' + nr + '_id', 16, pp.direction, "id") + '</td></tr>'
+ '<tr><td>username: </td><td>' + genInput('inp_param_' + nr + '_name', 16, pp.direction, "name") + '</td></tr>'
+ '<tr><td>address: </td><td>' + genInput('inp_param_' + nr + '_addr', 25, pp.direction, "address") + '</td></tr>'
+ '<tr><td>fingerprint: </td><td>' + genInput('inp_param_' + nr + '_fpr', 25, pp.direction, "fingerprint") + '</td></tr>'
+ '</table>';
},
PEP_enc_format : function(nr, pp, value)
{
var disabled = pp.direction == 'Out' ? " disabled" : "";
@ -142,7 +156,9 @@ var Form2Param =
var ret = {};
ret.id = document.getElementById('inp_param_' + nr + '_id').value;
ret.shortmsg = document.getElementById('inp_param_' + nr + '_smsg').value;
ret.longmsg = document.getElementById('inp_param_' + nr + '_lmsg').value;
ret.from = Form2Param.Identity( nr + '_from');
ret.to = Form2Param.IdentityList( nr + '_to');
return ret;
},
Identity : function(nr, pp, value)
@ -154,6 +170,17 @@ var Form2Param =
ret.fpr = document.getElementById('inp_param_' + nr + '_fpr').value;
return ret;
},
IdentityList : function(nr, pp, value)
{
var iden = {};
iden.user_id = document.getElementById('inp_param_' + nr + '_id').value;
iden.username = document.getElementById('inp_param_' + nr + '_name').value;
iden.address = document.getElementById('inp_param_' + nr + '_addr').value;
iden.fpr = document.getElementById('inp_param_' + nr + '_fpr').value;
var ret = [];
ret.push(iden);
return ret;
},
PEP_enc_format : function(nr, pp, value)
{
return parseInt( $('input[name=inp_rad_' + nr + ']:checked', '#frm').val() );


+ 2
- 1
server/mt-server.cc View File

@ -51,7 +51,8 @@ const std::string server_version =
// "(7b) Elsdorf"; // add own_key functions, which are new in the pEp Engine
// "(8) Kerpen"; // pEp_identity fixes due to changes in the pEp Engine
// "(8a) Kreuz Kerpen"; // remove own_key_add() because pEpEngine doesn't have it anymore.
"(9a) Frechen-Königsdorf"; // add security-token
// "(9a) Frechen-Königsdorf"; // add security-token
"(10) Kreuz Köln-West"; // More fields in JavaScript for "message", 1-element identity list to support message->to attribute
template<>


+ 5
- 2
server/pep-types.cc View File

@ -229,8 +229,11 @@ pEp_identity* from_json<pEp_identity*>(const js::Value& v)
free(address);
ident->comm_type = from_json_object<PEP_comm_type, js::int_type>(o, "comm_type");
strncpy(ident->lang, lang, 3);
free(lang);
if(lang)
{
strncpy(ident->lang, lang, 3);
free(lang);
}
ident->me = from_json_object<bool, js::bool_type>(o, "me");
return ident;


Loading…
Cancel
Save