summaryrefslogtreecommitdiff
path: root/core/Messenger.h
diff options
context:
space:
mode:
Diffstat (limited to 'core/Messenger.h')
-rw-r--r--core/Messenger.h54
1 files changed, 24 insertions, 30 deletions
diff --git a/core/Messenger.h b/core/Messenger.h
index 6afe84ac..c0432e68 100644
--- a/core/Messenger.h
+++ b/core/Messenger.h
@@ -1,29 +1,28 @@
1/* Messenger.h 1/* Messenger.h
2* 2 *
3* An implementation of a simple text chat only messenger on the tox network core. 3 * An implementation of a simple text chat only messenger on the tox network core.
4* 4 *
5* NOTE: All the text in the messages must be encoded using UTF-8 5 * NOTE: All the text in the messages must be encoded using UTF-8
6 6 *
7 Copyright (C) 2013 Tox project All Rights Reserved. 7 * Copyright (C) 2013 Tox project All Rights Reserved.
8 8 *
9 This file is part of Tox. 9 * This file is part of Tox.
10 10 *
11 Tox is free software: you can redistribute it and/or modify 11 * Tox is free software: you can redistribute it and/or modify
12 it under the terms of the GNU General Public License as published by 12 * it under the terms of the GNU General Public License as published by
13 the Free Software Foundation, either version 3 of the License, or 13 * the Free Software Foundation, either version 3 of the License, or
14 (at your option) any later version. 14 * (at your option) any later version.
15 15 *
16 Tox is distributed in the hope that it will be useful, 16 * Tox is distributed in the hope that it will be useful,
17 but WITHOUT ANY WARRANTY; without even the implied warranty of 17 * but WITHOUT ANY WARRANTY; without even the implied warranty of
18 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 18 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 GNU General Public License for more details. 19 * GNU General Public License for more details.
20 20 *
21 You should have received a copy of the GNU General Public License 21 * You should have received a copy of the GNU General Public License
22 along with Tox. If not, see <http://www.gnu.org/licenses/>. 22 * along with Tox. If not, see <http://www.gnu.org/licenses/>.
23 23 *
24*/ 24 */
25 25
26
27#ifndef MESSENGER_H 26#ifndef MESSENGER_H
28#define MESSENGER_H 27#define MESSENGER_H
29 28
@@ -79,7 +78,6 @@ int m_delfriend(int friendnumber);
79 return 0 if there is no friend with that number */ 78 return 0 if there is no friend with that number */
80int m_friendstatus(int friendnumber); 79int m_friendstatus(int friendnumber);
81 80
82
83/* send a text chat message to an online friend 81/* send a text chat message to an online friend
84 returns 1 if packet was successfully put into the send queue 82 returns 1 if packet was successfully put into the send queue
85 return 0 if it was not */ 83 return 0 if it was not */
@@ -91,7 +89,6 @@ int m_sendmessage(int friendnumber, uint8_t * message, uint32_t length);
91 return -1 if failure */ 89 return -1 if failure */
92int setname(uint8_t * name, uint16_t length); 90int setname(uint8_t * name, uint16_t length);
93 91
94
95/* get name of friendnumber 92/* get name of friendnumber
96 put it in name 93 put it in name
97 name needs to be a valid memory location with a size of at least MAX_NAME_LENGTH (128) bytes. 94 name needs to be a valid memory location with a size of at least MAX_NAME_LENGTH (128) bytes.
@@ -117,7 +114,6 @@ int m_copy_userstatus(int friendnumber, uint8_t * buf, uint32_t maxlen);
117 function format is function(uint8_t * public_key, uint8_t * data, uint16_t length) */ 114 function format is function(uint8_t * public_key, uint8_t * data, uint16_t length) */
118void m_callback_friendrequest(void (*function)(uint8_t *, uint8_t *, uint16_t)); 115void m_callback_friendrequest(void (*function)(uint8_t *, uint8_t *, uint16_t));
119 116
120
121/* set the function that will be executed when a message from a friend is received. 117/* set the function that will be executed when a message from a friend is received.
122 function format is: function(int friendnumber, uint8_t * message, uint32_t length) */ 118 function format is: function(int friendnumber, uint8_t * message, uint32_t length) */
123void m_callback_friendmessage(void (*function)(int, uint8_t *, uint16_t)); 119void m_callback_friendmessage(void (*function)(int, uint8_t *, uint16_t));
@@ -137,11 +133,9 @@ void m_callback_userstatus(void (*function)(int, uint8_t *, uint16_t));
137 returns -1 if there are problems */ 133 returns -1 if there are problems */
138int initMessenger(); 134int initMessenger();
139 135
140
141/* the main loop that needs to be run at least 200 times per second */ 136/* the main loop that needs to be run at least 200 times per second */
142void doMessenger(); 137void doMessenger();
143 138
144
145/* SAVING AND LOADING FUNCTIONS: */ 139/* SAVING AND LOADING FUNCTIONS: */
146 140
147/* returns the size of the messenger data (for saving) */ 141/* returns the size of the messenger data (for saving) */