author | Mikael Berthe <mikael@lilotux.net> |
Sun, 04 Dec 2005 09:04:02 +0100 | |
changeset 576 | 8b3db0b555a1 |
parent 572 | afc2bd38b15c |
child 580 | fed6d1e4d7a9 |
permissions | -rw-r--r-- |
72 | 1 |
#ifndef __ROSTER_H__ |
2 |
#define __ROSTER_H__ 1 |
|
3 |
||
4 |
#include <glib.h> |
|
5 |
||
572
afc2bd38b15c
Implement affiliations handling, add "/room whois"
Mikael Berthe <mikael@lilotux.net>
parents:
548
diff
changeset
|
6 |
enum imstatus { |
afc2bd38b15c
Implement affiliations handling, add "/room whois"
Mikael Berthe <mikael@lilotux.net>
parents:
548
diff
changeset
|
7 |
offline, |
afc2bd38b15c
Implement affiliations handling, add "/room whois"
Mikael Berthe <mikael@lilotux.net>
parents:
548
diff
changeset
|
8 |
available, |
afc2bd38b15c
Implement affiliations handling, add "/room whois"
Mikael Berthe <mikael@lilotux.net>
parents:
548
diff
changeset
|
9 |
invisible, |
afc2bd38b15c
Implement affiliations handling, add "/room whois"
Mikael Berthe <mikael@lilotux.net>
parents:
548
diff
changeset
|
10 |
freeforchat, |
afc2bd38b15c
Implement affiliations handling, add "/room whois"
Mikael Berthe <mikael@lilotux.net>
parents:
548
diff
changeset
|
11 |
dontdisturb, |
afc2bd38b15c
Implement affiliations handling, add "/room whois"
Mikael Berthe <mikael@lilotux.net>
parents:
548
diff
changeset
|
12 |
notavail, |
afc2bd38b15c
Implement affiliations handling, add "/room whois"
Mikael Berthe <mikael@lilotux.net>
parents:
548
diff
changeset
|
13 |
away, |
afc2bd38b15c
Implement affiliations handling, add "/room whois"
Mikael Berthe <mikael@lilotux.net>
parents:
548
diff
changeset
|
14 |
imstatus_size |
afc2bd38b15c
Implement affiliations handling, add "/room whois"
Mikael Berthe <mikael@lilotux.net>
parents:
548
diff
changeset
|
15 |
}; |
72 | 16 |
|
438
b44be19d6229
Handle multiple resources for the same buddy
Mikael Berthe <mikael@lilotux.net>
parents:
364
diff
changeset
|
17 |
enum imrole { |
b44be19d6229
Handle multiple resources for the same buddy
Mikael Berthe <mikael@lilotux.net>
parents:
364
diff
changeset
|
18 |
role_none, |
b44be19d6229
Handle multiple resources for the same buddy
Mikael Berthe <mikael@lilotux.net>
parents:
364
diff
changeset
|
19 |
role_moderator, |
b44be19d6229
Handle multiple resources for the same buddy
Mikael Berthe <mikael@lilotux.net>
parents:
364
diff
changeset
|
20 |
role_participant, |
b44be19d6229
Handle multiple resources for the same buddy
Mikael Berthe <mikael@lilotux.net>
parents:
364
diff
changeset
|
21 |
role_visitor |
b44be19d6229
Handle multiple resources for the same buddy
Mikael Berthe <mikael@lilotux.net>
parents:
364
diff
changeset
|
22 |
}; |
b44be19d6229
Handle multiple resources for the same buddy
Mikael Berthe <mikael@lilotux.net>
parents:
364
diff
changeset
|
23 |
|
572
afc2bd38b15c
Implement affiliations handling, add "/room whois"
Mikael Berthe <mikael@lilotux.net>
parents:
548
diff
changeset
|
24 |
enum imaffiliation { |
afc2bd38b15c
Implement affiliations handling, add "/room whois"
Mikael Berthe <mikael@lilotux.net>
parents:
548
diff
changeset
|
25 |
affil_none, |
afc2bd38b15c
Implement affiliations handling, add "/room whois"
Mikael Berthe <mikael@lilotux.net>
parents:
548
diff
changeset
|
26 |
affil_owner, |
afc2bd38b15c
Implement affiliations handling, add "/room whois"
Mikael Berthe <mikael@lilotux.net>
parents:
548
diff
changeset
|
27 |
affil_admin, |
afc2bd38b15c
Implement affiliations handling, add "/room whois"
Mikael Berthe <mikael@lilotux.net>
parents:
548
diff
changeset
|
28 |
affil_member, |
afc2bd38b15c
Implement affiliations handling, add "/room whois"
Mikael Berthe <mikael@lilotux.net>
parents:
548
diff
changeset
|
29 |
affil_outcast |
afc2bd38b15c
Implement affiliations handling, add "/room whois"
Mikael Berthe <mikael@lilotux.net>
parents:
548
diff
changeset
|
30 |
}; |
afc2bd38b15c
Implement affiliations handling, add "/room whois"
Mikael Berthe <mikael@lilotux.net>
parents:
548
diff
changeset
|
31 |
|
438
b44be19d6229
Handle multiple resources for the same buddy
Mikael Berthe <mikael@lilotux.net>
parents:
364
diff
changeset
|
32 |
enum subscr { |
b44be19d6229
Handle multiple resources for the same buddy
Mikael Berthe <mikael@lilotux.net>
parents:
364
diff
changeset
|
33 |
sub_none, |
b44be19d6229
Handle multiple resources for the same buddy
Mikael Berthe <mikael@lilotux.net>
parents:
364
diff
changeset
|
34 |
sub_to, |
b44be19d6229
Handle multiple resources for the same buddy
Mikael Berthe <mikael@lilotux.net>
parents:
364
diff
changeset
|
35 |
sub_from, |
b44be19d6229
Handle multiple resources for the same buddy
Mikael Berthe <mikael@lilotux.net>
parents:
364
diff
changeset
|
36 |
sub_both |
b44be19d6229
Handle multiple resources for the same buddy
Mikael Berthe <mikael@lilotux.net>
parents:
364
diff
changeset
|
37 |
}; |
b44be19d6229
Handle multiple resources for the same buddy
Mikael Berthe <mikael@lilotux.net>
parents:
364
diff
changeset
|
38 |
|
72 | 39 |
enum findwhat { |
40 |
jidsearch, |
|
41 |
namesearch |
|
42 |
}; |
|
43 |
||
44 |
// Roster_type is a set of flags, so values should be 2^n |
|
45 |
#define ROSTER_TYPE_USER 1 |
|
46 |
#define ROSTER_TYPE_GROUP 2 |
|
47 |
#define ROSTER_TYPE_AGENT 4 |
|
447
03bb57383cea
Initial Multi-User Chat support
Mikael Berthe <mikael@lilotux.net>
parents:
439
diff
changeset
|
48 |
#define ROSTER_TYPE_ROOM 8 |
72 | 49 |
|
50 |
// Flags: |
|
51 |
#define ROSTER_FLAG_MSG 1 // Message not read |
|
52 |
#define ROSTER_FLAG_HIDE 2 // Group hidden (or buddy window closed) |
|
53 |
#define ROSTER_FLAG_LOCK 4 // Node should not be removed from buddylist |
|
54 |
// ROSTER_FLAG_LOCAL 8 // Buddy not on server's roster (??) |
|
55 |
||
56 |
extern GList *buddylist; |
|
78 | 57 |
extern GList *current_buddy; |
330 | 58 |
extern GList *alternate_buddy; |
72 | 59 |
|
78 | 60 |
// Macros... |
61 |
||
79 | 62 |
#define BUDDATA(glist_node) ((glist_node)->data) |
63 |
#define CURRENT_JID buddy_getjid(BUDDATA(current_buddy)) |
|
78 | 64 |
|
65 |
// Prototypes... |
|
66 |
GSList *roster_add_group(const char *name); |
|
67 |
GSList *roster_add_user(const char *jid, const char *name, const char *group, |
|
68 |
guint type); |
|
447
03bb57383cea
Initial Multi-User Chat support
Mikael Berthe <mikael@lilotux.net>
parents:
439
diff
changeset
|
69 |
GSList *roster_find(const char *jidname, enum findwhat type, guint roster_type); |
78 | 70 |
void roster_del_user(const char *jid); |
164 | 71 |
void roster_free(void); |
438
b44be19d6229
Handle multiple resources for the same buddy
Mikael Berthe <mikael@lilotux.net>
parents:
364
diff
changeset
|
72 |
void roster_setstatus(const char *jid, const char *resname, gchar prio, |
468
644b8bf9ca4d
Improve MUC presence messages handling
Mikael Berthe <mikael@lilotux.net>
parents:
447
diff
changeset
|
73 |
enum imstatus bstat, const char *status_msg, |
572
afc2bd38b15c
Implement affiliations handling, add "/room whois"
Mikael Berthe <mikael@lilotux.net>
parents:
548
diff
changeset
|
74 |
enum imrole role, enum imaffiliation affil, |
afc2bd38b15c
Implement affiliations handling, add "/room whois"
Mikael Berthe <mikael@lilotux.net>
parents:
548
diff
changeset
|
75 |
const char *realjid); |
80 | 76 |
void roster_setflags(const char *jid, guint flags, guint value); |
148 | 77 |
void roster_msg_setflag(const char *jid, guint value); |
510
6c3cd3aa4a91
New 'buddy_format' option
Mikael Berthe <mikael@lilotux.net>
parents:
489
diff
changeset
|
78 |
const char *roster_getname(const char *jid); |
89 | 79 |
void roster_settype(const char *jid, guint type); |
438
b44be19d6229
Handle multiple resources for the same buddy
Mikael Berthe <mikael@lilotux.net>
parents:
364
diff
changeset
|
80 |
enum imstatus roster_getstatus(const char *jid, const char *resname); |
b44be19d6229
Handle multiple resources for the same buddy
Mikael Berthe <mikael@lilotux.net>
parents:
364
diff
changeset
|
81 |
const char *roster_getstatusmsg(const char *jid, const char *resname); |
89 | 82 |
guint roster_gettype(const char *jid); |
72 | 83 |
|
166 | 84 |
void buddylist_build(void); |
85 |
void buddy_hide_group(gpointer rosterdata, int hide); |
|
86 |
void buddylist_set_hide_offline_buddies(int hide); |
|
120 | 87 |
inline int buddylist_get_hide_offline_buddies(void); |
72 | 88 |
const char *buddy_getjid(gpointer rosterdata); |
207 | 89 |
void buddy_setname(gpointer rosterdata, char *newname); |
72 | 90 |
const char *buddy_getname(gpointer rosterdata); |
469
a926523d2392
Use UTF8 to handle resources and room nicknames
Mikael Berthe <mikael@lilotux.net>
parents:
468
diff
changeset
|
91 |
void buddy_setnickname(gpointer rosterdata, const char *newname); |
447
03bb57383cea
Initial Multi-User Chat support
Mikael Berthe <mikael@lilotux.net>
parents:
439
diff
changeset
|
92 |
const char *buddy_getnickname(gpointer rosterdata); |
548
265c50238a48
Add buddy_{get,set}topic()
Mikael Berthe <mikael@lilotux.net>
parents:
539
diff
changeset
|
93 |
void buddy_settopic(gpointer rosterdata, const char *newtopic); |
265c50238a48
Add buddy_{get,set}topic()
Mikael Berthe <mikael@lilotux.net>
parents:
539
diff
changeset
|
94 |
const char *buddy_gettopic(gpointer rosterdata); |
489
21ab22a60bcb
Auto-convert a roster item to "room" type when receiving a groupchat message
Mikael Berthe <mikael@lilotux.net>
parents:
480
diff
changeset
|
95 |
void buddy_settype(gpointer rosterdata, guint type); |
166 | 96 |
guint buddy_gettype(gpointer rosterdata); |
210 | 97 |
void buddy_setgroup(gpointer rosterdata, char *newgroupname); |
207 | 98 |
const char *buddy_getgroupname(gpointer rosterdata); |
166 | 99 |
gpointer buddy_getgroup(gpointer rosterdata); |
438
b44be19d6229
Handle multiple resources for the same buddy
Mikael Berthe <mikael@lilotux.net>
parents:
364
diff
changeset
|
100 |
enum imstatus buddy_getstatus(gpointer rosterdata, const char *resname); |
b44be19d6229
Handle multiple resources for the same buddy
Mikael Berthe <mikael@lilotux.net>
parents:
364
diff
changeset
|
101 |
const char *buddy_getstatusmsg(gpointer rosterdata, const char *resname); |
439
63562fd409a1
/info can show multiple resources
Mikael Berthe <mikael@lilotux.net>
parents:
438
diff
changeset
|
102 |
gchar buddy_getresourceprio(gpointer rosterdata, const char *resname); |
539 | 103 |
int buddy_isresource(gpointer rosterdata); |
439
63562fd409a1
/info can show multiple resources
Mikael Berthe <mikael@lilotux.net>
parents:
438
diff
changeset
|
104 |
GSList *buddy_getresources(gpointer rosterdata); |
468
644b8bf9ca4d
Improve MUC presence messages handling
Mikael Berthe <mikael@lilotux.net>
parents:
447
diff
changeset
|
105 |
void buddy_resource_setname(gpointer rosterdata, const char *resname, |
644b8bf9ca4d
Improve MUC presence messages handling
Mikael Berthe <mikael@lilotux.net>
parents:
447
diff
changeset
|
106 |
const char *newname); |
572
afc2bd38b15c
Implement affiliations handling, add "/room whois"
Mikael Berthe <mikael@lilotux.net>
parents:
548
diff
changeset
|
107 |
enum imrole buddy_getrole(gpointer rosterdata, const char *resname); |
afc2bd38b15c
Implement affiliations handling, add "/room whois"
Mikael Berthe <mikael@lilotux.net>
parents:
548
diff
changeset
|
108 |
enum imaffiliation buddy_getaffil(gpointer rosterdata, const char *resname); |
afc2bd38b15c
Implement affiliations handling, add "/room whois"
Mikael Berthe <mikael@lilotux.net>
parents:
548
diff
changeset
|
109 |
const char *buddy_getrjid(gpointer rosterdata, const char *resname); |
447
03bb57383cea
Initial Multi-User Chat support
Mikael Berthe <mikael@lilotux.net>
parents:
439
diff
changeset
|
110 |
void buddy_del_all_resources(gpointer rosterdata); |
166 | 111 |
void buddy_setflags(gpointer rosterdata, guint flags, guint value); |
112 |
guint buddy_getflags(gpointer rosterdata); |
|
480 | 113 |
GList *buddy_search_jid(char *jid); |
265 | 114 |
GList *buddy_search(char *string); |
532
2ac8d8e49e81
Send status changes to chatrooms
Mikael Berthe <mikael@lilotux.net>
parents:
510
diff
changeset
|
115 |
void foreach_buddy(guint roster_type, |
2ac8d8e49e81
Send status changes to chatrooms
Mikael Berthe <mikael@lilotux.net>
parents:
510
diff
changeset
|
116 |
void (*pfunc)(gpointer rosterdata, void *param), |
2ac8d8e49e81
Send status changes to chatrooms
Mikael Berthe <mikael@lilotux.net>
parents:
510
diff
changeset
|
117 |
void *param); |
236 | 118 |
gpointer unread_msg(gpointer rosterdata); |
72 | 119 |
|
225 | 120 |
GSList *compl_list(guint type); |
121 |
||
72 | 122 |
#endif /* __ROSTER_H__ */ |
576 | 123 |
|
124 |
/* vim: set expandtab cindent cinoptions=>2:2(0: For Vim users... */ |