summaryrefslogtreecommitdiff
path: root/core/Messenger.c
diff options
context:
space:
mode:
authorSilentSand <edb881@gmail.com>2013-07-26 04:02:17 -0400
committerSilentSand <edb881@gmail.com>2013-07-26 04:02:17 -0400
commit59b34e423beb75fcd3e3c8abc2c05fe60aca26bc (patch)
tree6d1686d86da385579e862d8c761be9b59db92a48 /core/Messenger.c
parentb9169ff1b2a4e1dd13ed40f3902d06ed020eefb7 (diff)
Formatting.
Many stylistic changes, mostly formatting code more closely to the coding style.
Diffstat (limited to 'core/Messenger.c')
-rw-r--r--core/Messenger.c14
1 files changed, 1 insertions, 13 deletions
diff --git a/core/Messenger.c b/core/Messenger.c
index 11613cbb..d58e895c 100644
--- a/core/Messenger.c
+++ b/core/Messenger.c
@@ -38,8 +38,6 @@ typedef struct
38 uint8_t userstatus_sent; 38 uint8_t userstatus_sent;
39 uint16_t info_size; /* length of the info */ 39 uint16_t info_size; /* length of the info */
40}Friend; 40}Friend;
41
42
43 41
44uint8_t self_public_key[crypto_box_PUBLICKEYBYTES]; 42uint8_t self_public_key[crypto_box_PUBLICKEYBYTES];
45 43
@@ -57,7 +55,6 @@ static uint32_t numfriends;
57 0 if we are offline 55 0 if we are offline
58 static uint8_t online; */ 56 static uint8_t online; */
59 57
60
61/* return the friend id associated to that public key. 58/* return the friend id associated to that public key.
62 return -1 if no such friend */ 59 return -1 if no such friend */
63int getfriend_id(uint8_t * client_id) 60int getfriend_id(uint8_t * client_id)
@@ -76,7 +73,6 @@ int getfriend_id(uint8_t * client_id)
76 return -1; 73 return -1;
77} 74}
78 75
79
80/* copies the public key associated to that friend id into client_id buffer. 76/* copies the public key associated to that friend id into client_id buffer.
81 make sure that client_id is of size CLIENT_ID_SIZE. 77 make sure that client_id is of size CLIENT_ID_SIZE.
82 return 0 if success 78 return 0 if success
@@ -96,7 +92,6 @@ int getclient_id(int friend_id, uint8_t * client_id)
96 return -1; 92 return -1;
97} 93}
98 94
99
100/* add a friend 95/* add a friend
101 set the data that will be sent along with friend request 96 set the data that will be sent along with friend request
102 client_id is the client id of the friend 97 client_id is the client id of the friend
@@ -191,7 +186,6 @@ int m_delfriend(int friendnumber)
191 return 0; 186 return 0;
192} 187}
193 188
194
195/* return 4 if friend is online 189/* return 4 if friend is online
196 return 3 if friend is confirmed 190 return 3 if friend is confirmed
197 return 2 if the friend request was sent 191 return 2 if the friend request was sent
@@ -206,7 +200,6 @@ int m_friendstatus(int friendnumber)
206 return friendlist[friendnumber].status; 200 return friendlist[friendnumber].status;
207} 201}
208 202
209
210/* send a text chat message to an online friend 203/* send a text chat message to an online friend
211 return 1 if packet was successfully put into the send queue 204 return 1 if packet was successfully put into the send queue
212 return 0 if it was not */ 205 return 0 if it was not */
@@ -239,7 +232,6 @@ static int m_sendname(int friendnumber, uint8_t * name)
239/* set the name of a friend 232/* set the name of a friend
240 return 0 if success 233 return 0 if success
241 return -1 if failure */ 234 return -1 if failure */
242
243static int setfriendname(int friendnumber, uint8_t * name) 235static int setfriendname(int friendnumber, uint8_t * name)
244{ 236{
245 if(friendnumber >= numfriends || friendnumber < 0) 237 if(friendnumber >= numfriends || friendnumber < 0)
@@ -250,7 +242,6 @@ static int setfriendname(int friendnumber, uint8_t * name)
250 return 0; 242 return 0;
251} 243}
252 244
253
254/* Set our nickname 245/* Set our nickname
255 name must be a string of maximum MAX_NAME_LENGTH length. 246 name must be a string of maximum MAX_NAME_LENGTH length.
256 return 0 if success 247 return 0 if success
@@ -352,6 +343,7 @@ static int set_friend_userstatus(int friendnumber, uint8_t * status, uint16_t le
352 friendlist[friendnumber].userstatus_length = length; 343 friendlist[friendnumber].userstatus_length = length;
353 return 0; 344 return 0;
354} 345}
346
355/* 347/*
356static void (*friend_request)(uint8_t *, uint8_t *, uint16_t); 348static void (*friend_request)(uint8_t *, uint8_t *, uint16_t);
357static uint8_t friend_request_isset = 0; 349static uint8_t friend_request_isset = 0;
@@ -362,7 +354,6 @@ void m_callback_friendrequest(void (*function)(uint8_t *, uint8_t *, uint16_t))
362 callback_friendrequest(function); 354 callback_friendrequest(function);
363} 355}
364 356
365
366static void (*friend_message)(int, uint8_t *, uint16_t); 357static void (*friend_message)(int, uint8_t *, uint16_t);
367static uint8_t friend_message_isset = 0; 358static uint8_t friend_message_isset = 0;
368 359
@@ -373,7 +364,6 @@ void m_callback_friendmessage(void (*function)(int, uint8_t *, uint16_t))
373 friend_message_isset = 1; 364 friend_message_isset = 1;
374} 365}
375 366
376
377static void (*friend_namechange)(int, uint8_t *, uint16_t); 367static void (*friend_namechange)(int, uint8_t *, uint16_t);
378static uint8_t friend_namechange_isset = 0; 368static uint8_t friend_namechange_isset = 0;
379void m_callback_namechange(void (*function)(int, uint8_t *, uint16_t)) 369void m_callback_namechange(void (*function)(int, uint8_t *, uint16_t))
@@ -520,8 +510,6 @@ static void doFriends()
520 } 510 }
521} 511}
522 512
523
524
525static void doInbound() 513static void doInbound()
526{ 514{
527 uint8_t secret_nonce[crypto_box_NONCEBYTES]; 515 uint8_t secret_nonce[crypto_box_NONCEBYTES];