| 954 _("Select at least two initial participants."), |
954 _("Select at least two initial participants."), |
| 955 select, TRUE, |
955 select, TRUE, |
| 956 G_CALLBACK(fb_blist_chat_create), NULL, |
956 G_CALLBACK(fb_blist_chat_create), NULL, |
| 957 fata); |
957 fata); |
| 958 g_slist_free(select); |
958 g_slist_free(select); |
| |
959 } |
| |
960 |
| |
961 static GList * |
| |
962 fb_get_account_options(PurpleProtocol *protocol) { |
| |
963 GList *opts = NULL; |
| |
964 PurpleAccountOption *opt; |
| |
965 |
| |
966 opt = purple_account_option_int_new(_("Buddy list sync interval"), |
| |
967 "sync-interval", 5); |
| |
968 opts = g_list_prepend(opts, opt); |
| |
969 |
| |
970 opt = purple_account_option_bool_new(_("Mark messages as read on focus"), |
| |
971 "mark-read", TRUE); |
| |
972 opts = g_list_prepend(opts, opt); |
| |
973 |
| |
974 opt = purple_account_option_bool_new(_("Mark messages as read only when available"), |
| |
975 "mark-read-available", FALSE); |
| |
976 opts = g_list_prepend(opts, opt); |
| |
977 |
| |
978 opt = purple_account_option_bool_new(_("Show self messages"), |
| |
979 "show-self", TRUE); |
| |
980 opts = g_list_prepend(opts, opt); |
| |
981 |
| |
982 opt = purple_account_option_bool_new(_("Show unread messages"), |
| |
983 "show-unread", TRUE); |
| |
984 opts = g_list_prepend(opts, opt); |
| |
985 |
| |
986 opt = purple_account_option_bool_new(_("Open new group chats with " |
| |
987 "incoming messages"), |
| |
988 "group-chat-open", TRUE); |
| |
989 opts = g_list_prepend(opts, opt); |
| |
990 |
| |
991 return g_list_reverse(opts); |
| 959 } |
992 } |
| 960 |
993 |
| 961 static void |
994 static void |
| 962 fb_login(PurpleAccount *acct) |
995 fb_login(PurpleAccount *acct) |
| 963 { |
996 { |
| 1522 fb_api_thread_remove(api, tid, 0); |
1555 fb_api_thread_remove(api, tid, 0); |
| 1523 return PURPLE_CMD_RET_OK; |
1556 return PURPLE_CMD_RET_OK; |
| 1524 } |
1557 } |
| 1525 |
1558 |
| 1526 static void |
1559 static void |
| 1527 facebook_protocol_init(FacebookProtocol *self) |
1560 facebook_protocol_init(FacebookProtocol *self) { |
| 1528 { |
|
| 1529 PurpleProtocol *protocol = PURPLE_PROTOCOL(self); |
|
| 1530 GList *opts = NULL; |
|
| 1531 PurpleAccountOption *opt; |
|
| 1532 |
|
| 1533 protocol->id = FB_PROTOCOL_ID; |
|
| 1534 protocol->name = "Facebook"; |
|
| 1535 protocol->options = OPT_PROTO_CHAT_TOPIC; |
|
| 1536 |
|
| 1537 opt = purple_account_option_int_new(_("Buddy list sync interval"), |
|
| 1538 "sync-interval", 5); |
|
| 1539 opts = g_list_prepend(opts, opt); |
|
| 1540 |
|
| 1541 opt = purple_account_option_bool_new(_("Mark messages as read on focus"), |
|
| 1542 "mark-read", TRUE); |
|
| 1543 opts = g_list_prepend(opts, opt); |
|
| 1544 |
|
| 1545 opt = purple_account_option_bool_new(_("Mark messages as read only when available"), |
|
| 1546 "mark-read-available", FALSE); |
|
| 1547 opts = g_list_prepend(opts, opt); |
|
| 1548 |
|
| 1549 opt = purple_account_option_bool_new(_("Show self messages"), |
|
| 1550 "show-self", TRUE); |
|
| 1551 opts = g_list_prepend(opts, opt); |
|
| 1552 |
|
| 1553 opt = purple_account_option_bool_new(_("Show unread messages"), |
|
| 1554 "show-unread", TRUE); |
|
| 1555 opts = g_list_prepend(opts, opt); |
|
| 1556 |
|
| 1557 opt = purple_account_option_bool_new(_("Open new group chats with " |
|
| 1558 "incoming messages"), |
|
| 1559 "group-chat-open", TRUE); |
|
| 1560 opts = g_list_prepend(opts, opt); |
|
| 1561 protocol->account_options = g_list_reverse(opts); |
|
| 1562 } |
1561 } |
| 1563 |
1562 |
| 1564 static void |
1563 static void |
| 1565 facebook_protocol_class_init(FacebookProtocolClass *klass) |
1564 facebook_protocol_class_init(FacebookProtocolClass *klass) |
| 1566 { |
1565 { |
| 1567 PurpleProtocolClass *protocol_class = PURPLE_PROTOCOL_CLASS(klass); |
1566 PurpleProtocolClass *protocol_class = PURPLE_PROTOCOL_CLASS(klass); |
| |
1567 |
| |
1568 protocol_class->get_account_options = fb_get_account_options; |
| 1568 |
1569 |
| 1569 protocol_class->login = fb_login; |
1570 protocol_class->login = fb_login; |
| 1570 protocol_class->close = fb_close; |
1571 protocol_class->close = fb_close; |
| 1571 protocol_class->status_types = fb_status_types; |
1572 protocol_class->status_types = fb_status_types; |
| 1572 protocol_class->list_icon = fb_list_icon; |
1573 protocol_class->list_icon = fb_list_icon; |
| 1641 PURPLE_CMD_FLAG_PROTOCOL_ONLY; |
1642 PURPLE_CMD_FLAG_PROTOCOL_ONLY; |
| 1642 |
1643 |
| 1643 g_return_if_fail(fb_cmds == NULL); |
1644 g_return_if_fail(fb_cmds == NULL); |
| 1644 |
1645 |
| 1645 id = purple_cmd_register("kick", "s", PURPLE_CMD_P_PROTOCOL, cflags, |
1646 id = purple_cmd_register("kick", "s", PURPLE_CMD_P_PROTOCOL, cflags, |
| 1646 fb_protocol->id, fb_cmd_kick, |
1647 FB_PROTOCOL_ID, fb_cmd_kick, |
| 1647 _("kick: Kick someone from the chat"), |
1648 _("kick: Kick someone from the chat"), |
| 1648 NULL); |
1649 NULL); |
| 1649 fb_cmds = g_slist_prepend(fb_cmds, GUINT_TO_POINTER(id)); |
1650 fb_cmds = g_slist_prepend(fb_cmds, GUINT_TO_POINTER(id)); |
| 1650 |
1651 |
| 1651 id = purple_cmd_register("leave", "", PURPLE_CMD_P_PROTOCOL, cflags, |
1652 id = purple_cmd_register("leave", "", PURPLE_CMD_P_PROTOCOL, cflags, |
| 1652 fb_protocol->id, fb_cmd_leave, |
1653 FB_PROTOCOL_ID, fb_cmd_leave, |
| 1653 _("leave: Leave the chat"), |
1654 _("leave: Leave the chat"), |
| 1654 NULL); |
1655 NULL); |
| 1655 fb_cmds = g_slist_prepend(fb_cmds, GUINT_TO_POINTER(id)); |
1656 fb_cmds = g_slist_prepend(fb_cmds, GUINT_TO_POINTER(id)); |
| 1656 } |
1657 } |
| 1657 |
1658 |
| 1690 plugin_load(PurplePlugin *plugin, GError **error) |
1691 plugin_load(PurplePlugin *plugin, GError **error) |
| 1691 { |
1692 { |
| 1692 PurpleProtocolManager *manager = purple_protocol_manager_get_default(); |
1693 PurpleProtocolManager *manager = purple_protocol_manager_get_default(); |
| 1693 |
1694 |
| 1694 facebook_protocol_register_type(G_TYPE_MODULE(plugin)); |
1695 facebook_protocol_register_type(G_TYPE_MODULE(plugin)); |
| 1695 fb_protocol = g_object_new(FACEBOOK_TYPE_PROTOCOL, NULL); |
1696 fb_protocol = g_object_new(FACEBOOK_TYPE_PROTOCOL, |
| |
1697 "id", FB_PROTOCOL_ID, |
| |
1698 "name", "Facebook", |
| |
1699 "options", OPT_PROTO_CHAT_TOPIC, |
| |
1700 NULL); |
| 1696 |
1701 |
| 1697 if(!purple_protocol_manager_register(manager, fb_protocol, error)) { |
1702 if(!purple_protocol_manager_register(manager, fb_protocol, error)) { |
| 1698 g_clear_object(&fb_protocol); |
1703 g_clear_object(&fb_protocol); |
| 1699 |
1704 |
| 1700 return FALSE; |
1705 return FALSE; |