Creating a Google chat client in 15 minutes

Posted by Ariya Hidayat on March 8, 2009 · 4 comments

Of course, I cheated. The trick is actually by using Google’s own iPhone web application, which is pure HTML and JavaScript. Despite the name Google Talk, unfortunately it has no support for voice chat, rather only text chat.

The secret is to find the actual URL and load it in QWebView. Since initially it presents a login page, this particular client also automatically fills the username and password for you, getting them from its own login page. Overall, the code is very simple and does not even reach 200 lines, including some rudimentary error handling (wrong password, failed login). The user interface was created completely using Qt Designer. Careful readers might notice that I deliberately added the flick support (kinetic scrolling) using Flick Charm. This quick-and-dirty chat client was completed in less than quarter an hour.

Check the code at the usual Graphics Dojo git repository, find it under the webgtalk folder. This example requires Qt 4.5, which has just been released, in particular due to the use document.getElementByid. Exercise for the reader: tweak the little JavaScript snippets used in this program so that it works also with Qt 4.4. Another challenge: there is also
chat client for iGoogle which performs better but then it requires Flash plugin.

QShare(this)

Possibly related posts:

  1. Qt for Google Native Client Preview
  2. QtDemo is no longer my Twitter client

4 comments

1 WaxDragon March 9, 2009 at 3:14 am
 

Very nice.
With this concept is also possible do a MSN client with the WebApllication, the benefits of WebKit !

BTW, i think that with this Android shit, the Google nome is prohibited inside Nokia.

2 Adam Higerd March 9, 2009 at 4:47 pm
 

Well, if you’re going to go about it THAT way, you could hook into Meebo and get the full power of libpurple behind it — yay multiprotocol.

3 Nils March 10, 2009 at 7:06 pm
 

Hi!

Any news about WebKit DOM Access? Is it still on the roadmap?

Nils

4 ariya March 11, 2009 at 10:18 am
 

WaxDragon, Adam: Whether it is MSN or Meebo, feel free to experiement. That is exactly my point. I picked Google Talk randomly, just as an example.

Nils: It is on our roadmap. We will talk about it when we feel it is the right time.

Comments on this entry are closed.

Previous post:

Next post: