Commit Graph

198 Commits

Author SHA1 Message Date
irungentoo
4f1e02bafa
tox_group_get_names now returns a list of name lengths along with the list of names.
TCP test now also tests pings.
2014-03-31 20:37:03 -04:00
irungentoo
f7beb70fe9 nTox fixes.
Added TOX_MAX_MESSAGE_LENGTH to tox.h
2014-03-18 20:45:03 -04:00
irungentoo
5770a0e29a Merge branch 'api-fix'
Main changes:
1. Strings no longer need to be NULL terminated.
2. tox_get_friend_id is now named tox_get_friend_number.
3. The friend request callback function is now (Tox *tox, uint8_t *,
uint8_t *, uint16_t, void *), the Tox object pointer has been added to
it.
2014-03-18 20:02:50 -04:00
irungentoo
5babb281c0 Friend request callback now contains the Tox object. 2014-03-16 13:24:39 -04:00
Maxim Biro
5a142bb697 Renamed dht server to dht node 2014-02-22 17:07:15 -05:00
irungentoo
554afe11d7 Some api changes. 2014-02-21 11:38:04 -05:00
Ben Iofel
174cec7f15 proper windows preprocessor detection 2014-01-19 19:30:14 -05:00
irungentoo
a6d5a54c79 Fixed ntox building on windows. 2013-12-19 12:36:51 -05:00
AZ Huang
2cb7f24132 Fix typo. 2013-11-29 23:38:06 +08:00
AZ Huang
8419d3469a Fix API name consistency. 2013-11-29 23:12:07 +08:00
AZ Huang
eec31edb1c Fix return code inconsistency. 2013-11-29 18:26:09 +08:00
Coren[m]
26fef7cf9a
Various changes to nTox including a potential crash (also possible from remote!), and a tiny change to toxcore.
Crash stuff:

nTox.c:
- do_refresh(): avoid crashes (input a "%" and the client goes "boom!", send someone a string with embedded "%" and see him blow up...)

Other stuff:

toxcore: tox.h (doc.)/network.c (code):
- networking_wait_prepare(): return -1 if lenptr was NULL and therefore not settable

nTox.c:
- fraddr_to_str(): function to convert a TOX_FRIEND_ADDRESS into a segmented (and therefore line-breakable) string
- print_friendlist(): print index of friend on name line, print id on 2nd line
- command /f: skip spaces (and +) inside a friend id
- command /r (new): "/r #" to remove a friend
- main(): reduce cpu consumption if we're not currently sending files
2013-11-27 21:00:23 +01:00
Coren[m]
a204b95c51
Print a more detailed message on CHAT_CHANGE_PEER_DEL, so a user isn't confounded by the change of peer numbers.
On deleting the last peer, it's just a delete.
On deleting any other peer, the last peer is moved into that space, gaining a different number.
Print that detail where appropriate.
2013-11-26 18:55:11 +01:00
Coren[m]
e85e9dbb99
group_namelistchange(): for ui reasons, divulge the peernumber and the nature of the change (add, del, name change).
tox.*, Messenger.*, group_chats.*:
- expand interface of callback by peernumber/change

groupchats.c:
- call callback in addpeer/delpeer/setnick with peernumber and flag

nTox.c:
- print_groupchatpeers(): print as many names on a line as possible, not one peer per line
- print_groupnamelistchange(): only print the change, if possible (i.e. "new peer", "peer's new name")
- added command "/p" to print the list of peers
2013-11-24 21:12:26 +01:00
irungentoo
f21a9a7666 Added callback that tells you when the peer name list of a group chat changes. 2013-11-23 17:19:02 -05:00
irungentoo
d2b56faded Added function to get the number of peers and list of names for group chats. 2013-11-22 23:31:55 -05:00
Coren[m]
ca621bd440
Wrapping: Expanded space of output to be a bit larger than input. Basic wrap(): Embed continuation markers if there's enough space. 2013-11-14 02:45:37 +01:00
Coren[m]
bde536f6bc
Add a "conversation mode", where you set your conversation partner once and then all non-commands are sent as message to them.
/cf # rsp. /cg # sets, /cr resets target

Also reformatted display of sent group message slightly to look less beta-ish.
Then using "#<num>" for group number vs. "<num>" for friend/peer numbers.
Also changed to a slightly different message on people without name.
2013-11-13 22:34:02 +01:00
irungentoo
244c625e51 Merge branch 'group_peername' of https://github.com/FullName/ProjectTox-Core into FullName-group_peername 2013-11-12 19:41:52 -05:00
Coren[m]
6d31a9be7e
Group chat: Add a nickname message. Remove strange default nickname. (Seriously...)
group_chats.*:
- group_send_nick() to send own name
- setnick() to store a received name

Messenger.c:
- group_send_nick() before group_sendmessage() (in regular intervals, to inform new peers)

nTox.c:
- print_groupmessage(): on error or on a name of length zero the result of tox_group_peername() isn't null-terminated, catch that
2013-11-12 19:57:01 +01:00
Coren[m]
e457eb6635
Undo faulty newlines, undo extra newlines. 2013-11-12 14:17:48 +01:00
Coren[m]
553aba0498
nTox.c:
- multiple places: tox_getname() doesn't terminate the string, make sure nTox does
- format_message():
.  - renamed to print_formatted_message()
.  - changed semantics: does the new_line() itself, saves caller from freeing the buffer (which no caller did)
.  - changed signature: now also prints the friend's name when sending
.  - intern: date is only printed once, the message line gets only time
- print_message(): enforce null termination
- main():
.  - setlocale() to init locale (for date/time printing)
.  - own name: ensure null termination

Messenger.c:
- notify of friend name change *before* the old name is overwritten
2013-11-11 15:25:54 +01:00
Coren[m]
4993928888
Started as a simple bugfix for wrap(), expanded to more detailed help.
nTox.c:
- flag[]: additional flag for special wrapping
- help expanded and split (to keep below 256 chars)
- new_lines_mark(): stores flag for special wrapping
- print_friendlist():
.  - extracted pattern for output
.  - added length of id string allocation
.  - replaced '\t' with '+ ', wrappers don't account for '\t'
- line_eval():
.  - removed a few do_refresh() directly after a new_lines() (calls do_refresh() at its end)
.  - 'h' (help): parsing of an additional character for f(riend) or g(roup)
- wrap():
.  - the major bugfix:
.    - no more endless looping if the input had a substring with no spaces
.      for more than line_width (e.g. ID of 78 and window smaller than 78)
- wrap_bars(): wrap() for "rich" messages, honors embedded '\n', breaks preferable at '|'
- print_help(): listed all options and added explanations
- print_invite(): fixed minuscule typo
- main(): made print_help() reachable again

nTox.h:
- majorly cut down to what is really needed
2013-11-10 19:06:17 +01:00
irungentoo
4aa507b664 Added function to get the piece size for sending files. 2013-10-08 18:55:35 -04:00
irungentoo
97f192969c Fixed warnings. 2013-10-05 11:24:30 -04:00
irungentoo
fbd494a8b4 File sending added to public api. 2013-10-02 20:53:24 -04:00
irungentoo
6425cf3b53 File control packets can now be used by the person sending the file. 2013-10-02 20:08:14 -04:00
irungentoo
6182af8449 nTox updated with changes in core, some file sending things fixes. 2013-10-01 18:59:33 -04:00
irungentoo
3c7de51ba5 Basic ntox file sending. 2013-09-30 13:13:49 -04:00
Coren[m]
6fe25e4f6f Permit -Wshadow as useful warning. 2013-09-27 11:24:33 +02:00
Coren[m]
330c1bee5c nTox: keep bootstrap()ping every 10 seconds, until we get a connection running (the initial one might get lost, it IS done via UDP after all)
nTox.c:
- main(): keep calling tox_bootstrap_from_address() every 10 seconds, until the connection is established
2013-09-21 02:02:27 +02:00
irungentoo
d2b9b059ba Forgot an else. 2013-09-18 11:19:32 -04:00
irungentoo
1a9ee5c95f Fixed bad code in nTox. 2013-09-18 11:11:10 -04:00
irungentoo
5a83c1296c astyled everything. 2013-09-17 16:28:39 -04:00
irungentoo
dd12d464de Functions to get name of peer in group chat added.
Group message callback modified.
2013-09-16 20:59:53 -04:00
Coren[m]
ab2805a23b Fix warnings of -Wall -Wextra 2013-09-16 10:37:22 +02:00
Coren[m]
6d3ac937af Merge remote-tracking branch 'upstream/master' into nTox 2013-09-15 19:07:54 +02:00
irungentoo
dde98eb345 DHT peer finding for new friends should now be slightly faster.
Also fixed the "[i] could not send message" bug in nTox.
2013-09-14 20:38:48 -04:00
irungentoo
20a8fb8a23 Fixed warnings. 2013-09-14 19:15:26 -04:00
irungentoo
12d1c5199b astyled everything. 2013-09-14 12:42:17 -04:00
Coren[m]
0db05eca49 Save datafile when adding a friend/accepting a friend request.
(Note to self: make clean is your friend. Those extra seconds are well spent.)
2013-09-14 18:39:59 +02:00
Coren[m]
f2ad7fd4ea Rename load_old_key_or_save_new_one() to load_data_or_init(). 2013-09-13 09:20:03 +02:00
Coren[m]
484615e67d Made (load_/save_)data() functions static. 2013-09-13 09:16:48 +02:00
Coren[m]
cbd575f7a0 Merge remote-tracking branch 'upstream/master' into nTox 2013-09-13 09:14:21 +02:00
Coren[m]
e67a11dd04 Merge remote-tracking branch 'upstream/master' into Integration 2013-09-13 09:06:52 +02:00
irungentoo
f8b979a92a Put group chat functions in the public API.
Group chats are not complete, they seem to work very well though.

This means that the functions will change.
2013-09-12 20:29:30 -04:00
irungentoo
91d7f4857f Very basic group chats, tested and working with nTox.
Please wait until the tox.h API is updated before integrating it into
your clients.

nTox:
/g
creates a new group chat

/i friendnum groupnum
invite friendnum to groupnum

/z groupnum message
send message to groupnum

NOTE: group chats currenly might not handle packet loss well if there are less than 6 participants.
2013-09-12 19:26:30 -04:00
Coren[m]
a74cfaea81 tox.h:
- #define'd tox's network port (as range)
- finally killed tox_new_ex() in favor of changing tox_new()'s signature
- renamed tox_bootstrap() to tox_bootstrap_from_ip()

network.h:
- #define'd tox's network port (as range)
- renamed SEND_NODES_EX to SEND_NODES_IPV6
- bind() loop uses #define'd port range

DHT.c:
- renamed SEND_NODES_EX to SEND_NODES_IPV6
- sending ipv6 node addresses even if can't use them ourselves

nTox.c:
- adapted to changed tox_new()
2013-09-12 15:42:03 +02:00
Coren[m]
20f865521a nTox.c:
- correct a message who claims we're going to exit when we actually aren't
- don't treat a failed close on reading the data file as failure of the reading
2013-09-12 14:19:22 +02:00
Coren[m]
d017189bb6 nTox.c:
- don't claim "Added friend" per default, check for returned ID first
- on '/q' SAVE... else everything but the keys is lost on each restart
- for that, split load_key() into load_data() and save_data()
- announce own nickname on startup
2013-09-12 00:01:46 +02:00
Coren[m]
513e37815d tox.h, DHT.h:
- tox_bootstrap_ex(), DHT_bootstrap_ex() renamed to tox_bootstrap_from_address(), DHT_bootstrap_from_address()
- (handle_)sendnodes_ex() renamed to (handle_)sendnodes_ipv6()
- only sending sendnodes_ipv6() if we're actually IPv6 enabled
- changed comments to conform better

nTox.c, Messenger_text.c, DHT_test.c, DHT_bootstrap.c:
- fallout from *_ex() to *_from_address()

DHT_bootstrap.c:
- corrected a potentially wrong info message

util.c:
- fixed logfile name: now (funcptr) => now() (number)

network.c:
- addead comment about the necessity of bind() to succeed

auto_test/messenger_test.c:
- defaulting ipv6enabled to TOX_ENABLE_IPV6_DEFAULT

LAN_discovery.c:
- slight cleanup and comments for clarity
2013-09-11 20:50:15 +02:00
Coren[m]
4cf0d857bc cmdline parsing of --ipv4/6 plucked into util 2013-09-11 00:14:20 +02:00
Coren[m]
64ca4b5db2 tox.*, DHT.*:
- return to the caller if the string could be resolved into an IP

other/DHT_bootstrap.c, testing/*_test.c, testing/nTox.c:
- parse cmdline for --ipv4/--ipv6 switch to allow user a choice

util.h:
- proper old-style C-comment
2013-09-10 22:59:33 +02:00
Coren[m]
bcb283cf45 big push, putting all the infrastructure in place behind TOX_ENABLE_IPV6 2013-09-10 16:36:20 +02:00
irungentoo
8f0bef5f20 Fixed warnings and moved hex_string_to_bin to testing/ 2013-08-30 08:16:34 -04:00
irungentoo
7441a234b7 Merge branch 'udp_connections' of https://github.com/vx-k/ProjectTox-Core into vx-k-udp_connections 2013-08-30 07:53:51 -04:00
Anony Moose
eb33796e58 Moved misc_tools from testing to toxcore. 2013-08-29 22:54:54 +00:00
jin-eld
14a8ee4e0d Make nTox work on MinGW/Win32 2013-08-27 14:25:09 +03:00
irungentoo
0f77a2d131 Added tox_ to 2 typedefs. 2013-08-23 10:34:10 -04:00
irungentoo
9d3a8d94f2 New API done and tested.
Some stuff needs to be cleaned a bit though.
2013-08-23 10:26:52 -04:00
irungentoo
2f66b31244 nTox and cmake fixed. 2013-08-20 15:28:16 -04:00
irungentoo
88ff81d9de Passed everything through astyle. 2013-08-16 13:11:09 -04:00
naxuroqa
72ee99e848 rewrite of get_id function 2013-08-14 10:44:57 +02:00
irungentoo
f93e23e411 Updated some files. 2013-08-13 11:50:33 -04:00
Andreas Schneider
6b06431e9b core: Fix a possible buffer overflow using getself_name().
If the passed buffer is smaller than MAX_NAME_LENGTH then, you
will probably overflow it.
2013-08-13 09:50:51 +02:00
alek900
8d3e68b74d Added support for userdata in callbacks 2013-08-12 14:23:46 +02:00
Chris Hall
4293c4b1e6 Messenger refactor - redid work from pull request 79
Moves static state out of Messenger.c and into a Messenger struct
Purely stylistic, no functional changes were made.

This commit also changed all the callers of Messenger as they now have
to pass an instance of the Messenger struct to messenger functions.

Also removed some uses of the 'static' keyword at the beginning of
function definitions when the function was already declared static, as
these caused gcc to whine.
2013-08-12 21:37:38 +12:00
Maxim Biro
b1a2af23e5 Modified clients to properly work with the changes 2013-08-07 18:12:59 -04:00
Nick ODell
34f531553a Fix bug where file handle wasn't closed on success 2013-08-06 18:11:13 -06:00
Sebastian Stal
5ec3b2330e Make test clients compatible with userstatus kinds
No features were added, just fixed callbacks.
2013-08-05 12:30:40 -07:00
irungentoo
519e22677a Merge pull request #312 from Niautanor/master
fix for Issue #288
2013-08-05 07:19:50 -07:00
Sean Qureshi
a8f752130b Fixed 2 Null pointer derefrences in both nTox and toxic 2013-08-04 14:36:09 -07:00
irungentoo
b9f387b3b7 Merge pull request #311 from CharmlessCoin/nTox
nTox Cleaning
2013-08-04 08:27:15 -07:00
Tim Malte Gräfje
0259cb0194 added fix in nTox_win32.c 2013-08-04 13:01:20 +02:00
charmlesscoin
ae8367dc3e whoops, returning a free'd variable is really not what I meant... 2013-08-04 05:09:12 -04:00
charmlesscoin
b36bca295c fixed bug that would cause this to always exit 2013-08-03 21:59:17 -04:00
Tim Malte Gräfje
5817c2c888 fix for #288
nTox will now display a message if you try to accept a not yet received
or already accepted friend request
2013-08-04 01:46:54 +02:00
charmlesscoin
175a434de3 removed some magic numbers from line_eval() 2013-08-03 18:06:28 -04:00
charmlesscoin
6222e32848 added some better error checking for print_nickname() anr print_statuschange() 2013-08-03 18:02:09 -04:00
charmlesscoin
43f6608530 cleaned up load_key() and added more error checking 2013-08-03 17:57:44 -04:00
irungentoo
09a6d2d351 Merge branch 'nTox' of https://github.com/CharmlessCoin/ProjectTox-Core into CharmlessCoin-nTox
Conflicts:
	testing/nTox.c
2013-08-03 16:46:58 -04:00
Michael Kress
d5493bb24f added backspace to nTox; removed trailing spaces 2013-08-03 13:27:52 +02:00
charmlesscoin
9b6283c084 whoops, removed part of a string by accident. 2013-08-03 01:27:20 -04:00
charmlesscoin
bb2ea0e5b4 Fixed the printing of a few strings, moved some code around. 2013-08-03 01:14:30 -04:00
charmlesscoin
6b8f12e33c added a getopt system, with -f and -h flags 2013-08-03 00:45:34 -04:00
charmlesscoin
b9e3bf1fa6 changed some formatting, fixed the removal of x and y 2013-08-02 22:34:45 -04:00
charmlesscoin
3678b302db cleaned up print_friendlist(), it now prints a message if you have _no_ friends 2013-08-02 21:22:02 -04:00
charmlesscoin
f906fd628f cleaned up my changes 2013-08-02 19:54:57 -04:00
charmlesscoin
809ee9af75 new_lines should use strncpy, and wrote get_id() to declutter code 2013-08-02 19:51:08 -04:00
irungentoo
af8e843451 Merge pull request #229 from JFreegman/master
fixed friend add bugs and gave no message its own error
2013-08-01 17:38:29 -07:00
irungentoo
4c949c5b13 Merge pull request #252 from nickodell/master
Fix a bug and remove useless code.
2013-08-01 16:52:25 -07:00
Nick ODell
67b7523b18 Remove code that did nothing. 2013-08-01 16:19:01 -06:00
Nick ODell
ff2e04b107 Fix bug where messages from yourself were preceeded by [-1] 2013-08-01 16:15:56 -06:00
plutooo
9fbff0c758 nTox: fixed 2 possible crashes, 3 incorrect packet lengths 2013-08-01 16:28:48 -04:00
Jfreegman
8abc0a3462 added error code for no message on friend add & updated nTox.c/nTox_win32.c 2013-08-01 15:27:08 -04:00
plutooo
3d916b35f2 core: getaddrinfo() lookup error handling 2013-08-01 11:54:06 -07:00
Jfreegman
44d9e24855 small fix 2013-07-31 17:38:39 -04:00
Jfreegman
8f6e1d8fbf partially fixed friend add bug (key length test still broken) 2013-07-31 17:30:16 -04:00
Jfreegman
3eafbc900e remove debugging printf statement 2013-07-31 15:34:34 -04:00
Nick ODell
ccbe4c6799 Show error message instead of "added friendnumber -1" 2013-07-31 10:38:13 -06:00