pEp_utility.cpp
branchkeysync
changeset 172 112b0fac353d
parent 171 44bfd5428aa9
child 177 4d197f1c3abb
     1.1 --- a/pEp_utility.cpp	Mon Oct 03 19:15:35 2016 +0200
     1.2 +++ b/pEp_utility.cpp	Mon Oct 03 22:06:35 2016 +0200
     1.3 @@ -16,11 +16,11 @@
     1.4                  user_id = _ident->user_id;
     1.5              if (_ident->username)
     1.6                  username = _ident->username;
     1.7 -            comm_type = (pEp_comm_type) _ident->comm_type;
     1.8 +            comm_type = (pEpComType) _ident->comm_type;
     1.9              lang = _ident->lang;
    1.10          }
    1.11  
    1.12 -        pEp_identity_cpp::pEp_identity_cpp(const pEp_identity_s *_ident)
    1.13 +        pEp_identity_cpp::pEp_identity_cpp(const pEpIdentity *_ident)
    1.14              : me(false)
    1.15          {
    1.16              if (_ident->address)
    1.17 @@ -56,9 +56,9 @@
    1.18              return _ident;
    1.19          }
    1.20  
    1.21 -        pEp_identity_s * pEp_identity_cpp::to_pEp_identity_s()
    1.22 +        pEpIdentity * pEp_identity_cpp::to_pEp_identity_s()
    1.23          {
    1.24 -            pEp_identity_s *_ident = (pEp_identity_s *) calloc(1, sizeof(pEp_identity_s));
    1.25 +            pEpIdentity *_ident = (pEpIdentity *) calloc(1, sizeof(pEpIdentity));
    1.26              assert(_ident);
    1.27              if (_ident == NULL)
    1.28                  throw bad_alloc();
    1.29 @@ -73,11 +73,11 @@
    1.30              return _ident;
    1.31          }
    1.32  
    1.33 -        void copy_identity(pEp_identity_s * ident_s, const pEp_identity * ident)
    1.34 +        void copy_identity(pEpIdentity * ident_s, const pEp_identity * ident)
    1.35          {
    1.36              assert(ident_s);
    1.37  
    1.38 -            ::memset(ident_s, 0, sizeof(pEp_identity_s));
    1.39 +            ::memset(ident_s, 0, sizeof(pEpIdentity));
    1.40              if (ident) {
    1.41                  if (ident->address)
    1.42                      ident_s->address = utf16_bstr(ident->address);
    1.43 @@ -87,13 +87,13 @@
    1.44                      ident_s->user_id = utf16_bstr(ident->user_id);
    1.45                  if (ident->username)
    1.46                      ident_s->username = utf16_bstr(ident->username);
    1.47 -                ident_s->comm_type = (pEp_comm_type) ident->comm_type;
    1.48 +                ident_s->comm_type = (pEpComType) ident->comm_type;
    1.49                  if (ident->lang)
    1.50                      ident_s->lang = utf16_bstr(ident->lang);
    1.51              }
    1.52          }
    1.53  
    1.54 -        ::pEp_identity *new_identity(const pEp_identity_s * ident)
    1.55 +        ::pEp_identity *new_identity(const pEpIdentity * ident)
    1.56          {
    1.57              if (ident == NULL)
    1.58                  return NULL;
    1.59 @@ -162,7 +162,7 @@
    1.60              return utf16_bstr(s);
    1.61          }
    1.62  
    1.63 -        template<> blob *from_C< blob *, bloblist_t >(bloblist_t *tl)
    1.64 +        template<> Blob *from_C< Blob *, bloblist_t >(bloblist_t *tl)
    1.65          {
    1.66              CComSafeArray<BYTE> sa;
    1.67              sa.Create(tl->size);
    1.68 @@ -174,7 +174,7 @@
    1.69                  SafeArrayUnaccessData(sa);
    1.70              }
    1.71  
    1.72 -            blob *_blob = new blob();
    1.73 +            Blob *_blob = new Blob();
    1.74  
    1.75              _blob->value = sa.Detach();
    1.76              _blob->mime_type = bstr(tl->mime_type);
    1.77 @@ -204,7 +204,7 @@
    1.78              return sa;
    1.79          }
    1.80  
    1.81 -        void clear_identity_s(pEp_identity_s& ident)
    1.82 +        void clear_identity_s(pEpIdentity& ident)
    1.83          {
    1.84              SysFreeString(ident.address);
    1.85              SysFreeString(ident.fpr);
    1.86 @@ -212,12 +212,12 @@
    1.87              SysFreeString(ident.username);
    1.88              SysFreeString(ident.user_id);
    1.89  
    1.90 -            memset(&ident, 0, sizeof(pEp_identity_s));
    1.91 +            memset(&ident, 0, sizeof(pEpIdentity));
    1.92          }
    1.93  
    1.94 -        template<> pEp_identity_s from_C< pEp_identity_s, pEp_identity >(pEp_identity *tl)
    1.95 +        template<> pEpIdentity from_C< pEpIdentity, pEp_identity >(pEp_identity *tl)
    1.96          {
    1.97 -            pEp_identity_s _ident;
    1.98 +            pEpIdentity _ident;
    1.99              memset(&_ident, 0, sizeof(_ident));
   1.100  
   1.101              if (tl)
   1.102 @@ -225,15 +225,15 @@
   1.103              return _ident;
   1.104          }
   1.105  
   1.106 -        pEp_identity_s identity_s(pEp_identity *ident)
   1.107 +        pEpIdentity identity_s(pEp_identity *ident)
   1.108          {
   1.109 -            return from_C< pEp_identity_s, pEp_identity >(ident);
   1.110 +            return from_C< pEpIdentity, pEp_identity >(ident);
   1.111          }
   1.112  
   1.113 -        template<> pEp_identity_s *from_C< pEp_identity_s *, identity_list >(identity_list *il)
   1.114 +        template<> pEpIdentity *from_C< pEpIdentity *, identity_list >(identity_list *il)
   1.115          {
   1.116 -            pEp_identity_s *ident = new pEp_identity_s();
   1.117 -            memset(ident, 0, sizeof(pEp_identity_s));
   1.118 +            pEpIdentity *ident = new pEpIdentity();
   1.119 +            memset(ident, 0, sizeof(pEpIdentity));
   1.120  
   1.121              if (il)
   1.122                  copy_identity(ident, il->ident);
   1.123 @@ -265,7 +265,7 @@
   1.124              return stringpair_list_length(tl);
   1.125          }
   1.126  
   1.127 -        void clear_text_message(text_message *msg)
   1.128 +        void clear_text_message(TextMessage *msg)
   1.129          {
   1.130              SysFreeString(msg->id);
   1.131              SysFreeString(msg->shortmsg);
   1.132 @@ -283,32 +283,32 @@
   1.133              SysFreeString(msg->comments);
   1.134              SafeArrayDestroy(msg->opt_fields);
   1.135  
   1.136 -            memset(msg, 0, sizeof(text_message));
   1.137 +            memset(msg, 0, sizeof(TextMessage));
   1.138          }
   1.139  
   1.140 -        void text_message_from_C(text_message *msg2, const ::message *msg)
   1.141 +        void text_message_from_C(TextMessage *msg2, const ::message *msg)
   1.142          {
   1.143              assert(msg2);
   1.144              assert(msg);
   1.145  
   1.146              clear_text_message(msg2);
   1.147  
   1.148 -            msg2->dir = (pEp_msg_direction) msg->dir;
   1.149 +            msg2->dir = (pEpMsgDirection) msg->dir;
   1.150              msg2->id = bstr(msg->id);
   1.151              msg2->shortmsg = bstr(msg->shortmsg);
   1.152              msg2->longmsg = bstr(msg->longmsg);
   1.153              msg2->longmsg_formatted = bstr(msg->longmsg_formatted);
   1.154 -            msg2->attachments = array_from_C<blob, bloblist_t>(msg->attachments);
   1.155 +            msg2->attachments = array_from_C<Blob, bloblist_t>(msg->attachments);
   1.156              if (msg->sent)
   1.157                  msg2->sent = mktime(msg->sent);
   1.158              if (msg->recv)
   1.159                  msg2->recv = mktime(msg->recv);
   1.160              msg2->from = identity_s(msg->from);
   1.161 -            msg2->to = array_from_C<pEp_identity_s, identity_list>(msg->to);
   1.162 +            msg2->to = array_from_C<pEpIdentity, identity_list>(msg->to);
   1.163              msg2->recv_by = identity_s(msg->recv_by);
   1.164 -            msg2->cc = array_from_C<pEp_identity_s, identity_list>(msg->cc);
   1.165 -            msg2->bcc = array_from_C<pEp_identity_s, identity_list>(msg->bcc);
   1.166 -            msg2->reply_to = array_from_C<pEp_identity_s, identity_list>(msg->reply_to);
   1.167 +            msg2->cc = array_from_C<pEpIdentity, identity_list>(msg->cc);
   1.168 +            msg2->bcc = array_from_C<pEpIdentity, identity_list>(msg->bcc);
   1.169 +            msg2->reply_to = array_from_C<pEpIdentity, identity_list>(msg->reply_to);
   1.170              msg2->references = string_array(msg->references);
   1.171              msg2->keywords = string_array(msg->keywords);
   1.172              msg2->comments = bstr(msg->comments);
   1.173 @@ -325,12 +325,12 @@
   1.174              return _s;
   1.175          }
   1.176  
   1.177 -        void clear_blob(blob& b)
   1.178 +        void clear_blob(Blob& b)
   1.179          {
   1.180              SysFreeString(b.filename);
   1.181              SysFreeString(b.mime_type);
   1.182              SafeArrayDestroy(b.value);
   1.183 -            memset(&b, 0, sizeof(blob));
   1.184 +            memset(&b, 0, sizeof(Blob));
   1.185          }
   1.186  
   1.187          bloblist_t *bloblist(SAFEARRAY *sa)
   1.188 @@ -352,8 +352,8 @@
   1.189  
   1.190              bloblist_t *_bl = bl;
   1.191              for (LONG i = lbound; i <= ubound; i++) {
   1.192 -                blob b;
   1.193 -                memset(&b, 0, sizeof(blob));
   1.194 +                Blob b;
   1.195 +                memset(&b, 0, sizeof(Blob));
   1.196                  SafeArrayGetElement(sa, &i, &b);
   1.197  
   1.198                  LONG _lbound, _ubound;
   1.199 @@ -410,8 +410,8 @@
   1.200  
   1.201              identity_list *_il = il;
   1.202              for (LONG i = lbound; i <= ubound; i++) {
   1.203 -                pEp_identity_s s;
   1.204 -                memset(&s, 0, sizeof(pEp_identity_s));
   1.205 +                pEpIdentity s;
   1.206 +                memset(&s, 0, sizeof(pEpIdentity));
   1.207                  SafeArrayGetElement(sa, &i, &s);
   1.208  
   1.209                  pEp_identity *ident;
   1.210 @@ -493,7 +493,7 @@
   1.211              return il;
   1.212          }
   1.213          
   1.214 -        ::message * text_message_to_C(text_message *msg)
   1.215 +        ::message * text_message_to_C(TextMessage *msg)
   1.216          {
   1.217              assert(msg);
   1.218