view libpurple/protocols/myspace/message.h @ 17264:ddcf9ef2ccec

Add MsimMessage implementation (sending only).
author Jeffrey Connelly <jaconnel@calpoly.edu>
date Thu, 31 May 2007 02:29:50 +0000
parents
children 793301c04e3a
line wrap: on
line source

/** MySpaceIM protocol messages
 *
 * \author Jeff Connelly
 *
 * Copyright (C) 2007, Jeff Connelly <jeff2@homing.pidgin.im>
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation; either version 2 of the License, or
 * (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program; if not, write to the Free Software
 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
 */

#ifndef _MYSPACE_MESSAGE_H
#define _MYSPACE_MESSAGE_H

#include "myspace.h"

/* Types */
#define MsimMessage GList		/* #define instead of typedef to avoid casting */
typedef struct _MsimMessageElement
{
	gchar *name;					/**< Textual name of element. */
	guint type;						/**< MSIM_TYPE_* code. */
	gpointer data;					/**< Pointer to data, or GUINT_TO_POINTER for int/bool. */
} MsimMessageElement;

typedef gchar MsimMessageType;

/* Protocol field types */
#define MSIM_TYPE_INTEGER		'i'
#define MSIM_TYPE_STRING		's'
#define MSIM_TYPE_BINARY		'b'
#define MSIM_TYPE_BOOLEAN		'f'
#define MSIM_TYPE_DICTIONARY	'd'
#define MSIM_TYPE_LIST			'l'

MsimMessage *msim_msg_new(void);
void msim_msg_free(MsimMessage *msg);
MsimMessage *msim_msg_append(MsimMessage *msg, gchar *name, MsimMessageType type, gpointer data);
gchar *msim_msg_debug_string(MsimMessage *msg);
gchar *msim_msg_pack(MsimMessage *msg);
gboolean msim_msg_send(MsimSession *session, MsimMessage *msg);

#endif /* _MYSPACE_MESSAGE_H */