| 378 protocol = purple_find_protocol_info(purple_account_get_protocol_id(account)); |
378 protocol = purple_find_protocol_info(purple_account_get_protocol_id(account)); |
| 379 |
379 |
| 380 if (protocol == NULL) |
380 if (protocol == NULL) |
| 381 return; |
381 return; |
| 382 |
382 |
| 383 if (!purple_account_is_disconnected(account) && protocol->set_status != NULL) |
383 if (!purple_account_is_disconnected(account)) |
| 384 { |
|
| 385 purple_protocol_iface_set_status(protocol, account, new_status); |
384 purple_protocol_iface_set_status(protocol, account, new_status); |
| 386 } |
|
| 387 } |
385 } |
| 388 |
386 |
| 389 void |
387 void |
| 390 purple_protocol_change_account_status(PurpleAccount *account, |
388 purple_protocol_change_account_status(PurpleAccount *account, |
| 391 PurpleStatus *old_status, PurpleStatus *new_status) |
389 PurpleStatus *old_status, PurpleStatus *new_status) |
| 436 { |
434 { |
| 437 PurpleAttentionType *attn; |
435 PurpleAttentionType *attn; |
| 438 PurpleMessageFlags flags; |
436 PurpleMessageFlags flags; |
| 439 PurpleProtocol *protocol; |
437 PurpleProtocol *protocol; |
| 440 PurpleIMConversation *im; |
438 PurpleIMConversation *im; |
| 441 gboolean (*send_attention)(PurpleConnection *, const char *, guint); |
|
| 442 PurpleBuddy *buddy; |
439 PurpleBuddy *buddy; |
| 443 const char *alias; |
440 const char *alias; |
| 444 gchar *description; |
441 gchar *description; |
| 445 time_t mtime; |
442 time_t mtime; |
| 446 |
443 |
| 447 g_return_if_fail(gc != NULL); |
444 g_return_if_fail(gc != NULL); |
| 448 g_return_if_fail(who != NULL); |
445 g_return_if_fail(who != NULL); |
| 449 |
446 |
| 450 protocol = purple_find_protocol_info(purple_account_get_protocol_id(purple_connection_get_account(gc))); |
447 protocol = purple_find_protocol_info(purple_account_get_protocol_id(purple_connection_get_account(gc))); |
| 451 send_attention = protocol->send_attention; |
448 g_return_if_fail(PURPLE_PROTOCOL_GET_INTERFACE(protocol)->send_attention != NULL); |
| 452 g_return_if_fail(send_attention != NULL); |
|
| 453 |
449 |
| 454 mtime = time(NULL); |
450 mtime = time(NULL); |
| 455 |
451 |
| 456 attn = purple_get_attention_type_from_code(purple_connection_get_account(gc), type_code); |
452 attn = purple_get_attention_type_from_code(purple_connection_get_account(gc), type_code); |
| 457 |
453 |
| 469 flags = PURPLE_MESSAGE_SEND | PURPLE_MESSAGE_NOTIFY | PURPLE_MESSAGE_SYSTEM; |
465 flags = PURPLE_MESSAGE_SEND | PURPLE_MESSAGE_NOTIFY | PURPLE_MESSAGE_SYSTEM; |
| 470 |
466 |
| 471 purple_debug_info("server", "serv_send_attention: sending '%s' to %s\n", |
467 purple_debug_info("server", "serv_send_attention: sending '%s' to %s\n", |
| 472 description, who); |
468 description, who); |
| 473 |
469 |
| 474 if (!send_attention(gc, who, type_code)) |
470 if (!purple_protocol_iface_send_attention(protocol, gc, who, type_code)) |
| 475 return; |
471 return; |
| 476 |
472 |
| 477 im = purple_im_conversation_new(purple_connection_get_account(gc), who); |
473 im = purple_im_conversation_new(purple_connection_get_account(gc), who); |
| 478 purple_conversation_write_message(PURPLE_CONVERSATION(im), NULL, description, flags, mtime); |
474 purple_conversation_write_message(PURPLE_CONVERSATION(im), NULL, description, flags, mtime); |
| 479 purple_protocol_attention(PURPLE_CONVERSATION(im), who, type_code, PURPLE_MESSAGE_SEND, time(NULL)); |
475 purple_protocol_attention(PURPLE_CONVERSATION(im), who, type_code, PURPLE_MESSAGE_SEND, time(NULL)); |
| 557 if (account) |
553 if (account) |
| 558 gc = purple_account_get_connection(account); |
554 gc = purple_account_get_connection(account); |
| 559 if (gc) |
555 if (gc) |
| 560 protocol = purple_connection_get_protocol_info(gc); |
556 protocol = purple_connection_get_protocol_info(gc); |
| 561 |
557 |
| 562 if (protocol && PURPLE_PROTOCOL_PLUGIN_HAS_FUNC(protocol, initiate_media)) { |
558 if (protocol) { |
| 563 /* should check that the protocol supports this media type here? */ |
559 /* should check that the protocol supports this media type here? */ |
| 564 return purple_protocol_iface_initiate_media(protocol, account, who, type); |
560 return purple_protocol_iface_initiate_media(protocol, account, who, type); |
| 565 } else |
561 } else |
| 566 #endif |
562 #endif |
| 567 return FALSE; |
563 return FALSE; |
| 577 if (account) |
573 if (account) |
| 578 gc = purple_account_get_connection(account); |
574 gc = purple_account_get_connection(account); |
| 579 if (gc) |
575 if (gc) |
| 580 protocol = purple_connection_get_protocol_info(gc); |
576 protocol = purple_connection_get_protocol_info(gc); |
| 581 |
577 |
| 582 if (protocol && PURPLE_PROTOCOL_PLUGIN_HAS_FUNC(protocol, |
578 if (protocol) |
| 583 get_media_caps)) { |
|
| 584 return purple_protocol_iface_get_media_caps(protocol, account, who); |
579 return purple_protocol_iface_get_media_caps(protocol, account, who); |
| 585 } |
|
| 586 #endif |
580 #endif |
| 587 return PURPLE_MEDIA_CAPS_NONE; |
581 return PURPLE_MEDIA_CAPS_NONE; |
| 588 } |
582 } |
| 589 |
583 |
| 590 void |
584 void |
| 657 PurpleProtocol * |
651 PurpleProtocol * |
| 658 purple_protocols_add(GType protocol_type) |
652 purple_protocols_add(GType protocol_type) |
| 659 { |
653 { |
| 660 PurpleProtocol *protocol; |
654 PurpleProtocol *protocol; |
| 661 |
655 |
| 662 g_return_val_if_fail(type != G_TYPE_INVALID && type != G_TYPE_NONE, NULL); |
656 g_return_val_if_fail(protocol_type != G_TYPE_INVALID && |
| |
657 protocol_type != G_TYPE_NONE, NULL); |
| 663 |
658 |
| 664 protocol = g_object_new(protocol_type, NULL); |
659 protocol = g_object_new(protocol_type, NULL); |
| 665 if (purple_find_protocol_info(purple_protocol_get_id(protocol))) { |
660 if (purple_find_protocol_info(purple_protocol_get_id(protocol))) { |
| 666 g_object_unref(protocol); |
661 g_object_unref(protocol); |
| 667 return NULL; |
662 return NULL; |