gobjectification.conversation: e0159826: Update nullclient to work again.

sadrul at pidgin.im sadrul at pidgin.im
Sat Jul 24 23:10:48 EDT 2010


----------------------------------------------------------------------
Revision: e0159826a20b715a18ecda3790588dd954291cfa
Parent:   af477e6f7be8d5d99d9e9b469c61262a1507bf49
Author:   sadrul at pidgin.im
Date:     07/24/10 21:46:29
Branch:   im.pidgin.gobjectification.conversation
URL: http://d.pidgin.im/viewmtn/revision/info/e0159826a20b715a18ecda3790588dd954291cfa

Changelog: 

Update nullclient to work again.

Changes against parent af477e6f7be8d5d99d9e9b469c61262a1507bf49

  patched  libpurple/example/nullclient.c

-------------- next part --------------
============================================================
--- libpurple/example/nullclient.c	e5206b2dda5c21b68001728d89a30ec10e25de10
+++ libpurple/example/nullclient.c	0d7e22817db8c58c1255c02834092cb9081e9fe1
@@ -117,55 +117,14 @@ static PurpleEventLoopUiOps glib_eventlo
 };
 /*** End of the eventloop functions. ***/
 
-/*** Conversation uiops ***/
 static void
-null_write_conv(PurpleConversation *conv, const char *who, const char *alias,
-			const char *message, PurpleMessageFlags flags, time_t mtime)
-{
-	const char *name;
-	if (alias && *alias)
-		name = alias;
-	else if (who && *who)
-		name = who;
-	else
-		name = NULL;
-
-	printf("(%s) %s %s: %s\n", purple_conversation_get_name(conv),
-			purple_utf8_strftime("(%H:%M:%S)", localtime(&mtime)),
-			name, message);
-}
-
-static PurpleConversationUiOps null_conv_uiops = 
-{
-	NULL,                      /* create_conversation  */
-	NULL,                      /* destroy_conversation */
-	NULL,                      /* write_chat           */
-	NULL,                      /* write_im             */
-	null_write_conv,           /* write_conv           */
-	NULL,                      /* chat_add_users       */
-	NULL,                      /* chat_rename_user     */
-	NULL,                      /* chat_remove_users    */
-	NULL,                      /* chat_update_user     */
-	NULL,                      /* present              */
-	NULL,                      /* has_focus            */
-	NULL,                      /* custom_smiley_add    */
-	NULL,                      /* custom_smiley_write  */
-	NULL,                      /* custom_smiley_close  */
-	NULL,                      /* send_confirm         */
-	NULL,
-	NULL,
-	NULL,
-	NULL
-};
-
-static void
 null_ui_init(void)
 {
 	/**
 	 * This should initialize the UI components for all the modules. Here we
 	 * just initialize the UI for conversations.
 	 */
-	purple_conversations_set_ui_ops(&null_conv_uiops);
+	/*purple_conversations_set_ui_ops(&null_conv_uiops);*/
 }
 
 static PurpleCoreUiOps null_core_uiops = 
@@ -238,12 +197,31 @@ static void
 }
 
 static void
+conversation_msg_write(PurpleConversation *conv, PurpleMessage *msg)
+{
+	printf("*** Message received\n%s: %s\n",
+			purple_message_get_sender(msg),
+			purple_message_get_message(msg));
+}
+
+static void
 connect_to_signals_for_demonstration_purposes_only(void)
 {
 	purple_g_signal_connect(PURPLE_TYPE_CONNECTION, "signed-on",
 				PURPLE_CALLBACK(signed_on), NULL);
+
+	purple_g_signal_connect(PURPLE_TYPE_CONVERSATION, "msg-write",
+			PURPLE_CALLBACK(conversation_msg_write), NULL);
 }
 
+static void
+account_connecting_cb(PurpleAccount *account, PurpleConnection *gc, gpointer null)
+{
+	purple_debug_info("nullclient", "Connecting account(%s), connection-account(%s)\n",
+			purple_account_get_username(account),
+			purple_account_get_username(purple_connection_get_account(gc)));
+}
+
 int main(int argc, char *argv[])
 {
 	GList *iter;
@@ -299,6 +277,9 @@ int main(int argc, char *argv[])
 	/* Create the account */
 	account = purple_account_new(name, prpl);
 
+	g_signal_connect(G_OBJECT(account), "connecting",
+			G_CALLBACK(account_connecting_cb), NULL);
+
 	/* Get the password for the account */
 	password = getpass("Password: ");
 	purple_account_set_password(account, password);


More information about the Commits mailing list