irungentoo / toxcore

The future of online communications.
https://tox.chat/
GNU General Public License v3.0
8.74k stars 1.27k forks source link

tox_callback_friend_message callback gets empty message string #1307

Closed pedropatinho closed 8 years ago

pedropatinho commented 9 years ago

Hi!

I am developing a python lib for toxcore (ToxPy), and while wrapping the C api callbacks I was getting blank messages from friends. I thought it were my ctypes wrapper functions, so I went to code it again in C, but found the same behavior. I just tried the nTox in /testing, and I can confirm it happens too: blank messages!

I started to code my stuff with the old API, and nTox worked well then, so I guess it's a bug in the new_api.

Haven't dig further, but I'm willing to port toxcore to python :-).

dubslow commented 9 years ago

@pedropatinho Have you looked at https://github.com/aitjcize/PyTox ? It needs porting to the new API, but for the old API is basically complete.

Then again, using ctypes would increase portability... meh up to you

pedropatinho commented 9 years ago

@dubslow I searched for python tox, but did't find anything, so I started to build my own... Seems like PyTox is a nice port, it should be referenced in the wiki.

About the blank messages issue, one more finding: the message is there, but starts at the 5th byte. It starts with 3 NULLs (that's why it appeared empty) and the 4th byte is "something". The length parameter includes these 4 extra bytes.

nurupo commented 9 years ago

@pedropatinho toxcore had API changed a week ago. If toxcore with new API and toxcore with old API communicate, the new one sees messages starting with null byte(s).

nurupo commented 9 years ago

i.e. make sure that both the sender and receiver are using the same API versions. Preferably the new API, because it makes no sense to make python bindings for the old API, it's going away soon. Currently only uTox and Antox (Android client) are ported to use the new API, though all the installers/binary downloads/package repository binaries of them are frozen to use the old API until more clients support new API. So if you want to have a client that supports new API, you'd need to build uTox from source.

nurupo commented 9 years ago

I searched for python tox, but did't find anything, so I started to build my own... Seems like PyTox is a nice port, it should be referenced in the wiki.

PyTox is nice, it has online documentation, tests and examples, but it needs to be ported to the new API. Would be great if someone could port it : )

pedropatinho commented 9 years ago

@nurupo Oh, thanks for enlightening me. It seems I have arrived to tox at the wrong time :).

I found about tox on March 21st, and started "playing". So I arrived right in the middle of the API change!

When will the new API become "official"? Wouldn't it be good to support communication between different API clients?

Sorry for all these questions, I'm trying to gather as much info as I can :).

nurupo commented 9 years ago

The new API is "official" since it got merged into the master branch. All clients are actively porting to using it. uTox and Antox are already ported, but because the network protocol changed a bit with the new API, it would be bad to release the new uTox binaries that use new API and other client binaries that still use old API -- they won't be compatible and users would be confused when faced the non-compatibilities, just like you did. They would receive messages with nulls in them, etc.

If you need to test your python bindings of new API, you'd need a client ported to the new API, which limits you to using uTox built from source. uTox because it's the only desktop client hat has been ported to the new API so far. From source because all binary downloads of it are frozen to use old API to be compatible with the rest of clients while they are being ported to new API.

aitjcize commented 9 years ago

Is there actually any project using PyTox? I felt like I'm just making PyTox for nothing .. so I didn't really have the motivation to port it to the new API...

subliun commented 9 years ago

@aitjcize although PyTox isn't being used in any clients, I've used PyTox for various little helper bots. I would have used it for DiceBot, if it was working at the time. I'm sure a lot of people would appreciate you keeping it updated.

alnf commented 9 years ago

@aitjcize Agree with @subliun, I used it when I just started to do smth with tox, cause it was easy to implement.

zetok commented 9 years ago

I would have used it for DiceBot, if it was working at the time. I'm sure a lot of people would appreciate you keeping it updated.

Yeah, sadly PyTox never worked for me, (python segfaulting when trying to just load av), so I couldn't use it for what I'd like to use when I would learn how to do anything more in python.

As result I've lost interest in learning python by trying to make Tox audio groupchat bot using PyTox and now I'm in a slow process of learning rust, which has bindings for old API, and even if maintainer of bindings won't port it to new API, bindings look simple enough to make me want to try to do it myself when I'll learn enough.

anyway, my little story isn't that important, since what really matters is that someone has been trying to use PyTox for something serious (at least it did sound like it), and… well. Sadly, PyTox shape didn't allow him for that.

Also, there is: https://github.com/toxmail/toxmail ← may not look like it, but under the hood it's powered by PyTox (no idea why/whether this project was stalled, since it looked interesting)

@aitjcize I really think that if PyTox bindings were working, people would use them.

(sorry if what I wrote sounds a bit harsh, this is not my intention; I merely want to say that it has a lot of potential, but it has to work first…)

Edit: I think that the guy who tried to use PyTox is waiting for new API bindings to arrive, since without them it's ~pointless(?) to try to make something..

grimd34th commented 9 years ago

@aitjcize please don't discontinue pytox it is the light shining in the dark str8c world

stal888 commented 9 years ago

@aitjcize RIP mobile users

JFreegman commented 9 years ago

Without Pytox there is only despair.

optimumtact commented 9 years ago

I agree you should give up on pytox, without a guarantee of API stability or a properly documented API there is no point developing third party wrappers.

If core devs can provide this, then certainly I think pytox is worthy project

hexafluoride commented 9 years ago

@aitjcize I'm sure that the community needs PyTox. It might not see any public use currently, but Python is a very popular language for prototyping/firing things up quickly and I'm fairly certain that it will get much use in the future where people would be more interested in the non-client part of Tox(bots, syncing, etc.).

I also feel slightly inclined to complain about @irungentoo not writing protocol docs, and @Astonex pretty much "going on an angry vacation" because of that.

ghost commented 9 years ago

@aitjcize I recommend PyTox to a lot of people because it's written in a safe language and prevents a lot of security critical bugs. I think that maintaining PyTox is critical for tox future because of that. Please keep doing the good work.

Thank you.

TheLastProject commented 9 years ago

@aitjcize Seeing how Python is such a great language for beginning programmers, PyTox is what allows people, even with little programming experience, to create software working on the Tox network. It has serious value for that reason, and I have used it for a bot myself before.

aitjcize commented 9 years ago

Thank you guys for the support, I'm find time for it ASAP :)

hexafluoride commented 9 years ago

That's really nice! Good luck!

urras commented 9 years ago

Thank you so much @aitjcize! :+1:

Stefan-Code commented 9 years ago

That's awesome, @aitjcize Thanks! :smiley:

LittleVulpix commented 9 years ago

@aitjcize I am told that the "LoadTest" tox bot uses PyTox, so I'd also love if you could port it over to new api as the LoadTest is a great bot for my friends who use it as an infallible indication of being online (cause they only have me in their contact list sometimes)

GrayHatter commented 8 years ago

currently using pytox don't let it die @aitjcize

otherwise, stale, and incomplete issue