TextMessage.cpp
changeset 32 b9e23540d7fd
parent 31 83a083fb4810
     1.1 --- a/TextMessage.cpp	Sat May 30 15:53:25 2015 +0200
     1.2 +++ b/TextMessage.cpp	Sat May 30 19:36:36 2015 +0200
     1.3 @@ -28,7 +28,7 @@
     1.4      assert(pVal);
     1.5  
     1.6      try {
     1.7 -        copy_identity(pVal, msg->from);
     1.8 +        copy_identity(pVal, msg()->from);
     1.9      }
    1.10      catch (bad_alloc&) {
    1.11          return E_OUTOFMEMORY;
    1.12 @@ -58,8 +58,8 @@
    1.13          return E_FAIL;
    1.14      }
    1.15  
    1.16 -    ::free_identity(msg->from);
    1.17 -    msg->from = _from;
    1.18 +    ::free_identity(msg()->from);
    1.19 +    msg()->from = _from;
    1.20      return S_OK;
    1.21  }
    1.22  
    1.23 @@ -164,12 +164,12 @@
    1.24  
    1.25  STDMETHODIMP CTextMessage::get_to(LPSAFEARRAY * pVal)
    1.26  {
    1.27 -    return il_get(msg->to, pVal);
    1.28 +    return il_get(msg()->to, pVal);
    1.29  }
    1.30  
    1.31  STDMETHODIMP CTextMessage::put_to(SAFEARRAY * newVal)
    1.32  {
    1.33 -    return il_put(&msg->to, newVal);
    1.34 +    return il_put(&msg()->to, newVal);
    1.35  }
    1.36  
    1.37  STDMETHODIMP CTextMessage::get_recv_by(pEp_identity_s* pVal)
    1.38 @@ -177,7 +177,7 @@
    1.39      assert(pVal);
    1.40  
    1.41      try {
    1.42 -        copy_identity(pVal, msg->recv_by);
    1.43 +        copy_identity(pVal, msg()->recv_by);
    1.44      }
    1.45      catch (bad_alloc&) {
    1.46          return E_OUTOFMEMORY;
    1.47 @@ -206,53 +206,53 @@
    1.48          return E_FAIL;
    1.49      }
    1.50  
    1.51 -    ::free_identity(msg->recv_by);
    1.52 -    msg->recv_by = _recv_by;
    1.53 +    ::free_identity(msg()->recv_by);
    1.54 +    msg()->recv_by = _recv_by;
    1.55      return S_OK;
    1.56  }
    1.57  
    1.58  STDMETHODIMP CTextMessage::get_cc(LPSAFEARRAY * pVal)
    1.59  {
    1.60 -    return il_get(msg->cc, pVal);
    1.61 +    return il_get(msg()->cc, pVal);
    1.62  }
    1.63  
    1.64  STDMETHODIMP CTextMessage::put_cc(SAFEARRAY * newVal)
    1.65  {
    1.66 -    return il_put(&msg->cc, newVal);
    1.67 +    return il_put(&msg()->cc, newVal);
    1.68  }
    1.69  
    1.70  STDMETHODIMP CTextMessage::get_bcc(LPSAFEARRAY * pVal)
    1.71  {
    1.72 -    return il_get(msg->bcc, pVal);
    1.73 +    return il_get(msg()->bcc, pVal);
    1.74  }
    1.75  
    1.76  STDMETHODIMP CTextMessage::put_bcc(SAFEARRAY * newVal)
    1.77  {
    1.78 -    return il_put(&msg->bcc, newVal);
    1.79 +    return il_put(&msg()->bcc, newVal);
    1.80  }
    1.81  
    1.82  STDMETHODIMP CTextMessage::get_reply_to(LPSAFEARRAY * pVal)
    1.83  {
    1.84 -    return il_get(msg->reply_to, pVal);
    1.85 +    return il_get(msg()->reply_to, pVal);
    1.86  }
    1.87  
    1.88  STDMETHODIMP CTextMessage::put_reply_to(SAFEARRAY * newVal)
    1.89  {
    1.90 -    return il_put(&msg->reply_to, newVal);
    1.91 +    return il_put(&msg()->reply_to, newVal);
    1.92  }
    1.93  
    1.94  STDMETHODIMP CTextMessage::get_dir(pEp_msg_direction *pVal)
    1.95  {
    1.96      assert(pVal);
    1.97  
    1.98 -    *pVal = (pEp_msg_direction) msg->dir;
    1.99 +    *pVal = (pEp_msg_direction) msg()->dir;
   1.100  
   1.101      return S_OK;
   1.102  }
   1.103  
   1.104  STDMETHODIMP CTextMessage::put_dir(pEp_msg_direction newVal)
   1.105  {
   1.106 -    msg->dir = (PEP_msg_direction) newVal;
   1.107 +    msg()->dir = (PEP_msg_direction) newVal;
   1.108  
   1.109      return S_OK;
   1.110  }
   1.111 @@ -263,9 +263,9 @@
   1.112  
   1.113      _bstr_t val;
   1.114  
   1.115 -    if (msg->id) {
   1.116 +    if (msg()->id) {
   1.117          try {
   1.118 -            val = utf16_bstr(msg->id);
   1.119 +            val = utf16_bstr(msg()->id);
   1.120          }
   1.121          catch (bad_alloc&) {
   1.122              return E_OUTOFMEMORY;
   1.123 @@ -300,10 +300,10 @@
   1.124              return E_OUTOFMEMORY;
   1.125      }
   1.126  
   1.127 -    if (msg->id)
   1.128 -        free(msg->id);
   1.129 +    if (msg()->id)
   1.130 +        free(msg()->id);
   1.131  
   1.132 -    msg->id = _val;
   1.133 +    msg()->id = _val;
   1.134      return S_OK;
   1.135  }
   1.136  
   1.137 @@ -313,9 +313,9 @@
   1.138  
   1.139      _bstr_t val;
   1.140  
   1.141 -    if (msg->shortmsg) {
   1.142 +    if (msg()->shortmsg) {
   1.143          try {
   1.144 -            val = utf16_bstr(msg->shortmsg);
   1.145 +            val = utf16_bstr(msg()->shortmsg);
   1.146          }
   1.147          catch (bad_alloc&) {
   1.148              return E_OUTOFMEMORY;
   1.149 @@ -351,10 +351,10 @@
   1.150              return E_OUTOFMEMORY;
   1.151      }
   1.152  
   1.153 -    if (msg->shortmsg)
   1.154 -        free(msg->shortmsg);
   1.155 +    if (msg()->shortmsg)
   1.156 +        free(msg()->shortmsg);
   1.157  
   1.158 -    msg->shortmsg = _val;
   1.159 +    msg()->shortmsg = _val;
   1.160      return S_OK;
   1.161  }
   1.162  
   1.163 @@ -364,9 +364,9 @@
   1.164  
   1.165      _bstr_t val;
   1.166  
   1.167 -    if (msg->longmsg) {
   1.168 +    if (msg()->longmsg) {
   1.169          try {
   1.170 -            val = utf16_bstr(msg->longmsg);
   1.171 +            val = utf16_bstr(msg()->longmsg);
   1.172          }
   1.173          catch (bad_alloc&) {
   1.174              return E_OUTOFMEMORY;
   1.175 @@ -402,10 +402,10 @@
   1.176              return E_OUTOFMEMORY;
   1.177      }
   1.178  
   1.179 -    if (msg->longmsg)
   1.180 -        free(msg->longmsg);
   1.181 +    if (msg()->longmsg)
   1.182 +        free(msg()->longmsg);
   1.183  
   1.184 -    msg->longmsg = _val;
   1.185 +    msg()->longmsg = _val;
   1.186      return S_OK;
   1.187  }
   1.188  
   1.189 @@ -415,9 +415,9 @@
   1.190  
   1.191      _bstr_t val;
   1.192  
   1.193 -    if (msg->longmsg_formatted) {
   1.194 +    if (msg()->longmsg_formatted) {
   1.195          try {
   1.196 -            val = utf16_bstr(msg->longmsg_formatted);
   1.197 +            val = utf16_bstr(msg()->longmsg_formatted);
   1.198          }
   1.199          catch (bad_alloc&) {
   1.200              return E_OUTOFMEMORY;
   1.201 @@ -453,10 +453,10 @@
   1.202              return E_OUTOFMEMORY;
   1.203      }
   1.204  
   1.205 -    if (msg->longmsg_formatted)
   1.206 -        free(msg->longmsg_formatted);
   1.207 +    if (msg()->longmsg_formatted)
   1.208 +        free(msg()->longmsg_formatted);
   1.209  
   1.210 -    msg->longmsg_formatted = _val;
   1.211 +    msg()->longmsg_formatted = _val;
   1.212      return S_OK;
   1.213  }
   1.214  
   1.215 @@ -508,14 +508,14 @@
   1.216          }
   1.217      }
   1.218  
   1.219 -    bloblist_t *blob = bloblist_add(msg->attachments, _data, len, _mime_type.c_str(), _filename.c_str());
   1.220 +    bloblist_t *blob = bloblist_add(msg()->attachments, _data, len, _mime_type.c_str(), _filename.c_str());
   1.221      if (blob == NULL) {
   1.222          free(_data);
   1.223          return E_OUTOFMEMORY;
   1.224      }
   1.225  
   1.226 -    if (msg->attachments == NULL)
   1.227 -        msg->attachments = blob;
   1.228 +    if (msg()->attachments == NULL)
   1.229 +        msg()->attachments = blob;
   1.230  
   1.231      return S_OK;
   1.232  }
   1.233 @@ -524,13 +524,13 @@
   1.234  {
   1.235      assert(result);
   1.236  
   1.237 -    if (msg->attachments == NULL || msg->attachments->data == NULL) {
   1.238 +    if (msg()->attachments == NULL || msg()->attachments->data == NULL) {
   1.239          m_next_attachment = NULL;
   1.240          *result = false;
   1.241          return S_OK;
   1.242      }
   1.243  
   1.244 -    m_next_attachment = msg->attachments;
   1.245 +    m_next_attachment = msg()->attachments;
   1.246      *result = true;
   1.247  
   1.248      return S_OK;
   1.249 @@ -596,10 +596,10 @@
   1.250  {
   1.251      assert(result);
   1.252  
   1.253 -    if (msg->sent == NULL)
   1.254 +    if (msg()->sent == NULL)
   1.255          return E_NOT_SET;
   1.256  
   1.257 -    *result = mktime(msg->sent);
   1.258 +    *result = mktime(msg()->sent);
   1.259      return S_OK;
   1.260  }
   1.261  
   1.262 @@ -609,9 +609,9 @@
   1.263      if (ts == NULL)
   1.264          return E_OUTOFMEMORY;
   1.265  
   1.266 -    if (msg->sent)
   1.267 -        free_timestamp(msg->sent);
   1.268 -    msg->sent = ts;
   1.269 +    if (msg()->sent)
   1.270 +        free_timestamp(msg()->sent);
   1.271 +    msg()->sent = ts;
   1.272  
   1.273      return S_OK;
   1.274  }
   1.275 @@ -620,10 +620,10 @@
   1.276  {
   1.277      assert(result);
   1.278  
   1.279 -    if (msg->recv == NULL)
   1.280 +    if (msg()->recv == NULL)
   1.281          return E_NOT_SET;
   1.282  
   1.283 -    *result = mktime(msg->recv);
   1.284 +    *result = mktime(msg()->recv);
   1.285      return S_OK;
   1.286  }
   1.287  
   1.288 @@ -633,9 +633,9 @@
   1.289      if (ts == NULL)
   1.290          return E_OUTOFMEMORY;
   1.291  
   1.292 -    if (msg->recv)
   1.293 -        free_timestamp(msg->recv);
   1.294 -    msg->recv = ts;
   1.295 +    if (msg()->recv)
   1.296 +        free_timestamp(msg()->recv);
   1.297 +    msg()->recv = ts;
   1.298  
   1.299      return S_OK;
   1.300  }
   1.301 @@ -646,8 +646,8 @@
   1.302  
   1.303      CComSafeArray<BSTR> sa;
   1.304      try {
   1.305 -        if (msg->references) {
   1.306 -            sa = string_array(msg->references);
   1.307 +        if (msg()->references) {
   1.308 +            sa = string_array(msg()->references);
   1.309          }
   1.310          else {
   1.311              sa.Create(0UL);
   1.312 @@ -680,10 +680,10 @@
   1.313          return E_FAIL;
   1.314      }
   1.315  
   1.316 -    if (msg->references)
   1.317 -        free_stringlist(msg->references);
   1.318 +    if (msg()->references)
   1.319 +        free_stringlist(msg()->references);
   1.320  
   1.321 -    msg->references = sl;
   1.322 +    msg()->references = sl;
   1.323  
   1.324      return S_OK;
   1.325  }
   1.326 @@ -694,8 +694,8 @@
   1.327  
   1.328      CComSafeArray<BSTR> sa;
   1.329      try {
   1.330 -        if (msg->keywords) {
   1.331 -            sa = string_array(msg->keywords);
   1.332 +        if (msg()->keywords) {
   1.333 +            sa = string_array(msg()->keywords);
   1.334          }
   1.335          else {
   1.336              sa.Create(0UL);
   1.337 @@ -728,10 +728,10 @@
   1.338          return E_FAIL;
   1.339      }
   1.340  
   1.341 -    if (msg->keywords)
   1.342 -        free_stringlist(msg->keywords);
   1.343 +    if (msg()->keywords)
   1.344 +        free_stringlist(msg()->keywords);
   1.345  
   1.346 -    msg->keywords = sl;
   1.347 +    msg()->keywords = sl;
   1.348  
   1.349      return S_OK;
   1.350  }
   1.351 @@ -742,9 +742,9 @@
   1.352  
   1.353      _bstr_t val;
   1.354  
   1.355 -    if (msg->comments) {
   1.356 +    if (msg()->comments) {
   1.357          try {
   1.358 -            val = utf16_bstr(msg->comments);
   1.359 +            val = utf16_bstr(msg()->comments);
   1.360          }
   1.361          catch (bad_alloc&) {
   1.362              return E_OUTOFMEMORY;
   1.363 @@ -780,10 +780,10 @@
   1.364              return E_OUTOFMEMORY;
   1.365      }
   1.366  
   1.367 -    if (msg->comments)
   1.368 -        free(msg->comments);
   1.369 +    if (msg()->comments)
   1.370 +        free(msg()->comments);
   1.371  
   1.372 -    msg->comments = _val;
   1.373 +    msg()->comments = _val;
   1.374      return S_OK;
   1.375  }
   1.376  
   1.377 @@ -791,10 +791,10 @@
   1.378  {
   1.379      assert(pVal);
   1.380  
   1.381 -    if (msg->opt_fields == NULL)
   1.382 +    if (msg()->opt_fields == NULL)
   1.383          return S_OK;
   1.384  
   1.385 -    int len = stringpair_list_length(msg->opt_fields);
   1.386 +    int len = stringpair_list_length(msg()->opt_fields);
   1.387  
   1.388      LPSAFEARRAY sa = newSafeArray<struct opt_field>(len);
   1.389      if (sa == NULL)
   1.390 @@ -802,7 +802,7 @@
   1.391  
   1.392      stringpair_list_t *il;
   1.393      LONG i;
   1.394 -    for (i = 0, il = msg->opt_fields; il && il->value; il = il->next, i++) {
   1.395 +    for (i = 0, il = msg()->opt_fields; il && il->value; il = il->next, i++) {
   1.396          opt_field fld;
   1.397          memset(&fld, 0, sizeof(opt_field));
   1.398  
   1.399 @@ -875,8 +875,8 @@
   1.400          }
   1.401      }
   1.402  
   1.403 -    free_stringpair_list(msg->opt_fields);
   1.404 -    msg->opt_fields = il;
   1.405 +    free_stringpair_list(msg()->opt_fields);
   1.406 +    msg()->opt_fields = il;
   1.407  
   1.408      return S_OK;
   1.409  }