pidgin: b19f951f: Simplify some of the changes. Yeah, thi...

rlaager at pidgin.im rlaager at pidgin.im
Wed Oct 29 23:25:27 EDT 2008


-----------------------------------------------------------------
Revision: b19f951fd23cfcbd3e8b7806ebe6f20c9478f1ac
Ancestor: 65d5236e936af6170109ef8c5af76c7871b9cc12
Author: rlaager at pidgin.im
Date: 2008-10-30T02:36:22
Branch: im.pidgin.pidgin
URL: http://d.pidgin.im/viewmtn/revision/info/b19f951fd23cfcbd3e8b7806ebe6f20c9478f1ac

Modified files:
        libpurple/plugins/log_reader.c

ChangeLog: 

Simplify some of the changes.  Yeah, this code sucks.  I wrote it a LONG
time ago.  Let's finish gobjectification, and grow some good language
bindings so I can rewrite this in a higher-level language.

-------------- next part --------------
============================================================
--- libpurple/plugins/log_reader.c	c271903fb8c785eb7daa263bf8c8c02116ea6398
+++ libpurple/plugins/log_reader.c	ab4cb761d757d7f294b2c0e74da4e77e2b9a28ed
@@ -662,8 +662,8 @@ static GList *msn_logger_list(PurpleLogT
 	}
 
 	if (buddy) {
-		PurpleBlistNode *node = (PurpleBlistNode *)buddy;
-		savedfilename = purple_blist_node_get_string(node, "log_reader_msn_log_filename");
+		purple_blist_node_set_string(PURPLE_BLIST_NODE(buddy),
+		                             "log_reader_msn_log_filename", logfile);
 	}
 
 	if (savedfilename) {
@@ -1022,12 +1022,9 @@ static char * msn_logger_read (PurpleLog
 					name_guessed = NAME_GUESS_THEM;
 				} else {
 					if (buddy) {
-						const gchar *a = NULL, *server_alias = NULL;
-						gchar *alias = NULL, *temp = NULL;
-						
-						a = purple_buddy_get_alias(buddy);
-						if(a)
-							alias = g_strdup(a);
+						const char *server_alias = NULL;
+						char *alias = g_strdup(purple_buddy_get_alias(buddy));
+						char *temp;
 
 						/* "Truncate" the string at the first non-alphanumeric
 						 * character. The idea is to relax the comparison.
@@ -1572,31 +1569,30 @@ static char * trillian_logger_read (Purp
 					g_string_append(formatted, "</b>");
 					footer = NULL;
 				} else if (strstr(line, " signed off ")) {
-					if (buddy != NULL) {
-						const gchar *alias = purple_buddy_get_alias(buddy);
+					const char *alias = NULL;
 
-						if(alias != NULL)
-							g_string_append_printf(formatted,
-								_("%s has signed off."), alias);
-						else
-							g_string_append_printf(formatted,
-								_("%s has signed off."), log->name);
+					if (buddy != NULL)
+						alias = purple_buddy_get_alias(buddy);
+
+					if (alias != NULL) {
+						g_string_append_printf(formatted,
+							_("%s has signed off."), alias);
 					} else {
 						g_string_append_printf(formatted,
 							_("%s has signed off."), log->name);
 					}
 					line = "";
 				} else if (strstr(line, " signed on ")) {
-					if (buddy != NULL) {
-						const gchar *alias = purple_buddy_get_alias(buddy);
+					const char *alias = NULL;
 
-						if(alias)
-							g_string_append(formatted, alias);
-						else
-							g_string_append(formatted, log->name);
-					} else {
+					if (buddy != NULL)
+						alias = purple_buddy_get_alias(buddy);
+					
+					if (alias != NULL)
+						g_string_append(formatted, alias);
+					else
 						g_string_append(formatted, log->name);
-					}
+
 					line = " logged in.";
 				} else if (purple_str_has_prefix(line,
 					"One or more messages may have been undeliverable.")) {
@@ -1652,9 +1648,9 @@ static char * trillian_logger_read (Purp
 				}
 			} else if (purple_str_has_prefix(line, data->their_nickname)) {
 				if (buddy != NULL) {
-					const gchar *alias = purple_buddy_get_alias(buddy);
+					const char *alias = purple_buddy_get_alias(buddy);
 
-					if(alias != NULL) {
+					if (alias != NULL) {
 						line += strlen(data->their_nickname) + 2;
 						g_string_append_printf(formatted,
 							"<span style=\"color: #A82F2F;\">"
@@ -2025,10 +2021,10 @@ static char *qip_logger_read(PurpleLog *
 					g_string_append(formatted, "</font> ");
 
 					if (is_in_message) {
-						const gchar *alias = NULL;
+						const char *alias = NULL;
 
 						if (buddy_name != NULL && buddy != NULL &&
-							(alias = purple_buddy_get_alias(buddy)))
+						    (alias = purple_buddy_get_alias(buddy)))
 						{
 							g_string_append_printf(formatted,
 								"<span style=\"color: #A82F2F;\">"


More information about the Commits mailing list