| 232 static void |
233 static void |
| 233 msn_show_set_mobile_pages(GaimPluginAction *action) |
234 msn_show_set_mobile_pages(GaimPluginAction *action) |
| 234 { |
235 { |
| 235 GaimConnection *gc = (GaimConnection *) action->context; |
236 GaimConnection *gc = (GaimConnection *) action->context; |
| 236 gaim_request_action(gc, NULL, _("Allow MSN Mobile pages?"), |
237 gaim_request_action(gc, NULL, _("Allow MSN Mobile pages?"), |
| 237 _("Do you want to allow or disallow people on " |
238 _("Do you want to allow or disallow people on " |
| 238 "your buddy list to send you MSN Mobile pages " |
239 "your buddy list to send you MSN Mobile pages " |
| 239 "to your cell phone or other mobile device?"), |
240 "to your cell phone or other mobile device?"), |
| 240 -1, gc, 3, |
241 -1, gc, 3, |
| 241 _("Allow"), G_CALLBACK(enable_msn_pages_cb), |
242 _("Allow"), G_CALLBACK(enable_msn_pages_cb), |
| 242 _("Disallow"), G_CALLBACK(disable_msn_pages_cb), |
243 _("Disallow"), G_CALLBACK(disable_msn_pages_cb), |
| 243 _("Cancel"), NULL); |
244 _("Cancel"), NULL); |
| 244 } |
245 } |
| 245 |
246 |
| 246 static void |
247 static void |
| 247 show_send_to_mobile_cb(GaimConnection *gc, const char *passport) |
248 show_send_to_mobile_cb(GaimBlistNode *node, gpointer ignored) |
| 248 { |
249 { |
| |
250 GaimBuddy *buddy; |
| |
251 GaimConnection *gc; |
| |
252 |
| |
253 g_return_if_fail(GAIM_BLIST_NODE_IS_BUDDY(node)); |
| |
254 |
| |
255 buddy = (GaimBuddy *) node; |
| |
256 gc = gaim_account_get_connection(buddy->account); |
| |
257 |
| 249 MsnUser *user; |
258 MsnUser *user; |
| 250 MsnSession *session; |
259 MsnSession *session; |
| 251 MsnMobileData *data; |
260 MsnMobileData *data; |
| 252 |
261 |
| 253 session = gc->proto_data; |
262 session = gc->proto_data; |
| 254 user = msn_users_find_with_passport(session->users, passport); |
263 user = msn_users_find_with_passport(session->users, buddy->name); |
| 255 |
264 |
| 256 data = g_new0(MsnMobileData, 1); |
265 data = g_new0(MsnMobileData, 1); |
| 257 data->gc = gc; |
266 data->gc = gc; |
| 258 data->passport = passport; |
267 data->passport = buddy->name; |
| 259 |
268 |
| 260 gaim_request_input(gc, NULL, _("Send a mobile message."), NULL, |
269 gaim_request_input(gc, NULL, _("Send a mobile message."), NULL, |
| 261 NULL, TRUE, FALSE, NULL, |
270 NULL, TRUE, FALSE, NULL, |
| 262 _("Page"), G_CALLBACK(send_to_mobile_cb), |
271 _("Page"), G_CALLBACK(send_to_mobile_cb), |
| 263 _("Close"), G_CALLBACK(close_mobile_page_cb), |
272 _("Close"), G_CALLBACK(close_mobile_page_cb), |
| 264 data); |
273 data); |
| 265 } |
274 } |
| 266 |
275 |
| 267 static void |
276 static void |
| 268 initiate_chat_cb(GaimConnection *gc, const char *passport) |
277 initiate_chat_cb(GaimBlistNode *node, gpointer data) |
| 269 { |
278 { |
| 270 GaimAccount *account; |
279 GaimBuddy *buddy; |
| |
280 GaimConnection *gc; |
| |
281 |
| 271 MsnSession *session; |
282 MsnSession *session; |
| 272 MsnCmdProc *cmdproc; |
283 MsnCmdProc *cmdproc; |
| 273 MsnSwitchBoard *swboard; |
284 MsnSwitchBoard *swboard; |
| 274 MsnUser *user; |
285 MsnUser *user; |
| 275 |
286 |
| 276 account = gaim_connection_get_account(gc); |
287 g_return_if_fail(GAIM_BLIST_NODE_IS_BUDDY(node)); |
| |
288 |
| |
289 buddy = (GaimBuddy *) node; |
| |
290 gc = gaim_account_get_connection(buddy->account); |
| |
291 |
| 277 session = gc->proto_data; |
292 session = gc->proto_data; |
| 278 cmdproc = session->notification_conn->cmdproc; |
293 cmdproc = session->notification_conn->cmdproc; |
| 279 |
294 |
| 280 if ((swboard = msn_session_open_switchboard(session)) == NULL) |
295 if ((swboard = msn_session_open_switchboard(session)) == NULL) |
| 281 return; |
296 return; |
| 282 |
297 |
| 283 user = msn_user_new(session, passport, NULL); |
298 user = msn_user_new(session, buddy->name, NULL); |
| 284 |
299 |
| 285 msn_switchboard_set_user(swboard, user); |
300 msn_switchboard_set_user(swboard, user); |
| 286 |
301 |
| 287 swboard->total_users = 1; |
302 swboard->total_users = 1; |
| 288 |
303 |
| 289 session->last_chat_id++; |
304 session->last_chat_id++; |
| 290 swboard->chat_id = session->last_chat_id; |
305 swboard->chat_id = session->last_chat_id; |
| 291 swboard->chat = serv_got_joined_chat(gc, swboard->chat_id, "MSN Chat"); |
306 swboard->chat = serv_got_joined_chat(gc, swboard->chat_id, "MSN Chat"); |
| 292 |
307 |
| 293 gaim_conv_chat_add_user(GAIM_CONV_CHAT(swboard->chat), |
308 gaim_conv_chat_add_user(GAIM_CONV_CHAT(swboard->chat), |
| 294 gaim_account_get_username(account), NULL); |
309 gaim_account_get_username(buddy->account), NULL); |
| 295 } |
310 } |
| 296 |
311 |
| 297 /************************************************************************** |
312 /************************************************************************** |
| 298 * Protocol Plugin ops |
313 * Protocol Plugin ops |
| 299 **************************************************************************/ |
314 **************************************************************************/ |
| 408 |
423 |
| 409 return m; |
424 return m; |
| 410 } |
425 } |
| 411 |
426 |
| 412 static GList * |
427 static GList * |
| 413 msn_buddy_menu(GaimConnection *gc, const char *who) |
428 msn_buddy_menu(GaimBuddy *buddy) |
| 414 { |
429 { |
| 415 GaimAccount *account; |
|
| 416 MsnUser *user; |
430 MsnUser *user; |
| 417 struct proto_buddy_menu *pbm; |
431 |
| 418 GaimBuddy *b; |
|
| 419 GList *m = NULL; |
432 GList *m = NULL; |
| 420 |
433 GaimBlistNodeAction *act; |
| 421 account = gaim_connection_get_account(gc); |
434 |
| 422 b = gaim_find_buddy(account, who); |
435 user = buddy->proto_data; |
| 423 |
|
| 424 g_return_val_if_fail(b != NULL, NULL); |
|
| 425 |
|
| 426 user = b->proto_data; |
|
| 427 |
|
| 428 if (user != NULL) |
436 if (user != NULL) |
| 429 { |
437 { |
| 430 if (user->mobile) |
438 if (user->mobile) |
| 431 { |
439 { |
| 432 pbm = g_new0(struct proto_buddy_menu, 1); |
440 act = gaim_blist_node_action_new(_("Send to Mobile"), |
| 433 pbm->label = _("Send to Mobile"); |
441 show_send_to_mobile_cb, NULL); |
| 434 pbm->callback = show_send_to_mobile_cb; |
442 m = g_list_append(m, act); |
| 435 pbm->gc = gc; |
|
| 436 m = g_list_append(m, pbm); |
|
| 437 } |
443 } |
| 438 } |
444 } |
| 439 |
445 |
| 440 if (g_ascii_strcasecmp(who, gaim_account_get_username(account))) |
446 if (g_ascii_strcasecmp(buddy->name, gaim_account_get_username(buddy->account))) |
| 441 { |
447 { |
| 442 pbm = g_new0(struct proto_buddy_menu, 1); |
448 act = gaim_blist_node_action_new(_("Initiate Chat"), |
| 443 pbm->label = _("Initiate Chat"); |
449 initiate_chat_cb, NULL); |
| 444 pbm->callback = initiate_chat_cb; |
450 m = g_list_append(m, act); |
| 445 pbm->gc = gc; |
|
| 446 m = g_list_append(m, pbm); |
|
| 447 } |
451 } |
| 448 |
452 |
| 449 return m; |
453 return m; |
| 450 } |
454 } |
| |
455 |
| |
456 |
| |
457 static GList * |
| |
458 msn_blist_node_menu(GaimBlistNode *node) |
| |
459 { |
| |
460 if(GAIM_BLIST_NODE_IS_BUDDY(node)) { |
| |
461 return msn_buddy_menu((GaimBuddy *) node); |
| |
462 } else { |
| |
463 return NULL; |
| |
464 } |
| |
465 } |
| |
466 |
| 451 |
467 |
| 452 static void |
468 static void |
| 453 msn_login(GaimAccount *account) |
469 msn_login(GaimAccount *account) |
| 454 { |
470 { |
| 455 GaimConnection *gc; |
471 GaimConnection *gc; |