changeset 32310:6135b24cdc8a

Samtime: Move the "inpa" input watcher into protocol_data.
author andrew.victor@mxit.com
date Tue, 18 Oct 2011 21:17:08 +0000
parents a78523019e7a
children c2dcb6d3b246
files libpurple/connection.h libpurple/protocols/sametime/sametime.c libpurple/protocols/silc/silc.c libpurple/protocols/silc/util.c
diffstat 4 files changed, 15 insertions(+), 17 deletions(-) [+]
line wrap: on
line diff
--- a/libpurple/connection.h	Tue Oct 18 21:11:40 2011 +0000
+++ b/libpurple/connection.h	Tue Oct 18 21:17:08 2011 +0000
@@ -235,7 +235,7 @@
 
 	PurpleAccount *account;        /**< The account being connected to.    */
 	char *password;              /**< The password used.                 */
-	int inpa;                    /**< The input watcher.                 */
+	int inpa_;                    /**< The input watcher.                 */
 
 	GSList *buddy_chats;         /**< A list of active chats
 	                                  (#PurpleConversation structs of type
--- a/libpurple/protocols/sametime/sametime.c	Tue Oct 18 21:11:40 2011 +0000
+++ b/libpurple/protocols/sametime/sametime.c	Tue Oct 18 21:17:08 2011 +0000
@@ -217,6 +217,7 @@
 
   /** socket fd */
   int socket;
+  guint inpa;  /* input watcher */
   gint outpa;  /* like inpa, but the other way */
 
   /** circular buffer for outgoing data */
@@ -449,9 +450,9 @@
     pd->socket = 0;
   }
 
-  if(gc->inpa) {
-    purple_input_remove(gc->inpa);
-    gc->inpa = 0;
+  if(pd->inpa) {
+    purple_input_remove(pd->inpa);
+    pd->inpa = 0;
   }
 }
 
@@ -1760,9 +1761,9 @@
     pd->socket = 0;
   }
 
-  if(pd->gc->inpa) {
-    purple_input_remove(pd->gc->inpa);
-    pd->gc->inpa = 0;
+  if(pd->inpa) {
+    purple_input_remove(pd->inpa);
+    pd->inpa = 0;
   }
 
   if(! ret) {
@@ -1791,7 +1792,6 @@
 static void connect_cb(gpointer data, gint source, const gchar *error_message) {
 
   struct mwPurplePluginData *pd = data;
-  PurpleConnection *gc = pd->gc;
 
   if(source < 0) {
     /* connection failed */
@@ -1819,7 +1819,7 @@
   }
 
   pd->socket = source;
-  gc->inpa = purple_input_add(source, PURPLE_INPUT_READ,
+  pd->inpa = purple_input_add(source, PURPLE_INPUT_READ,
 			    read_cb, pd);
 
   mwSession_start(pd->session);
@@ -3794,9 +3794,9 @@
   purple_connection_set_protocol_data(gc, NULL);
 
   /* stop watching the socket */
-  if(gc->inpa) {
-    purple_input_remove(gc->inpa);
-    gc->inpa = 0;
+  if(pd->inpa) {
+    purple_input_remove(pd->inpa);
+    pd->inpa = 0;
   }
 
   /* clean up the rest */
--- a/libpurple/protocols/silc/silc.c	Tue Oct 18 21:11:40 2011 +0000
+++ b/libpurple/protocols/silc/silc.c	Tue Oct 18 21:17:08 2011 +0000
@@ -528,7 +528,7 @@
 	g_snprintf(prd, sizeof(prd), "%s" G_DIR_SEPARATOR_S "private_key.prv", silcpurple_silcdir());
 	if (!silc_load_key_pair((char *)purple_account_get_string(account, "public-key", pkd),
 				(char *)purple_account_get_string(account, "private-key", prd),
-				(gc->password == NULL) ? "" : gc->password,
+				(purple_connection_get_password(gc) == NULL) ? "" : purple_connection_get_password(gc),
 				&sg->public_key, &sg->private_key)) {
 		if (!purple_account_get_password(account)) {
 			purple_account_request_password(account, G_CALLBACK(silcpurple_got_password_cb),
--- a/libpurple/protocols/silc/util.c	Tue Oct 18 21:11:40 2011 +0000
+++ b/libpurple/protocols/silc/util.c	Tue Oct 18 21:17:08 2011 +0000
@@ -210,8 +210,7 @@
 						  SILCPURPLE_DEF_PKCS_LEN,
 						  file_public_key,
 						  file_private_key, NULL,
-						  (gc->password == NULL)
-						  ? "" : gc->password,
+						  (purple_connection_get_password(gc) == NULL) ? "" : purple_connection_get_password(gc),
 						  NULL, NULL, FALSE)) {
 				purple_connection_error(gc, PURPLE_CONNECTION_ERROR_OTHER_ERROR,
 				                             _("Unable to create SILC key pair"));
@@ -253,8 +252,7 @@
 						  SILCPURPLE_DEF_PKCS_LEN,
 						  file_public_key,
 						  file_private_key, NULL,
-						  (gc->password == NULL)
-						  ? "" : gc->password,
+						  (purple_connection_get_password(gc) == NULL) ? "" : purple_connection_get_password(gc),
 						  NULL, NULL, FALSE)) {
 				purple_connection_error(gc, PURPLE_CONNECTION_ERROR_OTHER_ERROR,
 				                             _("Unable to create SILC key pair"));