Frameworks/libpurple.framework/Versions/0.6.2/Headers/buddy.h
author Zachary West <zacw@adium.im>
Fri Aug 21 13:25:11 2009 -0700 (2009-08-21)
changeset 2592 e8d15275025e
parent 2571 Frameworks/libpurple.framework/Versions/0.6.0/Headers/buddy.h@75fb8ee8f2e6
permissions -rw-r--r--
im.pidgin.adium.1-4 at 267c6165e02e34318a1823960bd04c0639952f73
     1 /**
     2  * @file buddy.h Buddy handlers
     3  *
     4  * purple
     5  *
     6  * Copyright (C) 2003 Nathan Walp <faceprint@faceprint.com>
     7  *
     8  * This program is free software; you can redistribute it and/or modify
     9  * it under the terms of the GNU General Public License as published by
    10  * the Free Software Foundation; either version 2 of the License, or
    11  * (at your option) any later version.
    12  *
    13  * This program is distributed in the hope that it will be useful,
    14  * but WITHOUT ANY WARRANTY; without even the implied warranty of
    15  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    16  * GNU General Public License for more details.
    17  *
    18  * You should have received a copy of the GNU General Public License
    19  * along with this program; if not, write to the Free Software
    20  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02111-1301  USA
    21  */
    22 #ifndef PURPLE_JABBER_BUDDY_H_
    23 #define PURPLE_JABBER_BUDDY_H_
    24 
    25 typedef enum {
    26 	JABBER_BUDDY_STATE_UNKNOWN = -2,
    27 	JABBER_BUDDY_STATE_ERROR = -1,
    28 	JABBER_BUDDY_STATE_UNAVAILABLE = 0,
    29 	JABBER_BUDDY_STATE_ONLINE,
    30 	JABBER_BUDDY_STATE_CHAT,
    31 	JABBER_BUDDY_STATE_AWAY,
    32 	JABBER_BUDDY_STATE_XA,
    33 	JABBER_BUDDY_STATE_DND
    34 } JabberBuddyState;
    35 
    36 typedef struct _JabberBuddy JabberBuddy;
    37 
    38 #include "jabber.h"
    39 #include "caps.h"
    40 
    41 struct _JabberBuddy {
    42 	GList *resources;
    43 	char *error_msg;
    44 	enum {
    45 		JABBER_INVISIBLE_NONE   = 0,
    46 		JABBER_INVISIBLE_SERVER = 1 << 1,
    47 		JABBER_INVIS_BUDDY      = 1 << 2
    48 	} invisible;
    49 	enum {
    50 		JABBER_SUB_NONE    = 0,
    51 		JABBER_SUB_PENDING = 1 << 1,
    52 		JABBER_SUB_TO      = 1 << 2,
    53 		JABBER_SUB_FROM    = 1 << 3,
    54 		JABBER_SUB_BOTH    = (JABBER_SUB_TO | JABBER_SUB_FROM),
    55 		JABBER_SUB_REMOVE  = 1 << 4
    56 	} subscription;
    57 };
    58 
    59 typedef struct _JabberAdHocCommands {
    60 	char *jid;
    61 	char *node;
    62 	char *name;
    63 } JabberAdHocCommands;
    64 
    65 typedef struct _JabberBuddyResource {
    66 	JabberBuddy *jb;
    67 	char *name;
    68 	int priority;
    69 	JabberBuddyState state;
    70 	char *status;
    71 	time_t idle;
    72 	JabberCapabilities capabilities;
    73 	char *thread_id;
    74 	enum {
    75 		JABBER_CHAT_STATES_UNKNOWN,
    76 		JABBER_CHAT_STATES_UNSUPPORTED,
    77 		JABBER_CHAT_STATES_SUPPORTED
    78 	} chat_states;
    79 	struct {
    80 		char *version;
    81 		char *name;
    82 		char *os;
    83 	} client;
    84 	/* tz_off == PURPLE_NO_TZ_OFF when unset */
    85 	long tz_off;
    86 	struct {
    87 		JabberCapsClientInfo *info;
    88 		GList *exts;
    89 	} caps;
    90 	GList *commands;
    91 	gboolean commands_fetched;
    92 } JabberBuddyResource;
    93 
    94 void jabber_buddy_free(JabberBuddy *jb);
    95 JabberBuddy *jabber_buddy_find(JabberStream *js, const char *name,
    96 		gboolean create);
    97 JabberBuddyResource *jabber_buddy_find_resource(JabberBuddy *jb,
    98 		const char *resource);
    99 JabberBuddyResource *jabber_buddy_track_resource(JabberBuddy *jb, const char *resource,
   100 		int priority, JabberBuddyState state, const char *status);
   101 void jabber_buddy_resource_free(JabberBuddyResource *jbr);
   102 void jabber_buddy_remove_resource(JabberBuddy *jb, const char *resource);
   103 void jabber_buddy_get_info(PurpleConnection *gc, const char *who);
   104 
   105 GList *jabber_blist_node_menu(PurpleBlistNode *node);
   106 
   107 void jabber_set_info(PurpleConnection *gc, const char *info);
   108 void jabber_setup_set_info(PurplePluginAction *action);
   109 void jabber_set_buddy_icon(PurpleConnection *gc, PurpleStoredImage *img);
   110 
   111 const char *jabber_buddy_state_get_name(JabberBuddyState state);
   112 const char *jabber_buddy_state_get_status_id(JabberBuddyState state);
   113 const char *jabber_buddy_state_get_show(JabberBuddyState state);
   114 JabberBuddyState jabber_buddy_status_id_get_state(const char *id);
   115 JabberBuddyState jabber_buddy_show_get_state(const char *id);
   116 
   117 void jabber_user_search(JabberStream *js, const char *directory);
   118 void jabber_user_search_begin(PurplePluginAction *);
   119 
   120 void jabber_buddy_remove_all_pending_buddy_info_requests(JabberStream *js);
   121 
   122 void jabber_vcard_fetch_mine(JabberStream *js);
   123 
   124 gboolean jabber_resource_has_capability(const JabberBuddyResource *jbr,
   125 										const gchar *cap);
   126 gboolean jabber_buddy_has_capability(const JabberBuddy *jb, const gchar *cap);
   127 
   128 const gchar *
   129 jabber_resource_get_identity_category_type(const JabberBuddyResource *jbr,
   130 	const gchar *category);
   131 
   132 #endif /* PURPLE_JABBER_BUDDY_H_ */