2 * MXit Protocol libPurple Plugin
4 * -- user roster management (mxit contacts) --
6 * Pieter Loubser <libpurple@mxit.com>
8 * (C) Copyright 2009 MXit Lifestyle (Pty) Ltd.
9 * <http://www.mxitlifestyle.com>
11 * This program is free software; you can redistribute it and/or modify
12 * it under the terms of the GNU General Public License as published by
13 * the Free Software Foundation; either version 2 of the License, or
14 * (at your option) any later version.
16 * This program is distributed in the hope that it will be useful,
17 * but WITHOUT ANY WARRANTY; without even the implied warranty of
18 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 * GNU General Public License for more details.
21 * You should have received a copy of the GNU General Public License
22 * along with this program; if not, write to the Free Software
23 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA
26 #ifndef _MXIT_ROSTER_H_
27 #define _MXIT_ROSTER_H_
30 /* MXit contact presence states */
31 #define MXIT_PRESENCE_OFFLINE 0x00
32 #define MXIT_PRESENCE_ONLINE 0x01
33 #define MXIT_PRESENCE_AWAY 0x02
34 #define MXIT_PRESENCE_AVAILABLE 0x03
35 #define MXIT_PRESENCE_DND 0x04
38 /* MXit contact types */
39 #define MXIT_TYPE_MXIT 0x00
40 #define MXIT_TYPE_JABBER 0x01
41 #define MXIT_TYPE_MSN 0x02
42 #define MXIT_TYPE_YAHOO 0x03
43 #define MXIT_TYPE_ICQ 0x04
44 #define MXIT_TYPE_AIM 0x05
45 #define MXIT_TYPE_QQ 0x06
46 #define MXIT_TYPE_WV 0x07
47 #define MXIT_TYPE_BOT 0x08
48 #define MXIT_TYPE_CHATROOM 0x09
49 #define MXIT_TYPE_SMS 0x0A
50 #define MXIT_TYPE_GROUP 0x0B
51 #define MXIT_TYPE_GALLERY 0x0C
52 #define MXIT_TYPE_INFO 0x0D
53 #define MXIT_TYPE_MULTIMX 0x0E
54 #define MXIT_TYPE_HYBRID 0x0F
57 /* MXit contact moods */
58 #define MXIT_MOOD_NONE 0x00
59 #define MXIT_MOOD_ANGRY 0x01
60 #define MXIT_MOOD_EXCITED 0x02
61 #define MXIT_MOOD_GRUMPY 0x03
62 #define MXIT_MOOD_HAPPY 0x04
63 #define MXIT_MOOD_INLOVE 0x05
64 #define MXIT_MOOD_INVINCIBLE 0x06
65 #define MXIT_MOOD_SAD 0x07
66 #define MXIT_MOOD_HOT 0x08
67 #define MXIT_MOOD_SICK 0x09
68 #define MXIT_MOOD_SLEEPY 0x0A
69 #define MXIT_MOOD_BORED 0x0B
70 #define MXIT_MOOD_COLD 0x0C
71 #define MXIT_MOOD_CONFUSED 0x0D
72 #define MXIT_MOOD_HUNGRY 0x0E
73 #define MXIT_MOOD_STRESSED 0x0F
76 /* MXit contact flags */
77 //#define MXIT_CFLAG_HIDDEN 0x02 /* (DEPRECATED) */
78 #define MXIT_CFLAG_GATEWAY 0x04
79 #define MXIT_CFLAG_FOCUS_SEND_BLANK 0x20000
82 /* MXit presence flags */
83 #define MXIT_PFLAG_VOICE 0x1
84 #define MXIT_PFLAG_VIDEO 0x2
85 #define MXIT_PFLAG_TYPING 0x4
88 /* Subscription types */
89 #define MXIT_SUBTYPE_BOTH 'B'
90 #define MXIT_SUBTYPE_PENDING 'P'
91 #define MXIT_SUBTYPE_ASK 'A'
92 #define MXIT_SUBTYPE_REJECTED 'R'
93 #define MXIT_SUBTYPE_DELETED 'D'
94 #define MXIT_SUBTYPE_NONE 'N'
97 /* client protocol constants */
98 #define MXIT_CP_MAX_JID_LEN 64
99 #define MXIT_CP_MAX_GROUP_LEN 32
100 #define MXIT_CP_MAX_ALIAS_LEN 100
102 #define MXIT_DEFAULT_GROUP "MXit"
109 char username
[MXIT_CP_MAX_JID_LEN
+1]; /* unique contact name (with domain) */
110 char alias
[MXIT_CP_MAX_ALIAS_LEN
+1]; /* contact alias (what will be seen) */
111 char groupname
[MXIT_CP_MAX_GROUP_LEN
+1]; /* contact group name */
113 short type
; /* contact type */
114 short mood
; /* contact current mood */
115 int flags
; /* contact flags */
116 short presence
; /* presence state */
117 int capabilities
; /* contact capabilities */
118 short subtype
; /* subscription type */
120 char* msg
; /* invite/rejection message */
122 char customMood
[16]; /* custom mood */
123 char* statusMsg
; /* status message */
124 char* avatarId
; /* avatarId */
127 void* profile
; /* user's profile (if available) */
129 PurpleImage
*image
; /* avatar image */
132 /* Presence / Status */
133 GList
* mxit_status_types( PurpleAccount
* account
);
134 int mxit_convert_presence( const char* id
);
135 const char* mxit_convert_presence_to_name( short no
);
136 const char* mxit_convert_subtype_to_name( short subtype
);
139 int mxit_convert_mood( const char* id
);
140 const char* mxit_convert_mood_to_name( short id
);
142 /* MXit Protocol callbacks */
143 void mxit_update_contact( struct MXitSession
* session
, struct contact
* contact
);
144 void mxit_update_buddy_presence( struct MXitSession
* session
, const char* username
, short presence
, short mood
, const char* customMood
, const char* statusMsg
, int flags
);
145 void mxit_update_buddy_avatar( struct MXitSession
* session
, const char* username
, const char* avatarId
);
146 void mxit_new_subscription( struct MXitSession
* session
, struct contact
* contact
);
147 void mxit_update_blist( struct MXitSession
* session
);
148 gboolean
is_mxit_chatroom_contact( struct MXitSession
* session
, const char* username
);
149 struct contact
* get_mxit_invite_contact( struct MXitSession
* session
, const char* username
);
151 /* libPurple callbacks */
152 void mxit_add_buddy( PurpleConnection
* gc
, PurpleBuddy
* buddy
, PurpleGroup
* group
, const char* message
);
153 void mxit_remove_buddy( PurpleConnection
* gc
, PurpleBuddy
* buddy
, PurpleGroup
* group
);
154 void mxit_buddy_alias( PurpleConnection
* gc
, const char* who
, const char* alias
);
155 void mxit_buddy_group( PurpleConnection
* gc
, const char* who
, const char* old_group
, const char* new_group
);
156 void mxit_rename_group( PurpleConnection
* gc
, const char* old_name
, PurpleGroup
* group
, GList
* moved_buddies
);
157 PurpleMood
* mxit_get_moods( PurpleAccount
*account
);
160 #endif /* _MXIT_ROSTER_H_ */