mirror of
https://github.com/servalproject/serval-dna.git
synced 2024-12-19 05:07:56 +00:00
Pass identity name as meshmb manifest name
This commit is contained in:
parent
eff46c9030
commit
84caa24d0f
7
meshmb.c
7
meshmb.c
@ -9,9 +9,10 @@
|
||||
#include "commandline.h"
|
||||
#include "overlay_buffer.h"
|
||||
|
||||
int meshmb_send(keyring_identity *id, const char *message, size_t message_len,
|
||||
int meshmb_send(const keyring_identity *id, const char *message, size_t message_len,
|
||||
unsigned nassignments, const struct rhizome_manifest_field_assignment *assignments){
|
||||
|
||||
const char *did=NULL, *name=NULL;
|
||||
struct message_ply ply;
|
||||
bzero(&ply, sizeof ply);
|
||||
|
||||
@ -23,8 +24,8 @@ int meshmb_send(keyring_identity *id, const char *message, size_t message_len,
|
||||
message_ply_append_timestamp(b);
|
||||
assert(!ob_overrun(b));
|
||||
|
||||
// TODO add id card details to manifest
|
||||
int ret = message_ply_append(id, RHIZOME_SERVICE_MESHMB, NULL, &ply, b, nassignments, assignments);
|
||||
keyring_identity_extract(id, &did, &name);
|
||||
int ret = message_ply_append(id, RHIZOME_SERVICE_MESHMB, NULL, &ply, b, name, nassignments, assignments);
|
||||
ob_free(b);
|
||||
|
||||
return ret;
|
||||
|
4
meshmb.h
4
meshmb.h
@ -1,7 +1,7 @@
|
||||
#ifndef __SERVAL_DNA__MESHMB_H
|
||||
#define __SERVAL_DNA__MESHMB_H
|
||||
|
||||
int meshmb_send(keyring_identity *id, const char *message, size_t message_len,
|
||||
int meshmb_send(const keyring_identity *id, const char *message, size_t message_len,
|
||||
unsigned nassignments, const struct rhizome_manifest_field_assignment *assignments);
|
||||
|
||||
#endif
|
||||
#endif
|
||||
|
4
meshms.c
4
meshms.c
@ -305,7 +305,7 @@ static enum meshms_status update_conversation(const keyring_identity *id, struct
|
||||
message_ply_append_timestamp(b);
|
||||
assert(!ob_overrun(b));
|
||||
|
||||
if (message_ply_append(id, RHIZOME_SERVICE_MESHMS2, &conv->them, &conv->my_ply, b, 0, NULL)!=0){
|
||||
if (message_ply_append(id, RHIZOME_SERVICE_MESHMS2, &conv->them, &conv->my_ply, b, NULL, 0, NULL)!=0){
|
||||
status = MESHMS_STATUS_ERROR;
|
||||
}else{
|
||||
conv->metadata.my_last_ack = conv->metadata.their_last_message;
|
||||
@ -916,7 +916,7 @@ enum meshms_status meshms_send_message(const sid_t *sender, const sid_t *recipie
|
||||
|
||||
assert(!ob_overrun(b));
|
||||
|
||||
if (message_ply_append(id, RHIZOME_SERVICE_MESHMS2, recipient, &c->my_ply, b, 0, NULL)==0){
|
||||
if (message_ply_append(id, RHIZOME_SERVICE_MESHMS2, recipient, &c->my_ply, b, NULL, 0, NULL)==0){
|
||||
if (ack)
|
||||
c->metadata.my_last_ack = c->metadata.their_last_message;
|
||||
c->metadata.my_size += ob_position(b);
|
||||
|
@ -64,7 +64,7 @@ static int message_ply_fill_manifest(const keyring_identity *id, const sid_t *re
|
||||
}
|
||||
|
||||
int message_ply_append(const keyring_identity *id, const char *service, const sid_t *recipient, struct message_ply *ply, struct overlay_buffer *b,
|
||||
unsigned nassignments, const struct rhizome_manifest_field_assignment *assignments)
|
||||
const char *name, unsigned nassignments, const struct rhizome_manifest_field_assignment *assignments)
|
||||
{
|
||||
rhizome_manifest *mout = NULL;
|
||||
rhizome_manifest *m = rhizome_new_manifest();
|
||||
@ -86,6 +86,11 @@ int message_ply_append(const keyring_identity *id, const char *service, const si
|
||||
}
|
||||
}
|
||||
|
||||
// TODO add sender name?
|
||||
// if recipient, actual sender & name should be encrypted...
|
||||
if (name)
|
||||
rhizome_manifest_set_name(m, name);
|
||||
|
||||
struct rhizome_bundle_result result = rhizome_apply_assignments(m, nassignments, assignments);
|
||||
if (result.status != RHIZOME_BUNDLE_STATUS_NEW){
|
||||
WARNF("Cannot create message ply manifest: %s", alloca_rhizome_bundle_result(result));
|
||||
|
@ -46,6 +46,6 @@ void message_ply_append_ack(struct overlay_buffer *b, uint64_t message_offset, u
|
||||
void message_ply_append_timestamp(struct overlay_buffer *b);
|
||||
void message_ply_append_message(struct overlay_buffer *b, const char *message, size_t message_len);
|
||||
int message_ply_append(const struct keyring_identity *id, const char *service, const sid_t *recipient, struct message_ply *ply, struct overlay_buffer *b,
|
||||
unsigned nassignments, const struct rhizome_manifest_field_assignment *assignments);
|
||||
const char *name, unsigned nassignments, const struct rhizome_manifest_field_assignment *assignments);
|
||||
|
||||
#endif
|
Loading…
Reference in New Issue
Block a user