libpurple/protocols/gg/purplew.c

Sat, 30 Jun 2012 11:57:37 +0200

author
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
date
Sat, 30 Jun 2012 11:57:37 +0200
branch
soc.2012.gg
changeset 33306
b1bef9a92b4c
parent 33305
libpurple/protocols/gg/purple.c@41e5ff454167
child 33309
bc2f2ea7b5ab
permissions
-rw-r--r--

Gadu-Gadu: rename purple.(c|h) to purplew.(c|h) - purple wrappers

#include "purplew.h"

#include <request.h>

guint ggp_purplew_http_input_add(struct gg_http *http_req,
	PurpleInputFunction func, gpointer user_data)
{
	PurpleInputCondition cond = 0;
	int check = http_req->check;

	if (check & GG_CHECK_READ)
		cond |= PURPLE_INPUT_READ;
	if (check & GG_CHECK_WRITE)
		cond |= PURPLE_INPUT_WRITE;

	return purple_input_add(http_req->fd, cond, func, user_data);
}

static void ggp_purplew_request_processing_cancel(
	ggp_purplew_request_processing_handle *handle, gint id)
{
	handle->cancel_cb(handle->gc, handle->user_data);
	g_free(handle);
}

ggp_purplew_request_processing_handle * ggp_purplew_request_processing(
	PurpleConnection *gc, const gchar *msg, void *user_data,
	ggp_purplew_request_processing_cancel_cb cancel_cb)
{
	ggp_purplew_request_processing_handle *handle =
		g_new(ggp_purplew_request_processing_handle, 1);

	handle->gc = gc;
	handle->cancel_cb = cancel_cb;
	handle->user_data = user_data;
	handle->request_handle = purple_request_action(gc, _("Please wait..."),
		(msg ? msg : _("Please wait...")), NULL,
		PURPLE_DEFAULT_ACTION_NONE, purple_connection_get_account(gc),
		NULL, NULL, handle, 1,
		_("Cancel"), G_CALLBACK(ggp_purplew_request_processing_cancel));
	
	return handle;
}

void ggp_purplew_request_processing_done(
	ggp_purplew_request_processing_handle *handle)
{
	purple_request_close(PURPLE_REQUEST_ACTION, handle->request_handle);
	g_free(handle);
}

mercurial