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