comparison libpurple/protocols/gg/gg.c @ 32732:823c7f451700

Gadu-Gadu: possibility to require encryption; use encryption when available is default option now
author tomkiewicz@cpw.pidgin.im
date Sat, 08 Oct 2011 15:49:37 +0000
parents 1f68af4afe67
children 485692373850
comparison
equal deleted inserted replaced
32731:599f8901a5e0 32732:823c7f451700
2141 |GG_FEATURE_TYPING_NOTIFICATION); 2141 |GG_FEATURE_TYPING_NOTIFICATION);
2142 2142
2143 glp->async = 1; 2143 glp->async = 1;
2144 glp->status = ggp_to_gg_status(status, &glp->status_descr); 2144 glp->status = ggp_to_gg_status(status, &glp->status_descr);
2145 2145
2146 encryption_type = purple_account_get_string(account, "encryption", "none"); 2146 encryption_type = purple_account_get_string(account, "encryption",
2147 purple_debug_info("gg", "Requested encryption type: %s\n", encryption_type); 2147 "opportunistic_tls");
2148 purple_debug_info("gg", "Requested encryption type: %s\n",
2149 encryption_type);
2148 if (strcmp(encryption_type, "opportunistic_tls") == 0) 2150 if (strcmp(encryption_type, "opportunistic_tls") == 0)
2149 glp->tls = 1; 2151 glp->tls = GG_SSL_ENABLED;
2150 else 2152 else if (strcmp(encryption_type, "require_tls") == 0)
2151 glp->tls = 0; 2153 {
2152 purple_debug_info("gg", "TLS enabled: %d\n", glp->tls); 2154 if (gg_libgadu_check_feature(GG_LIBGADU_FEATURE_SSL))
2155 glp->tls = GG_SSL_REQUIRED;
2156 else
2157 {
2158 purple_connection_error(gc,
2159 PURPLE_CONNECTION_ERROR_NO_SSL_SUPPORT,
2160 _("SSL support unavailable"));
2161 g_free(glp);
2162 return;
2163 }
2164 }
2165 else /* encryption_type == "none" */
2166 glp->tls = GG_SSL_DISABLED;
2167 purple_debug_info("gg", "TLS mode: %d\n", glp->tls);
2153 2168
2154 if (!info->status_broadcasting) 2169 if (!info->status_broadcasting)
2155 glp->status = glp->status|GG_STATUS_FRIENDS_MASK; 2170 glp->status = glp->status|GG_STATUS_FRIENDS_MASK;
2156 2171
2157 address = purple_account_get_string(account, "gg_server", ""); 2172 address = purple_account_get_string(account, "gg_server", "");
2806 kvp->key = g_strdup((desc)); \ 2821 kvp->key = g_strdup((desc)); \
2807 kvp->value = g_strdup((v)); \ 2822 kvp->value = g_strdup((v)); \
2808 list = g_list_append(list, kvp); \ 2823 list = g_list_append(list, kvp); \
2809 } 2824 }
2810 2825
2811 ADD_VALUE(encryption_options, _("Don't use encryption"), "none");
2812 ADD_VALUE(encryption_options, _("Use encryption if available"), 2826 ADD_VALUE(encryption_options, _("Use encryption if available"),
2813 "opportunistic_tls"); 2827 "opportunistic_tls");
2814 #if 0
2815 /* TODO */
2816 ADD_VALUE(encryption_options, _("Require encryption"), "require_tls"); 2828 ADD_VALUE(encryption_options, _("Require encryption"), "require_tls");
2817 #endif 2829 ADD_VALUE(encryption_options, _("Don't use encryption"), "none");
2818 2830
2819 option = purple_account_option_list_new(_("Connection security"), 2831 option = purple_account_option_list_new(_("Connection security"),
2820 "encryption", encryption_options); 2832 "encryption", encryption_options);
2821 prpl_info.protocol_options = g_list_append(prpl_info.protocol_options, 2833 prpl_info.protocol_options = g_list_append(prpl_info.protocol_options,
2822 option); 2834 option);