Browse Source

correct swap of user_id and username

PYADPT-55
Volker Birk 7 years ago
parent
commit
eddf7b7a49
  1. 4
      src/identity.cc
  2. 2
      src/message.cc
  3. 4
      test/basic_doctest.py

4
src/identity.cc

@ -17,8 +17,8 @@ namespace pEp {
Identity::Identity(string address, string username, string user_id, Identity::Identity(string address, string username, string user_id,
string fpr, int comm_type, string lang, identity_flags_t flags) string fpr, int comm_type, string lang, identity_flags_t flags)
: _ident(new_identity(address.c_str(), fpr.c_str(), username.c_str(), : _ident(new_identity(address.c_str(), fpr.c_str(), user_id.c_str(),
user_id.c_str()), &::free_identity) username.c_str()), &::free_identity)
{ {
if (!_ident) if (!_ident)
throw bad_alloc(); throw bad_alloc();

2
src/message.cc

@ -358,6 +358,8 @@ namespace pEp {
static object update(Identity ident) static object update(Identity ident)
{ {
if (ident.address().empty())
throw runtime_error("at least address needed");
update_identity(adapter.session(), ident); update_identity(adapter.session(), ident);
return object(ident); return object(ident);
} }

4
test/basic_doctest.py

@ -1,11 +1,11 @@
""" """
>>> import pEp >>> import pEp
>>> me = pEp.Identity("alice.smith@peptest.ch", "23", "Alice Smith") >>> me = pEp.Identity("alice.smith@peptest.ch", "Alice Smith", "23")
>>> me.username >>> me.username
'Alice Smith' 'Alice Smith'
>>> print(me) >>> print(me)
Alice Smith <alice.smith@peptest.ch> Alice Smith <alice.smith@peptest.ch>
>>> you = pEp.Identity("bob.bourne@peptest.ch", "42", "Bob Bourne") >>> you = pEp.Identity("bob.bourne@peptest.ch", "Bob Bourne", "42")
>>> print(you) >>> print(you)
Bob Bourne <bob.bourne@peptest.ch> Bob Bourne <bob.bourne@peptest.ch>
>>> m = pEp.outgoing_message(me) >>> m = pEp.outgoing_message(me)

Loading…
Cancel
Save