comparison libpurple/plugins/signals-test.c @ 24256:0d0088b03745

Hide the blistnode, buddy, contact, group, and chat structs Updated the libpurple plugins to use api rather than the structs directly
author Gary Kramlich <grim@reaperworld.com>
date Tue, 28 Oct 2008 04:22:57 +0000
parents 38cc722159ff
children 0924698e2362
comparison
equal deleted inserted replaced
24255:4490b3002b89 24256:0d0088b03745
114 static void 114 static void
115 buddy_status_changed_cb(PurpleBuddy *buddy, PurpleStatus *old_status, 115 buddy_status_changed_cb(PurpleBuddy *buddy, PurpleStatus *old_status,
116 PurpleStatus *status, void *data) 116 PurpleStatus *status, void *data)
117 { 117 {
118 purple_debug_misc("signals test", "buddy-status-changed (%s %s to %s)\n", 118 purple_debug_misc("signals test", "buddy-status-changed (%s %s to %s)\n",
119 buddy->name, purple_status_get_id(old_status), 119 purple_buddy_get_name(buddy),
120 purple_status_get_id(status)); 120 purple_status_get_id(old_status),
121 purple_status_get_id(status));
121 } 122 }
122 123
123 static void 124 static void
124 buddy_idle_changed_cb(PurpleBuddy *buddy, gboolean old_idle, gboolean idle, 125 buddy_idle_changed_cb(PurpleBuddy *buddy, gboolean old_idle, gboolean idle,
125 void *data) 126 void *data)
126 { 127 {
127 purple_debug_misc("signals test", "buddy-idle-changed (%s %s)\n", 128 purple_debug_misc("signals test", "buddy-idle-changed (%s %s)\n",
128 buddy->name, old_idle ? "unidled" : "idled"); 129 purple_buddy_get_name(buddy),
130 old_idle ? "unidled" : "idled");
129 } 131 }
130 132
131 static void 133 static void
132 buddy_signed_on_cb(PurpleBuddy *buddy, void *data) 134 buddy_signed_on_cb(PurpleBuddy *buddy, void *data)
133 { 135 {
134 purple_debug_misc("signals test", "buddy-signed-on (%s)\n", buddy->name); 136 purple_debug_misc("signals test", "buddy-signed-on (%s)\n",
137 purple_buddy_get_name(buddy));
135 } 138 }
136 139
137 static void 140 static void
138 buddy_signed_off_cb(PurpleBuddy *buddy, void *data) 141 buddy_signed_off_cb(PurpleBuddy *buddy, void *data)
139 { 142 {
140 purple_debug_misc("signals test", "buddy-signed-off (%s)\n", buddy->name); 143 purple_debug_misc("signals test", "buddy-signed-off (%s)\n",
144 purple_buddy_get_name(buddy));
141 } 145 }
142 146
143 static void 147 static void
144 buddy_added_cb(PurpleBuddy *buddy, void *data) 148 buddy_added_cb(PurpleBuddy *buddy, void *data)
145 { 149 {
146 purple_debug_misc("signals test", "buddy_added_cb (%s)\n", purple_buddy_get_name(buddy)); 150 purple_debug_misc("signals test", "buddy_added_cb (%s)\n",
151 purple_buddy_get_name(buddy));
147 } 152 }
148 153
149 static void 154 static void
150 buddy_removed_cb(PurpleBuddy *buddy, void *data) 155 buddy_removed_cb(PurpleBuddy *buddy, void *data)
151 { 156 {
158 PurpleContact *p = (PurpleContact *)node; 163 PurpleContact *p = (PurpleContact *)node;
159 PurpleBuddy *b = (PurpleBuddy *)node; 164 PurpleBuddy *b = (PurpleBuddy *)node;
160 PurpleChat *c = (PurpleChat *)node; 165 PurpleChat *c = (PurpleChat *)node;
161 PurpleGroup *g = (PurpleGroup *)node; 166 PurpleGroup *g = (PurpleGroup *)node;
162 167
163 if (PURPLE_BLIST_NODE_IS_CONTACT(node)) 168 if (PURPLE_BLIST_NODE_IS_CONTACT(node)) {
164 purple_debug_misc("signals test", "blist-node-aliased (Contact: %s, %s)\n", p->alias, old_alias); 169 purple_debug_misc("signals test",
165 else if (PURPLE_BLIST_NODE_IS_BUDDY(node)) 170 "blist-node-aliased (Contact: %s, %s)\n",
166 purple_debug_misc("signals test", "blist-node-aliased (Buddy: %s, %s)\n", b->name, old_alias); 171 purple_contact_get_alias(p), old_alias);
167 else if (PURPLE_BLIST_NODE_IS_CHAT(node)) 172 } else if (PURPLE_BLIST_NODE_IS_BUDDY(node)) {
168 purple_debug_misc("signals test", "blist-node-aliased (Chat: %s, %s)\n", c->alias, old_alias); 173 purple_debug_misc("signals test",
169 else if (PURPLE_BLIST_NODE_IS_GROUP(node)) 174 "blist-node-aliased (Buddy: %s, %s)\n",
170 purple_debug_misc("signals test", "blist-node-aliased (Group: %s, %s)\n", g->name, old_alias); 175 purple_buddy_get_name(b), old_alias);
171 else 176 } else if (PURPLE_BLIST_NODE_IS_CHAT(node)) {
172 purple_debug_misc("signals test", "blist-node-aliased (UNKNOWN: %d, %s)\n", node->type, old_alias); 177 purple_debug_misc("signals test",
173 178 "blist-node-aliased (Chat: %s, %s)\n",
179 purple_chat_get_name(c), old_alias);
180 } else if (PURPLE_BLIST_NODE_IS_GROUP(node)) {
181 purple_debug_misc("signals test",
182 "blist-node-aliased (Group: %s, %s)\n",
183 purple_group_get_name(g), old_alias);
184 } else {
185 purple_debug_misc("signals test",
186 "blist-node-aliased (UNKNOWN: %d, %s)\n",
187 purple_blist_node_get_type(node), old_alias);
188 }
174 } 189 }
175 190
176 static void 191 static void
177 blist_node_extended_menu_cb(PurpleBlistNode *node, void *data) 192 blist_node_extended_menu_cb(PurpleBlistNode *node, void *data)
178 { 193 {
179 PurpleContact *p = (PurpleContact *)node; 194 PurpleContact *p = (PurpleContact *)node;
180 PurpleBuddy *b = (PurpleBuddy *)node; 195 PurpleBuddy *b = (PurpleBuddy *)node;
181 PurpleChat *c = (PurpleChat *)node; 196 PurpleChat *c = (PurpleChat *)node;
182 PurpleGroup *g = (PurpleGroup *)node; 197 PurpleGroup *g = (PurpleGroup *)node;
183 198
184 if (PURPLE_BLIST_NODE_IS_CONTACT(node)) 199 if (PURPLE_BLIST_NODE_IS_CONTACT(node)) {
185 purple_debug_misc("signals test", "blist-node-extended-menu (Contact: %s)\n", p->alias); 200 purple_debug_misc("signals test",
186 else if (PURPLE_BLIST_NODE_IS_BUDDY(node)) 201 "blist-node-extended-menu (Contact: %s)\n",
187 purple_debug_misc("signals test", "blist-node-extended-menu (Buddy: %s)\n", b->name); 202 purple_contact_get_alias(p));
188 else if (PURPLE_BLIST_NODE_IS_CHAT(node)) 203 } else if (PURPLE_BLIST_NODE_IS_BUDDY(node)) {
189 purple_debug_misc("signals test", "blist-node-extended-menu (Chat: %s)\n", c->alias); 204 purple_debug_misc("signals test",
190 else if (PURPLE_BLIST_NODE_IS_GROUP(node)) 205 "blist-node-extended-menu (Buddy: %s)\n",
191 purple_debug_misc("signals test", "blist-node-extended-menu (Group: %s)\n", g->name); 206 purple_buddy_get_name(b));
192 else 207 } else if (PURPLE_BLIST_NODE_IS_CHAT(node)) {
193 purple_debug_misc("signals test", "blist-node-extended-menu (UNKNOWN: %d)\n", node->type); 208 purple_debug_misc("signals test",
194 209 "blist-node-extended-menu (Chat: %s)\n",
210 purple_chat_get_name(c));
211 } else if (PURPLE_BLIST_NODE_IS_GROUP(node)) {
212 purple_debug_misc("signals test",
213 "blist-node-extended-menu (Group: %s)\n",
214 purple_group_get_name(g));
215 } else {
216 purple_debug_misc("signals test",
217 "blist-node-extended-menu (UNKNOWN: %d)\n",
218 purple_blist_node_get_type(node));
219 }
195 } 220 }
196 221
197 222
198 /************************************************************************** 223 /**************************************************************************
199 * Connection subsystem signal callbacks 224 * Connection subsystem signal callbacks