...making Linux just a little more fun!

<-- prev | next -->

# QQ on Linux

By Silas Brown

Here are some pointers that might help learners of Chinese to communicate with their Chinese friends using the QQ protocol which is popular in China.

## Preliminary notes

1. If you can get your friends to use something other than QQ, do. Dealing with QQ is messy, much more so than Skype, MSN etc.
2. To sign up for a QQ account you will need assistance from a Chinese person with good eyesight, as QQ's CAPTCHA relies on human recognition of distorted Chinese characters, and they're not beginners' characters.
3. libpurple (as used in Pidgin and Adium) has QQ protocol support; you likely have to install the latest version (not the one in your package manager), and in the account details select the Advanced tab and choose the most recent version of the protocol (QQ's servers no longer allow the 2005 version, for example). However libpurple is playing catchup with QQ; every so often QQ does something that's not supported by libpurple, and things can happen like all your incoming messages getting silently dropped, or people trying to send you screen-shots and not realising you're not receiving them.

## QQ for Linux

1. Download from im.qq.com/qq/linux (1.0 Beta 1 has links to a `.deb` for Ubuntu 7.10+, a distribution-independent `.tgz`, etc)
2. QQ 1.0 beta does not work well with GTK themes. Some colours will be taken from the theme and others will not; the result is usually unreadable. Additionally, you cannot simply change the `HOME` environment variable to point to a directory that lacks `.gtkrc`; QQ will find your real home directory anyway. You have to do something like

       mv .gtkrc g0 ; (sleep 5;mv g0 .gtkrc) & qq

3. The login window includes the expected fields for username and password, a remember-password checkbox, and a sign-in button (the left-hand part of which can be used to change status).
4. QQ bypasses the window manager a lot. If clicking on a QQ window to raise it does not work, try switching into it via Alt-Tab or equivalent.
5. The three tabs at the top of the main window are "Friends", "Groups", and "Recently chatted with". The colour button above that lets you choose a colour and picture for the QQ windows' title bars, and above this is a status button and an area where you can click to type a status message. The round button at the bottom is a menu. The spanner lets you change your account options (friendly name, etc). The other buttons are to view recently-downloaded files, and to find/add more QQ contacts.
6. Click to expand a list of contacts (friends, strangers, or other), double-click to start a chat, right-click to bring up a context menu, the items of which are Send Message, Send File, Delete Contact, View Profile, Annotate Contact (i.e. set an alias), and whether or not to show these aliases.
7. QQ 1.0 beta will crash if you try to type in an annotation that is longer than 16 characters. (There is no bounds-checking on the array until the C library sees corruption after `free()`. It's reasonable to assume that Chinese-character aliases won't be longer than 16 characters, but Latin-character aliases might well be.)
8. QQ can also forget some of your annotations from time to time; I'm not sure why. You'd be advised to keep a separate copy.
9. In the chat window, press Control+Enter to send (Enter just adds a new line). The icons in the chat window are: Emoticon, History (toggles display of the most recent part of the conversation you had before this one), Send picture (lets you choose a picture file and pastes the picture directly into the conversation), Take screenshot (this button darkens the screen, and you then use the mouse to drag out the rectangle that you want to send, and double-click on it; it will then appear in the typing box and you can add words around it), and Send file.
10. Voice and video chat are not available in the 1.0 beta Linux version.

## QQ in WINE

QQ 2008 (with voice chat) can be set up in WINE as follows, but it is unstable.

    mkdir qq && cd qq &&
    wget http://dl_dir.qq.com/qqfile/qq/QQ2008stablehij/QQ2008.exe &&
    HOME="$(pwd)" LANG=zh_CN.gb18030 wine QQ2008.exe

then click the button marked with an (I), then click the first radio box, then Next, then Next, then wait for installation, then Finish. The "what's new" file will appear in Notepad, and QQ will launch; you may now fill in your number and password (and choose to remember password).

You then need to close QQ and do this:

    killall TXPlatform.exe QQ.exe explorer.exe winedevice.exe rundll32.exe services.exe
    rm .wine/drive_c/Program\ Files/Tencent/QQ/TXPlatform.exe

Then run QQ with

    HOME="$(pwd)" LANG=zh_CN.gb18030 \
    WINEDLLOVERRIDES="mfc42,msvcp60,riched20,riched32=n,b;mmdevapi=" \
    wine .wine/drive_c/Program\ Files/Tencent/QQ/QQ.exe

## Concluding Notes:

(adapted from the Chinese-language thread at http://www.linuxdiyf.com/bbs/thread-109610-1-1.html, with some experimentation to improve stability)

Most characters should be displayed if your system has the zh_CN.gb18030 locale and some Chinese TTF fonts, although some menus may not display.

Voice chat works for me on Ubuntu Hardy's WINE package (version 1.0.0-1ubuntu4~hardy1). Newer WINE packages (1.1.0, 1.1.24) get an assertion failure about `(elem)->type == SND_MIXER_ELEM_SIMPLE` in the ALSA code, or if you use `winecfg` to set OSS audio then sound works only one way.

Some Chinese people will tell you that there exists an English version of QQ. However, that was released in 2005 and uses a version of the protocol that QQ no longer supports. There is a 2008 English version of their simpler "Tencent Messenger" product, but I was not able to get that to work with WINE.

With thanks to Jessy Li for some translation help.

Talkback: Discuss this article with The Answer Gang

Silas Brown is a legally blind computer scientist based in Cambridge UK. He has been using heavily-customised versions of Debian Linux since 1999.

Copyright © 2009, Silas Brown. Released under the Open Publication License unless otherwise noted in the body of the article. Linux Gazette is not produced, sponsored, or endorsed by its prior host, SSC, Inc.

Published in Issue 167 of Linux Gazette, October 2009

<-- prev | next -->