comparison mcabber/src/roster.c @ 987:f47e312560af

Improve JEP22 + JEP85 support
author Mikael Berthe <mikael@lilotux.net>
date Mon, 30 Oct 2006 20:18:00 +0100
parents ed697234bd39
children 54405d09b15a
comparison
equal deleted inserted replaced
986:ed697234bd39 987:f47e312560af
50 time_t status_timestamp; 50 time_t status_timestamp;
51 enum imrole role; 51 enum imrole role;
52 enum imaffiliation affil; 52 enum imaffiliation affil;
53 gchar *realjid; /* for chatrooms, if buddy's real jid is known */ 53 gchar *realjid; /* for chatrooms, if buddy's real jid is known */
54 guint events; 54 guint events;
55 #ifdef JEP0022
56 struct jep0022 jep22;
57 #endif
58 #ifdef JEP0085
59 struct jep0085 jep85;
60 #endif
55 } res; 61 } res;
56 62
57 /* This is a private structure type for the roster */ 63 /* This is a private structure type for the roster */
58 64
59 typedef struct { 65 typedef struct {
113 for ( lip = *reslist; lip ; lip = g_slist_next(lip)) { 119 for ( lip = *reslist; lip ; lip = g_slist_next(lip)) {
114 p_res = (res*)lip->data; 120 p_res = (res*)lip->data;
115 g_free((gchar*)p_res->status_msg); 121 g_free((gchar*)p_res->status_msg);
116 g_free((gchar*)p_res->name); 122 g_free((gchar*)p_res->name);
117 g_free((gchar*)p_res->realjid); 123 g_free((gchar*)p_res->realjid);
124 #ifdef JEP0022
125 g_free(p_res->jep22.last_msgid_sent);
126 g_free(p_res->jep22.last_msgid_rcvd);
127 #endif
118 } 128 }
119 // Free all nodes but the first (which is static) 129 // Free all nodes but the first (which is static)
120 g_slist_free(*reslist); 130 g_slist_free(*reslist);
121 *reslist = NULL; 131 *reslist = NULL;
122 } 132 }
207 217
208 // Free allocations and delete resource node 218 // Free allocations and delete resource node
209 g_free(p_res->name); 219 g_free(p_res->name);
210 g_free(p_res->status_msg); 220 g_free(p_res->status_msg);
211 g_free(p_res->realjid); 221 g_free(p_res->realjid);
222 #ifdef JEP0022
223 g_free(p_res->jep22.last_msgid_sent);
224 g_free(p_res->jep22.last_msgid_rcvd);
225 #endif
212 rost->resource = g_slist_delete_link(rost->resource, p_res_elt); 226 rost->resource = g_slist_delete_link(rost->resource, p_res_elt);
213 return; 227 return;
214 } 228 }
215 229
216 230
1077 { 1091 {
1078 roster *roster_usr = rosterdata; 1092 roster *roster_usr = rosterdata;
1079 res *p_res = get_resource(roster_usr, resname); 1093 res *p_res = get_resource(roster_usr, resname);
1080 if (p_res) 1094 if (p_res)
1081 p_res->events = events; 1095 p_res->events = events;
1082 1096 }
1083 /* 1097
1084 // update group 1098 struct jep0022 *buddy_resource_jep22(gpointer rosterdata, const char *resname)
1085 roster_usr = roster_usr->list->data; 1099 {
1086 p_res = get_resource(roster_usr, ""); 1100 #ifdef JEP0022
1101 roster *roster_usr = rosterdata;
1102 res *p_res = get_resource(roster_usr, resname);
1087 if (p_res) 1103 if (p_res)
1088 p_res->events = events; 1104 return &p_res->jep22;
1089 */ 1105 #endif
1106 return NULL;
1107 }
1108
1109 struct jep0085 *buddy_resource_jep85(gpointer rosterdata, const char *resname)
1110 {
1111 #ifdef JEP0085
1112 roster *roster_usr = rosterdata;
1113 res *p_res = get_resource(roster_usr, resname);
1114 if (p_res)
1115 return &p_res->jep85;
1116 #endif
1117 return NULL;
1090 } 1118 }
1091 1119
1092 enum imrole buddy_getrole(gpointer rosterdata, const char *resname) 1120 enum imrole buddy_getrole(gpointer rosterdata, const char *resname)
1093 { 1121 {
1094 roster *roster_usr = rosterdata; 1122 roster *roster_usr = rosterdata;