mirror of
https://github.com/servalproject/serval-dna.git
synced 2025-03-11 06:53:54 +00:00
Compare MeshMS sender first, so you can talk to yourself (Fixes #124)
This commit is contained in:
parent
34ad8c0fc0
commit
3333d2faa2
4
meshms.c
4
meshms.c
@ -136,14 +136,14 @@ static enum meshms_status get_database_conversations(const keyring_identity *id,
|
||||
WHYF("invalid Bundle ID hex: %s -- skipping", alloca_str_toprint(id_hex));
|
||||
continue;
|
||||
}
|
||||
const char *them = recipient;
|
||||
const char *them = sender;
|
||||
sid_t their_sid;
|
||||
if (str_to_sid_t(&their_sid, them) == -1) {
|
||||
WHYF("invalid SID hex: %s -- skipping", alloca_str_toprint(them));
|
||||
continue;
|
||||
}
|
||||
if (cmp_sid_t(&their_sid, id->box_pk) == 0) {
|
||||
them = sender;
|
||||
them = recipient;
|
||||
if (str_to_sid_t(&their_sid, them) == -1) {
|
||||
WHYF("invalid SID hex: %s -- skipping", alloca_str_toprint(them));
|
||||
continue;
|
||||
|
@ -116,6 +116,38 @@ teardown_AuthBasicWrong() {
|
||||
teardown
|
||||
}
|
||||
|
||||
doc_MeshmsTalkToYourself="HTTP RESTful talk to yourself"
|
||||
setup_MeshmsTalkToYourself() {
|
||||
IDENTITY_COUNT=1
|
||||
setup
|
||||
}
|
||||
test_MeshmsTalkToYourself() {
|
||||
executeOk curl \
|
||||
--silent --fail --show-error \
|
||||
--output sendmessage.json \
|
||||
--basic --user harry:potter \
|
||||
--form "message=Hello World;type=text/plain;charset=utf-8" \
|
||||
"http://$addr_localhost:$PORTA/restful/meshms/$SIDA1/$SIDA1/sendmessage"
|
||||
tfw_cat sendmessage.json
|
||||
tfw_preserve sendmessage.json
|
||||
executeOk curl \
|
||||
--silent --fail --show-error \
|
||||
--output conversationlist.json \
|
||||
--dump-header http.headers \
|
||||
--basic --user harry:potter \
|
||||
"http://$addr_localhost:$PORTA/restful/meshms/$SIDA1/conversationlist.json"
|
||||
tfw_cat conversationlist.json
|
||||
tfw_preserve conversationlist.json
|
||||
executeOk curl \
|
||||
--silent --fail --show-error \
|
||||
--output messagelist.json \
|
||||
--dump-header http.headers \
|
||||
--basic --user harry:potter \
|
||||
"http://$addr_localhost:$PORTA/restful/meshms/$SIDA1/$SIDA1/messagelist.json"
|
||||
tfw_cat messagelist.json
|
||||
tfw_preserve messagelist.json
|
||||
}
|
||||
|
||||
doc_MeshmsListConversations="HTTP RESTful list MeshMS conversations as JSON"
|
||||
setup_MeshmsListConversations() {
|
||||
IDENTITY_COUNT=5
|
||||
|
Loading…
x
Reference in New Issue
Block a user