libpurple/protocols/myspace/myspace.c

branch
soc.2013.gobjectification.plugins
changeset 36544
1bf8b6ef5aea
parent 36541
25bbce98aeb6
child 36545
23b59a16c808
equal deleted inserted replaced
36543:a8c3fecee2d3 36544:1bf8b6ef5aea
2916 } 2916 }
2917 2917
2918 /** 2918 /**
2919 * Send raw data to the server, possibly with embedded NULs. 2919 * Send raw data to the server, possibly with embedded NULs.
2920 * 2920 *
2921 * Used in prpl_info struct, so that plugins can have the most possible 2921 * Used in protocol struct, so that plugins can have the most possible
2922 * control of what is sent over the connection. Inside this prpl, 2922 * control of what is sent over the connection. Inside this prpl,
2923 * msim_send_raw() is used, since it sends NUL-terminated strings (easier). 2923 * msim_send_raw() is used, since it sends NUL-terminated strings (easier).
2924 * 2924 *
2925 * @param gc PurpleConnection 2925 * @param gc PurpleConnection
2926 * @param buf Buffer to send 2926 * @param buf Buffer to send
3087 } 3087 }
3088 3088
3089 /** 3089 /**
3090 * Callbacks called by Purple, to access this plugin. 3090 * Callbacks called by Purple, to access this plugin.
3091 */ 3091 */
3092 static PurplePluginProtocolInfo prpl_info = { 3092 static PurpleProtocol protocol = {
3093 "prpl-myspace", /* id */ 3093 "prpl-myspace", /* id */
3094 "MySpaceIM", /* name */ 3094 "MySpaceIM", /* name */
3095 sizeof(PurplePluginProtocolInfo), /* struct_size */ 3095 sizeof(PurpleProtocol), /* struct_size */
3096 /* options */ 3096 /* options */
3097 OPT_PROTO_USE_POINTSIZE /* specify font size in sane point size */ 3097 OPT_PROTO_USE_POINTSIZE /* specify font size in sane point size */
3098 | OPT_PROTO_MAIL_CHECK, 3098 | OPT_PROTO_MAIL_CHECK,
3099 3099
3100 /* | OPT_PROTO_IM_IMAGE - TODO: direct images. */ 3100 /* | OPT_PROTO_IM_IMAGE - TODO: direct images. */
3494 PurpleAccountOption *option; 3494 PurpleAccountOption *option;
3495 3495
3496 /* TODO: default to automatically try different ports. Make the user be 3496 /* TODO: default to automatically try different ports. Make the user be
3497 * able to set the first port to try (like LastConnectedPort in Windows client). */ 3497 * able to set the first port to try (like LastConnectedPort in Windows client). */
3498 option = purple_account_option_string_new(_("Connect server"), "server", MSIM_SERVER); 3498 option = purple_account_option_string_new(_("Connect server"), "server", MSIM_SERVER);
3499 prpl_info.protocol_options = g_list_append(prpl_info.protocol_options, option); 3499 protocol.protocol_options = g_list_append(protocol.protocol_options, option);
3500 3500
3501 option = purple_account_option_int_new(_("Connect port"), "port", MSIM_PORT); 3501 option = purple_account_option_int_new(_("Connect port"), "port", MSIM_PORT);
3502 prpl_info.protocol_options = g_list_append(prpl_info.protocol_options, option); 3502 protocol.protocol_options = g_list_append(protocol.protocol_options, option);
3503 3503
3504 #ifdef MSIM_USER_WANTS_TO_CONFIGURE_STATUS_TEXT 3504 #ifdef MSIM_USER_WANTS_TO_CONFIGURE_STATUS_TEXT
3505 option = purple_account_option_bool_new(_("Show display name in status text"), "show_display_name", TRUE); 3505 option = purple_account_option_bool_new(_("Show display name in status text"), "show_display_name", TRUE);
3506 prpl_info.protocol_options = g_list_append(prpl_info.protocol_options, option); 3506 protocol.protocol_options = g_list_append(protocol.protocol_options, option);
3507 3507
3508 option = purple_account_option_bool_new(_("Show headline in status text"), "show_headline", TRUE); 3508 option = purple_account_option_bool_new(_("Show headline in status text"), "show_headline", TRUE);
3509 prpl_info.protocol_options = g_list_append(prpl_info.protocol_options, option); 3509 protocol.protocol_options = g_list_append(protocol.protocol_options, option);
3510 #endif 3510 #endif
3511 3511
3512 #ifdef MSIM_USER_WANTS_TO_DISABLE_EMOTICONS 3512 #ifdef MSIM_USER_WANTS_TO_DISABLE_EMOTICONS
3513 option = purple_account_option_bool_new(_("Send emoticons"), "emoticons", TRUE); 3513 option = purple_account_option_bool_new(_("Send emoticons"), "emoticons", TRUE);
3514 prpl_info.protocol_options = g_list_append(prpl_info.protocol_options, option); 3514 protocol.protocol_options = g_list_append(protocol.protocol_options, option);
3515 #endif 3515 #endif
3516 3516
3517 #ifdef MSIM_USER_REALLY_CARES_ABOUT_PRECISE_FONT_SIZES 3517 #ifdef MSIM_USER_REALLY_CARES_ABOUT_PRECISE_FONT_SIZES
3518 option = purple_account_option_int_new(_("Screen resolution (dots per inch)"), "dpi", MSIM_DEFAULT_DPI); 3518 option = purple_account_option_int_new(_("Screen resolution (dots per inch)"), "dpi", MSIM_DEFAULT_DPI);
3519 prpl_info.protocol_options = g_list_append(prpl_info.protocol_options, option); 3519 protocol.protocol_options = g_list_append(protocol.protocol_options, option);
3520 3520
3521 option = purple_account_option_int_new(_("Base font size (points)"), "base_font_size", MSIM_BASE_FONT_POINT_SIZE); 3521 option = purple_account_option_int_new(_("Base font size (points)"), "base_font_size", MSIM_BASE_FONT_POINT_SIZE);
3522 prpl_info.protocol_options = g_list_append(prpl_info.protocol_options, option); 3522 protocol.protocol_options = g_list_append(protocol.protocol_options, option);
3523 #endif 3523 #endif
3524 3524
3525 purple_signal_connect(purple_get_core(), "uri-handler", &prpl_info, 3525 purple_signal_connect(purple_get_core(), "uri-handler", &protocol,
3526 PURPLE_CALLBACK(msim_uri_handler), NULL); 3526 PURPLE_CALLBACK(msim_uri_handler), NULL);
3527 3527
3528 purple_protocols_add(&prpl_info); 3528 purple_protocols_add(&protocol);
3529 3529
3530 return TRUE; 3530 return TRUE;
3531 } 3531 }
3532 3532
3533 /** 3533 /**
3534 * Unload the plugin. 3534 * Unload the plugin.
3535 */ 3535 */
3536 static gboolean 3536 static gboolean
3537 plugin_unload(PurplePlugin *plugin, GError **error) 3537 plugin_unload(PurplePlugin *plugin, GError **error)
3538 { 3538 {
3539 purple_protocols_remove(&prpl_info); 3539 purple_protocols_remove(&protocol);
3540 3540
3541 return TRUE; 3541 return TRUE;
3542 } 3542 }
3543 3543
3544 PURPLE_PLUGIN_INIT(myspace, plugin_query, plugin_load, plugin_unload); 3544 PURPLE_PLUGIN_INIT(myspace, plugin_query, plugin_load, plugin_unload);

mercurial