summaryrefslogtreecommitdiff
path: root/core/Messenger.h
diff options
context:
space:
mode:
Diffstat (limited to 'core/Messenger.h')
-rw-r--r--core/Messenger.h55
1 files changed, 25 insertions, 30 deletions
diff --git a/core/Messenger.h b/core/Messenger.h
index 6afe84ac..1067d156 100644
--- a/core/Messenger.h
+++ b/core/Messenger.h
@@ -1,35 +1,35 @@
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
30#include "net_crypto.h" 29#include "net_crypto.h"
31#include "DHT.h" 30#include "DHT.h"
32#include "friend_requests.h" 31#include "friend_requests.h"
32#include "LAN_discovery.h"
33 33
34#ifdef __cplusplus 34#ifdef __cplusplus
35extern "C" { 35extern "C" {
@@ -79,7 +79,6 @@ int m_delfriend(int friendnumber);
79 return 0 if there is no friend with that number */ 79 return 0 if there is no friend with that number */
80int m_friendstatus(int friendnumber); 80int m_friendstatus(int friendnumber);
81 81
82
83/* send a text chat message to an online friend 82/* send a text chat message to an online friend
84 returns 1 if packet was successfully put into the send queue 83 returns 1 if packet was successfully put into the send queue
85 return 0 if it was not */ 84 return 0 if it was not */
@@ -91,7 +90,6 @@ int m_sendmessage(int friendnumber, uint8_t * message, uint32_t length);
91 return -1 if failure */ 90 return -1 if failure */
92int setname(uint8_t * name, uint16_t length); 91int setname(uint8_t * name, uint16_t length);
93 92
94
95/* get name of friendnumber 93/* get name of friendnumber
96 put it in name 94 put it in name
97 name needs to be a valid memory location with a size of at least MAX_NAME_LENGTH (128) bytes. 95 name needs to be a valid memory location with a size of at least MAX_NAME_LENGTH (128) bytes.
@@ -117,7 +115,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) */ 115 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)); 116void m_callback_friendrequest(void (*function)(uint8_t *, uint8_t *, uint16_t));
119 117
120
121/* set the function that will be executed when a message from a friend is received. 118/* 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) */ 119 function format is: function(int friendnumber, uint8_t * message, uint32_t length) */
123void m_callback_friendmessage(void (*function)(int, uint8_t *, uint16_t)); 120void m_callback_friendmessage(void (*function)(int, uint8_t *, uint16_t));
@@ -137,11 +134,9 @@ void m_callback_userstatus(void (*function)(int, uint8_t *, uint16_t));
137 returns -1 if there are problems */ 134 returns -1 if there are problems */
138int initMessenger(); 135int initMessenger();
139 136
140
141/* the main loop that needs to be run at least 200 times per second */ 137/* the main loop that needs to be run at least 200 times per second */
142void doMessenger(); 138void doMessenger();
143 139
144
145/* SAVING AND LOADING FUNCTIONS: */ 140/* SAVING AND LOADING FUNCTIONS: */
146 141
147/* returns the size of the messenger data (for saving) */ 142/* returns the size of the messenger data (for saving) */