Replace functions which called once with their bodies
[pidgin-git.git] / libpurple / protocols / jabber / buddy.h
blobe2411450e5f279046f21dea3952cfa8f4e1749bf
1 /**
2 * @file buddy.h Buddy handlers
4 * purple
6 * Purple is the legal property of its developers, whose names are too numerous
7 * to list here. Please refer to the COPYRIGHT file distributed with this
8 * source distribution.
10 * This program is free software; you can redistribute it and/or modify
11 * it under the terms of the GNU General Public License as published by
12 * the Free Software Foundation; either version 2 of the License, or
13 * (at your option) any later version.
15 * This program is distributed in the hope that it will be useful,
16 * but WITHOUT ANY WARRANTY; without even the implied warranty of
17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 * GNU General Public License for more details.
20 * You should have received a copy of the GNU General Public License
21 * along with this program; if not, write to the Free Software
22 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA
25 #ifndef PURPLE_JABBER_BUDDY_H
26 #define PURPLE_JABBER_BUDDY_H
28 typedef struct _JabberBuddy JabberBuddy;
30 #include "action.h"
32 #include "jabber.h"
33 #include "caps.h"
34 #include "jutil.h"
36 struct _JabberBuddy {
37 /**
38 * A sorted list of resources in priority descending order.
39 * This means that the first resource in the list is the
40 * "most available" (see resource_compare_cb in buddy.c for
41 * details). Don't play with this yourself, let
42 * jabber_buddy_track_resource and jabber_buddy_remove_resource do it.
44 GList *resources;
45 char *error_msg;
46 enum {
47 JABBER_INVISIBLE_NONE = 0,
48 JABBER_INVISIBLE_SERVER = 1 << 1,
49 JABBER_INVIS_BUDDY = 1 << 2
50 } invisible;
51 enum {
52 JABBER_SUB_NONE = 0,
53 JABBER_SUB_PENDING = 1 << 1,
54 JABBER_SUB_TO = 1 << 2,
55 JABBER_SUB_FROM = 1 << 3,
56 JABBER_SUB_BOTH = (JABBER_SUB_TO | JABBER_SUB_FROM),
57 JABBER_SUB_REMOVE = 1 << 4
58 } subscription;
61 typedef struct {
62 char *jid;
63 char *node;
64 char *name;
65 } JabberAdHocCommands;
67 typedef struct {
68 JabberBuddy *jb;
69 char *name;
70 int priority;
71 JabberBuddyState state;
72 char *status;
73 time_t idle;
74 JabberCapabilities capabilities;
75 char *thread_id;
76 enum {
77 JABBER_CHAT_STATES_UNKNOWN,
78 JABBER_CHAT_STATES_UNSUPPORTED,
79 JABBER_CHAT_STATES_SUPPORTED
80 } chat_states;
81 struct {
82 char *version;
83 char *name;
84 char *os;
85 } client;
86 /* tz_off == PURPLE_NO_TZ_OFF when unset */
87 long tz_off;
88 struct {
89 JabberCapsClientInfo *info;
90 GList *exts;
91 } caps;
92 GList *commands;
93 gboolean commands_fetched;
94 } JabberBuddyResource;
96 void jabber_buddy_free(JabberBuddy *jb);
97 JabberBuddy *jabber_buddy_find(JabberStream *js, const char *name,
98 gboolean create);
99 JabberBuddyResource *jabber_buddy_find_resource(JabberBuddy *jb,
100 const char *resource);
101 JabberBuddyResource *jabber_buddy_track_resource(JabberBuddy *jb, const char *resource,
102 int priority, JabberBuddyState state, const char *status);
103 void jabber_buddy_remove_resource(JabberBuddy *jb, const char *resource);
104 void jabber_buddy_get_info(PurpleConnection *gc, const char *who);
106 GList *jabber_blist_node_menu(PurpleBlistNode *node);
108 void jabber_set_info(PurpleConnection *gc, const char *info);
109 void jabber_setup_set_info(PurpleProtocolAction *action);
110 void jabber_set_buddy_icon(PurpleConnection *gc, PurpleImage *img);
112 void jabber_user_search(JabberStream *js, const char *directory);
113 void jabber_user_search_begin(PurpleProtocolAction *);
115 void jabber_buddy_remove_all_pending_buddy_info_requests(JabberStream *js);
117 void jabber_vcard_fetch_mine(JabberStream *js);
119 gboolean jabber_resource_know_capabilities(const JabberBuddyResource *jbr);
120 gboolean jabber_resource_has_capability(const JabberBuddyResource *jbr,
121 const gchar *cap);
122 gboolean jabber_buddy_has_capability(const JabberBuddy *jb, const gchar *cap);
124 const gchar *
125 jabber_resource_get_identity_category_type(const JabberBuddyResource *jbr,
126 const gchar *category);
128 #endif /* PURPLE_JABBER_BUDDY_H */