comparison src/protocols/msn/msn.c @ 6148:82e7eaa67406

[gaim-migrate @ 6622] A last-minute surprise to all of gaim's MSN users who wanted this feature. Chats can now be initiated by right-clicking an MSN user and choosing Initiate Chat. Note that chats in MSN don't work like chats elsewhere, because IMs and Chats in MSN are the exact same things, and we can't detect the number of users before connecting to the switchboard. committer: Tailor Script <tailor@pidgin.im>
author Christian Hammond <chipx86@chipx86.com>
date Wed, 16 Jul 2003 06:15:19 +0000
parents d8cd876e613e
children 6f4979d8cc3c
comparison
equal deleted inserted replaced
6147:084f6c031783 6148:82e7eaa67406
235 _("Page"), G_CALLBACK(send_to_mobile_cb), 235 _("Page"), G_CALLBACK(send_to_mobile_cb),
236 _("Close"), G_CALLBACK(close_mobile_page_cb), 236 _("Close"), G_CALLBACK(close_mobile_page_cb),
237 data); 237 data);
238 } 238 }
239 239
240 static void
241 initiate_chat_cb(GaimConnection *gc, const char *passport)
242 {
243 GaimAccount *account = gaim_connection_get_account(gc);
244 MsnSession *session = gc->proto_data;
245 MsnSwitchBoard *swboard;
246 MsnUser *user;
247
248 if ((swboard = msn_session_open_switchboard(session)) == NULL) {
249 gaim_connection_error(gc, _("Write error"));
250
251 return;
252 }
253
254 user = msn_user_new(session, passport, NULL);
255
256 msn_switchboard_set_user(swboard, user);
257
258 swboard->total_users = 1;
259
260 swboard->chat = serv_got_joined_chat(gc, ++swboard->chat_id, "MSN Chat");
261
262 gaim_chat_add_user(GAIM_CHAT(swboard->chat),
263 gaim_account_get_username(account), NULL);
264 }
240 265
241 /************************************************************************** 266 /**************************************************************************
242 * Protocol Plugin ops 267 * Protocol Plugin ops
243 **************************************************************************/ 268 **************************************************************************/
244 269
371 } 396 }
372 397
373 static GList * 398 static GList *
374 msn_buddy_menu(GaimConnection *gc, const char *who) 399 msn_buddy_menu(GaimConnection *gc, const char *who)
375 { 400 {
401 GaimAccount *account = gaim_connection_get_account(gc);
376 MsnUser *user; 402 MsnUser *user;
377 struct proto_buddy_menu *pbm; 403 struct proto_buddy_menu *pbm;
378 struct buddy *b; 404 struct buddy *b;
379 GList *m = NULL; 405 GList *m = NULL;
380 406
387 pbm->label = _("Send to Mobile"); 413 pbm->label = _("Send to Mobile");
388 pbm->callback = show_send_to_mobile_cb; 414 pbm->callback = show_send_to_mobile_cb;
389 pbm->gc = gc; 415 pbm->gc = gc;
390 m = g_list_append(m, pbm); 416 m = g_list_append(m, pbm);
391 } 417 }
418 }
419
420 if (g_ascii_strcasecmp(who, gaim_account_get_username(account))) {
421 pbm = g_new0(struct proto_buddy_menu, 1);
422 pbm->label = _("Initiate Chat");
423 pbm->callback = initiate_chat_cb;
424 pbm->gc = gc;
425 m = g_list_append(m, pbm);
392 } 426 }
393 427
394 return m; 428 return m;
395 } 429 }
396 430