File tree Expand file tree Collapse file tree 1 file changed +9
-0
lines changed
Expand file tree Collapse file tree 1 file changed +9
-0
lines changed Original file line number Diff line number Diff line change @@ -156,6 +156,7 @@ static uint32_t _atoi(const char* sp) {
156156#define CMD_SEND_STATUS_REQ 27
157157#define CMD_HAS_CONNECTION 28
158158#define CMD_LOGOUT 29 // 'Disconnect'
159+ #define CMD_GET_CONTACT_BY_KEY 30
159160
160161#define RESP_CODE_OK 0
161162#define RESP_CODE_ERR 1
@@ -955,6 +956,14 @@ class MyMesh : public BaseChatMesh {
955956 } else {
956957 writeErrFrame (); // not found, or unable to send
957958 }
959+ } else if (cmd_frame[0 ] == CMD_GET_CONTACT_BY_KEY) {
960+ uint8_t * pub_key = &cmd_frame[1 ];
961+ ContactInfo* contact = lookupContactByPubKey (pub_key, PUB_KEY_SIZE);
962+ if (contact) {
963+ writeContactRespFrame (RESP_CODE_CONTACT, *contact);
964+ } else {
965+ writeErrFrame (); // not found
966+ }
958967 } else if (cmd_frame[0 ] == CMD_EXPORT_CONTACT) {
959968 if (len < 1 + PUB_KEY_SIZE) {
960969 // export SELF
You can’t perform that action at this time.
0 commit comments