soc.2008.masterpassword: e0b8e28d: updated the internal keyring plugin, add...

scrouaf at soc.pidgin.im scrouaf at soc.pidgin.im
Tue Jul 8 20:11:21 EDT 2008


-----------------------------------------------------------------
Revision: e0b8e28de286d0e546d84459030e0d4bca8eafb1
Ancestor: 692695ad18910565a8caaa2a6fa5a7517c376ee2
Author: scrouaf at soc.pidgin.im
Date: 2008-07-03T20:16:40
Branch: im.pidgin.soc.2008.masterpassword
URL: http://d.pidgin.im/viewmtn/revision/info/e0b8e28de286d0e546d84459030e0d4bca8eafb1

Modified files:
        libpurple/account.c libpurple/keyring.h libpurple/plugin.h
        libpurple/xmlnode.h

ChangeLog: 


updated the internal keyring plugin, added a few comments in libpurple for future reference.

-------------- next part --------------
============================================================
--- libpurple/account.c	c868e8cb151bd6f346ea4e9826733ab64680188c
+++ libpurple/account.c	92a4ca3f1406f2a5d7c9bc7fabab33621320b1c8
@@ -371,7 +371,7 @@ account_to_xmlnode(PurpleAccount *accoun
 	child = xmlnode_new_child(node, "name");
 	xmlnode_insert_data(child, purple_account_get_username(account), -1);
 
-	if (purple_account_get_remember_password(account) &&
+	if (purple_account_get_remember_password(account) &&			//  FIXME : fix this so it asks the plugin for the node
 		((tmp = purple_account_get_password(account)) != NULL))
 	{
 		child = xmlnode_new_child(node, "password");
@@ -794,7 +794,7 @@ parse_account(xmlnode *node)
 	g_free(protocol_id);
 
 	/* Read the password */
-	child = xmlnode_get_child(node, "password");
+	child = xmlnode_get_child(node, "password");					// FIXME : call plugin here
 	if ((child != NULL) && ((data = xmlnode_get_data(child)) != NULL))
 	{
 		purple_account_set_remember_password(ret, TRUE);
============================================================
--- libpurple/keyring.h	66924a77fcc03d951f5f8e683cadf80eb83f6efe
+++ libpurple/keyring.h	4bed44f799d47997f84d3bb34cb6e6b49d76d3d6
@@ -37,23 +37,28 @@
 
 /* maybe strip a couple GError* if they're not used */
 
-typedef void (*PurpleKeyringReadCallback)(const PurpleAccount * account, int result, gchar * password, GError * error, gpointer data);
-typedef void (*PurpleKeyringSaveCallback)(const PurpleAccount * account, int result, GError * error, gpointer data);
+typedef void (*PurpleKeyringReadCallback)(const PurpleAccount * account, gchar * password, GError * error, gpointer data);
+typedef void (*PurpleKeyringSaveCallback)(const PurpleAccount * account, GError * error, gpointer data);
 typedef void (*PurpleKeyringCloseCallback)(int result, Gerror * error, gpointer data);	/* async just so we can check for errors */
 typedef void (*PurpleKeyringChangeMasterCallback)(int result, Gerror * error, gpointer data);
 
-typedef void (*PurpleKeyringRead)(const PurpleAccount * account, gchar * masterpassword, GError ** error, PurpleKeyringReadCallback cb, gpointer data);
-typedef void (*PurpleKeyringSave)(const PurpleAccount * account, gchar * masterpassword, GError ** error, PurpleKeyringSaveCallback cb, gpointer data);
+typedef void (*PurpleKeyringRead)(const PurpleAccount * account, GError ** error, PurpleKeyringReadCallback cb, gpointer data);
+typedef void (*PurpleKeyringSave)(const PurpleAccount * account, gchar * password, GError ** error, PurpleKeyringSaveCallback cb, gpointer data);
 typedef void (*PurpleKeyringClose)(GError ** error, gpointer data);
 typedef void (*PurpleKeyringChangeMaster)(gchar * oldpassword, gchar * newpassword, GError ** error, PurpleKeyringChangeMasterCallback cb, gpointer data);
 typedef void (*PurpleKeyringFree)(gchar * password, GError ** error);
 
+typedef xmlnode * (*PurpleKeyringExportXml)(const PurpleAccount * account);
+typedef void * (*PurpleKeyringImportXml)(const PurpleAccount * account, xmlnode * passwordnode);
+
 typedef struct _PurpleKeyringInfo {
 	PurpleKeyringRead read_password;
 	PurpleKeyringSave save_password;
 	PurpleKeyringClose close_keyring;
 	PurpleKeyringFree free_password;
 	PurpleKeyringChangeMaster change_master;
+	PurpleKeyringImportXml import_xml;
+	PurpleKeyringExportXml export_xml;
 	int capabilities;
 	gpointer r1;	/* RESERVED */
 	gpointer r2;	/* RESERVED */
@@ -66,3 +71,16 @@ void purple_plugin_keyring_register(Purp
 /***************************************/
 
 void purple_plugin_keyring_register(PurpleKeyringInfo * info) /* do we need a callback ? */
+
+
+/***************************************/
+/** @name Error Codes                  */
+/***************************************/
+
+ERR_PIDGINKEYRING	/* error domain */
+
+ERR_NOPASSWD		/* no stored password */
+ERR_NOACCOUNT		/* account not found */
+ERR_WRONGPASS		/* user submitted wrong password */
+ERR_WRONGFORMAT
+
============================================================
--- libpurple/plugin.h	f9b57bb6bf0f80363f338ee05935b0f826e20930
+++ libpurple/plugin.h	5d775a550f601102f1ded17e3596e6df6576a254
@@ -62,6 +62,7 @@ typedef enum
 #define PURPLE_PRIORITY_LOWEST  -9999
 
 #define PURPLE_PLUGIN_FLAG_INVISIBLE 0x01
+#define PURPLE_PLUGIN_FLAG_AUTOLOAD  0x02
 
 #define PURPLE_PLUGIN_MAGIC 5 /* once we hit 6.0.0 I think we can remove this */
 
============================================================
--- libpurple/xmlnode.h	f73fde22673b21debb1d446f81d715725367b377
+++ libpurple/xmlnode.h	1f56d2bdb562a11537981403f94de3ab0735e5da
@@ -160,7 +160,7 @@ void xmlnode_set_attrib(xmlnode *node, c
  *
  * @param node   The node to set an attribute for.
  * @param attr   The name of the attribute to set
- * @param prefix The prefix of the attribute to ste
+ * @param prefix The prefix of the attribute to set
  * @param value  The value of the attribute
  */
 void xmlnode_set_attrib_with_prefix(xmlnode *node, const char *attr, const char *prefix, const char *value);


More information about the Commits mailing list