author | Mikael Berthe <mikael@lilotux.net> |
Tue, 30 May 2006 23:22:37 +0200 | |
changeset 889 | ae93e69aaaaf |
parent 885 | afdd81c2c44d |
child 952 | 527d6f234924 |
permissions | -rw-r--r-- |
72 | 1 |
#ifndef __ROSTER_H__ |
2 |
#define __ROSTER_H__ 1 |
|
3 |
||
4 |
#include <glib.h> |
|
625
028c01940490
Show presence timestamps in "/info" and "/room whois"
Mikael Berthe <mikael@lilotux.net>
parents:
610
diff
changeset
|
5 |
#include <time.h> |
72 | 6 |
|
889
ae93e69aaaaf
Fix up pending message flag for the status special buffer
Mikael Berthe <mikael@lilotux.net>
parents:
885
diff
changeset
|
7 |
#define SPECIAL_BUFFER_STATUS_ID "[status]" |
ae93e69aaaaf
Fix up pending message flag for the status special buffer
Mikael Berthe <mikael@lilotux.net>
parents:
885
diff
changeset
|
8 |
|
572
afc2bd38b15c
Implement affiliations handling, add "/room whois"
Mikael Berthe <mikael@lilotux.net>
parents:
548
diff
changeset
|
9 |
enum imstatus { |
afc2bd38b15c
Implement affiliations handling, add "/room whois"
Mikael Berthe <mikael@lilotux.net>
parents:
548
diff
changeset
|
10 |
offline, |
afc2bd38b15c
Implement affiliations handling, add "/room whois"
Mikael Berthe <mikael@lilotux.net>
parents:
548
diff
changeset
|
11 |
available, |
afc2bd38b15c
Implement affiliations handling, add "/room whois"
Mikael Berthe <mikael@lilotux.net>
parents:
548
diff
changeset
|
12 |
invisible, |
afc2bd38b15c
Implement affiliations handling, add "/room whois"
Mikael Berthe <mikael@lilotux.net>
parents:
548
diff
changeset
|
13 |
freeforchat, |
afc2bd38b15c
Implement affiliations handling, add "/room whois"
Mikael Berthe <mikael@lilotux.net>
parents:
548
diff
changeset
|
14 |
dontdisturb, |
afc2bd38b15c
Implement affiliations handling, add "/room whois"
Mikael Berthe <mikael@lilotux.net>
parents:
548
diff
changeset
|
15 |
notavail, |
afc2bd38b15c
Implement affiliations handling, add "/room whois"
Mikael Berthe <mikael@lilotux.net>
parents:
548
diff
changeset
|
16 |
away, |
afc2bd38b15c
Implement affiliations handling, add "/room whois"
Mikael Berthe <mikael@lilotux.net>
parents:
548
diff
changeset
|
17 |
imstatus_size |
afc2bd38b15c
Implement affiliations handling, add "/room whois"
Mikael Berthe <mikael@lilotux.net>
parents:
548
diff
changeset
|
18 |
}; |
72 | 19 |
|
438
b44be19d6229
Handle multiple resources for the same buddy
Mikael Berthe <mikael@lilotux.net>
parents:
364
diff
changeset
|
20 |
enum imrole { |
b44be19d6229
Handle multiple resources for the same buddy
Mikael Berthe <mikael@lilotux.net>
parents:
364
diff
changeset
|
21 |
role_none, |
b44be19d6229
Handle multiple resources for the same buddy
Mikael Berthe <mikael@lilotux.net>
parents:
364
diff
changeset
|
22 |
role_moderator, |
b44be19d6229
Handle multiple resources for the same buddy
Mikael Berthe <mikael@lilotux.net>
parents:
364
diff
changeset
|
23 |
role_participant, |
585
7eff2c1481fa
Add "/room affil" and "/room role"
Mikael Berthe <mikael@lilotux.net>
parents:
584
diff
changeset
|
24 |
role_visitor, |
7eff2c1481fa
Add "/room affil" and "/room role"
Mikael Berthe <mikael@lilotux.net>
parents:
584
diff
changeset
|
25 |
imrole_size |
438
b44be19d6229
Handle multiple resources for the same buddy
Mikael Berthe <mikael@lilotux.net>
parents:
364
diff
changeset
|
26 |
}; |
b44be19d6229
Handle multiple resources for the same buddy
Mikael Berthe <mikael@lilotux.net>
parents:
364
diff
changeset
|
27 |
|
584 | 28 |
extern char *strrole[]; // Should match enum above |
29 |
||
572
afc2bd38b15c
Implement affiliations handling, add "/room whois"
Mikael Berthe <mikael@lilotux.net>
parents:
548
diff
changeset
|
30 |
enum imaffiliation { |
afc2bd38b15c
Implement affiliations handling, add "/room whois"
Mikael Berthe <mikael@lilotux.net>
parents:
548
diff
changeset
|
31 |
affil_none, |
afc2bd38b15c
Implement affiliations handling, add "/room whois"
Mikael Berthe <mikael@lilotux.net>
parents:
548
diff
changeset
|
32 |
affil_owner, |
afc2bd38b15c
Implement affiliations handling, add "/room whois"
Mikael Berthe <mikael@lilotux.net>
parents:
548
diff
changeset
|
33 |
affil_admin, |
afc2bd38b15c
Implement affiliations handling, add "/room whois"
Mikael Berthe <mikael@lilotux.net>
parents:
548
diff
changeset
|
34 |
affil_member, |
585
7eff2c1481fa
Add "/room affil" and "/room role"
Mikael Berthe <mikael@lilotux.net>
parents:
584
diff
changeset
|
35 |
affil_outcast, |
7eff2c1481fa
Add "/room affil" and "/room role"
Mikael Berthe <mikael@lilotux.net>
parents:
584
diff
changeset
|
36 |
imaffiliation_size |
572
afc2bd38b15c
Implement affiliations handling, add "/room whois"
Mikael Berthe <mikael@lilotux.net>
parents:
548
diff
changeset
|
37 |
}; |
afc2bd38b15c
Implement affiliations handling, add "/room whois"
Mikael Berthe <mikael@lilotux.net>
parents:
548
diff
changeset
|
38 |
|
584 | 39 |
extern char *straffil[]; // Should match enum above |
40 |
||
438
b44be19d6229
Handle multiple resources for the same buddy
Mikael Berthe <mikael@lilotux.net>
parents:
364
diff
changeset
|
41 |
enum subscr { |
603 | 42 |
sub_none = 0, |
43 |
sub_pending = 1, |
|
44 |
sub_to = 1 << 2, |
|
45 |
sub_from = 1 << 3, |
|
46 |
sub_both = sub_to|sub_from, |
|
47 |
sub_remove = 1 << 4 |
|
438
b44be19d6229
Handle multiple resources for the same buddy
Mikael Berthe <mikael@lilotux.net>
parents:
364
diff
changeset
|
48 |
}; |
b44be19d6229
Handle multiple resources for the same buddy
Mikael Berthe <mikael@lilotux.net>
parents:
364
diff
changeset
|
49 |
|
72 | 50 |
enum findwhat { |
51 |
jidsearch, |
|
52 |
namesearch |
|
53 |
}; |
|
54 |
||
584 | 55 |
struct role_affil { |
56 |
enum { type_role, type_affil } type; |
|
57 |
union { |
|
58 |
enum imrole role; |
|
59 |
enum imaffiliation affil; |
|
60 |
} val; |
|
61 |
}; |
|
62 |
||
72 | 63 |
// Roster_type is a set of flags, so values should be 2^n |
64 |
#define ROSTER_TYPE_USER 1 |
|
65 |
#define ROSTER_TYPE_GROUP 2 |
|
66 |
#define ROSTER_TYPE_AGENT 4 |
|
447
03bb57383cea
Initial Multi-User Chat support
Mikael Berthe <mikael@lilotux.net>
parents:
439
diff
changeset
|
67 |
#define ROSTER_TYPE_ROOM 8 |
848
a9161d2dc414
Introduce special buffer stuff
Mikael Berthe <mikael@lilotux.net>
parents:
819
diff
changeset
|
68 |
#define ROSTER_TYPE_SPECIAL 16 |
72 | 69 |
|
70 |
// Flags: |
|
71 |
#define ROSTER_FLAG_MSG 1 // Message not read |
|
72 |
#define ROSTER_FLAG_HIDE 2 // Group hidden (or buddy window closed) |
|
73 |
#define ROSTER_FLAG_LOCK 4 // Node should not be removed from buddylist |
|
74 |
// ROSTER_FLAG_LOCAL 8 // Buddy not on server's roster (??) |
|
75 |
||
76 |
extern GList *buddylist; |
|
78 | 77 |
extern GList *current_buddy; |
330 | 78 |
extern GList *alternate_buddy; |
72 | 79 |
|
78 | 80 |
// Macros... |
81 |
||
79 | 82 |
#define BUDDATA(glist_node) ((glist_node)->data) |
83 |
#define CURRENT_JID buddy_getjid(BUDDATA(current_buddy)) |
|
78 | 84 |
|
85 |
// Prototypes... |
|
848
a9161d2dc414
Introduce special buffer stuff
Mikael Berthe <mikael@lilotux.net>
parents:
819
diff
changeset
|
86 |
void roster_init(void); |
78 | 87 |
GSList *roster_add_group(const char *name); |
88 |
GSList *roster_add_user(const char *jid, const char *name, const char *group, |
|
603 | 89 |
guint type, enum subscr esub); |
447
03bb57383cea
Initial Multi-User Chat support
Mikael Berthe <mikael@lilotux.net>
parents:
439
diff
changeset
|
90 |
GSList *roster_find(const char *jidname, enum findwhat type, guint roster_type); |
78 | 91 |
void roster_del_user(const char *jid); |
164 | 92 |
void roster_free(void); |
438
b44be19d6229
Handle multiple resources for the same buddy
Mikael Berthe <mikael@lilotux.net>
parents:
364
diff
changeset
|
93 |
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
|
94 |
enum imstatus bstat, const char *status_msg, |
625
028c01940490
Show presence timestamps in "/info" and "/room whois"
Mikael Berthe <mikael@lilotux.net>
parents:
610
diff
changeset
|
95 |
time_t timestamp, |
572
afc2bd38b15c
Implement affiliations handling, add "/room whois"
Mikael Berthe <mikael@lilotux.net>
parents:
548
diff
changeset
|
96 |
enum imrole role, enum imaffiliation affil, |
afc2bd38b15c
Implement affiliations handling, add "/room whois"
Mikael Berthe <mikael@lilotux.net>
parents:
548
diff
changeset
|
97 |
const char *realjid); |
80 | 98 |
void roster_setflags(const char *jid, guint flags, guint value); |
889
ae93e69aaaaf
Fix up pending message flag for the status special buffer
Mikael Berthe <mikael@lilotux.net>
parents:
885
diff
changeset
|
99 |
void roster_msg_setflag(const char *jid, guint special, guint value); |
510
6c3cd3aa4a91
New 'buddy_format' option
Mikael Berthe <mikael@lilotux.net>
parents:
489
diff
changeset
|
100 |
const char *roster_getname(const char *jid); |
863
4f1a93faffea
Add roster_getnickname()
Mikael Berthe <mikael@lilotux.net>
parents:
848
diff
changeset
|
101 |
const char *roster_getnickname(const char *jid); |
89 | 102 |
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
|
103 |
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
|
104 |
const char *roster_getstatusmsg(const char *jid, const char *resname); |
89 | 105 |
guint roster_gettype(const char *jid); |
819
c2d7d9dd4193
New option 'block_unsubscribed'
Mikael Berthe <mikael@lilotux.net>
parents:
792
diff
changeset
|
106 |
guint roster_getsubscription(const char *jid); |
610
0e8247cf2bd1
Consider buddies as offline when they have cancelled our subscription
Mikael Berthe <mikael@lilotux.net>
parents:
603
diff
changeset
|
107 |
void roster_unsubscribed(const char *jid); |
72 | 108 |
|
166 | 109 |
void buddylist_build(void); |
110 |
void buddy_hide_group(gpointer rosterdata, int hide); |
|
111 |
void buddylist_set_hide_offline_buddies(int hide); |
|
120 | 112 |
inline int buddylist_get_hide_offline_buddies(void); |
72 | 113 |
const char *buddy_getjid(gpointer rosterdata); |
207 | 114 |
void buddy_setname(gpointer rosterdata, char *newname); |
72 | 115 |
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
|
116 |
void buddy_setnickname(gpointer rosterdata, const char *newname); |
447
03bb57383cea
Initial Multi-User Chat support
Mikael Berthe <mikael@lilotux.net>
parents:
439
diff
changeset
|
117 |
const char *buddy_getnickname(gpointer rosterdata); |
644
68fb0c1dfb15
MUC: better nickname check when entering a room
Mikael Berthe <mikael@lilotux.net>
parents:
625
diff
changeset
|
118 |
void buddy_setinsideroom(gpointer rosterdata, guint8 inside); |
68fb0c1dfb15
MUC: better nickname check when entering a room
Mikael Berthe <mikael@lilotux.net>
parents:
625
diff
changeset
|
119 |
guint8 buddy_getinsideroom(gpointer rosterdata); |
548
265c50238a48
Add buddy_{get,set}topic()
Mikael Berthe <mikael@lilotux.net>
parents:
539
diff
changeset
|
120 |
void buddy_settopic(gpointer rosterdata, const char *newtopic); |
265c50238a48
Add buddy_{get,set}topic()
Mikael Berthe <mikael@lilotux.net>
parents:
539
diff
changeset
|
121 |
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
|
122 |
void buddy_settype(gpointer rosterdata, guint type); |
166 | 123 |
guint buddy_gettype(gpointer rosterdata); |
603 | 124 |
guint buddy_getsubscription(gpointer rosterdata); |
210 | 125 |
void buddy_setgroup(gpointer rosterdata, char *newgroupname); |
207 | 126 |
const char *buddy_getgroupname(gpointer rosterdata); |
166 | 127 |
gpointer buddy_getgroup(gpointer rosterdata); |
438
b44be19d6229
Handle multiple resources for the same buddy
Mikael Berthe <mikael@lilotux.net>
parents:
364
diff
changeset
|
128 |
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
|
129 |
const char *buddy_getstatusmsg(gpointer rosterdata, const char *resname); |
625
028c01940490
Show presence timestamps in "/info" and "/room whois"
Mikael Berthe <mikael@lilotux.net>
parents:
610
diff
changeset
|
130 |
time_t buddy_getstatustime(gpointer rosterdata, const char *resname); |
439
63562fd409a1
/info can show multiple resources
Mikael Berthe <mikael@lilotux.net>
parents:
438
diff
changeset
|
131 |
gchar buddy_getresourceprio(gpointer rosterdata, const char *resname); |
652
b243d3b3ff1b
We do not need buddy_isresource() anymore
Mikael Berthe <mikael@lilotux.net>
parents:
644
diff
changeset
|
132 |
//int buddy_isresource(gpointer rosterdata); |
439
63562fd409a1
/info can show multiple resources
Mikael Berthe <mikael@lilotux.net>
parents:
438
diff
changeset
|
133 |
GSList *buddy_getresources(gpointer rosterdata); |
792
89ad7b530b3c
MUC: Fix completion for UTF-8 nicknames
Mikael Berthe <mikael@lilotux.net>
parents:
652
diff
changeset
|
134 |
GSList *buddy_getresources_locale(gpointer rosterdata); |
468
644b8bf9ca4d
Improve MUC presence messages handling
Mikael Berthe <mikael@lilotux.net>
parents:
447
diff
changeset
|
135 |
void buddy_resource_setname(gpointer rosterdata, const char *resname, |
644b8bf9ca4d
Improve MUC presence messages handling
Mikael Berthe <mikael@lilotux.net>
parents:
447
diff
changeset
|
136 |
const char *newname); |
572
afc2bd38b15c
Implement affiliations handling, add "/room whois"
Mikael Berthe <mikael@lilotux.net>
parents:
548
diff
changeset
|
137 |
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
|
138 |
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
|
139 |
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
|
140 |
void buddy_del_all_resources(gpointer rosterdata); |
166 | 141 |
void buddy_setflags(gpointer rosterdata, guint flags, guint value); |
142 |
guint buddy_getflags(gpointer rosterdata); |
|
480 | 143 |
GList *buddy_search_jid(char *jid); |
265 | 144 |
GList *buddy_search(char *string); |
532
2ac8d8e49e81
Send status changes to chatrooms
Mikael Berthe <mikael@lilotux.net>
parents:
510
diff
changeset
|
145 |
void foreach_buddy(guint roster_type, |
2ac8d8e49e81
Send status changes to chatrooms
Mikael Berthe <mikael@lilotux.net>
parents:
510
diff
changeset
|
146 |
void (*pfunc)(gpointer rosterdata, void *param), |
2ac8d8e49e81
Send status changes to chatrooms
Mikael Berthe <mikael@lilotux.net>
parents:
510
diff
changeset
|
147 |
void *param); |
885
afdd81c2c44d
Allow /rename for groups
Mikael Berthe <mikael@lilotux.net>
parents:
863
diff
changeset
|
148 |
void foreach_group_member(gpointer groupdata, |
afdd81c2c44d
Allow /rename for groups
Mikael Berthe <mikael@lilotux.net>
parents:
863
diff
changeset
|
149 |
void (*pfunc)(gpointer rosterdata, void *param), |
afdd81c2c44d
Allow /rename for groups
Mikael Berthe <mikael@lilotux.net>
parents:
863
diff
changeset
|
150 |
void *param); |
236 | 151 |
gpointer unread_msg(gpointer rosterdata); |
72 | 152 |
|
225 | 153 |
GSList *compl_list(guint type); |
154 |
||
72 | 155 |
#endif /* __ROSTER_H__ */ |
576 | 156 |
|
580 | 157 |
/* vim: set expandtab cindent cinoptions=>2\:2(0: For Vim users... */ |