summaryrefslogtreecommitdiff
path: root/core/Messenger.h
diff options
context:
space:
mode:
authorjvrv <unknown@unknown.unknown>2013-07-20 00:00:10 -0300
committerjvrv <unknown@unknown.unknown>2013-07-20 00:00:10 -0300
commita72777ed70ed6bfcda8a532c52e0d64241a8bb71 (patch)
treeeb1e70bace7fbaf39a5e80eb4d953dff28998068 /core/Messenger.h
parentac6003e932219bd15cbe50808c7ad13ea01aad8f (diff)
fix comments of some files
Diffstat (limited to 'core/Messenger.h')
-rw-r--r--core/Messenger.h120
1 files changed, 60 insertions, 60 deletions
diff --git a/core/Messenger.h b/core/Messenger.h
index 3ba74d39..6fd98972 100644
--- a/core/Messenger.h
+++ b/core/Messenger.h
@@ -37,113 +37,113 @@
37#define PACKET_ID_USERSTATUS 49 37#define PACKET_ID_USERSTATUS 49
38#define PACKET_ID_MESSAGE 64 38#define PACKET_ID_MESSAGE 64
39 39
40// don't assume MAX_USERSTATUS_LENGTH will stay at 128, it may be increased 40/* don't assume MAX_USERSTATUS_LENGTH will stay at 128, it may be increased
41// to an absurdly large number later 41 to an absurdly large number later */
42 42
43//add a friend 43/* add a friend
44//set the data that will be sent along with friend request 44 set the data that will be sent along with friend request
45//client_id is the client id of the friend 45 client_id is the client id of the friend
46//data is the data and length is the length 46 data is the data and length is the length
47//returns the friend number if success 47 returns the friend number if success
48//return -1 if failure. 48 return -1 if failure. */
49int m_addfriend(uint8_t * client_id, uint8_t * data, uint16_t length); 49int m_addfriend(uint8_t * client_id, uint8_t * data, uint16_t length);
50 50
51 51
52//add a friend without sending a friendrequest. 52/* add a friend without sending a friendrequest.
53//returns the friend number if success 53 returns the friend number if success
54//return -1 if failure. 54 return -1 if failure. */
55int m_addfriend_norequest(uint8_t * client_id); 55int m_addfriend_norequest(uint8_t * client_id);
56 56
57//return the friend id associated to that client id. 57/* return the friend id associated to that client id.
58//return -1 if no such friend 58 return -1 if no such friend */
59int getfriend_id(uint8_t * client_id); 59int getfriend_id(uint8_t * client_id);
60 60
61//copies the public key associated to that friend id into client_id buffer. 61/* copies the public key associated to that friend id into client_id buffer.
62//make sure that client_id is of size CLIENT_ID_SIZE. 62 make sure that client_id is of size CLIENT_ID_SIZE.
63//returns 0 if success 63 return 0 if success
64//return -1 if failure. 64 return -1 if failure */
65int getclient_id(int friend_id, uint8_t * client_id); 65int getclient_id(int friend_id, uint8_t * client_id);
66 66
67//remove a friend 67/* remove a friend */
68int m_delfriend(int friendnumber); 68int m_delfriend(int friendnumber);
69 69
70//return 4 if friend is online 70/* return 4 if friend is online
71//return 3 if friend is confirmed 71 return 3 if friend is confirmed
72//return 2 if the friend request was sent 72 return 2 if the friend request was sent
73//return 1 if the friend was added 73 return 1 if the friend was added
74//return 0 if there is no friend with that number. 74 return 0 if there is no friend with that number */
75int m_friendstatus(int friendnumber); 75int m_friendstatus(int friendnumber);
76 76
77 77
78//send a text chat message to an online friend. 78/* send a text chat message to an online friend
79//returns 1 if packet was successfully put into the send queue 79 returns 1 if packet was successfully put into the send queue
80//return 0 if it was not. 80 return 0 if it was not */
81int m_sendmessage(int friendnumber, uint8_t * message, uint32_t length); 81int m_sendmessage(int friendnumber, uint8_t * message, uint32_t length);
82 82
83//Set our nickname 83/* Set our nickname
84//name must be a string of maximum MAX_NAME_LENGTH length. 84 name must be a string of maximum MAX_NAME_LENGTH length.
85//return 0 if success 85 return 0 if success
86//return -1 if failure 86 return -1 if failure */
87int setname(uint8_t * name, uint16_t length); 87int setname(uint8_t * name, uint16_t length);
88 88
89 89
90//get name of friendnumber 90/* get name of friendnumber
91//put it in name 91 put it in name
92//name needs to be a valid memory location with a size of at least MAX_NAME_LENGTH (128) bytes. 92 name needs to be a valid memory location with a size of at least MAX_NAME_LENGTH (128) bytes.
93//return 0 if success 93 return 0 if success
94//return -1 if failure 94 return -1 if failure */
95int getname(int friendnumber, uint8_t * name); 95int getname(int friendnumber, uint8_t * name);
96 96
97// set our user status 97/* set our user status
98// you are responsible for freeing status after 98 you are responsible for freeing status after
99// returns 0 on success, -1 on failure 99 returns 0 on success, -1 on failure */
100int m_set_userstatus(uint8_t *status, uint16_t length); 100int m_set_userstatus(uint8_t *status, uint16_t length);
101 101
102// return the length of friendnumber's user status, 102/* return the length of friendnumber's user status,
103// including null 103 including null
104// pass it into malloc 104 pass it into malloc */
105int m_get_userstatus_size(int friendnumber); 105int m_get_userstatus_size(int friendnumber);
106 106
107// copy friendnumber's userstatus into buf, truncating if size is over maxlen 107/* copy friendnumber's userstatus into buf, truncating if size is over maxlen
108// get the size you need to allocate from m_get_userstatus_size 108 get the size you need to allocate from m_get_userstatus_size */
109int m_copy_userstatus(int friendnumber, uint8_t * buf, uint32_t maxlen); 109int m_copy_userstatus(int friendnumber, uint8_t * buf, uint32_t maxlen);
110 110
111//set the function that will be executed when a friend request is received. 111/* set the function that will be executed when a friend request is received.
112//function format is function(uint8_t * public_key, uint8_t * data, uint16_t length) 112 function format is function(uint8_t * public_key, uint8_t * data, uint16_t length) */
113void m_callback_friendrequest(void (*function)(uint8_t *, uint8_t *, uint16_t)); 113void m_callback_friendrequest(void (*function)(uint8_t *, uint8_t *, uint16_t));
114 114
115 115
116//set the function that will be executed when a message from a friend is received. 116/* set the function that will be executed when a message from a friend is received.
117//function format is: function(int friendnumber, uint8_t * message, uint32_t length) 117 function format is: function(int friendnumber, uint8_t * message, uint32_t length) */
118void m_callback_friendmessage(void (*function)(int, uint8_t *, uint16_t)); 118void m_callback_friendmessage(void (*function)(int, uint8_t *, uint16_t));
119 119
120// set the callback for name changes 120/* set the callback for name changes
121// function(int friendnumber, uint8_t *newname, uint16_t length) 121 function(int friendnumber, uint8_t *newname, uint16_t length)
122// you are not responsible for freeing newname 122 you are not responsible for freeing newname */
123void m_callback_namechange(void (*function)(int, uint8_t *, uint16_t)); 123void m_callback_namechange(void (*function)(int, uint8_t *, uint16_t));
124 124
125// set the callback for user status changes 125/* set the callback for user status changes
126// function(int friendnumber, uint8_t *newstatus, uint16_t length) 126 function(int friendnumber, uint8_t *newstatus, uint16_t length)
127// you are not responsible for freeing newstatus 127 you are not responsible for freeing newstatus */
128void m_callback_userstatus(void (*function)(int, uint8_t *, uint16_t)); 128void m_callback_userstatus(void (*function)(int, uint8_t *, uint16_t));
129 129
130//run this at startup 130/* run this at startup */
131void initMessenger(); 131void initMessenger();
132 132
133 133
134//the main loop that needs to be run at least 200 times per second. 134/* the main loop that needs to be run at least 200 times per second */
135void doMessenger(); 135void doMessenger();
136 136
137 137
138//SAVING AND LOADING FUNCTIONS: 138/* SAVING AND LOADING FUNCTIONS: */
139 139
140//returns the size of the messenger data (for saving) 140/* returns the size of the messenger data (for saving) */
141uint32_t Messenger_size(); 141uint32_t Messenger_size();
142 142
143//save the messenger in data (must be allocated memory of size Messenger_size()) 143/* save the messenger in data (must be allocated memory of size Messenger_size()) */
144void Messenger_save(uint8_t * data); 144void Messenger_save(uint8_t * data);
145 145
146//load the messenger from data of size length. 146/* load the messenger from data of size length */
147int Messenger_load(uint8_t * data, uint32_t length); 147int Messenger_load(uint8_t * data, uint32_t length);
148 148
149#endif 149#endif