comparison libpurple/protocols/myspace/zap.c @ 19714:43a8cd1f708c

Remove the *_USE_ATTENTION_API markers everywhere.
author Richard Laager <rlaager@wiktel.com>
date Mon, 10 Sep 2007 20:51:59 +0000
parents d3d9e3978d82
children 77673386d31d
comparison
equal deleted inserted replaced
19713:eabc8a32b1e4 19714:43a8cd1f708c
90 static gboolean 90 static gboolean
91 msim_send_zap(MsimSession *session, const gchar *username, guint code) 91 msim_send_zap(MsimSession *session, const gchar *username, guint code)
92 { 92 {
93 gchar *zap_string; 93 gchar *zap_string;
94 gboolean rc; 94 gboolean rc;
95 #ifndef MSIM_USE_ATTENTION_API
96 GList *types;
97 MsimAttentionType *attn;
98 gchar *zap_description;
99 #endif
100 95
101 g_return_val_if_fail(session != NULL, FALSE); 96 g_return_val_if_fail(session != NULL, FALSE);
102 g_return_val_if_fail(username != NULL, FALSE); 97 g_return_val_if_fail(username != NULL, FALSE);
103 98
104 99
105 #ifdef MSIM_USE_ATTENTION_API
106 /* serv_send_attention(session->gc, username, code); */
107 #else
108 types = msim_attention_types(session->account); 100 types = msim_attention_types(session->account);
109 101
110 attn = g_list_nth_data(types, code); 102 attn = g_list_nth_data(types, code);
111 if (!attn) { 103 if (!attn) {
112 return FALSE; 104 return FALSE;
118 110
119 serv_got_im(session->gc, username, zap_description, 111 serv_got_im(session->gc, username, zap_description,
120 PURPLE_MESSAGE_SEND | PURPLE_MESSAGE_SYSTEM, time(NULL)); 112 PURPLE_MESSAGE_SEND | PURPLE_MESSAGE_SYSTEM, time(NULL));
121 113
122 g_free(zap_description); 114 g_free(zap_description);
123 #endif
124 115
125 /* Construct and send the actual zap command. */ 116 /* Construct and send the actual zap command. */
126 zap_string = g_strdup_printf("!!!ZAP_SEND!!!=RTE_BTN_ZAPS_%d", code); 117 zap_string = g_strdup_printf("!!!ZAP_SEND!!!=RTE_BTN_ZAPS_%d", code);
127 118
128 if (!msim_send_bm(session, username, zap_string, MSIM_BM_ACTION)) { 119 if (!msim_send_bm(session, username, zap_string, MSIM_BM_ACTION)) {
163 gc = purple_account_get_connection(account); 154 gc = purple_account_get_connection(account);
164 session = (MsimSession *)gc->proto_data; 155 session = (MsimSession *)gc->proto_data;
165 156
166 zap = GPOINTER_TO_INT(zap_num_ptr); 157 zap = GPOINTER_TO_INT(zap_num_ptr);
167 158
168 #ifdef MSIM_USE_ATTENTION_API
169 serv_send_attention(session->gc, buddy->name, zap); 159 serv_send_attention(session->gc, buddy->name, zap);
170 #else
171 g_return_if_fail(msim_send_zap(session, buddy->name, zap));
172 #endif
173 } 160 }
174 161
175 /** Return menu, if any, for a buddy list node. */ 162 /** Return menu, if any, for a buddy list node. */
176 GList * 163 GList *
177 msim_blist_node_menu(PurpleBlistNode *node) 164 msim_blist_node_menu(PurpleBlistNode *node)
219 gboolean 206 gboolean
220 msim_incoming_zap(MsimSession *session, MsimMessage *msg) 207 msim_incoming_zap(MsimSession *session, MsimMessage *msg)
221 { 208 {
222 gchar *msg_text, *username; 209 gchar *msg_text, *username;
223 gint zap; 210 gint zap;
224 #ifndef MSIM_USE_ATTENTION_API
225 const gchar *zap_past_tense[10];
226 gchar *zap_text;
227
228 zap_past_tense[0] = _("zapped");
229 zap_past_tense[1] = _("whacked");
230 zap_past_tense[2] = _("torched");
231 zap_past_tense[3] = _("smooched");
232 zap_past_tense[4] = _("hugged");
233 zap_past_tense[5] = _("bslapped");
234 zap_past_tense[6] = _("goosed");
235 zap_past_tense[7] = _("hi-fived");
236 zap_past_tense[8] = _("punk'd");
237 zap_past_tense[9] = _("raspberried");
238 #endif
239 211
240 msg_text = msim_msg_get_string(msg, "msg"); 212 msg_text = msim_msg_get_string(msg, "msg");
241 username = msim_msg_get_string(msg, "_username"); 213 username = msim_msg_get_string(msg, "_username");
242 214
243 g_return_val_if_fail(msg_text != NULL, FALSE); 215 g_return_val_if_fail(msg_text != NULL, FALSE);
245 217
246 g_return_val_if_fail(sscanf(msg_text, "!!!ZAP_SEND!!!=RTE_BTN_ZAPS_%d", &zap) == 1, FALSE); 218 g_return_val_if_fail(sscanf(msg_text, "!!!ZAP_SEND!!!=RTE_BTN_ZAPS_%d", &zap) == 1, FALSE);
247 219
248 zap = CLAMP(zap, 0, 9); 220 zap = CLAMP(zap, 0, 9);
249 221
250 #ifdef MSIM_USE_ATTENTION_API
251 serv_got_attention(session->gc, username, zap); 222 serv_got_attention(session->gc, username, zap);
252 #else
253 zap_text = g_strdup_printf(_("*** You have been %s! ***"), zap_past_tense[zap]);
254 serv_got_im(session->gc, username, zap_text,
255 PURPLE_MESSAGE_RECV | PURPLE_MESSAGE_SYSTEM, time(NULL));
256 g_free(zap_text);
257 #endif
258 223
259 g_free(msg_text); 224 g_free(msg_text);
260 g_free(username); 225 g_free(username);
261 226
262 return TRUE; 227 return TRUE;