Commit 80ad8452 authored by cypherpunk's avatar cypherpunk
Browse files

	* otr-plugin.h:
	* otr-plugin.c (otrg_plugin_proto_supports_otr): New function to
	check whether a given protocol supports OTR.  Right now,
	everything except IRC is assumed to support it.

	* otr-plugin.c (supply_extended_menu): Don't add the "OTR
	Settings" menu option to the per-buddy menu if this buddy's
	protocol doesn't support OTR.

	* ui.c (otrg_ui_find_policy): If the protocol doesn't support
	OTR, always return a policy of OTRL_POLICY_NEVER.
parent d426db7d
2005-05-19
* otr-plugin.h:
* otr-plugin.c (otrg_plugin_proto_supports_otr): New function to
check whether a given protocol supports OTR. Right now,
everything except IRC is assumed to support it.
* otr-plugin.c (supply_extended_menu): Don't add the "OTR
Settings" menu option to the per-buddy menu if this buddy's
protocol doesn't support OTR.
* ui.c (otrg_ui_find_policy): If the protocol doesn't support
OTR, always return a policy of OTRL_POLICY_NEVER.
2005-05-03
* README:
......
19 May 2005:
- OTR doesn't work over IRC (since IRC's maximum message size is too
small for a Key Exchange Message to fit), so don't even provide the
OTR Settings buddy-menu option or the OTR conversation window button
for IRC.
3 May 2005:
- Released 2.0.2
- Fix to co-exist more nicely with other encrypting gaim plugins.
......
......@@ -423,11 +423,21 @@ static void otr_options_cb(GaimBlistNode *node, gpointer user_data)
static void supply_extended_menu(GaimBlistNode *node, GList **menu)
{
GaimBlistNodeAction *act;
GaimBuddy *buddy;
GaimAccount *acct;
const char *proto;
if (!GAIM_BLIST_NODE_IS_BUDDY(node)) return;
act = gaim_blist_node_action_new("OTR Settings", otr_options_cb, NULL);
*menu = g_list_append(*menu, act);
/* Extract the account, and then the protocol, for this buddy */
buddy = (GaimBuddy *)node;
acct = buddy->account;
if (acct == NULL) return;
proto = gaim_account_get_protocol_id(acct);
if (!otrg_plugin_proto_supports_otr(proto)) return;
act = gaim_blist_node_action_new("OTR Settings", otr_options_cb, NULL);
*menu = g_list_append(*menu, act);
}
/* Disconnect a context, sending a notice to the other side, if
......@@ -511,6 +521,17 @@ static gboolean otr_plugin_unload(GaimPlugin *handle)
return 1;
}
/* Return 1 if the given protocol supports OTR, 0 otherwise. */
int otrg_plugin_proto_supports_otr(const char *proto)
{
/* IRC is the only protocol we know of that OTR doesn't work on (its
* maximum message size is too small to fit a Key Exchange Message). */
if (proto && !strcmp(proto, "prpl-irc")) {
return 0;
}
return 1;
}
#ifdef USING_GTK
static GaimGtkPluginUiInfo ui_info =
......
......@@ -58,4 +58,7 @@ void otrg_plugin_send_default_query_conv(GaimConversation *conv);
* appropriate. */
void otrg_plugin_disconnect(ConnContext *context);
/* Return 1 if the given protocol supports OTR, 0 otherwise. */
int otrg_plugin_proto_supports_otr(const char *proto);
#endif
......@@ -132,6 +132,12 @@ void otrg_ui_config_buddy(GaimBuddy *buddy)
/* Calculate the policy for a particular account / username */
OtrlPolicy otrg_ui_find_policy(GaimAccount *account, const char *name)
{
/* Check to see if the protocol for this account supports OTR at all. */
const char *proto = gaim_account_get_protocol_id(account);
if (!otrg_plugin_proto_supports_otr(proto)) {
return OTRL_POLICY_NEVER;
}
if (ui_ops != NULL) {
return ui_ops->find_policy(account, name);
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment