News for hackers. Stuff that matters.
[dead]
Re:WhatsApp is blocking Telegram links by ones_and_zeros on Tuesday December 01, 2015 @04:58PM (#10659166)
> but Telegram is not even sending messages that are shared from WhatsApp

This is wrong. If you follow the logic (which is admittedly difficult) you'll see they are stripping out the "sent from WhatsApp" tagline WhatsApp adds when you share a photo, etc from WhatsApp to Telegram.

You'll still get the photo, it just won't have the tagline indicating where it came from. Still a bit shady but I also dislike the "Sent from ..." taglines.

EDIT: Parent is a WhatsApp employee... now this seems like sort of a lame attempt to justify their own unethical behavior. This makes me pretty bummed.

Re:WhatsApp is blocking Telegram links by Wingman4l7 on Tuesday December 01, 2015 @05:05PM (#10659219)
"Sent from" is basically using my mobile messaging activities as advertising, which is why it's highly annoying to me. This is a nice internal fix.
Re:WhatsApp is blocking Telegram links by cheez on Tuesday December 01, 2015 @05:30PM (#10659380)
That is some horrifying code...
Re:WhatsApp is blocking Telegram links by ones_and_zeros on Tuesday December 01, 2015 @05:35PM (#10659408)
Indeed, and unsurprisingly, this results in a bug. It's not that it strips out the text, it's that it sets that variable to null which is then used for flow control.

So you will run in to issues (not sure how it would manifest itself) if you share photo or video that does have text, but just doesn't contain "WhatsApp" ("Sent from FooBar").

It looks like it'll send a text and then send the photo[0] but who knows what kind of state will be modified when you send the text first.

[0] https://github.com/DrKLO/Telegram/blob/74def22213846b1f90a26...

Re:WhatsApp is blocking Telegram links by newjersey on Tuesday December 01, 2015 @06:26PM (#10659699)
Would it be better they set it to string.empty or ""?
Re:WhatsApp is blocking Telegram links by ones_and_zeros on Wednesday December 02, 2015 @01:42PM (#10664883)
Comment is now dead but I'd significantly refactor this code where I wouldn't be using nulls or empty strings as program flow control. At the very least I'd have an enum that was very explicit of what action I should be taking ie TEXT, PHOTO, VIDEO, etc.

The logic is too mixed up and this method does too many things. Off the top of my head you might refactor it so that inspection, classification, validation, preparation, etc all happen separately, right now this method does them all and then some.

Re:WhatsApp is blocking Telegram links by newjersey on Wednesday December 02, 2015 @07:06PM (#10666834)
Oh wow you sound like Uncle Bob (and I say that as a compliment).

I think you're right. There is a lot of room for refactoring here. A few more (business/model) classes would not hurt here.

Re:WhatsApp is blocking Telegram links by kpcyrd on Tuesday December 01, 2015 @01:43PM (#10657718)
The commit that introduced this:

https://github.com/DrKLO/Telegram/commit/a93d2994842ef694442...

> Showing 208 changed files with 5,479 additions and 1,841 deletions.

It looks like they squash all their commits and just push one big diff for each update. This isn't really what I've expect from a product that advertises itself as open source security software.

Re:WhatsApp is blocking Telegram links by electic on Tuesday December 01, 2015 @01:58PM (#10657822)
As far as I know, Telegram does not have an official repo. These seem to be updates taken from Telegram's open source page and uploaded to GitHub. You can find the official source code files here:

https://telegram.org/apps

Re:WhatsApp is blocking Telegram links by kpcyrd on Tuesday December 01, 2015 @02:22PM (#10657985)
The page you've linked links to https://github.com/DrKLO/Telegram for the android client.
Re:WhatsApp is blocking Telegram links by drdaeman on Tuesday December 01, 2015 @04:54PM (#10659136)
That "official" repo is just a code dump.

They handle this pretty weirdly, with each commit on master being a release. There's dev branch that was meant to have actual changes (without commit comments - developer said most of his commits have useless descriptions like "bugfixes", but that's a personal preference), but seems to be dead.

This was all discussed here: https://github.com/DrKLO/Telegram/pull/76

Re:WhatsApp is blocking Telegram links by zobzu on Tuesday December 01, 2015 @04:58PM (#10659169)
Bet this is done on purpose. Also bet without checking anything that the telegram commit was prior to whatsapp block, and that it was just whatsapp retaliating.

Dirty games. I don't want to use either.

Re:WhatsApp is blocking Telegram links by Lazare on Tuesday December 01, 2015 @06:52PM (#10659837)
1. Your comment is outright false. Telegram does send messages that are shared from WhatsApp (as is trivially verifiable), and as others have explained the code you linked doesn't do what you claim it does.

2. Given that you're a WhatsApp employee, commenting about Telegram on a thread about how WhatsApp (unfairly?) competes with Telegram, you should probably disclose your affiliation. That would be true even if your comment was accurate, but since it's an outright false claim...

The interesting question here, I think, is whether you're just careless and didn't take the time to double check your claims, or if your comment was actually made in bad faith.

Re:WhatsApp is blocking Telegram links by ergl on Tuesday December 01, 2015 @05:55PM (#10659542)
You can clearly see that condition is inside a block that deals with images and videos, so it's looking for the "Sent from WhatsApp" tagline.

Also the fact that you're a WhatsApp employee makes your comment a poor attempt at justifying your own censoring behaviour

Re:WhatsApp is blocking Telegram links by mschultheiss on Tuesday December 01, 2015 @12:52PM (#10657343)
I guess this code is only used when sharing something from WhatsApp to Telegram. If you share a picture for example, it removes the "Sent from Whatsapp" advertisment message. Correct me if i am wrong...
Re:WhatsApp is blocking Telegram links by rms_returns on Tuesday December 01, 2015 @01:15PM (#10657525)
No. This is inside the handleIntent() method which is like a main entry-point inside that Activity. And the intent being handled here is the ACTION_SEND. In simple words, when a message is being sent:

    Intent.ACTION_SEND.equals(intent.getAction()))
And no, it isn't just removing "Sent from Whatsapp", it is setting the sendingText variable to null, which will result in:

1. The message not being delivered.

2. The exception block being fired where this toast message will be displayed to the user: "Unsupported content"

Re:WhatsApp is blocking Telegram links by mschultheiss on Tuesday December 01, 2015 @01:29PM (#10657617)
1. Thats wrong, the variable sendingText is generated of Intent.EXTRA_TEXT (see http://developer.android.com/training/sharing/send.html for details) so it is definitely for handling shared content.

2. error=true is set in the else if case, which can not be stepped into anymore after having checked if the text contains "WhatsApp"

Re:WhatsApp is blocking Telegram links by bwindels on Tuesday December 01, 2015 @12:27PM (#10657165)
I don't know what's worse, this, or the fact that it is in a 488 LOC method.

I can't trigger this behaviour in telegram though on mac or windows phone. Maybe just for Android?

Re:WhatsApp is blocking Telegram links by ex3ndr on Tuesday December 01, 2015 @01:18PM (#10657545)
Main Android app is built by iOS developer. It is have very low quality.
Re:WhatsApp is blocking Telegram links by amyjess on Tuesday December 01, 2015 @12:37PM (#10657246)
That's because this is the Android source code.

I don't have time right now to dig through the source myself, but the desktop source code is here if you want to see if this logic is in it: https://github.com/telegramdesktop/tdesktop

Re:WhatsApp is blocking Telegram links by eveningcoffee on Tuesday December 01, 2015 @05:54PM (#10659533)
I wish I could flag your message, but maybe you will delete your comment by yourself?

Base: https://news.ycombinator.com/item?id=10657981

Edit: tone.

Re:WhatsApp is blocking Telegram links by sangnoir on Tuesday December 01, 2015 @06:31PM (#10659732)
You can flag a post by clicking on its timestamp first > flag
Re:WhatsApp is blocking Telegram links by darklajid on Tuesday December 01, 2015 @05:37PM (#10659427)
That seems to be wrong. Looking at that code in context that's the text to be sent, when sharing something that is stream based (probably a video, an image).

In other words: As my (green/new) sibling ones_and_zeros states, afaik that ONLY strips the text if it contains "WhatsApp" and you send non-text content. Which .. is an improvement, I guess. Or a band-aid to grudgingly fix a 'bug' in WhatsApp.

Re:WhatsApp is blocking Telegram links by maxwellito on Tuesday December 01, 2015 @12:28PM (#10657176)
Is it intentional to have this condition on line 666? :-P
Re:WhatsApp is blocking Telegram links by abc_lisper on Tuesday December 01, 2015 @04:22PM (#10658874)
Damn, those functions are longgggg. While the code seems to be organized well, it is a hell to keep track of variables, and all the flow changes.
Re:WhatsApp is blocking Telegram links by codeshaman on Tuesday December 01, 2015 @04:35PM (#10658974)
Spaghetti. More suitable for my plate than an app. I know that Java is a terribly verbose language, but even for Java this looks over the top.

This code is written with a bulldozer ! How hard is it to refactor each of those branches into separate functions or objects ?

If there's no time for that, I wonder, is there enough time to figure out the security and privacy implications of this entire codebase ? Should I trust this code with my life ? Because some people will ...

Re:WhatsApp is blocking Telegram links by chc on Tuesday December 01, 2015 @05:02PM (#10659204)
I don't think Telegram is something people who need security should be using, but this kind of stylistic shaming toward open-source projects is useless at best and harmful in most cases.
Re:WhatsApp is blocking Telegram links by codeshaman on Tuesday December 01, 2015 @06:53PM (#10659840)
Maybe I'm wrong, but last time I checked, Telegram is not entirely "open source". The core part of the service is secret. Which kind of voids the whole 'open source' argument and actually makes this whole project doubly sneaky..

Also, open source does not automatically imply high quality or immunity from criticism.

In this particular case, when people can be arrested or even executed for what they say (in some countries), this kind of code can be plain dangerous.

Even if their intentions are absolutely pristine and they really want to do good in the world (which I hope they are) - a bit more diligence about the quality of the stuff you're sharing never hurts.

Re:WhatsApp is blocking Telegram links by abc_lisper on Tuesday December 01, 2015 @05:20PM (#10659325)
Useless? I think it is a constructive criticism.
Re:WhatsApp is blocking Telegram links by chc on Tuesday December 01, 2015 @05:35PM (#10659402)
In what way is it constructive to suggest that stylistic problems with somebody's code indicate that the program is unfit for use?

It seems to me about as constructive as walking into any software company and saying, "Ugh, these engineers are wearing t-shirts and their shoes are completely unshined! People, if these programmers care so little for their appearance, can you trust them to care about their code?"

Re:WhatsApp is blocking Telegram links by abc_lisper on Tuesday December 01, 2015 @05:47PM (#10659476)
I don't think you are getting the point. It is not just a stylistic issue! The code is hard to understand and reason about because it is written like a book.
Re:WhatsApp is blocking Telegram links by ga2arch on Tuesday December 01, 2015 @05:11PM (#10659267)
DEX has a 65K methods number limit, that's probably why they keep all the code inside the least amount of functions, resulting in that monstrosity.
Re:WhatsApp is blocking Telegram links by szastupov on Tuesday December 01, 2015 @02:02PM (#10657857)
I guess there is nothing scary about that, but the code is such a fucking spaghetti it's hard be sure. Not to offend the authors though, I bet they were under pressure writing the client.
Re:WhatsApp is blocking Telegram links by the_mitsuhiko on Tuesday December 01, 2015 @04:31PM (#10658932)
> WhatsApp is not linkifying Telegram URLs, but Telegram is not even sending messages that are shared from WhatsApp.

How do you even share a message from whatsapp to telegram?

Re:WhatsApp is blocking Telegram links by 3x14159265 on Tuesday December 01, 2015 @12:30PM (#10657189)
hmm... weird. I'm running the latest version of telegram on my android phone, no problems at all to send messages containing "whatsapp". i will look out for that in upcoming updates of telegram android.
Re:WhatsApp is blocking Telegram links by karangoeluw on Tuesday December 01, 2015 @12:47PM (#10657318)
It's case sensitive. Try "WhatsApp"
Re:WhatsApp is blocking Telegram links by eveningcoffee on Tuesday December 01, 2015 @02:21PM (#10657981)
Could you report what happens when you send exactly "WhatsApp"?
Re:WhatsApp is blocking Telegram links by the_mitsuhiko on Tuesday December 01, 2015 @04:31PM (#10658943)
It sends "WhatsApp".
Re:WhatsApp is blocking Telegram links by heartbreak on Tuesday December 01, 2015 @12:45PM (#10657302)
Wow it has been there since the end of June.