diff options
Diffstat (limited to 'testing')
-rw-r--r-- | testing/Messenger_test.c | 14 |
1 files changed, 12 insertions, 2 deletions
diff --git a/testing/Messenger_test.c b/testing/Messenger_test.c index 4290d0fa..3c7c08e9 100644 --- a/testing/Messenger_test.c +++ b/testing/Messenger_test.c | |||
@@ -42,12 +42,22 @@ void print_request(uint8_t * public_key, uint8_t * data, uint16_t length) | |||
42 | } | 42 | } |
43 | printf("\nOf length: %u with data: %s \n", length, data); | 43 | printf("\nOf length: %u with data: %s \n", length, data); |
44 | 44 | ||
45 | if(length != sizeof("Install Gentoo")) | ||
46 | { | ||
47 | return; | ||
48 | } | ||
49 | if(memcmp(data ,"Install Gentoo", sizeof("Install Gentoo")) == 0 ) | ||
50 | //if the request contained the message of peace the person is obviously a friend so we add him. | ||
51 | { | ||
52 | printf("Friend request accepted.\n"); | ||
53 | m_addfriend_norequest(public_key); | ||
54 | } | ||
45 | } | 55 | } |
46 | 56 | ||
47 | void print_message(int friendnumber, uint8_t * string, uint16_t length) | 57 | void print_message(int friendnumber, uint8_t * string, uint16_t length) |
48 | { | 58 | { |
49 | printf("Message with length %u recieved from %u: %s \n", length, friendnumber, string); | 59 | printf("Message with length %u recieved from %u: %s \n", length, friendnumber, string); |
50 | 60 | m_sendmessage(friendnumber, "Test1", 6); | |
51 | } | 61 | } |
52 | 62 | ||
53 | int main(int argc, char *argv[]) | 63 | int main(int argc, char *argv[]) |
@@ -86,7 +96,7 @@ int main(int argc, char *argv[]) | |||
86 | { | 96 | { |
87 | m_sendmessage(num, "Test", 5); | 97 | m_sendmessage(num, "Test", 5); |
88 | doMessenger(); | 98 | doMessenger(); |
89 | c_sleep(1); | 99 | c_sleep(30); |
90 | } | 100 | } |
91 | 101 | ||
92 | } | 102 | } |