Browse Source

beautiful names require lots of casting

AllGroupDevicesShowHandshake
Volker Birk 6 years ago
parent
commit
334a173330
3 changed files with 43 additions and 34 deletions
  1. +2
    -2
      src/Identity.cc
  2. +16
    -16
      src/Identity.hh
  3. +25
    -16
      src/pEpmodule.cc

+ 2
- 2
src/Identity.cc View File

@ -31,7 +31,7 @@ namespace pEp {
return _ident;
}
void Identity::set_lang(string value)
void Identity::lang(string value)
{
if (value == "")
memset(_ident->lang, 0, 3);
@ -41,7 +41,7 @@ namespace pEp {
memcpy(_ident->lang, value.data(), 2);
}
string Identity::get_lang()
string Identity::lang()
{
return _ident->lang;
}


+ 16
- 16
src/Identity.hh View File

@ -19,29 +19,29 @@ namespace pEp {
~Identity();
operator pEp_identity *();
void set_address(string value) { str_attr(_ident->address, value); }
string get_address() { return str_attr(_ident->address); }
void address(string value) { str_attr(_ident->address, value); }
string address() { return str_attr(_ident->address); }
void set_fpr(string value) { str_attr(_ident->fpr, value); }
string get_fpr() { return str_attr(_ident->fpr); }
void fpr(string value) { str_attr(_ident->fpr, value); }
string fpr() { return str_attr(_ident->fpr); }
void set_user_id(string value) { str_attr(_ident->user_id, value); }
string get_user_id() { return str_attr(_ident->user_id); }
void user_id(string value) { str_attr(_ident->user_id, value); }
string user_id() { return str_attr(_ident->user_id); }
void set_username(string value) { str_attr(_ident->username, value); }
string get_username() { return str_attr(_ident->username); }
void username(string value) { str_attr(_ident->username, value); }
string username() { return str_attr(_ident->username); }
void set_comm_type(PEP_comm_type value) { _ident->comm_type = value; };
PEP_comm_type get_comm_type() { return _ident->comm_type; }
void comm_type(PEP_comm_type value) { _ident->comm_type = value; };
PEP_comm_type comm_type() { return _ident->comm_type; }
void set_lang(std::string value);
std::string get_lang();
void lang(std::string value);
std::string lang();
void set_me(bool value) { _ident->me = value; }
bool get_me() { return _ident->me; }
void me(bool value) { _ident->me = value; }
bool me() { return _ident->me; }
void set_flags(identity_flags_t flags) { _ident->flags = flags; }
identity_flags_t get_flags() { return _ident->flags; }
void flags(identity_flags_t flags) { _ident->flags = flags; }
identity_flags_t flags() { return _ident->flags; }
};
}
}


+ 25
- 16
src/pEpmodule.cc View File

@ -26,21 +26,30 @@ BOOST_PYTHON_MODULE(pEp)
def("about", about, "delivers the p≡p about string");
class_<Identity>("Identity", "p≡p identity")
.add_property("address", &Identity::get_address,
&Identity::set_address, "email address or URI")
.add_property("fpr", &Identity::get_fpr,
&Identity::set_fpr, "key ID (fingerprint)")
.add_property("user_id", &Identity::get_user_id,
&Identity::set_user_id, "ID of person associated")
.add_property("username", &Identity::get_username,
&Identity::set_username, "name of person associated")
.add_property("comm_type", &Identity::get_comm_type,
&Identity::set_comm_type, "communication type (p≡p internal)")
.add_property("lang", &Identity::get_lang,
&Identity::set_lang, "ISO 639-1 language code")
.add_property("me", &Identity::get_me,
&Identity::set_me, "true if own identity, false otherwise")
.add_property("flags", &Identity::get_flags,
&Identity::set_flags);
.add_property("address", (string(Identity::*)()) &Identity::address,
(void(Identity::*)(string)) &Identity::address,
"email address or URI")
.add_property("fpr", (string(Identity::*)()) &Identity::fpr,
(void(Identity::*)(string)) &Identity::fpr,
"key ID (fingerprint)")
.add_property("user_id", (string(Identity::*)()) &Identity::user_id,
(void(Identity::*)(string)) &Identity::user_id,
"ID of person associated")
.add_property("username", (string(Identity::*)()) &Identity::username,
(void(Identity::*)(string)) &Identity::username,
"name of person associated")
.add_property("comm_type", (int(Identity::*)())
(PEP_comm_type(Identity::*)()) &Identity::comm_type,
(void(Identity::*)(int))
(void(Identity::*)(PEP_comm_type)) &Identity::comm_type,
"communication type (p≡p internal)")
.add_property("lang", (string(Identity::*)()) &Identity::lang,
(void(Identity::*)(string)) &Identity::lang,
"ISO 639-1 language code")
.add_property("me", (bool(Identity::*)()) &Identity::me,
(void(Identity::*)(bool)) &Identity::me,
"true if own identity, false otherwise")
.add_property("flags", (identity_flags_t(Identity::*)()) &Identity::flags,
(void(Identity::*)(identity_flags_t)) &Identity::flags);
}

Loading…
Cancel
Save