Telepathic Flirt With Chromium

Hackweek is an event in SUSE where developers can work on any pet project for a week (like Google's 20%) This year's edition happened last week in SUSE. Since I am part of the openSUSE community, I too participated in the spirit of this event in my night time. The project is codenamed Arattai.

I tried to bring a prototype to provide IM/Chat support built-in to the Chromium browser. Watch the screencast below. Please click here in case you do not see the embedded video. Please see the video in full screen HD.



Under the Hood

  • I have used Telepathy  as the underlying library for implementing the basic chat support. 
  • The source code is mostly a prototype which will have to go through a rigorous design review and improved upon if you need to use it in a production machine. This is mostly to satisfy a personal itch and not of good quality yet.
  • The patches are attached in the Chromium bug http://code.google.com/p/chromium/issues/detail?id=98990
  • I chose Telepathy because it seem to provide the best implementation for XMPP 0174 protocol, Serverless Messaging, which was my primary aim. Also it is agreed upon by both GNOME and KDE. Isn't it something rare ;-) ?
  • The heart of the code is only about 5 days old and is not of good quality yet. 
  • telepathy-glib has a C interface. Chromium is written using C++ . So, I wrote a TelepathyBridge class with static members to marshal the requests from Chromium to Telepathy and vice-versa. I wrote a TelepathyBean class to move across these layers. Also, there were ArattaiUI and ArattaiHandler classes to take care of the Chromium side of things (like registering a protocol, webui etc.) The user-interface you have seen is provided by the arattai.html and arattai.js files.
  • I believe having IM support may be important for Chromium as IM is one of the important activities that could not be performed yet on the browser.
  • There are things like webRTC which will form the future of communication. However, we still have dozens of protocols that work with existing clients which the browser should support (like support for Novell Groupwise, MSN, Office Communicator etc.)

Observations
  • My personal opinion that, C++ is a needlessly complex language, strengthened. There are a dozen ways to do casting, smart pointers, const functions etc. but no native async/event support. I love C# as a programming language. Sadly C# does not seem to have an appealing future on Linux anymore.
  • The guy who invented Javascript should have been a C++ programmer.
  • Javascript typing can get on a C programmer's nerves
  • Telepathy hackers in #telepathy are extremely helpful. Thanks a lot folks.
  • Open source libraries in general have very poor documentation, if not backed by a company like Google.
  • If Telepathy support has to be included into Chromium, it should be available in Windows too.
  • Automatic memory management is bliss.
Please share your opinions/thoughts about this feature either in the comments or by mail. Thanks.

26 comments:

Anonymous said...

If you thought C++ is needlessly complex, you should try C++11. Just one look at the wikipedia page and it will make you cry. And that's just the wikipedia page, imagine the spec.

chenthill said...

machii ne office enna panrae nu ellarukkum theringu pochhu da :D UI konjam ready pannu and i will start giving it a try instead of pinging you on irc :)

Pavol Rusnak said...

Great work! As usual. :-) I am wondering though if you can remake this effort into a separate extension or it is not possible because of hacking directly in Chromium code. If it's not then it's quite unfortunate, because chromium codebase is evolving fast and I'm not sure if it would be possible to refresh patches all the time.

Sankar said...

@anonymous: True

@pchenthill: Should do ;)

@pavol: thanks. Ideally an extension will be best way to move forward. But for writing a extension, chromium devs. want us to build using their own NaCl toolchain. It is too much of an effort to build telepathy (along with all its dependencies). Also, I just heard that chromium developers do not want to see a chat client (even conditionally built) inside chromium's sources. So, we are probably left with nowhere :) Chrome is not run as a typical open source project. It is in a lot of ways like iFolder, Unity etc. ;-)

Anonymous said...

OT: What makes you think C# has no future on linux?

Sankar said...

@anonymous: Well, Xamarin seem to be focussed on mobile clients more. Also there are hardly any applications written using mono these days (except good old banshee and Tomboy). I see only fading developer interest for C#, in linux.

skuro said...

The guy who invented Javascript, Brendan Eich, used to be quite a good C developer. Thanks goodness, he was also good at Self and Scheme.

A real bad thing of Javascript is that its C-like syntax makes you expect that, knowing C-family languages, you build wrong expectations on your Javascript code. I couldn't get Javascript right until I got good knowledge of Lisp, and started appreciating it ever since.

Anonymous said...

You want proper events, a modern language and not as complex as C++? Why not write it in Python?

It's only going to be more widespread, it's perfect for quick experimentation and Linux is one of its main platforms. The deployment options on Mac and Windows are also quite solid and well tested.

Anonymous said...

I really like your demo...particularly when the desktop was shown :)

Gabriel.iGabe said...
This comment has been removed by the author.
Gabriel.iGabe said...
This comment has been removed by the author.
Gabriel.iGabe said...

I have reason, too. @Meebo keeps my chat logs locked away while expressing big goals - see http://blog.meebo.com -- like new interfaces and feature contests, it feels profane, basic liberty ignored in profits name?

Admirable and inspirational extension; touching taboo one might daresay.

Data liberation is sane. Just sane.

Keep your thought, curiosity.
-
Inspired robot poem:)

Un|Reasonable :

Locked in years.
Lockin real.
Propriety feel,
Fear alternatives,
Liberation features near.
| Data liberation features near.

Sankar said...

@skuro: Oh, Okay. I should try to know about LISP in that case :-) Thanks.

@anon: I would prefer python over C++ personally. But for this project, chromium is already in C++ and I have to use C++. However, I consider C# to be superior to Python because of the nice compile time facilities, parallelism support etc.

@anon: :-)

@Gabriele: Thanks. It was nice.

Sascha Manns said...

I like the girl on the left ;-)

willthompson said...

Nifty!

Sankar said...

@sascha: :-)

@will: Thanks :)

Sanjoy Das said...

[OT] C++ does have its strengths -- one must be willing to select the right subset of features.

Google's C++ coding guidelines are a good example, IMHO.

Sankar said...

@Sanjoy: It is a matter of taste. Some prefer it in C++ flavor. But for me, C with object orientedness is way better (as used in the Linux Kernel, GNOME etc.)

Sanjoy Das said...

I keep getting the feeling that hardcore C hackers miss out on what C++ has to offer by focusing on its negative points. Just because you can write C++ code that will give the reader (and sometimes the compiler) a headache does not mean it is difficult to write elegant, easy to read C++ code. As far as projects like GNOME are concerned, I think a lot of such decisions were influenced by the unavailability of good C++ compilers back in the formative years of the projects (and maybe of the people who founded the projects). I'd personally use C only in places where I'd like a good amount of control on the kind of code the compiler generates, and C++ everywhere else.

That said, you probably have written and read much more code than I have, so I'll shut up now. :P

Sankar said...

@sanjoy: Dude, You have done a lot more in college itself than what most of us in the industry have done :-) It's truth and I am not lying. Keep up your good work. You may get tempted to feel arrogant in future, try to avoid it :-) (if it happnes )

Regarding C vs C++, there are a lot of people who felt bad about C++'s complexity. It is like they made the language with a goal of keeping it complex. When Java was designed, due to the C++ fiasco, it was decided that the language will be kept simple (and it paid off). Later, when C# was created it followed Java's taste and not c++

The problem with cpp (imho) is the language is so complex but severely lacks useful features like events, async, delegates etc. by default.

carl can said...

I like your blog,and also like the article,and thank you for provide me so much information :)) wholesale diamonds

Ls angels said...

It is useful post, i appreciate your studying, thanks for sharing

jack said...

I like this blog ,because I learn some knowledge from it.Thank you very much.


Ravens Jerseys
Cowboys Jerseys
Bears Jerseys
Packers Jerseys
Custom Ravens Jersey
Torrey Smith Jersey
Jarret Johnson Jersey

security equipment said...

I would like to say this is an excellent blog that I have ever come across. Very informative. Please write more so that we can get more details.

jersey said...

Packers Jersey
Clay Matthews Jersey
Aaron Rodgers Jersey
Jordy Nelson Jersey
B.J. Raji Jersey
Charles Woodson Jersey
Brett Favre Jersey
Donald Driver Jersey
Reggie White Jersey
Ray Nitschke Jersey
Bart Starr Jersey
Greg Jennings Jersey
Jermichael Finley Jersey
A.J. Hawk Jersey
Paul Hornung Jersey
Tramon Williams Jersey

aquarium supplies said...

Actually this code works awesome as developer i appreciate your help so much sir.