Gaim Plugin Development
I. Description of the plugin
GAIM is a client based on GTK 2 multi-platform instant messaging client. It supports many common protocols, including: MSN, Yahoo, ICQ, QQ, Jabber, and I am doing Taobao Want Want. If you need to make a plugin for a new IM protocol, then look down on the simple description, detailed content only Can be further added further.
Second. Interface definition
Define interface functions and interface variables in accordance with Gaim Plugin API.
Define Gaim Plugin handle
Static Gaimplugin * WW_PLUGIN = NULL;
This structure is defined in Plugin.h:
The member variable of the structure GaimpluginInfo * INFO will point to the pointer to the plug-in detail in the initialization.
2. Define the plugin protocol information
Static GaimpluginProtocolinfo prPl_info = {
.
.
.
}
This structure defines the population of all protocol functions to provide GAIM calls. GAIM looks for the corresponding function in this structure when the event is triggered, such as the user uses this plugin on Gaim On the interface, Gaim will find it here. The login function is called.
Note: List_ICON functions cannot be empty
3. Define plug-in details
Static GaimpluginInfo Info = {
.
.
}
This structure is defined in Plugin.h:
The main plug-in ID, the name of the plugin, the version of the plugin, the plugin type (instructions are protocol plugins, or ordinary plug-ins), plugin protocol information (definition message processing)
4. Define the initialization function
Static void init_plugin (gaimplugin * plugin) {
WW_PLUGIN = Plugin; // Point Plugin to WW_PLUGIN defined in front
}
5. Define the plug-in inlet function
GAIM_INIT_PLUGIN (WW, INIT_PLUGIN, INFO)
6. Source code.
I don't know how to put it, see the protocol example in Gaim code.
III. Compilation and installation
Look at Makefile
All: Install
Libwangwang.so:wwang.o
ld -shared -o lowwang.so wwang.o
WWANG.O: wwang.c
GCC-FPIC-DGAIM_PLUGINS -WALL -G -DVERSION = / "
1.1.1
/ "
I.
-I ../../ src -i .. -i / usr / include / gtk-2.0 -i / usr / lib / gtk-2.0 /
INCLUDE-I / USR / include / glib-2.0 -i / usr / lib / glib-2.0 / include -c wwang.c -o wwang.o
Install: Libwangwang.so
CP Libwwang.so / Home / WEE / BIN / GAIM / LIB / GAIM /
3. Further processing
After the compiled SO is copied to the GAIM installation directory, start GAIM to select the new account, then you can see the name of the plugin you defined in the list of protocols, you can enter the username and password save, of course, when you log in, The button does not do, further processing is to handle each action according to the protocol you want to connect, such as login exit, add deduction friends, group, and send and receive messages. Examples can be referred to in addition to GAIM self-contained MSN Outside the plugin of Jabber, Yahoo, OpenQ ..