|
|
@ -24,28 +24,6 @@ void release_transport_system(PEP_SESSION session) |
|
|
|
// nothing yet |
|
|
|
} |
|
|
|
|
|
|
|
pEp_identity *identity_dup(const pEp_identity *src) |
|
|
|
{ |
|
|
|
assert(src); |
|
|
|
|
|
|
|
pEp_identity *dup = new_identity(src->address, src->fpr, src->user_id, src->username); |
|
|
|
assert(dup); |
|
|
|
if (dup == NULL) |
|
|
|
return NULL; |
|
|
|
|
|
|
|
dup->address_size = strlen(dup->address); |
|
|
|
dup->fpr_size = strlen(dup->fpr); |
|
|
|
dup->user_id_size = strlen(dup->user_id); |
|
|
|
dup->username_size = strlen(dup->username); |
|
|
|
dup->comm_type = src->comm_type; |
|
|
|
dup->lang[0] = src->lang[0]; |
|
|
|
dup->lang[1] = src->lang[1]; |
|
|
|
dup->lang[2] = 0; |
|
|
|
dup->me = src->me; |
|
|
|
|
|
|
|
return dup; |
|
|
|
} |
|
|
|
|
|
|
|
identity_list *new_identity_list(const pEp_identity *ident) |
|
|
|
{ |
|
|
|
identity_list *id_list = calloc(1, sizeof(identity_list)); |
|
|
@ -65,6 +43,26 @@ identity_list *new_identity_list(const pEp_identity *ident) |
|
|
|
return id_list; |
|
|
|
} |
|
|
|
|
|
|
|
identity_list *identity_list_dup(const identity_list *src) |
|
|
|
{ |
|
|
|
assert(src); |
|
|
|
|
|
|
|
identity_list *id_list = new_identity_list(src->ident); |
|
|
|
assert(id_list); |
|
|
|
if (id_list == NULL) |
|
|
|
return NULL; |
|
|
|
|
|
|
|
if (src->next) { |
|
|
|
id_list->next = identity_list_dup(src->next); |
|
|
|
if (id_list->next == NULL) { |
|
|
|
free_identity_list(id_list); |
|
|
|
return NULL; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
return id_list; |
|
|
|
} |
|
|
|
|
|
|
|
void free_identity_list(identity_list *id_list) |
|
|
|
{ |
|
|
|
if (id_list) { |
|
|
@ -100,7 +98,7 @@ identity_list *identity_list_add(identity_list *id_list, const pEp_identity *ide |
|
|
|
message *new_message( |
|
|
|
msg_direction dir, |
|
|
|
const pEp_identity *from, |
|
|
|
const pEp_identity *to, |
|
|
|
const identity_list *to, |
|
|
|
const char *shortmsg |
|
|
|
) |
|
|
|
{ |
|
|
@ -109,13 +107,15 @@ message *new_message( |
|
|
|
if (msg == NULL) |
|
|
|
return NULL; |
|
|
|
|
|
|
|
msg->shortmsg = strdup(shortmsg); |
|
|
|
assert(msg->shortmsg); |
|
|
|
if (msg->shortmsg == NULL) { |
|
|
|
free(msg); |
|
|
|
return NULL; |
|
|
|
if (msg->shortmsg) { |
|
|
|
msg->shortmsg = strdup(shortmsg); |
|
|
|
assert(msg->shortmsg); |
|
|
|
if (msg->shortmsg == NULL) { |
|
|
|
free(msg); |
|
|
|
return NULL; |
|
|
|
} |
|
|
|
msg->shortmsg_size = strlen(msg->shortmsg); |
|
|
|
} |
|
|
|
msg->shortmsg_size = strlen(msg->shortmsg); |
|
|
|
|
|
|
|
msg->dir = dir; |
|
|
|
|
|
|
@ -126,16 +126,7 @@ message *new_message( |
|
|
|
return NULL; |
|
|
|
} |
|
|
|
|
|
|
|
if (dir == dir_incoming) { |
|
|
|
msg->recv_by = identity_dup(to); |
|
|
|
assert(msg->recv_by); |
|
|
|
if (msg->recv_by == NULL) { |
|
|
|
free_message(msg); |
|
|
|
return NULL; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
msg->to = new_identity_list(to); |
|
|
|
msg->to = identity_list_dup(to); |
|
|
|
assert(msg->to); |
|
|
|
if (msg->to == NULL) { |
|
|
|
free_message(msg); |
|
|
|