Trac is being migrated to new services! Issues can be found in our new
YouTrack instance and WIKI pages can be found on our
website.
- Timestamp:
-
Apr 26, 2007, 6:07:44 AM (17 years ago)
- Author:
-
MarkDoliner
- Comment:
-
--
Legend:
- Unmodified
- Added
- Removed
- Modified
-
v5
|
v6
|
|
5 | 5 | = How does it work? = |
6 | 6 | |
7 | | You write a program in C or C++ that provides all the fancy windows and dialogs and anything that the user interacts with. Your program registers a bunch of callback functions, called "UI ops," with libpurple. This is done by populating the appropriate uiops structures (eg. PurpleAccountUiOps, PurpleBlistUiOps, etc.) and making them available to the libpurple core (by calling purple_account_set_ui_ops, purple_blist_set_ui_ops, etc.). Thes ui ops are triggered at specific events. For example, the buddylist ui ops are used to update your buddylist window when a new buddy is added, or if a buddy goes away, or becomes idle, etc. |
| 7 | You write a program in C or C++ that provides all the fancy windows and dialogs and anything that the user interacts with. Your program uses our libpurple library to connect to the IM networks, manage accounts and preferences, and lots of other helpful little things. |
8 | 8 | |
9 | | Your program provides the int main() function. Your main function will call libpurple_core_init() which initializes libpurple. Your main function will also register a whole bunch of "callback" functions that are called by libpurple any time there is something to tell the user. For example, when libpurple receives an IM it'll call your function for handling an incoming IM. When one of your buddies signs online then libpurple will call your function to update the buddylist. The same thing happens for conversations, logging etc. |
| 9 | Your program registers a bunch of callback functions, called "UI ops," with libpurple. This is done by populating the appropriate uiops structures (eg. PurpleAccountUiOps, PurpleBlistUiOps, etc.) and making them available to the libpurple core (by calling purple_account_set_ui_ops, purple_blist_set_ui_ops, etc.). Thes ui ops are triggered by specific events. For example, the buddylist ui ops are used to update your buddylist window when a new buddy is added, or if a buddy goes away, or becomes idle, etc. The same thing happens for conversations, logging etc. |
10 | 10 | |
11 | | While the uiops are sufficient for most of the ui operations, it's likely that you will want to use the gaim-signals as well to fine-tune some stuff. |
| 11 | While the uiops are sufficient for most of the ui operations, it's likely that you will want to use various libpurple signals, as well. |
12 | 12 | |
13 | | If your user fetches someone's info then you'll call a libpurple function that sends the appropriate message across the network. Then libpurple will get a response and call your function for handling buddy info. |
| 13 | = Can you give me some details? = |
14 | 14 | |
15 | | libgaim uses the glib mainloop to do all the things. The application wanting to use libgaim will [likely] have to do the same. |
| 15 | Your application will first initialize the core (purple_core_init), add plugin-search paths, load the saved plugins, prefs etc. Your best bet is to check out a copy of the source code and look at console/gntgaim.c:init_libgaim(). |
16 | 16 | |
17 | | The application will first initialize the core (gaim_core_init), add plugin-search paths, load the saved plugins, prefs etc. If you have the source, I suggest you take a look at console/gntgaim.c:init_libgaim to get an idea of what's required to setup libgaim for your application. |
| 17 | = Is it threaded? = |
| 18 | |
| 19 | Nope! libpurple uses the glib mainloop to do all the things. It watches socket for new data and calls timeout functions after a specified delay. It's easiest if your application also uses the glib mainloop, but this is not required. |
All information, including names and email addresses, entered onto this website or sent to mailing lists affiliated with this website will be public. Do not post confidential information, especially passwords!