Remotelogging stuff (Re: Revision 4f37cd..)
Sadrul Habib Chowdhury
imadil at gmail.com
Mon Jul 23 22:54:42 EDT 2007
* mshkutkov at soc.pidgin.im had this to say on [23 Jul 2007, 06:24:30 -0400]:
[snip]
> +static void get_total_size_for_contact_cb(int size, void *data)
> +{
> + struct _finch_log_size_data *callback_data = data;
> +
> + callback_data->counter--;
> + callback_data->total_size += size;
> +
> + if (!callback_data->counter) {
> + callback_data->lc->finished = TRUE;
> + if (callback_data->value != callback_data->total_size) {
> + g_hash_table_replace(logsize_contacts, callback_data->lc, GINT_TO_POINTER(callback_data->total_size));
> + /* refresh buddy list */
> + populate_buddylist();
> + /* saving value into blist file */
> + purple_blist_node_set_int(callback_data->lc->node, "log_size", callback_data->total_size);
> + }
> + g_free(callback_data);
> + }
> +}
I was looking at the nonblocking-logging stuff in .remotelogging and
.finchfeat.logging. A couple of suggestions/requests for clarifications:
* Does it make sense to send the account and name to the callbacks
(PurpleLogListCallback etc.)?
* Instead of maintaining a counter in the callback data, does it make
sense to use something like a PurpleLogContext or something)? For example,
PurpleLogContext *ct = purple_log_context_new(destroy_context_cb);
purple_log_context_set_userdata(ct, some_data);
purple_log_read_nonblocking(ct, ..., callback_fn, ...);
and the _nonblocking functions will _ref the 'ct', and an internal
log-callback (not 'callback_fn') will _unref it, and call
'destroy_context_cb' when appropriate.
Am I making any sense, or making things unnecessarily more complex than
they need to be?
Sadrul
PS: Oh, and we can do 'gpointer data', instead of 'gpointer *data'
More information about the Devel
mailing list