roomlist.h
Go to the documentation of this file.
/* purple
*
* Purple is the legal property of its developers, whose names are too numerous
* to list here. Please refer to the COPYRIGHT file distributed with this
* source distribution.
*
* 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., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA
*/
#ifndef _PURPLE_ROOMLIST_H_
#define _PURPLE_ROOMLIST_H_
typedef struct _PurpleRoomlist PurpleRoomlist;
typedef struct _PurpleRoomlistRoom PurpleRoomlistRoom;
typedef struct _PurpleRoomlistField PurpleRoomlistField;
typedef struct _PurpleRoomlistUiOps PurpleRoomlistUiOps;
typedef enum
{
PURPLE_ROOMLIST_ROOMTYPE_CATEGORY = 0x01,
PURPLE_ROOMLIST_ROOMTYPE_ROOM = 0x02
} PurpleRoomlistRoomType;
typedef enum
{
PURPLE_ROOMLIST_FIELD_BOOL,
PURPLE_ROOMLIST_FIELD_INT,
PURPLE_ROOMLIST_FIELD_STRING
} PurpleRoomlistFieldType;
#include "account.h"
#include <glib.h>
/**************************************************************************/
/**************************************************************************/
struct _PurpleRoomlist {
PurpleAccount *account;
GList *fields;
GList *rooms;
gboolean in_progress;
gpointer ui_data;
gpointer proto_data;
guint ref;
};
struct _PurpleRoomlistRoom {
PurpleRoomlistRoomType type;
gchar *name;
GList *fields;
PurpleRoomlistRoom *parent;
gboolean expanded_once;
};
struct _PurpleRoomlistField {
PurpleRoomlistFieldType type;
gchar *label;
gchar *name;
gboolean hidden;
};
struct _PurpleRoomlistUiOps {
void (*show_with_account)(PurpleAccount *account);
void (*create)(PurpleRoomlist *list);
void (*set_fields)(PurpleRoomlist *list, GList *fields);
void (*add_room)(PurpleRoomlist *list, PurpleRoomlistRoom *room);
void (*in_progress)(PurpleRoomlist *list, gboolean flag);
void (*destroy)(PurpleRoomlist *list);
void (*_purple_reserved1)(void);
void (*_purple_reserved2)(void);
void (*_purple_reserved3)(void);
void (*_purple_reserved4)(void);
};
#ifdef __cplusplus
extern "C" {
#endif
/**************************************************************************/
/**************************************************************************/
void purple_roomlist_show_with_account(PurpleAccount *account);
PurpleRoomlist *purple_roomlist_new(PurpleAccount *account);
void purple_roomlist_ref(PurpleRoomlist *list);
void purple_roomlist_unref(PurpleRoomlist *list);
void purple_roomlist_set_fields(PurpleRoomlist *list, GList *fields);
void purple_roomlist_set_in_progress(PurpleRoomlist *list, gboolean in_progress);
gboolean purple_roomlist_get_in_progress(PurpleRoomlist *list);
void purple_roomlist_room_add(PurpleRoomlist *list, PurpleRoomlistRoom *room);
PurpleRoomlist *purple_roomlist_get_list(PurpleConnection *gc);
void purple_roomlist_cancel_get_list(PurpleRoomlist *list);
void purple_roomlist_expand_category(PurpleRoomlist *list, PurpleRoomlistRoom *category);
GList * purple_roomlist_get_fields(PurpleRoomlist *roomlist);
/**************************************************************************/
/**************************************************************************/
PurpleRoomlistRoom *purple_roomlist_room_new(PurpleRoomlistRoomType type, const gchar *name,
PurpleRoomlistRoom *parent);
void purple_roomlist_room_add_field(PurpleRoomlist *list, PurpleRoomlistRoom *room, gconstpointer field);
void purple_roomlist_room_join(PurpleRoomlist *list, PurpleRoomlistRoom *room);
PurpleRoomlistRoomType purple_roomlist_room_get_type(PurpleRoomlistRoom *room);
const char * purple_roomlist_room_get_name(PurpleRoomlistRoom *room);
PurpleRoomlistRoom * purple_roomlist_room_get_parent(PurpleRoomlistRoom *room);
GList * purple_roomlist_room_get_fields(PurpleRoomlistRoom *room);
/**************************************************************************/
/**************************************************************************/
PurpleRoomlistField *purple_roomlist_field_new(PurpleRoomlistFieldType type,
const gchar *label, const gchar *name,
gboolean hidden);
PurpleRoomlistFieldType purple_roomlist_field_get_type(PurpleRoomlistField *field);
const char * purple_roomlist_field_get_label(PurpleRoomlistField *field);
gboolean purple_roomlist_field_get_hidden(PurpleRoomlistField *field);
/**************************************************************************/
/**************************************************************************/
void purple_roomlist_set_ui_ops(PurpleRoomlistUiOps *ops);
PurpleRoomlistUiOps *purple_roomlist_get_ui_ops(void);
#ifdef __cplusplus
}
#endif
#endif /* _PURPLE_ROOMLIST_H_ */
PurpleRoomlistFieldType
PurpleRoomlistFieldType
The types of fields.
Definition: roomlist.h:51
purple_roomlist_show_with_account
void purple_roomlist_show_with_account(PurpleAccount *account)
This is used to get the room list on an account, asking the UI to pop up a dialog with the specified ...
purple_roomlist_room_join
void purple_roomlist_room_join(PurpleRoomlist *list, PurpleRoomlistRoom *room)
Join a room, given a PurpleRoomlistRoom and it&#39;s associated PurpleRoomlist.
purple_roomlist_get_fields
GList * purple_roomlist_get_fields(PurpleRoomlist *roomlist)
Get the list of fields for a roomlist.
purple_roomlist_room_add
void purple_roomlist_room_add(PurpleRoomlist *list, PurpleRoomlistRoom *room)
Adds a room to the list of them.
PurpleRoomlistRoomType
PurpleRoomlistRoomType
The types of rooms.
Definition: roomlist.h:41
_PurpleRoomlist::fields
GList * fields
The fields.
Definition: roomlist.h:71
PURPLE_ROOMLIST_FIELD_STRING
We do a g_strdup on the passed value if it&#39;s this type.
Definition: roomlist.h:55
purple_roomlist_expand_category
void purple_roomlist_expand_category(PurpleRoomlist *list, PurpleRoomlistRoom *category)
Tells the prpl that a category was expanded.
_PurpleRoomlistRoom::expanded_once
gboolean expanded_once
A flag the UI uses to avoid multiple expand prpl cbs.
Definition: roomlist.h:87
purple_roomlist_field_new
PurpleRoomlistField * purple_roomlist_field_new(PurpleRoomlistFieldType type, const gchar *label, const gchar *name, gboolean hidden)
Creates a new field.
purple_roomlist_field_get_hidden
gboolean purple_roomlist_field_get_hidden(PurpleRoomlistField *field)
Check whether a roomlist-field is hidden.
purple_roomlist_ref
void purple_roomlist_ref(PurpleRoomlist *list)
Increases the reference count on the room list.
_PurpleAccount
Structure representing an account.
Definition: account.h:169
purple_roomlist_set_ui_ops
void purple_roomlist_set_ui_ops(PurpleRoomlistUiOps *ops)
Sets the UI operations structure to be used in all purple room lists.
purple_roomlist_room_new
PurpleRoomlistRoom * purple_roomlist_room_new(PurpleRoomlistRoomType type, const gchar *name, PurpleRoomlistRoom *parent)
Creates a new room, to be added to the list.
_PurpleRoomlistField::type
PurpleRoomlistFieldType type
The type of field.
Definition: roomlist.h:94
purple_roomlist_room_add_field
void purple_roomlist_room_add_field(PurpleRoomlist *list, PurpleRoomlistRoom *room, gconstpointer field)
Adds a field to a room.
purple_roomlist_set_fields
void purple_roomlist_set_fields(PurpleRoomlist *list, GList *fields)
Set the different field types and their names for this protocol.
purple_roomlist_room_get_fields
GList * purple_roomlist_room_get_fields(PurpleRoomlistRoom *room)
Get the list of fields for a room.
PURPLE_ROOMLIST_ROOMTYPE_CATEGORY
It&#39;s a category, but not a room you can join.
Definition: roomlist.h:43
_PurpleRoomlistField::label
gchar * label
The i18n user displayed name of the field.
Definition: roomlist.h:95
_PurpleRoomlistRoom::parent
PurpleRoomlistRoom * parent
The parent room, or NULL.
Definition: roomlist.h:86
_PurpleRoomlistField
A field a room might have.
Definition: roomlist.h:93
_PurpleRoomlist::account
PurpleAccount * account
The account this list belongs to.
Definition: roomlist.h:70
purple_roomlist_new
PurpleRoomlist * purple_roomlist_new(PurpleAccount *account)
Returns a newly created room list object.
purple_roomlist_unref
void purple_roomlist_unref(PurpleRoomlist *list)
Decreases the reference count on the room list.
_PurpleRoomlist::in_progress
gboolean in_progress
The listing is in progress.
Definition: roomlist.h:73
purple_roomlist_cancel_get_list
void purple_roomlist_cancel_get_list(PurpleRoomlist *list)
Tells the prpl to stop fetching the list.
account.h
Account API.
_PurpleRoomlistUiOps
The room list ops to be filled out by the UI.
Definition: roomlist.h:103
purple_roomlist_room_get_parent
PurpleRoomlistRoom * purple_roomlist_room_get_parent(PurpleRoomlistRoom *room)
Get the parent of a room.
_PurpleRoomlistField::hidden
gboolean hidden
Hidden?
Definition: roomlist.h:97
purple_roomlist_get_in_progress
gboolean purple_roomlist_get_in_progress(PurpleRoomlist *list)
Gets the "in progress" state of the room list.
purple_roomlist_room_get_type
PurpleRoomlistRoomType purple_roomlist_room_get_type(PurpleRoomlistRoom *room)
Get the type of a room.
_PurpleRoomlistRoom::name
gchar * name
The name of the room.
Definition: roomlist.h:84
PURPLE_ROOMLIST_ROOMTYPE_ROOM
It&#39;s a room, like the kind you can join.
Definition: roomlist.h:44
purple_roomlist_get_list
PurpleRoomlist * purple_roomlist_get_list(PurpleConnection *gc)
Returns a PurpleRoomlist structure from the prpl, and instructs the prpl to start fetching the list...
_PurpleRoomlist
Data Structures.
Definition: roomlist.h:69
purple_roomlist_get_ui_ops
PurpleRoomlistUiOps * purple_roomlist_get_ui_ops(void)
Returns the purple window UI operations structure to be used in new windows.
_PurpleConnection
Definition: connection.h:245
purple_roomlist_field_get_type
PurpleRoomlistFieldType purple_roomlist_field_get_type(PurpleRoomlistField *field)
Get the type of a field.
purple_roomlist_field_get_label
const char * purple_roomlist_field_get_label(PurpleRoomlistField *field)
Get the label of a field.
_PurpleRoomlist::ref
guint ref
Prpl private data.
Definition: roomlist.h:76
_PurpleRoomlistRoom::fields
GList * fields
Other fields.
Definition: roomlist.h:85
purple_roomlist_room_get_name
const char * purple_roomlist_room_get_name(PurpleRoomlistRoom *room)
Get the name of a room.
_PurpleRoomlist::rooms
GList * rooms
The list of rooms.
Definition: roomlist.h:72
_PurpleRoomlistRoom
Represents a room.
Definition: roomlist.h:82
purple_roomlist_set_in_progress
void purple_roomlist_set_in_progress(PurpleRoomlist *list, gboolean in_progress)
Set the "in progress" state of the room list.
_PurpleRoomlistField::name
gchar * name
The internal name of the field.
Definition: roomlist.h:96
_PurpleRoomlist::ui_data
gpointer ui_data
UI private data.
Definition: roomlist.h:74
_PurpleRoomlistRoom::type
PurpleRoomlistRoomType type
The type of room.
Definition: roomlist.h:83