Frameworks/libpurple.framework/Versions/0.6.2/Headers/transaction.h
changeset 2592 e8d15275025e
parent 1739 8b0daad9656c
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/Frameworks/libpurple.framework/Versions/0.6.2/Headers/transaction.h	Fri Aug 21 13:25:11 2009 -0700
     1.3 @@ -0,0 +1,79 @@
     1.4 +/**
     1.5 + * @file transaction.h MSN transaction functions
     1.6 + *
     1.7 + * purple
     1.8 + *
     1.9 + * Purple is the legal property of its developers, whose names are too numerous
    1.10 + * to list here.  Please refer to the COPYRIGHT file distributed with this
    1.11 + * source distribution.
    1.12 + *
    1.13 + * This program is free software; you can redistribute it and/or modify
    1.14 + * it under the terms of the GNU General Public License as published by
    1.15 + * the Free Software Foundation; either version 2 of the License, or
    1.16 + * (at your option) any later version.
    1.17 + *
    1.18 + * This program is distributed in the hope that it will be useful,
    1.19 + * but WITHOUT ANY WARRANTY; without even the implied warranty of
    1.20 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    1.21 + * GNU General Public License for more details.
    1.22 + *
    1.23 + * You should have received a copy of the GNU General Public License
    1.24 + * along with this program; if not, write to the Free Software
    1.25 + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02111-1301  USA
    1.26 + */
    1.27 +#ifndef _MSN_TRANSACTION_H
    1.28 +#define _MSN_TRANSACTION_H
    1.29 +
    1.30 +typedef struct _MsnTransaction MsnTransaction;
    1.31 +
    1.32 +#include "command.h"
    1.33 +#include "cmdproc.h"
    1.34 +
    1.35 +typedef void (*MsnTransCb)(MsnCmdProc *cmdproc, MsnCommand *cmd);
    1.36 +typedef void (*MsnTimeoutCb)(MsnCmdProc *cmdproc, MsnTransaction *trans);
    1.37 +typedef void (*MsnErrorCb)(MsnCmdProc *cmdproc, MsnTransaction *trans,
    1.38 +						   int error);
    1.39 +
    1.40 +/**
    1.41 + * A transaction. A sending command that will initiate the transaction.
    1.42 + */
    1.43 +struct _MsnTransaction
    1.44 +{
    1.45 +	MsnCmdProc *cmdproc;
    1.46 +	unsigned int trId;
    1.47 +
    1.48 +	char *command;
    1.49 +	char *params;
    1.50 +
    1.51 +	guint timer;
    1.52 +
    1.53 +	void *data; /**< The data to be used on the different callbacks. */
    1.54 +	GHashTable *callbacks;
    1.55 +	gboolean has_custom_callbacks;
    1.56 +	MsnErrorCb error_cb;
    1.57 +	MsnTimeoutCb timeout_cb;
    1.58 +
    1.59 +	char *payload;
    1.60 +	size_t payload_len;
    1.61 +
    1.62 +	GQueue *queue;
    1.63 +	MsnCommand *pendent_cmd; /**< The command that is waiting for the result of
    1.64 +							   this transaction. */
    1.65 +};
    1.66 +
    1.67 +MsnTransaction *msn_transaction_new(MsnCmdProc *cmdproc, const char *command,
    1.68 +	const char *format, ...) G_GNUC_PRINTF(3, 4);
    1.69 +void msn_transaction_destroy(MsnTransaction *trans);
    1.70 +
    1.71 +char *msn_transaction_to_string(MsnTransaction *trans);
    1.72 +void msn_transaction_queue_cmd(MsnTransaction *trans, MsnCommand *cmd);
    1.73 +void msn_transaction_unqueue_cmd(MsnTransaction *trans, MsnCmdProc *cmdproc);
    1.74 +void msn_transaction_set_payload(MsnTransaction *trans,
    1.75 +								 const char *payload, int payload_len);
    1.76 +void msn_transaction_set_data(MsnTransaction *trans, void *data);
    1.77 +void msn_transaction_add_cb(MsnTransaction *trans, char *answer,
    1.78 +							MsnTransCb cb);
    1.79 +void msn_transaction_set_error_cb(MsnTransaction *trans, MsnErrorCb cb);
    1.80 +void msn_transaction_set_timeout_cb(MsnTransaction *trans, MsnTimeoutCb cb);
    1.81 +
    1.82 +#endif /* _MSN_TRANSACTION_H */