pidgin: 8eecb8c3: Clean up this WebKit stuff. Fix up broke...

qulogic at pidgin.im qulogic at pidgin.im
Thu Sep 8 18:10:50 EDT 2011


----------------------------------------------------------------------
Revision: 8eecb8c39a2664ad42716d06cb5675afbe77da3e
Parent:   320d1e01b3cedcb51048d5d0a3c396212600c824
Author:   qulogic at pidgin.im
Date:     09/08/11 18:04:35
Branch:   im.pidgin.pidgin
URL: http://d.pidgin.im/viewmtn/revision/info/8eecb8c39a2664ad42716d06cb5675afbe77da3e

Changelog: 

Clean up this WebKit stuff. Fix up broken merging, mark unfinished
work with FIXME/TODO, and fix this ungodly formatting.

Changes against parent 320d1e01b3cedcb51048d5d0a3c396212600c824

  patched  pidgin/gtkconv.c
  patched  pidgin/gtklog.c
  patched  pidgin/gtknotify.c
  patched  pidgin/gtkwebview.c
  patched  pidgin/gtkwebview.h
  patched  pidgin/plugins/adiumthemes/message-style.c
  patched  pidgin/plugins/adiumthemes/message-style.h
  patched  pidgin/plugins/adiumthemes/webkit.c
  patched  pidgin/smileyparser.c
  patched  pidgin/smileyparser.h

-------------- next part --------------
============================================================
--- pidgin/gtkconv.c	6bceda0fc3bb0c586732cd4a0d7e5c97c7313c74
+++ pidgin/gtkconv.c	72440fc4e230fb0fa77b01a8db76b8e2226dadac
@@ -175,8 +175,6 @@ static GList *xa_list = NULL;
 static GList *away_list = NULL;
 static GList *busy_list = NULL;
 static GList *xa_list = NULL;
-static GList *login_list = NULL;
-static GList *logout_list = NULL;
 static GList *offline_list = NULL;
 static GHashTable *prpl_lists = NULL;
 
@@ -316,6 +314,15 @@ static void
 }
 
 static void
+conversation_entry_clear(PidginConversation *gtkconv)
+{
+	GtkIMHtml *imhtml = GTK_IMHTML(gtkconv->entry);
+	gtk_source_undo_manager_begin_not_undoable_action(imhtml->undo_manager);
+	gtk_imhtml_clear(imhtml);
+	gtk_source_undo_manager_end_not_undoable_action(imhtml->undo_manager);
+}
+
+static void
 clear_formatting_cb(GtkIMHtml *imhtml, PidginConversation *gtkconv)
 {
 	default_formatize(gtkconv);
@@ -425,15 +432,16 @@ static void clear_conversation_scrollbac
 }
 
 static void clear_conversation_scrollback_cb(PurpleConversation *conv,
-		void *data)
+                                             void *data)
 {
 	PidginConversation *gtkconv = NULL;
 
 	gtkconv = PIDGIN_CONVERSATION(conv);
 
 	if (PIDGIN_CONVERSATION(conv))
-		webkit_web_view_load_html_string (WEBKIT_WEB_VIEW (gtkconv->webview), "", "");
+		webkit_web_view_load_html_string(WEBKIT_WEB_VIEW(gtkconv->webview), "", "");
 }
+
 static PurpleCmdRet
 clear_command_cb(PurpleConversation *conv,
                  const char *cmd, char **args, char **error, void *data)
@@ -613,7 +621,7 @@ send_cb(GtkWidget *widget, PidginConvers
 	account = purple_conversation_get_account(conv);
 
 	if (check_for_and_do_command(conv)) {
-		gtk_imhtml_clear(GTK_IMHTML(gtkconv->entry));
+		conversation_entry_clear(gtkconv);
 		return;
 	}
 
@@ -668,7 +676,7 @@ send_cb(GtkWidget *widget, PidginConvers
 	g_free(clean);
 	g_free(buf);
 
-	gtk_imhtml_clear(GTK_IMHTML(gtkconv->entry));
+	conversation_entry_clear(gtkconv);
 	gtkconv_set_unseen(gtkconv, PIDGIN_UNSEEN_NONE);
 }
 
@@ -797,9 +805,9 @@ do_invite(GtkWidget *w, int resp, Invite
 do_invite(GtkWidget *w, int resp, InviteBuddyInfo *info)
 {
 	const char *buddy, *message;
-	PidginConversation *gtkconv;
+	PurpleConversation *conv;
 
-	gtkconv = PIDGIN_CONVERSATION(info->conv);
+	conv = info->conv;
 
 	if (resp == GTK_RESPONSE_OK) {
 		buddy   = gtk_entry_get_text(GTK_ENTRY(info->entry));
@@ -808,8 +816,8 @@ do_invite(GtkWidget *w, int resp, Invite
 		if (!g_ascii_strcasecmp(buddy, ""))
 			return;
 
-		serv_chat_invite(purple_conversation_get_gc(info->conv),
-						 purple_conv_chat_get_id(PURPLE_CONV_CHAT(info->conv)),
+		serv_chat_invite(purple_conversation_get_gc(conv),
+						 purple_conv_chat_get_id(PURPLE_CONV_CHAT(conv)),
 						 message, buddy);
 	}
 
@@ -903,7 +911,6 @@ invite_cb(GtkWidget *widget, PidginConve
 	InviteBuddyInfo *info = NULL;
 
 	if (invite_dialog == NULL) {
-		PurpleConnection *gc;
 		PidginWindow *gtkwin;
 		GtkWidget *label;
 		GtkWidget *vbox, *hbox;
@@ -916,7 +923,6 @@ invite_cb(GtkWidget *widget, PidginConve
 		info = g_new0(InviteBuddyInfo, 1);
 		info->conv = conv;
 
-		gc        = purple_conversation_get_gc(conv);
 		gtkwin    = pidgin_conv_get_window(gtkconv);
 
 		/* Create the new dialog. */
@@ -1583,8 +1589,19 @@ menu_last_said_cb(GtkWidget *w, PidginCo
 static void
 menu_last_said_cb(GtkWidget *w, PidginConversation *gtkconv)
 {
-	/* I don't know what this is! */
-	return;
+/* FIXME: This doesn't work yet, of course... */
+#if 0
+	GtkTextMark *mark;
+	const char *who;
+
+	who = g_object_get_data(G_OBJECT(w), "user_data");
+	mark = get_mark_for_user(gtkconv, who);
+
+	if (mark != NULL)
+		gtk_text_view_scroll_to_mark(GTK_TEXT_VIEW(gtkconv->imhtml), mark, 0.1, FALSE, 0, 0);
+	else
+		g_return_if_reached();
+#endif
 }
 
 static GtkWidget *
@@ -1789,10 +1806,13 @@ right_click_chat_cb(GtkWidget *widget, G
 		chat_do_im(gtkconv, who);
 	} else if (event->button == 2 && event->type == GDK_BUTTON_PRESS) {
 		/* Move to user's anchor */
-		//GtkTextMark *mark = get_mark_for_user(gtkconv, who);
+/* FIXME: This isn't implemented yet. */
+#if 0
+		GtkTextMark *mark = get_mark_for_user(gtkconv, who);
 
-		//if(mark != NULL)
-		//	gtk_text_view_scroll_to_mark(GTK_TEXT_VIEW(gtkconv->imhtml), mark, 0.1, FALSE, 0, 0);
+		if(mark != NULL)
+			gtk_text_view_scroll_to_mark(GTK_TEXT_VIEW(gtkconv->imhtml), mark, 0.1, FALSE, 0, 0);
+#endif
 	} else if (event->button == 3 && event->type == GDK_BUTTON_PRESS) {
 		GtkWidget *menu = create_chat_menu (conv, who, gc);
 		gtk_menu_popup(GTK_MENU(menu), NULL, NULL, NULL, NULL,
@@ -2126,14 +2146,20 @@ entry_key_press_cb(GtkWidget *entry, Gdk
 			break;
 
 		case GDK_Page_Up:
- 		case GDK_KP_Page_Up:
-			//gtk_imhtml_page_up(GTK_IMHTML(gtkconv->imhtml));
+		case GDK_KP_Page_Up:
+/* FIXME: Write this. */
+#if 0
+			gtk_imhtml_page_up(GTK_IMHTML(gtkconv->imhtml));
+#endif
 			return TRUE;
 			break;
 
 		case GDK_Page_Down:
- 		case GDK_KP_Page_Down:
-			//gtk_imhtml_page_down(GTK_IMHTML(gtkconv->imhtml));
+		case GDK_KP_Page_Down:
+/* FIXME: Write this. */
+#if 0
+			gtk_imhtml_page_down(GTK_IMHTML(gtkconv->imhtml));
+#endif
 			return TRUE;
 			break;
 
@@ -2243,7 +2269,7 @@ pidgin_conv_switch_active_conversation(P
 	entry = GTK_IMHTML(gtkconv->entry);
 	protocol_name = purple_account_get_protocol_name(conv->account);
 	gtk_imhtml_set_protocol_name(entry, protocol_name);
-	//gtk_imhtml_set_protocol_name(GTK_IMHTML(gtkconv->imhtml), protocol_name);
+	/* FIXME: gtk_imhtml_set_protocol_name(GTK_IMHTML(gtkconv->imhtml), protocol_name); */
 
 	if (!(conv->features & PURPLE_CONNECTION_HTML))
 		gtk_imhtml_clear_formatting(GTK_IMHTML(gtkconv->entry));
@@ -2608,7 +2634,6 @@ redraw_icon(gpointer data)
 	PidginConversation *gtkconv = (PidginConversation *)data;
 	PurpleConversation *conv = gtkconv->active_conv;
 	PurpleAccount *account;
-	PurplePluginProtocolInfo *prpl_info = NULL;
 
 	GdkPixbuf *buf;
 	GdkPixbuf *scale;
@@ -3633,7 +3658,41 @@ update_typing_message(PidginConversation
 static void
 update_typing_message(PidginConversation *gtkconv, const char *message)
 {
-	/* this is not handled at all */
+	/* FIXME: this is not handled at all */
+#if 0
+	GtkTextBuffer *buffer;
+	GtkTextMark *stmark, *enmark;
+
+	if (g_object_get_data(G_OBJECT(gtkconv->imhtml), "disable-typing-notification"))
+		return;
+
+	buffer = gtk_text_view_get_buffer(GTK_TEXT_VIEW(gtkconv->imhtml));
+	stmark = gtk_text_buffer_get_mark(buffer, "typing-notification-start");
+	enmark = gtk_text_buffer_get_mark(buffer, "typing-notification-end");
+	if (stmark && enmark) {
+		GtkTextIter start, end;
+		gtk_text_buffer_get_iter_at_mark(buffer, &start, stmark);
+		gtk_text_buffer_get_iter_at_mark(buffer, &end, enmark);
+		gtk_text_buffer_delete_mark(buffer, stmark);
+		gtk_text_buffer_delete_mark(buffer, enmark);
+		gtk_text_buffer_delete(buffer, &start, &end);
+	} else if (message && *message == '\n' && message[1] == ' ' && message[2] == '\0')
+		message = NULL;
+
+#ifdef RESERVE_LINE
+	if (!message)
+		message = "\n ";   /* The blank space is required to avoid a GTK+/Pango bug */
+#endif
+
+	if (message) {
+		GtkTextIter iter;
+		gtk_text_buffer_get_end_iter(buffer, &iter);
+		gtk_text_buffer_create_mark(buffer, "typing-notification-start", &iter, TRUE);
+		gtk_text_buffer_insert_with_tags_by_name(buffer, &iter, message, -1, "TYPING-NOTIFICATION", NULL);
+		gtk_text_buffer_get_end_iter(buffer, &iter);
+		gtk_text_buffer_create_mark(buffer, "typing-notification-end", &iter, TRUE);
+	}
+#endif
 }
 
 static void
@@ -4979,17 +5038,17 @@ setup_common_pane(PidginConversation *gt
 	gtk_cell_layout_set_attributes(GTK_CELL_LAYOUT(gtkconv->infopane), rend, "pixbuf", CONV_EMBLEM_COLUMN, NULL);
 	g_object_set(rend, "xalign", 0.0, "xpad", 6, "ypad", 0, NULL);
 
-	/* Setup the gtkimhtml widget */
+	/* Setup the webkit widget */
 	/* TODO: create a pidgin_create_webview() function in utils*/
-	webview_sw = gtk_scrolled_window_new (NULL, NULL);
+	webview_sw = gtk_scrolled_window_new(NULL, NULL);
 	gtk_scrolled_window_set_shadow_type(GTK_SCROLLED_WINDOW(webview_sw), GTK_SHADOW_IN);
-        gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (webview_sw), GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC);
+	gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(webview_sw), GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC);
 
-	gtkconv->webview = gtk_webview_new ();
+	gtkconv->webview = gtk_webview_new();
 	gtk_webview_set_vadjustment(GTK_WEBVIEW(gtkconv->webview),
 			gtk_scrolled_window_get_vadjustment(GTK_SCROLLED_WINDOW(webview_sw)));
-	gtk_container_add (GTK_CONTAINER (webview_sw), gtkconv->webview);
-	
+	gtk_container_add(GTK_CONTAINER(webview_sw), gtkconv->webview);
+
 	gtk_widget_set_size_request(gtkconv->webview, -1, 0);
 
 	if (chat) {
@@ -5737,11 +5796,8 @@ pidgin_conv_write_conv(PurpleConversatio
 	PidginConversation *gtkconv;
 	PurpleConnection *gc;
 	PurpleAccount *account;
-	PurplePluginProtocolInfo *prpl_info;
 	int gtk_font_options = 0;
 	int gtk_font_options_all = 0;
-	int max_scrollback_lines;
-	int line_count;
 	char buf2[BUF_LONG];
 	gboolean show_date;
 	char *mdate;
@@ -5809,12 +5865,9 @@ pidgin_conv_write_conv(PurpleConversatio
 	}
 	length = strlen(displaying) + 1;
 
-
-	prpl_info = gc ? PURPLE_PLUGIN_PROTOCOL_INFO(gc->prpl) : NULL;
-
 	/* if the buffer is not empty add a <br> */
-	if (!gtk_webview_is_empty (GTK_WEBVIEW(gtkconv->webview)))
-		gtk_webview_append_html (GTK_WEBVIEW(gtkconv->webview), "<br />");
+	if (!gtk_webview_is_empty(GTK_WEBVIEW(gtkconv->webview)))
+		gtk_webview_append_html(GTK_WEBVIEW(gtkconv->webview), "<br />");
 
 	/* First message in a conversation. */
 	if (gtkconv->newday == 0)
@@ -5870,7 +5923,7 @@ pidgin_conv_write_conv(PurpleConversatio
 
 	/* TODO: These colors should not be hardcoded so log.c can use them */
 	if (flags & PURPLE_MESSAGE_RAW) {
-		gtk_webview_append_html (GTK_WEBVIEW(gtkconv->webview), message);
+		gtk_webview_append_html(GTK_WEBVIEW(gtkconv->webview), message);
 	} else if (flags & PURPLE_MESSAGE_SYSTEM) {
 		g_snprintf(buf2, sizeof(buf2),
 			   "<font %s><font size=\"2\"><span class='timestamp'>%s</span></font><b>%s</b></font>",
@@ -5985,10 +6038,10 @@ pidgin_conv_write_conv(PurpleConversatio
 
 		g_free(str);
 
-		if(gc){
+		if (gc) {
 			char *pre = g_strdup_printf("<font %s>", sml_attrib ? sml_attrib : "");
 			char *post = "</font>";
-			with_font_tag = g_strdup_printf ("%s%s%s", pre, new_message, post);
+			with_font_tag = g_strdup_printf("%s%s%s", pre, new_message, post);
 			g_free(pre);
 		} else
 			with_font_tag = g_memdup(new_message, length);
@@ -6110,7 +6163,6 @@ pidgin_conv_chat_rename_user(PurpleConve
 	GtkTreeIter iter;
 	GtkTreeModel *model;
 	GtkTextTag *tag;
-	int f = 1;
 
 	chat    = PURPLE_CONV_CHAT(conv);
 	gtkconv = PIDGIN_CONVERSATION(conv);
@@ -6904,7 +6956,6 @@ pidgin_conv_update_buddy_icon(PurpleConv
 	int size = 0;
 
 	PurpleAccount *account;
-	PurplePluginProtocolInfo *prpl_info = NULL;
 
 	PurpleBuddyIcon *icon;
 
@@ -6921,8 +6972,6 @@ pidgin_conv_update_buddy_icon(PurpleConv
 		return;
 
 	account = purple_conversation_get_account(conv);
-	if(account && account->gc)
-		prpl_info = PURPLE_PLUGIN_PROTOCOL_INFO(account->gc->prpl);
 
 	/* Remove the current icon stuff */
 	children = gtk_container_get_children(GTK_CONTAINER(gtkconv->u.im->icon_container));
@@ -6971,7 +7020,6 @@ pidgin_conv_update_buddy_icon(PurpleConv
 
 	if (data == NULL) {
 		icon = purple_conv_im_get_icon(PURPLE_CONV_IM(conv));
-
 		if (icon == NULL)
 		{
 			gtk_widget_set_size_request(gtkconv->u.im->icon_container,
@@ -6980,7 +7028,6 @@ pidgin_conv_update_buddy_icon(PurpleConv
 		}
 
 		data = purple_buddy_icon_get_data(icon, &len);
-
 		if (data == NULL)
 		{
 			gtk_widget_set_size_request(gtkconv->u.im->icon_container,
@@ -7248,8 +7295,11 @@ show_timestamps_pref_cb(const char *name
 		        GTK_CHECK_MENU_ITEM(win->menu.show_timestamps),
 		        (gboolean)GPOINTER_TO_INT(value));
 
-		gtk_imhtml_show_comments(GTK_IMHTML(gtkconv->webview),
+/* FIXME: Use WebKit version of this. */
+#if 0
+		gtk_imhtml_show_comments(GTK_IMHTML(gtkconv->imhtml),
 			(gboolean)GPOINTER_TO_INT(value));
+#endif
 	}
 }
 
@@ -9879,12 +9929,9 @@ conv_placement_by_group(PidginConversati
 static void
 conv_placement_by_group(PidginConversation *conv)
 {
-	PurpleConversationType type;
 	PurpleGroup *group = NULL;
 	GList *wl, *cl;
 
-	type = purple_conversation_get_type(conv->active_conv);
-
 	group = conv_get_group(conv);
 
 	/* Go through the list of IMs and find one with this group. */
============================================================
--- pidgin/gtknotify.c	3246880c744dd2f3d8c59c5f57704808a5903dd5
+++ pidgin/gtknotify.c	375d032ca8d46ace28d9eb7b17bf94e8fa807a77
@@ -856,11 +856,11 @@ pidgin_notify_formatted(const char *titl
 
 	/* Add the webview */
 	scrolled_window = gtk_scrolled_window_new (NULL, NULL);
-        gtk_scrolled_window_set_shadow_type(GTK_SCROLLED_WINDOW(scrolled_window), GTK_SHADOW_IN);
-	gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (scrolled_window), GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC);
+	gtk_scrolled_window_set_shadow_type(GTK_SCROLLED_WINDOW(scrolled_window), GTK_SHADOW_IN);
+	gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(scrolled_window), GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC);
 
-	web_view = gtk_webview_new ();
-	gtk_container_add (GTK_CONTAINER (scrolled_window), web_view);
+	web_view = gtk_webview_new();
+	gtk_container_add(GTK_CONTAINER(scrolled_window), web_view);
 
 	gtk_widget_set_name(web_view, "pidgin_notify_webview");
 	gtk_widget_set_size_request(web_view, 300, 250);
@@ -878,7 +878,7 @@ pidgin_notify_formatted(const char *titl
 
 	/* Make sure URLs are clickable */
 	linked_text = purple_markup_linkify(text);
-	webkit_web_view_load_html_string (WEBKIT_WEB_VIEW (web_view), linked_text, "");
+	webkit_web_view_load_html_string(WEBKIT_WEB_VIEW(web_view), linked_text, "");
 	g_free(linked_text);
 
 	g_object_set_data(G_OBJECT(window), "webview-widget", web_view);
@@ -1138,9 +1138,8 @@ pidgin_notify_userinfo(PurpleConnection 
 	if (pinfo != NULL) {
 		GtkWidget *webview = g_object_get_data(G_OBJECT(pinfo->window), "webview-widget");
 		char *linked_text = purple_markup_linkify(info);
-		g_assert (webview);
-		printf ("%s\n", linked_text);
-		gtk_webview_load_html_string_with_imgstore (GTK_WEBVIEW (webview), linked_text);
+		g_assert(webview);
+		gtk_webview_load_html_string_with_imgstore(GTK_WEBVIEW(webview), linked_text);
 		g_free(linked_text);
 		g_free(key);
 		ui_handle = pinfo->window;
@@ -1640,7 +1639,7 @@ pidgin_create_notification_dialog(Pidgin
 	gtk_label_set_line_wrap(GTK_LABEL(label), TRUE);
 	gtk_misc_set_alignment(GTK_MISC(label), 0, 0);
 	gtk_box_pack_start(GTK_BOX(vbox), label, FALSE, FALSE, 0);
-	gtk_box_pack_start(GTK_BOX(vbox), 
+	gtk_box_pack_start(GTK_BOX(vbox),
 		pidgin_make_scrollable(spec_dialog->treeview, GTK_POLICY_AUTOMATIC, GTK_POLICY_ALWAYS, GTK_SHADOW_IN, -1, -1),
 		TRUE, TRUE, 2);
 
============================================================
--- pidgin/gtklog.c	48372318f9981319b22846fe7b3f0b0397a206a3
+++ pidgin/gtklog.c	e20f9c033ba6f67054aa522a25ebb4d02b2f9fbb
@@ -130,7 +130,7 @@ static void search_cb(GtkWidget *button,
 		populate_log_tree(lv);
 		g_free(lv->search);
 		lv->search = NULL;
-		webkit_web_view_unmark_text_matches(WEBKIT_WEB_VIEW(lv->web_view)); 
+		webkit_web_view_unmark_text_matches(WEBKIT_WEB_VIEW(lv->web_view));
 		select_first_log(lv);
 		return;
 	}
@@ -138,7 +138,7 @@ static void search_cb(GtkWidget *button,
 	if (lv->search != NULL && !strcmp(lv->search, search_term))
 	{
 		/* Searching for the same term acts as "Find Next" */
-		webkit_web_view_search_text (WEBKIT_WEB_VIEW(lv->web_view), lv->search, FALSE, TRUE, TRUE);
+		webkit_web_view_search_text(WEBKIT_WEB_VIEW(lv->web_view), lv->search, FALSE, TRUE, TRUE);
 		return;
 	}
 
@@ -148,7 +148,7 @@ static void search_cb(GtkWidget *button,
 	lv->search = g_strdup(search_term);
 
 	gtk_tree_store_clear(lv->treestore);
-	webkit_web_view_open (WEBKIT_WEB_VIEW (lv->web_view), "about:blank"); /* clear the view */
+	webkit_web_view_open(WEBKIT_WEB_VIEW(lv->web_view), "about:blank"); /* clear the view */
 
 	for (logs = lv->logs; logs != NULL; logs = logs->next) {
 		char *read = purple_log_read((PurpleLog*)logs->data, NULL);
@@ -419,9 +419,9 @@ static gboolean search_find_cb(gpointer 
 static gboolean search_find_cb(gpointer data)
 {
 	PidginLogViewer *viewer = data;
-	webkit_web_view_mark_text_matches (WEBKIT_WEB_VIEW (viewer->web_view), viewer->search, FALSE, 0);
-	webkit_web_view_set_highlight_text_matches (WEBKIT_WEB_VIEW (viewer->web_view), TRUE);
-	webkit_web_view_search_text (WEBKIT_WEB_VIEW (viewer->web_view), viewer->search, FALSE, TRUE, TRUE);
+	webkit_web_view_mark_text_matches(WEBKIT_WEB_VIEW(viewer->web_view), viewer->search, FALSE, 0);
+	webkit_web_view_set_highlight_text_matches(WEBKIT_WEB_VIEW(viewer->web_view), TRUE);
+	webkit_web_view_search_text(WEBKIT_WEB_VIEW(viewer->web_view), viewer->search, FALSE, TRUE, TRUE);
 	return FALSE;
 }
 
@@ -462,11 +462,11 @@ static void log_select_cb(GtkTreeSelecti
 	read = purple_log_read(log, &flags);
 	viewer->flags = flags;
 
-	webkit_web_view_open (WEBKIT_WEB_VIEW(viewer->web_view), "about:blank");
+	webkit_web_view_open(WEBKIT_WEB_VIEW(viewer->web_view), "about:blank");
 
 	purple_signal_emit(pidgin_log_get_handle(), "log-displaying", viewer, log);
 
-	webkit_web_view_load_html_string (WEBKIT_WEB_VIEW(viewer->web_view), read, "");
+	webkit_web_view_load_html_string(WEBKIT_WEB_VIEW(viewer->web_view), read, "");
 	g_free(read);
 
 	if (viewer->search != NULL) {
@@ -614,7 +614,7 @@ static PidginLogViewer *display_log_view
 	col = gtk_tree_view_column_new_with_attributes ("time", rend, "markup", 0, NULL);
 	gtk_tree_view_append_column (GTK_TREE_VIEW(lv->treeview), col);
 	gtk_tree_view_set_headers_visible (GTK_TREE_VIEW (lv->treeview), FALSE);
-	gtk_paned_add1(GTK_PANED(pane), 
+	gtk_paned_add1(GTK_PANED(pane),
 		pidgin_make_scrollable(lv->treeview, GTK_POLICY_NEVER, GTK_POLICY_ALWAYS, GTK_SHADOW_IN, -1, -1));
 
 	populate_log_tree(lv);
@@ -649,7 +649,7 @@ static PidginLogViewer *display_log_view
 	gtk_paned_add2(GTK_PANED(pane), vbox);
 
 	/* Viewer ************/
-	/*
+	/* FIXME:
 	sw = gtk_scrolled_window_new (NULL, NULL);
 	gtk_scrolled_window_set_shadow_type (GTK_SCROLLED_WINDOW (sw), GTK_SHADOW_IN);
 	gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(sw), GTK_POLICY_NEVER, GTK_POLICY_ALWAYS);
============================================================
--- pidgin/gtkwebview.c	27c55e838fd42a5d9d1e575d361f2d6e40b226c3
+++ pidgin/gtkwebview.c	f3d8acb3b8c89d627bd634f8aacd7c6f1605432c
@@ -10,7 +10,7 @@
  * source distribution.
  *
  * This program is free software; you can redistribute it and/or modify
- * under the terms of the GNU General Public License as published by
+ * it under the terms of the GNU General Public License as published by
  * the Free Software Foundation; either version 2 of the License, or
  * (at your option) any later version.
  *
@@ -53,82 +53,85 @@ struct GtkWebViewPriv {
 	GTimer *scroll_time;
 };
 
-GtkWidget* gtk_webview_new (void)
+GtkWidget *
+gtk_webview_new(void)
 {
-	GtkWebView* ret = GTK_WEBVIEW (g_object_new(gtk_webview_get_type(), NULL));
-	return GTK_WIDGET (ret);
+	GtkWebView* ret = GTK_WEBVIEW(g_object_new(gtk_webview_get_type(), NULL));
+	return GTK_WIDGET(ret);
 }
 
-static char*
-get_image_filename_from_id (GtkWebView* view, int id)
+static char *
+get_image_filename_from_id(GtkWebView* view, int id)
 {
 	char *filename = NULL;
 	FILE *file;
 	PurpleStoredImage* img;
 
 	if (!view->priv->images)
-		view->priv->images = g_hash_table_new_full (g_direct_hash, g_direct_equal, NULL, g_free);
-	
-	filename = (char*) g_hash_table_lookup (view->priv->images, GINT_TO_POINTER (id));
-	if (filename) return filename;
-			
+		view->priv->images = g_hash_table_new_full(g_direct_hash, g_direct_equal, NULL, g_free);
+
+	filename = (char *)g_hash_table_lookup(view->priv->images, GINT_TO_POINTER(id));
+	if (filename)
+		return filename;
+
 	/* else get from img store */
-	file = purple_mkstemp (&filename, TRUE);
+	file = purple_mkstemp(&filename, TRUE);
 
-	img = purple_imgstore_find_by_id (id);
+	img = purple_imgstore_find_by_id(id);
 
-	fwrite (purple_imgstore_get_data (img), purple_imgstore_get_size (img), 1, file);
-	g_hash_table_insert (view->priv->images, GINT_TO_POINTER (id), filename);
-	fclose (file);
+	fwrite(purple_imgstore_get_data(img), purple_imgstore_get_size(img), 1, file);
+	g_hash_table_insert(view->priv->images, GINT_TO_POINTER(id), filename);
+	fclose(file);
 	return filename;
 }
 
 static void
-clear_single_image (gpointer key, gpointer value, gpointer userdata)
+clear_single_image(gpointer key, gpointer value, gpointer userdata)
 {
-	g_unlink ((char*) value);
+	g_unlink((char *)value);
 }
 
 static void
-clear_images (GtkWebView* view)
+clear_images(GtkWebView *view)
 {
-	if (!view->priv->images) return;
-	g_hash_table_foreach (view->priv->images, clear_single_image, NULL);
-	g_hash_table_unref (view->priv->images);
+	if (!view->priv->images)
+		return;
+	g_hash_table_foreach(view->priv->images, clear_single_image, NULL);
+	g_hash_table_unref(view->priv->images);
 }
 
 /*
  * Replace all <img id=""> tags with <img src="">. I hoped to never
- * write any HTML parsing code, but I'm forced to do this, until 
+ * write any HTML parsing code, but I'm forced to do this, until
  * purple changes the way it works.
  */
-static char*
-replace_img_id_with_src (GtkWebView *view, const char* html)
+static char *
+replace_img_id_with_src(GtkWebView *view, const char *html)
 {
-	GString *buffer = g_string_sized_new (strlen (html));
+	GString *buffer = g_string_sized_new(strlen(html));
 	const char* cur = html;
 	char *id;
 	int nid;
 
 	while (*cur) {
-		const char* img = strstr (cur, "<img");
+		const char *img = strstr(cur, "<img");
 		if (!img) {
-			g_string_append (buffer, cur);
+			g_string_append(buffer, cur);
 			break;
 		} else
-			g_string_append_len (buffer, cur, img - cur);
+			g_string_append_len(buffer, cur, img - cur);
 
-		cur = strstr (img, "/>");
+		cur = strstr(img, "/>");
 		if (!cur)
-			cur = strstr (img, ">");
+			cur = strstr(img, ">");
 
 		if (!cur) { /* invalid html? */
-			g_string_printf (buffer, "%s", html);
+			g_string_printf(buffer, "%s", html);
 			break;
 		}
 
-		if (strstr (img, "src=") || !strstr (img, "id=")) {
-			g_string_printf (buffer, "%s", html);
+		if (strstr(img, "src=") || !strstr(img, "id=")) {
+			g_string_printf(buffer, "%s", html);
 			break;
 		}
 
@@ -138,46 +141,46 @@ replace_img_id_with_src (GtkWebView *vie
 		 * '=' cannot appear in parameters.
 		 */
 
-		id = strstr (img, "id=") + 3; 
+		id = strstr(img, "id=") + 3;
 
 		/* *id can't be \0, since a ">" appears after this */
-		if (isdigit (*id)) 
-			nid = atoi (id);
-		else 
-			nid = atoi (id+1);
+		if (isdigit(*id))
+			nid = atoi(id);
+		else
+			nid = atoi(id + 1);
 
 		/* let's dump this, tag and then dump the src information */
-		g_string_append_len (buffer, img, cur - img);
+		g_string_append_len(buffer, img, cur - img);
 
-		g_string_append_printf (buffer, " src='file://%s' ", get_image_filename_from_id (view, nid));
+		g_string_append_printf(buffer, " src='file://%s' ", get_image_filename_from_id(view, nid));
 	}
 
-	return g_string_free (buffer, FALSE);
+	return g_string_free(buffer, FALSE);
 }
 
 static void
-gtk_webview_finalize (GObject *view)
+gtk_webview_finalize(GObject *view)
 {
 	gpointer temp;
-	
-	while ((temp = g_queue_pop_head (GTK_WEBVIEW(view)->priv->js_queue)))
-		g_free (temp);
-	g_queue_free (GTK_WEBVIEW(view)->priv->js_queue);
 
-	clear_images (GTK_WEBVIEW (view));
-	g_free (GTK_WEBVIEW(view)->priv);
-	G_OBJECT_CLASS (parent_class)->finalize (G_OBJECT(view));
+	while ((temp = g_queue_pop_head(GTK_WEBVIEW(view)->priv->js_queue)))
+		g_free(temp);
+	g_queue_free(GTK_WEBVIEW(view)->priv->js_queue);
+
+	clear_images(GTK_WEBVIEW(view));
+	g_free(GTK_WEBVIEW(view)->priv);
+	G_OBJECT_CLASS(parent_class)->finalize(G_OBJECT(view));
 }
 
 static void
-gtk_webview_class_init (GtkWebViewClass *klass, gpointer userdata)
+gtk_webview_class_init(GtkWebViewClass *klass, gpointer userdata)
 {
-	parent_class = g_type_class_ref (webkit_web_view_get_type ());
-	G_OBJECT_CLASS (klass)->finalize = gtk_webview_finalize;
+	parent_class = g_type_class_ref(webkit_web_view_get_type());
+	G_OBJECT_CLASS(klass)->finalize = gtk_webview_finalize;
 }
 
 static gboolean
-webview_link_clicked (WebKitWebView *view,
+webview_link_clicked(WebKitWebView *view,
 		      WebKitWebFrame *frame,
 		      WebKitNetworkRequest *request,
 		      WebKitWebNavigationAction *navigation_action,
@@ -186,13 +189,13 @@ webview_link_clicked (WebKitWebView *vie
 	const gchar *uri;
 	WebKitWebNavigationReason reason;
 
-	uri = webkit_network_request_get_uri (request);
+	uri = webkit_network_request_get_uri(request);
 	reason = webkit_web_navigation_action_get_reason(navigation_action);
 
 	if (reason == WEBKIT_WEB_NAVIGATION_REASON_LINK_CLICKED) {
 		/* the gtk imhtml way was to create an idle cb, not sure
 		 * why, so right now just using purple_notify_uri directly */
-		purple_notify_uri (NULL, uri);
+		purple_notify_uri(NULL, uri);
 	}
 
 	webkit_web_policy_decision_use(policy_decision);
@@ -201,129 +204,131 @@ static gboolean
 }
 
 static gboolean
-process_js_script_queue (GtkWebView *view)
+process_js_script_queue(GtkWebView *view)
 {
 	char *script;
-	if (view->priv->is_loading) return FALSE; /* we will be called when loaded */
-	if (!view->priv->js_queue || g_queue_is_empty (view->priv->js_queue))
+	if (view->priv->is_loading)
+		return FALSE; /* we will be called when loaded */
+	if (!view->priv->js_queue || g_queue_is_empty(view->priv->js_queue))
 		return FALSE; /* nothing to do! */
 
-	script = g_queue_pop_head (view->priv->js_queue);
-	webkit_web_view_execute_script (WEBKIT_WEB_VIEW(view), script);
-	g_free (script);
+	script = g_queue_pop_head(view->priv->js_queue);
+	webkit_web_view_execute_script(WEBKIT_WEB_VIEW(view), script);
+	g_free(script);
 
 	return TRUE; /* there may be more for now */
 }
 
 static void
-webview_load_started (WebKitWebView *view,
+webview_load_started(WebKitWebView *view,
 		      WebKitWebFrame *frame,
 		      gpointer userdata)
 {
 	/* is there a better way to test for is_loading? */
-	GTK_WEBVIEW(view)->priv->is_loading = true;
+	GTK_WEBVIEW(view)->priv->is_loading = TRUE;
 }
 
 static void
-webview_load_finished (WebKitWebView *view,
+webview_load_finished(WebKitWebView *view,
 		       WebKitWebFrame *frame,
 		       gpointer userdata)
 {
-	GTK_WEBVIEW(view)->priv->is_loading = false;
-	g_idle_add ((GSourceFunc) process_js_script_queue, view);
+	GTK_WEBVIEW(view)->priv->is_loading = FALSE;
+	g_idle_add((GSourceFunc)process_js_script_queue, view);
 }
 
 void
-gtk_webview_safe_execute_script (GtkWebView *view, const char* script)
+gtk_webview_safe_execute_script(GtkWebView *view, const char *script)
 {
-	g_queue_push_tail (view->priv->js_queue, g_strdup (script));
-	g_idle_add ((GSourceFunc)process_js_script_queue, view);
+	g_queue_push_tail(view->priv->js_queue, g_strdup(script));
+	g_idle_add((GSourceFunc)process_js_script_queue, view);
 }
 
 static void
-gtk_webview_init (GtkWebView *view, gpointer userdata)
+gtk_webview_init(GtkWebView *view, gpointer userdata)
 {
-	view->priv = g_new0 (struct GtkWebViewPriv, 1);
-	g_signal_connect (view, "navigation-policy-decision-requested",
-			  G_CALLBACK (webview_link_clicked),
+	view->priv = g_new0(struct GtkWebViewPriv, 1);
+	g_signal_connect(view, "navigation-policy-decision-requested",
+			  G_CALLBACK(webview_link_clicked),
 			  view);
 
-	g_signal_connect (view, "load-started",
-			  G_CALLBACK (webview_load_started),
+	g_signal_connect(view, "load-started",
+			  G_CALLBACK(webview_load_started),
 			  view);
 
-	g_signal_connect (view, "load-finished",
-			  G_CALLBACK (webview_load_finished),
+	g_signal_connect(view, "load-finished",
+			  G_CALLBACK(webview_load_finished),
 			  view);
 
 	view->priv->empty = TRUE;
-	view->priv->js_queue = g_queue_new ();
+	view->priv->js_queue = g_queue_new();
 }
 
 
 void
-gtk_webview_load_html_string_with_imgstore (GtkWebView* view, const char* html)
+gtk_webview_load_html_string_with_imgstore(GtkWebView *view, const char *html)
 {
-	char* html_imged;
-	
-	clear_images (view);
-	html_imged = replace_img_id_with_src (view, html);
-	printf ("%s\n", html_imged);
-	webkit_web_view_load_html_string (WEBKIT_WEB_VIEW (view), html_imged, "file:///");
-	g_free (html_imged);
+	char *html_imged;
+
+	clear_images(view);
+	html_imged = replace_img_id_with_src(view, html);
+	webkit_web_view_load_html_string(WEBKIT_WEB_VIEW(view), html_imged, "file:///");
+	g_free(html_imged);
 }
 
-char *gtk_webview_quote_js_string(const char *text)
+char *
+gtk_webview_quote_js_string(const char *text)
 {
-        GString *str = g_string_new("\"");
-        const char *cur = text;
+	GString *str = g_string_new("\"");
+	const char *cur = text;
 
-        while (cur && *cur) {
-                switch (*cur) {
-                case '\\':
-                        g_string_append(str, "\\\\");
-                        break;
-                case '\"':
-                        g_string_append(str, "\\\"");
-                        break;
-                case '\r':
-                        g_string_append(str, "<br/>");
-                        break;
-                case '\n':
-                        break;
-                default:
-			g_string_append_c(str, *cur);
+	while (cur && *cur) {
+		switch (*cur) {
+			case '\\':
+				g_string_append(str, "\\\\");
+				break;
+			case '\"':
+				g_string_append(str, "\\\"");
+				break;
+			case '\r':
+				g_string_append(str, "<br/>");
+				break;
+			case '\n':
+				break;
+			default:
+				g_string_append_c(str, *cur);
 		}
-		cur ++;
+		cur++;
 	}
-	g_string_append_c (str, '"');
-	return g_string_free (str, FALSE);
+	g_string_append_c(str, '"');
+	return g_string_free(str, FALSE);
 }
 
-void gtk_webview_set_vadjustment(GtkWebView *webview, GtkAdjustment *vadj)
+void
+gtk_webview_set_vadjustment(GtkWebView *webview, GtkAdjustment *vadj)
 {
 	webview->priv->vadj = vadj;
 }
 
-/* this is a "hack", my plan is to eventually handle this 
+/* this is a "hack", my plan is to eventually handle this
  * correctly using a signals and a plugin: the plugin will have
  * the information as to what javascript function to call. It seems
  * wrong to hardcode that here.
  */
 void
-gtk_webview_append_html (GtkWebView* view, const char* html)
+gtk_webview_append_html(GtkWebView *view, const char *html)
 {
-	char* escaped = gtk_webview_quote_js_string (html);
-	char* script = g_strdup_printf ("document.write(%s)", escaped);
-	printf ("script: %s\n", script);
-	webkit_web_view_execute_script (WEBKIT_WEB_VIEW (view), script);
+	char *escaped = gtk_webview_quote_js_string(html);
+	char *script = g_strdup_printf("document.write(%s)", escaped);
+	webkit_web_view_execute_script(WEBKIT_WEB_VIEW(view), script);
 	view->priv->empty = FALSE;
 	gtk_webview_scroll_to_end(view, TRUE);
-	g_free (script);
-	g_free (escaped);
+	g_free(script);
+	g_free(escaped);
 }
 
-gboolean gtk_webview_is_empty (GtkWebView *view)
+gboolean
+gtk_webview_is_empty(GtkWebView *view)
 {
 	return view->priv->empty;
 }
@@ -336,7 +341,8 @@ gboolean gtk_webview_is_empty (GtkWebVie
  *
  * @return TRUE if the window needs to be scrolled further, FALSE if we're at the bottom.
  */
-static gboolean smooth_scroll_cb(gpointer data)
+static gboolean
+smooth_scroll_cb(gpointer data)
 {
 	struct GtkWebViewPriv *priv = data;
 	GtkAdjustment *adj = priv->vadj;
@@ -360,18 +366,20 @@ static gboolean smooth_scroll_cb(gpointe
 	return TRUE;
 }
 
-static gboolean scroll_idle_cb(gpointer data)
+static gboolean
+scroll_idle_cb(gpointer data)
 {
 	struct GtkWebViewPriv *priv = data;
 	GtkAdjustment *adj = priv->vadj;
-	if(adj) {
+	if (adj) {
 		gtk_adjustment_set_value(adj, adj->upper - adj->page_size);
 	}
 	priv->scroll_src = 0;
 	return FALSE;
 }
 
-void gtk_webview_scroll_to_end(GtkWebView *webview, gboolean smooth)
+void
+gtk_webview_scroll_to_end(GtkWebView *webview, gboolean smooth)
 {
 	struct GtkWebViewPriv *priv = webview->priv;
 	if (priv->scroll_time)
@@ -387,24 +395,26 @@ void gtk_webview_scroll_to_end(GtkWebVie
 	}
 }
 
-GType gtk_webview_get_type (void)
+GType
+gtk_webview_get_type(void)
 {
 	static GType mview_type = 0;
-	if (G_UNLIKELY (mview_type == 0)) {
+	if (G_UNLIKELY(mview_type == 0)) {
 		static const GTypeInfo mview_info = {
-			sizeof (GtkWebViewClass),
+			sizeof(GtkWebViewClass),
 			NULL,
 			NULL,
 			(GClassInitFunc) gtk_webview_class_init,
 			NULL,
 			NULL,
-			sizeof (GtkWebView),
+			sizeof(GtkWebView),
 			0,
 			(GInstanceInitFunc) gtk_webview_init,
 			NULL
 		};
-		mview_type = g_type_register_static(webkit_web_view_get_type (),
+		mview_type = g_type_register_static(webkit_web_view_get_type(),
 				"GtkWebView", &mview_info, 0);
 	}
 	return mview_type;
 }
+
============================================================
--- pidgin/gtkwebview.h	e78dca4f64edf567173dd5421ba60614bd6edd39
+++ pidgin/gtkwebview.h	32fe88aad9e13230fb22f63d99812537f81d8920
@@ -3,12 +3,14 @@
  * @ingroup pidgin
  */
 
-/* Pidgin is the legal property of its developers, whose names are too numerous
+/* pidgin
+ *
+ * Pidgin is the legal property of its developers, whose names are too numerous
  * to list here.  Please refer to the COPYRIGHT file distributed with this
  * source distribution.
  *
  * This program is free software; you can redistribute it and/or modify
- * under the terms of the GNU General Public License as published by
+ * it under the terms of the GNU General Public License as published by
  * the Free Software Foundation; either version 2 of the License, or
  * (at your option) any later version.
  *
@@ -20,6 +22,7 @@
  * You should have received a copy of the GNU General Public License
  * along with this program; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02111-1301  USA
+ *
  */
 
 #ifndef _PIDGIN_WEBVIEW_H_
@@ -45,7 +48,7 @@ struct _GtkWebView
 	WebKitWebView webkit_web_view;
 
 	/*< private >*/
-	struct GtkWebViewPriv* priv;
+	struct GtkWebViewPriv *priv;
 };
 
 typedef struct _GtkWebView GtkWebView;
@@ -63,14 +66,14 @@ typedef struct _GtkWebViewClass GtkWebVi
  *
  * @return the GType for GtkWebView widget
  */
-GType gtk_webview_get_type (void);
+GType gtk_webview_get_type(void);
 
 /**
  * Create a new GtkWebView object
  *
  * @return a GtkWidget corresponding to the GtkWebView object
  */
-GtkWidget* gtk_webview_new (void);
+GtkWidget *gtk_webview_new(void);
 
 /**
  * Set the vertical adjustment for the GtkWebView.
@@ -87,7 +90,7 @@ void gtk_webview_set_vadjustment(GtkWebV
  * @param webview The GtkWebView object
  * @param markup  The html markup to append
  */
-void gtk_webview_append_html (GtkWebView *webview, const char* markup);
+void gtk_webview_append_html(GtkWebView *webview, const char *markup);
 
 /**
  * Rather than use webkit_webview_load_string, this routine
@@ -97,47 +100,48 @@ void gtk_webview_append_html (GtkWebView
  * @param webview The GtkWebView object
  * @param html    The HTML content to load
  */
-void gtk_webview_load_html_string_with_imgstore (GtkWebView* webview, const char* html);
+void gtk_webview_load_html_string_with_imgstore(GtkWebView *webview, const char *html);
 
 /**
- * (To be changed, right now it just tests whether an append has been
+ * FIXME: (To be changed, right now it just tests whether an append has been
  * called since the last clear or since the Widget was created. So it
  * does not test for load_string's called in between.
  *
  * @param webview The GtkWebView object
- * 
+ *
  * @return gboolean indicating whether the webview is empty.
  */
-gboolean gtk_webview_is_empty (GtkWebView *webview);
+gboolean gtk_webview_is_empty(GtkWebView *webview);
 
 /**
  * Execute the JavaScript only after the webkit_webview_load_string
  * loads completely. We also guarantee that the scripts are executed
- * in the order they are called here.This is useful to avoid race
- * conditions when calls JS functions immediately after opening the
+ * in the order they are called here. This is useful to avoid race
+ * conditions when calling JS functions immediately after opening the
  * page.
  *
  * @param webview the GtkWebView object
  * @param script   the script to execute
  */
-void gtk_webview_safe_execute_script (GtkWebView *webview, const char* script);
+void gtk_webview_safe_execute_script(GtkWebView *webview, const char *script);
 
 /**
- * A convenience routine to quote a string for use as a JavaScript 
+ * A convenience routine to quote a string for use as a JavaScript
  * string. For instance, "hello 'world'" becomes "'hello \\'world\\''"
  *
  * @param str The string to escape and quote
  *
  * @return the quoted string.
  */
-char* gtk_webview_quote_js_string (const char* str);
+char *gtk_webview_quote_js_string(const char *str);
 
 /**
  * Scrolls the Webview to the end of its contents.
  *
  * @param webview The GtkWebView.
- * @param smoth   A boolean indicating if smooth scrolling should be used.
+ * @param smooth   A boolean indicating if smooth scrolling should be used.
  */
 void gtk_webview_scroll_to_end(GtkWebView *webview, gboolean smooth);
 
 #endif /* _PIDGIN_WEBVIEW_H_ */
+
============================================================
--- pidgin/plugins/adiumthemes/webkit.c	20d347ab91b07f1378efaf2a565ee536ed997094
+++ pidgin/plugins/adiumthemes/webkit.c	72c3eb3d4273c5fc1f152b6c1e9d9208ed6893e7
@@ -1,33 +1,34 @@
-/*
- * Adium Message Styles
- * Copyright (C) 2009  Arnold Noronha <arnstein87 at gmail.com>
- * Copyright (C) 2007
+/* pidgin
  *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License as
- * published by the Free Software Foundation; either version 2 of the
- * License, or (at your option) any later version.
+ * Pidgin is the legal property of its developers, whose names are too numerous
+ * to list here.  Please refer to the COPYRIGHT file distributed with this
+ * source distribution.
  *
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * General Public License for more details.
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
  *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
  * You should have received a copy of the GNU General Public License
  * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
- * 02111-1307, USA.
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02111-1301  USA
+ *
  */
 
 #define PLUGIN_ID		"gtk-webview-adium-ims"
 #define PLUGIN_NAME		"webview-adium-ims"
 
 /*
- * A lot of this was originally written by Sean Egan, but I think I've 
- * rewrote enough to replace the author for now. 
+ * A lot of this was originally written by Sean Egan, but I think I've
+ * rewrote enough to replace the author for now.
  */
 #define PLUGIN_AUTHOR		"Arnold Noronha <arnstein87 at gmail.com>"
-#define PURPLE_PLUGINS          "Hell yeah"
+#define PURPLE_PLUGINS		"Hell yeah"
 
 /* System headers */
 #include <string.h>
@@ -59,38 +60,36 @@ static void  *handle = NULL;
 static char  *cur_style_dir = NULL;
 static void  *handle = NULL;
 
-static inline char* get_absolute_path (const char *path)
+static inline char *
+get_absolute_path(const char *path)
 {
-	if (g_path_is_absolute (path)) return g_strdup (path);
+	if (g_path_is_absolute(path))
+		return g_strdup(path);
 	else {
-		char* cwd = g_get_current_dir (), *ret;
-		ret = g_build_filename (cwd, path, NULL);
-		g_free (cwd);
+		char *cwd, *ret;
+		cwd = g_get_current_dir();
+		ret = g_build_filename(cwd, path, NULL);
+		g_free(cwd);
 		return ret;
 	}
 }
 
-static void
-glist_free_all_string (GList *list)
-{
-	GList *first = list;
-	for (; list; list = g_list_next (list))
-		g_free (list->data);
-	g_list_free (first);
-}
+static void webkit_on_webview_destroy(GtkObject* obj, gpointer data);
 
-static void webkit_on_webview_destroy (GtkObject* obj, gpointer data);
-
-static void* webkit_plugin_get_handle ()
+static void *
+webkit_plugin_get_handle(void)
 {
-	if (handle) return handle;
-	else return (handle = g_malloc (1));
+	if (handle)
+		return handle;
+	else
+		return (handle = g_malloc(1));
 }
 
-static void webkit_plugin_free_handle ()
+static void
+webkit_plugin_free_handle(void)
 {
-	purple_signals_disconnect_by_handle (handle);
-	g_free (handle);
+	purple_signals_disconnect_by_handle(handle);
+	g_free(handle);
 }
 
 static char *
@@ -242,12 +241,13 @@ static char *
 }
 
 static char *
-replace_template_tokens(PidginMessageStyle *style, char *text, int len, char *header, char *footer) {
+replace_template_tokens(PidginMessageStyle *style, char *text, int len, char *header, char *footer)
+{
 	GString *str = g_string_new_len(NULL, len);
 
 	char **ms = g_strsplit(text, "%@", 6);
 	char *base = NULL;
-	char *csspath = pidgin_message_style_get_css (style);
+	char *csspath = pidgin_message_style_get_css(style);
 	if (ms[0] == NULL || ms[1] == NULL || ms[2] == NULL || ms[3] == NULL || ms[4] == NULL || ms[5] == NULL) {
 		g_strfreev(ms);
 		g_string_free(str, TRUE);
@@ -256,9 +256,9 @@ replace_template_tokens(PidginMessageSty
 
 	g_string_append(str, ms[0]);
 	g_string_append(str, "file://");
-	base = g_build_filename (style->style_dir, "Contents", "Resources", "Template.html", NULL);
+	base = g_build_filename(style->style_dir, "Contents", "Resources", "Template.html", NULL);
 	g_string_append(str, base);
-	g_free (base);
+	g_free(base);
 
 	g_string_append(str, ms[1]);
 
@@ -269,8 +269,6 @@ replace_template_tokens(PidginMessageSty
 	g_string_append(str, "file://");
 	g_string_append(str, csspath);
 
-
-
 	g_string_append(str, ms[3]);
 	if (header)
 		g_string_append(str, header);
@@ -280,8 +278,8 @@ replace_template_tokens(PidginMessageSty
 	g_string_append(str, ms[5]);
 
 	g_strfreev(ms);
-	g_free (csspath);
-	return g_string_free (str, FALSE);
+	g_free(csspath);
+	return g_string_free(str, FALSE);
 }
 
 static GtkWidget *
@@ -295,33 +293,34 @@ get_webkit(PurpleConversation *conv)
 		return gtkconv->webview;
 }
 
-static void set_theme_webkit_settings (WebKitWebView *webview, PidginMessageStyle *style)
+static void
+set_theme_webkit_settings(WebKitWebView *webview, PidginMessageStyle *style)
 {
 	WebKitWebSettings *settings;
 
-	g_object_get (G_OBJECT(webview), "settings", &settings, NULL);
+	g_object_get(G_OBJECT(webview), "settings", &settings, NULL);
 	if (style->default_font_family)
-		g_object_set (G_OBJECT (settings), "default-font-family", style->default_font_family, NULL);
+		g_object_set(G_OBJECT(settings), "default-font-family", style->default_font_family, NULL);
 
 	if (style->default_font_size)
-		g_object_set (G_OBJECT (settings), "default-font-size", GINT_TO_POINTER (style->default_font_size), NULL);
+		g_object_set(G_OBJECT(settings), "default-font-size", GINT_TO_POINTER(style->default_font_size), NULL);
 
 	/* this does not work :( */
-	webkit_web_view_set_transparent (webview, style->default_background_is_transparent);
+	webkit_web_view_set_transparent(webview, style->default_background_is_transparent);
 }
 
 /*
  * The style specification says that if the conversation is a group
- * chat then the <div id="Chat"> element will be given a class 
- * 'groupchat'. I can't add another '%@' in Template.html because 
+ * chat then the <div id="Chat"> element will be given a class
+ * 'groupchat'. I can't add another '%@' in Template.html because
  * that breaks style-specific Template.html's. I have to either use libxml
  * or conveniently play with WebKit's javascript engine. The javascript
  * engine should work, but it's not an identical behavior.
  */
 static void
-webkit_set_groupchat (GtkWebView *webview)
+webkit_set_groupchat(GtkWebView *webview)
 {
-	gtk_webview_safe_execute_script (webview, "document.getElementById('Chat').className = 'groupchat'");
+	gtk_webview_safe_execute_script(webview, "document.getElementById('Chat').className = 'groupchat'");
 }
 
 
@@ -329,7 +328,7 @@ webkit_set_groupchat (GtkWebView *webvie
  * Called when either a new PurpleConversation is created
  * or when a PidginConversation changes its active PurpleConversation
  * This will not change the theme if the theme is already set.
- * (This is to prevent accidental theme changes if a new 
+ * (This is to prevent accidental theme changes if a new
  * PurpleConversation gets added.
  *
  * FIXME: it's not at all clear to me as to how
@@ -337,7 +336,7 @@ static void
  * changes.
  */
 static void
-init_theme_for_webkit (PurpleConversation *conv, char *style_dir)
+init_theme_for_webkit(PurpleConversation *conv, char *style_dir)
 {
 	GtkWidget *webkit = PIDGIN_CONVERSATION(conv)->webview;
 	char *header, *footer;
@@ -346,67 +345,70 @@ init_theme_for_webkit (PurpleConversatio
 	char* basedir;
 	char* baseuri;
 	PidginMessageStyle *style, *oldStyle;
-	oldStyle = g_object_get_data (G_OBJECT(webkit), MESSAGE_STYLE_KEY);
+	PidginMessageStyle *copy;
 
-	if (oldStyle) return;
+	oldStyle = g_object_get_data(G_OBJECT(webkit), MESSAGE_STYLE_KEY);
+	if (oldStyle)
+		return;
 
-	purple_debug_info ("webkit", "loading %s\n", style_dir);
-	style = pidgin_message_style_load (style_dir);
-	g_assert (style);
-	g_assert (style->template_html); /* debugging test? */
+	purple_debug_info("webkit", "loading %s\n", style_dir);
+	style = pidgin_message_style_load(style_dir);
+	g_assert(style);
+	g_assert(style->template_html); /* debugging test? */
 
-	basedir = g_build_filename (style->style_dir, "Contents", "Resources", "Template.html", NULL);
-	baseuri = g_strdup_printf ("file://%s", basedir);
+	basedir = g_build_filename(style->style_dir, "Contents", "Resources", "Template.html", NULL);
+	baseuri = g_strdup_printf("file://%s", basedir);
 	header = replace_header_tokens(style->header_html, strlen(style->header_html), conv);
-	g_assert (style);
+	g_assert(style);
 	footer = replace_header_tokens(style->footer_html, strlen(style->footer_html), conv);
 	template = replace_template_tokens(style, style->template_html, strlen(style->template_html) + strlen(style->header_html), header, footer);
 
 	g_assert(template);
 
-	purple_debug_info ("webkit", "template: %s\n", template);
+	purple_debug_info("webkit", "template: %s\n", template);
 
-	set_theme_webkit_settings (WEBKIT_WEB_VIEW(webkit), style);
+	set_theme_webkit_settings(WEBKIT_WEB_VIEW(webkit), style);
 	webkit_web_view_load_string(WEBKIT_WEB_VIEW(webkit), template, "text/html", "UTF-8", baseuri);
 
-	PidginMessageStyle *copy = pidgin_message_style_copy (style);
-	g_object_set_data (G_OBJECT(webkit), MESSAGE_STYLE_KEY, copy);
+	copy = pidgin_message_style_copy(style);
+	g_object_set_data(G_OBJECT(webkit), MESSAGE_STYLE_KEY, copy);
 
-	pidgin_message_style_unref (style);
+	pidgin_message_style_unref(style);
 	/* I need to unref this style when the webkit object destroys */
-	g_signal_connect (G_OBJECT(webkit), "destroy", G_CALLBACK(webkit_on_webview_destroy), copy);
+	g_signal_connect(G_OBJECT(webkit), "destroy", G_CALLBACK(webkit_on_webview_destroy), copy);
 
-	if (purple_conversation_get_type (conv) == PURPLE_CONV_TYPE_CHAT)
-		webkit_set_groupchat (GTK_WEBVIEW (webkit));
-	g_free (basedir);
-	g_free (baseuri);
-	g_free (header);
-	g_free (footer);
-	g_free (template);
+	if (purple_conversation_get_type(conv) == PURPLE_CONV_TYPE_CHAT)
+		webkit_set_groupchat(GTK_WEBVIEW(webkit));
+	g_free(basedir);
+	g_free(baseuri);
+	g_free(header);
+	g_free(footer);
+	g_free(template);
 }
 
 
 /* restore the non theme version of the conversation window */
 static void
-finalize_theme_for_webkit (PurpleConversation *conv)
+finalize_theme_for_webkit(PurpleConversation *conv)
 {
 	GtkWidget *webview = PIDGIN_CONVERSATION(conv)->webview;
-	PidginMessageStyle *style = g_object_get_data (G_OBJECT(webview), MESSAGE_STYLE_KEY);
+	PidginMessageStyle *style = g_object_get_data(G_OBJECT(webview), MESSAGE_STYLE_KEY);
 
 	webkit_web_view_load_string(WEBKIT_WEB_VIEW(webview), "", "text/html", "UTF-8", "");
 
-	g_object_set_data (G_OBJECT(webview), MESSAGE_STYLE_KEY, NULL);
-	pidgin_message_style_unref (style);
+	g_object_set_data(G_OBJECT(webview), MESSAGE_STYLE_KEY, NULL);
+	pidgin_message_style_unref(style);
 }
 
 static void
-webkit_on_webview_destroy (GtkObject *object, gpointer data)
+webkit_on_webview_destroy(GtkObject *object, gpointer data)
 {
-	pidgin_message_style_unref ((PidginMessageStyle*) data);
-	g_object_set_data (G_OBJECT(object), MESSAGE_STYLE_KEY, NULL);
+	pidgin_message_style_unref((PidginMessageStyle *)data);
+	g_object_set_data(G_OBJECT(object), MESSAGE_STYLE_KEY, NULL);
 }
 
-static gboolean webkit_on_displaying_im_msg (PurpleAccount *account,
+static gboolean
+webkit_on_displaying_im_msg(PurpleAccount *account,
 						 const char* name,
 						 char **pmessage,
 						 PurpleConversation *conv,
@@ -423,17 +425,16 @@ static gboolean webkit_on_displaying_im_
 	char *script;
 	char *func = "appendMessage";
 	char *smileyed;
-	time_t mtime = time (NULL); /* FIXME: this should come from the write_conv calback, but the signal doesn't pass this to me */
+	time_t mtime = time(NULL); /* FIXME: this should come from the write_conv calback, but the signal doesn't pass this to me */
 
 	PurpleMessageFlags old_flags = GPOINTER_TO_INT(purple_conversation_get_data(conv, "webkit-lastflags"));
 	PidginMessageStyle *style;
 
-	fprintf (stderr, "hmm.. here %s %s\n", name, message);
 	webkit = get_webkit(conv);
 	stripped = g_strdup(message);
 
-	style = g_object_get_data (G_OBJECT (webkit), MESSAGE_STYLE_KEY);
-	g_assert (style);
+	style = g_object_get_data(G_OBJECT(webkit), MESSAGE_STYLE_KEY);
+	g_assert(style);
 
 	if (flags & PURPLE_MESSAGE_SEND && old_flags & PURPLE_MESSAGE_SEND) {
 		message_html = style->outgoing_next_content_html;
@@ -452,11 +453,11 @@ static gboolean webkit_on_displaying_im_
 
 	smileyed = smiley_parse_markup(stripped, conv->account->protocol_id);
 	msg = replace_message_tokens(message_html, 0, conv, name, alias, smileyed, flags, mtime);
-	escape = gtk_webview_quote_js_string (msg);
+	escape = gtk_webview_quote_js_string(msg);
 	script = g_strdup_printf("%s(%s)", func, escape);
 
-	purple_debug_info ("webkit", "JS: %s\n", script);
-	gtk_webview_safe_execute_script (GTK_WEBVIEW (webkit), script);
+	purple_debug_info("webkit", "JS: %s\n", script);
+	gtk_webview_safe_execute_script(GTK_WEBVIEW(webkit), script);
 
 	g_free(script);
 	g_free(smileyed);
@@ -467,7 +468,8 @@ static gboolean webkit_on_displaying_im_
 	return TRUE; /* GtkConv should not handle this IM */
 }
 
-static gboolean webkit_on_displaying_chat_msg (PurpleAccount *account,
+static gboolean
+webkit_on_displaying_chat_msg(PurpleAccount *account,
 					       const char *who,
 					       char **message,
 					       PurpleConversation *conv,
@@ -475,43 +477,43 @@ static gboolean webkit_on_displaying_cha
 					       gpointer userdata)
 {
 	/* handle exactly like an IM message for now */
-	return webkit_on_displaying_im_msg (account, who, message, conv, flags, NULL);
+	return webkit_on_displaying_im_msg(account, who, message, conv, flags, NULL);
 }
 
 static void
-webkit_on_conversation_displayed (PidginConversation *gtkconv, gpointer data)
+webkit_on_conversation_displayed(PidginConversation *gtkconv, gpointer data)
 {
-	init_theme_for_webkit (gtkconv->active_conv, cur_style_dir);
+	init_theme_for_webkit(gtkconv->active_conv, cur_style_dir);
 }
 
 static void
-webkit_on_conversation_switched (PurpleConversation *conv, gpointer data)
+webkit_on_conversation_switched(PurpleConversation *conv, gpointer data)
 {
-	init_theme_for_webkit (conv, cur_style_dir);
+	init_theme_for_webkit(conv, cur_style_dir);
 }
 
 static void
-webkit_on_conversation_hiding (PidginConversation *gtkconv, gpointer data)
+webkit_on_conversation_hiding(PidginConversation *gtkconv, gpointer data)
 {
-	/* 
+	/*
 	 * I'm not sure if I need to do anything here, but let's keep
-	 * this anyway. 
+	 * this anyway.
 	 */
 }
 
-static GList*
-get_dir_dir_list (const char* dirname)
+static GList *
+get_dir_dir_list(const char *dirname)
 {
 	GList *ret = NULL;
-	GDir  *dir = g_dir_open (dirname, 0, NULL);
+	GDir  *dir = g_dir_open(dirname, 0, NULL);
 	const char* subdir;
 
 	if (!dir) return NULL;
-	while ((subdir = g_dir_read_name (dir))) {
-		ret = g_list_append (ret, g_build_filename (dirname, subdir, NULL));
+	while ((subdir = g_dir_read_name(dir))) {
+		ret = g_list_append(ret, g_build_filename(dirname, subdir, NULL));
 	}
 
-	g_dir_close (dir);
+	g_dir_close(dir);
 	return ret;
 }
 
@@ -520,40 +522,40 @@ get_dir_dir_list (const char* dirname)
  * directories. I don't guarrantee that these are valid themes, just
  * that they are in the directories for themes.
  */
-static GList*
-get_style_directory_list ()
+static GList *
+get_style_directory_list(void)
 {
 	char *user_dir, *user_style_dir, *global_style_dir;
 	GList *list1, *list2;
 
-	user_dir = get_absolute_path (purple_user_dir ());
+	user_dir = get_absolute_path(purple_user_dir());
 
-	user_style_dir = g_build_filename (user_dir, "styles", NULL);
-	global_style_dir = g_build_filename (DATADIR, "pidgin", "styles", NULL);
+	user_style_dir = g_build_filename(user_dir, "styles", NULL);
+	global_style_dir = g_build_filename(DATADIR, "pidgin", "styles", NULL);
 
-	list1 = get_dir_dir_list (user_style_dir);
-	list2 = get_dir_dir_list (global_style_dir);
+	list1 = get_dir_dir_list(user_style_dir);
+	list2 = get_dir_dir_list(global_style_dir);
 
-	g_free (global_style_dir);
-	g_free (user_style_dir);
-	g_free (user_dir);
+	g_free(global_style_dir);
+	g_free(user_style_dir);
+	g_free(user_dir);
 
-	return g_list_concat (list1, list2);
+	return g_list_concat(list1, list2);
 }
 
 /**
- * use heuristics or previous user options to figure out what 
+ * use heuristics or previous user options to figure out what
  * theme to use as default in this Pidgin instance.
  */
 static void
-style_set_default ()
+style_set_default(void)
 {
-	GList* styles = get_style_directory_list (), *iter;
-	const char *stylepath = purple_prefs_get_string ("/plugins/gtk/adiumthemes/stylepath");
-	g_assert (cur_style_dir == NULL);
+	GList *styles = get_style_directory_list(), *iter;
+	const char *stylepath = purple_prefs_get_string("/plugins/gtk/adiumthemes/stylepath");
+	g_assert(cur_style_dir == NULL);
 
 	if (stylepath && *stylepath)
-		styles = g_list_prepend (styles, g_strdup (stylepath));
+		styles = g_list_prepend(styles, g_strdup(stylepath));
 	else {
 		purple_notify_error(handle, _("Webkit themes"),
 			_("Can't find installed styles"),
@@ -563,62 +565,63 @@ style_set_default ()
 
 	/* pick any one that works. Note that we have first preference
 	 * for the one in the userdir */
-	for (iter = styles; iter; iter = g_list_next (iter)) {
-		PidginMessageStyle *style = pidgin_message_style_load (iter->data);
+	for (iter = styles; iter; iter = g_list_next(iter)) {
+		PidginMessageStyle *style = pidgin_message_style_load(iter->data);
 		if (style) {
-			cur_style_dir = (char*) g_strdup (iter->data);
-			pidgin_message_style_unref (style);
+			cur_style_dir = (char *)g_strdup(iter->data);
+			pidgin_message_style_unref(style);
 			break;
 		}
-		purple_debug_info ("webkit", "Style %s is invalid\n", (char*) iter->data);
+		purple_debug_info("webkit", "Style %s is invalid\n", (char *)iter->data);
 	}
 
-	for (iter = styles; iter; iter = g_list_next (iter))
-		g_free (iter->data);
-	g_list_free (styles);
+	for (iter = styles; iter; iter = g_list_next(iter))
+		g_free(iter->data);
+	g_list_free(styles);
 }
 
 static gboolean
 plugin_load(PurplePlugin *plugin)
 {
-	style_set_default ();
-	if (!cur_style_dir) return FALSE; /* couldn't find a style */
+	style_set_default();
+	if (!cur_style_dir)
+		return FALSE; /* couldn't find a style */
 
-	purple_signal_connect (pidgin_conversations_get_handle (),
+	purple_signal_connect(pidgin_conversations_get_handle(),
 			       "displaying-im-msg",
-			       webkit_plugin_get_handle (),
+			       webkit_plugin_get_handle(),
 			       PURPLE_CALLBACK(webkit_on_displaying_im_msg),
 			       NULL);
 
-	purple_signal_connect (pidgin_conversations_get_handle (),
+	purple_signal_connect(pidgin_conversations_get_handle(),
 			       "displaying-chat-msg",
-			       webkit_plugin_get_handle (),
+			       webkit_plugin_get_handle(),
 			       PURPLE_CALLBACK(webkit_on_displaying_chat_msg),
 			       NULL);
 
-	purple_signal_connect (pidgin_conversations_get_handle (),
+	purple_signal_connect(pidgin_conversations_get_handle(),
 			       "conversation-displayed",
-			       webkit_plugin_get_handle (),
+			       webkit_plugin_get_handle(),
 			       PURPLE_CALLBACK(webkit_on_conversation_displayed),
 			       NULL);
 
-	purple_signal_connect (pidgin_conversations_get_handle (),
+	purple_signal_connect(pidgin_conversations_get_handle(),
 			       "conversation-switched",
-			       webkit_plugin_get_handle (),
+			       webkit_plugin_get_handle(),
 			       PURPLE_CALLBACK(webkit_on_conversation_switched),
 			       NULL);
 
-	purple_signal_connect (pidgin_conversations_get_handle (),
+	purple_signal_connect(pidgin_conversations_get_handle(),
 			       "conversation-hiding",
-			       webkit_plugin_get_handle (),
+			       webkit_plugin_get_handle(),
 			       PURPLE_CALLBACK(webkit_on_conversation_hiding),
 			       NULL);
 
 	/* finally update each of the existing conversation windows */
 	{
-		GList* list = purple_get_conversations ();
+		GList *list = purple_get_conversations();
 		for (;list; list = g_list_next(list))
-			init_theme_for_webkit (list->data, cur_style_dir);
+			init_theme_for_webkit(list->data, cur_style_dir);
 
 	}
 	return TRUE;
@@ -629,9 +632,9 @@ plugin_unload(PurplePlugin *plugin)
 {
 	GList *list;
 
-	webkit_plugin_free_handle ();
+	webkit_plugin_free_handle();
 	cur_style_dir = NULL;
-	list = purple_get_conversations ();
+	list = purple_get_conversations();
 	while (list) {
 		finalize_theme_for_webkit(list->data);
 		list = g_list_next(list);
@@ -645,156 +648,155 @@ static void
  */
 
 static void
-style_changed (GtkWidget* combobox, gpointer null)
+style_changed(GtkWidget *combobox, gpointer null)
 {
-	char *name = gtk_combo_box_get_active_text (GTK_COMBO_BOX(combobox));
+	char *name = gtk_combo_box_get_active_text(GTK_COMBO_BOX(combobox));
 	GtkWidget *dialog;
-	GList *styles = get_style_directory_list (), *iter;
+	GList *styles = get_style_directory_list(), *iter;
 
 	/* find the full path for this name, I wish I could store this info in the combobox itself. :( */
 	for (iter = styles; iter; iter = g_list_next(iter)) {
-		char* basename = g_path_get_basename (iter->data);
-		if (g_str_equal (basename, name)) {
-			g_free (basename);
+		char *basename = g_path_get_basename(iter->data);
+		if (g_str_equal(basename, name)) {
+			g_free(basename);
 			break;
 		}
-		g_free (basename);
+		g_free(basename);
 	}
 
-	g_assert (iter);
-	g_free (name);
-	g_free (cur_style_dir);
-	cur_style_dir = g_strdup (iter->data);;
-	purple_prefs_set_string ("/plugins/gtk/adiumthemes/stylepath", cur_style_dir);
+	g_assert(iter);
+	g_free(name);
+	g_free(cur_style_dir);
+	cur_style_dir = g_strdup(iter->data);;
+	purple_prefs_set_string("/plugins/gtk/adiumthemes/stylepath", cur_style_dir);
 
 	/* inform the user that existing conversations haven't changed */
-	dialog = gtk_message_dialog_new (NULL, 0, GTK_MESSAGE_INFO, GTK_BUTTONS_CLOSE, "The style for existing conversations have not been changed. Please close and re-open the conversation for the changes to take effect.");
-	g_assert (dialog);
-	gtk_widget_show (dialog);
-	g_signal_connect_swapped (dialog, "response", G_CALLBACK(gtk_widget_destroy), dialog);
+	dialog = gtk_message_dialog_new(NULL, 0, GTK_MESSAGE_INFO, GTK_BUTTONS_CLOSE, "The style for existing conversations have not been changed. Please close and re-open the conversation for the changes to take effect.");
+	g_assert(dialog);
+	gtk_widget_show(dialog);
+	g_signal_connect_swapped(dialog, "response", G_CALLBACK(gtk_widget_destroy), dialog);
 }
 
-static GtkWidget*
-get_style_config_frame ()
+static GtkWidget *
+get_style_config_frame(void)
 {
-	GtkWidget *combobox = gtk_combo_box_new_text ();
-	GList *styles = get_style_directory_list (), *iter;
+	GtkWidget *combobox = gtk_combo_box_new_text();
+	GList *styles = get_style_directory_list(), *iter;
 	int index = 0, selected = 0;
 
-	for (iter = styles; iter; iter = g_list_next (iter)) {
-		PidginMessageStyle *style = pidgin_message_style_load (iter->data);
+	for (iter = styles; iter; iter = g_list_next(iter)) {
+		PidginMessageStyle *style = pidgin_message_style_load(iter->data);
 
 		if (style) {
-			char *text = g_path_get_basename (iter->data);
-			gtk_combo_box_append_text (GTK_COMBO_BOX(combobox), text);
-			g_free (text);
+			char *text = g_path_get_basename(iter->data);
+			gtk_combo_box_append_text(GTK_COMBO_BOX(combobox), text);
+			g_free(text);
 
-			if (g_str_equal (iter->data, cur_style_dir))
+			if (g_str_equal(iter->data, cur_style_dir))
 				selected = index;
 			index++;
-			pidgin_message_style_unref (style);
+			pidgin_message_style_unref(style);
 		}
 	}
-	gtk_combo_box_set_active (GTK_COMBO_BOX(combobox), selected);
-	g_signal_connect_after (G_OBJECT(combobox), "changed", G_CALLBACK(style_changed), NULL);
+	gtk_combo_box_set_active(GTK_COMBO_BOX(combobox), selected);
+	g_signal_connect_after(G_OBJECT(combobox), "changed", G_CALLBACK(style_changed), NULL);
 	return combobox;
 }
 
 static void
-variant_update_conversation (PurpleConversation *conv)
+variant_update_conversation(PurpleConversation *conv)
 {
-	PidginConversation *gtkconv = PIDGIN_CONVERSATION (conv);
-	WebKitWebView *webview = WEBKIT_WEB_VIEW (gtkconv->webview);
-	PidginMessageStyle *style = (PidginMessageStyle*) g_object_get_data (G_OBJECT(webview), MESSAGE_STYLE_KEY);
+	PidginConversation *gtkconv = PIDGIN_CONVERSATION(conv);
+	WebKitWebView *webview = WEBKIT_WEB_VIEW(gtkconv->webview);
+	PidginMessageStyle *style = (PidginMessageStyle *)g_object_get_data(G_OBJECT(webview), MESSAGE_STYLE_KEY);
 	char *script;
 
-	g_assert (style);
+	g_assert(style);
 
-	script = g_strdup_printf ("setStylesheet(\"mainStyle\",\"%s\")", pidgin_message_style_get_css (style));
-	gtk_webview_safe_execute_script (GTK_WEBVIEW(webview), script);
+	script = g_strdup_printf("setStylesheet(\"mainStyle\",\"%s\")", pidgin_message_style_get_css(style));
+	gtk_webview_safe_execute_script(GTK_WEBVIEW(webview), script);
 
-	set_theme_webkit_settings (WEBKIT_WEB_VIEW (gtkconv->webview), style);
-	g_free (script);
+	set_theme_webkit_settings(WEBKIT_WEB_VIEW(gtkconv->webview), style);
+	g_free(script);
 }
 
 static void
-variant_changed (GtkWidget* combobox, gpointer null)
+variant_changed(GtkWidget* combobox, gpointer null)
 {
 	char *name;
 	GList *list;
-	PidginMessageStyle *style = pidgin_message_style_load (cur_style_dir);
+	PidginMessageStyle *style = pidgin_message_style_load(cur_style_dir);
 
-	g_assert (style);
-	name = gtk_combo_box_get_active_text (GTK_COMBO_BOX (combobox));
-	pidgin_message_style_set_variant (style, name);
-	pidgin_message_style_save_state (style);
+	g_assert(style);
+	name = gtk_combo_box_get_active_text(GTK_COMBO_BOX(combobox));
+	pidgin_message_style_set_variant(style, name);
+	pidgin_message_style_save_state(style);
 
 	/* update conversations */
-	list = purple_get_conversations ();
+	list = purple_get_conversations();
 	while (list) {
-		variant_update_conversation (list->data);
+		variant_update_conversation(list->data);
 		list = g_list_next(list);
 	}
 
-	g_free (name);
-	pidgin_message_style_unref (style);
+	g_free(name);
+	pidgin_message_style_unref(style);
 }
 
 static GtkWidget *
 get_variant_config_frame()
 {
-	PidginMessageStyle *style = pidgin_message_style_load (cur_style_dir);
-	GList *variants = pidgin_message_style_get_variants (style), *iter;
-	char *cur_variant = pidgin_message_style_get_variant (style);
+	PidginMessageStyle *style = pidgin_message_style_load(cur_style_dir);
+	GList *variants = pidgin_message_style_get_variants(style), *iter;
+	char *cur_variant = pidgin_message_style_get_variant(style);
 	GtkWidget *combobox = gtk_combo_box_new_text();
 	int def = -1, index = 0;
 
-	pidgin_message_style_unref (style);
+	pidgin_message_style_unref(style);
 
-	for (iter = variants; iter; iter = g_list_next (iter)) {
-		gtk_combo_box_append_text (GTK_COMBO_BOX(combobox), iter->data);
+	for (iter = variants; iter; iter = g_list_next(iter)) {
+		gtk_combo_box_append_text(GTK_COMBO_BOX(combobox), iter->data);
 
-		if (g_str_equal (cur_variant, iter->data))
+		if (g_str_equal(cur_variant, iter->data))
 			def = index;
 		index ++;
 
 	}
 
-	gtk_combo_box_set_active (GTK_COMBO_BOX(combobox), def);
-	g_signal_connect (G_OBJECT(combobox), "changed", G_CALLBACK(variant_changed), NULL);
+	gtk_combo_box_set_active(GTK_COMBO_BOX(combobox), def);
+	g_signal_connect(G_OBJECT(combobox), "changed", G_CALLBACK(variant_changed), NULL);
 
 	return combobox;
 }
 
 static void
-style_changed_reset_variants (GtkWidget* combobox, gpointer table)
+style_changed_reset_variants(GtkWidget* combobox, gpointer table)
 {
 	/* I hate to do this, I swear. But I don't know how to cleanly clean an existing combobox */
-	GtkWidget* variants = g_object_get_data (G_OBJECT(table), "variants-cbox");
-	gtk_widget_destroy (variants);
-	variants = get_variant_config_frame ();
-	gtk_table_attach_defaults (GTK_TABLE (table), variants, 1, 2, 1, 2);
-	gtk_widget_show_all (GTK_WIDGET(table));
+	GtkWidget* variants = g_object_get_data(G_OBJECT(table), "variants-cbox");
+	gtk_widget_destroy(variants);
+	variants = get_variant_config_frame();
+	gtk_table_attach_defaults(GTK_TABLE(table), variants, 1, 2, 1, 2);
+	gtk_widget_show_all(GTK_WIDGET(table));
 
-	g_object_set_data (G_OBJECT(table), "variants-cbox", variants);
+	g_object_set_data(G_OBJECT(table), "variants-cbox", variants);
 }
 
 static GtkWidget*
 get_config_frame(PurplePlugin* plugin)
 {
-	GtkWidget *table = gtk_table_new (2, 2, FALSE);
-	GtkWidget *style_config = get_style_config_frame ();
-	GtkWidget *variant_config = get_variant_config_frame ();
+	GtkWidget *table = gtk_table_new(2, 2, FALSE);
+	GtkWidget *style_config = get_style_config_frame();
+	GtkWidget *variant_config = get_variant_config_frame();
 
-	gtk_table_attach_defaults (GTK_TABLE(table), gtk_label_new ("Message Style"), 0, 1, 0, 1);
-	gtk_table_attach_defaults (GTK_TABLE(table), style_config, 1, 2, 0, 1);
-	gtk_table_attach_defaults (GTK_TABLE(table), gtk_label_new ("Style Variant"), 0, 1, 1, 2);
-	gtk_table_attach_defaults (GTK_TABLE(table), variant_config, 1, 2, 1, 2);
+	gtk_table_attach_defaults(GTK_TABLE(table), gtk_label_new("Message Style"), 0, 1, 0, 1);
+	gtk_table_attach_defaults(GTK_TABLE(table), style_config, 1, 2, 0, 1);
+	gtk_table_attach_defaults(GTK_TABLE(table), gtk_label_new("Style Variant"), 0, 1, 1, 2);
+	gtk_table_attach_defaults(GTK_TABLE(table), variant_config, 1, 2, 1, 2);
 
-
-	g_object_set_data (G_OBJECT(table), "variants-cbox", variant_config);
+	g_object_set_data(G_OBJECT(table), "variants-cbox", variant_config);
 	/* to clarify, this is a second signal connected on style config */
-	g_signal_connect_after (G_OBJECT(style_config), "changed", G_CALLBACK(style_changed_reset_variants), table);
+	g_signal_connect_after(G_OBJECT(style_config), "changed", G_CALLBACK(style_changed_reset_variants), table);
 
 	return table;
 }
@@ -818,7 +820,7 @@ static PurplePluginInfo info =
 	PURPLE_MAJOR_VERSION,		/* Purple Major Version	*/
 	PURPLE_MINOR_VERSION,		/* Purple Minor Version	*/
 	PURPLE_PLUGIN_STANDARD,		/* plugin type			*/
-PIDGIN_PLUGIN_TYPE,			/* ui requirement		*/
+	PIDGIN_PLUGIN_TYPE,			/* ui requirement		*/
 	0,							/* flags				*/
 	NULL,						/* dependencies			*/
 	PURPLE_PRIORITY_DEFAULT,	/* priority				*/
@@ -851,10 +853,11 @@ init_plugin(PurplePlugin *plugin) {
 	info.summary = "Adium-like IMs with Pidgin";
 	info.description = "You can chat in Pidgin using Adium's WebKit view.";
 
-	purple_prefs_add_none ("/plugins");
-	purple_prefs_add_none ("/plugins/gtk");
-	purple_prefs_add_none ("/plugins/gtk/adiumthemes");
-	purple_prefs_add_string ("/plugins/gtk/adiumthemes/stylepath", "");
+	purple_prefs_add_none("/plugins");
+	purple_prefs_add_none("/plugins/gtk");
+	purple_prefs_add_none("/plugins/gtk/adiumthemes");
+	purple_prefs_add_string("/plugins/gtk/adiumthemes/stylepath", "");
 }
 
 PURPLE_INIT_PLUGIN(webkit, init_plugin, info)
+
============================================================
--- pidgin/smileyparser.c	46760d4ed882f521a99433309744f7fca4567439
+++ pidgin/smileyparser.c	c9e64921eb77cb33459641798083d55d76b93470
@@ -1,140 +1,165 @@
+/* pidgin
+ *
+ * Pidgin is the legal property of its developers, whose names are too numerous
+ * to list here.  Please refer to the COPYRIGHT file distributed with this
+ * source distribution.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02111-1301  USA
+ *
+ */
 
 #include <gtk/gtk.h>
+#include <debug.h>
 #include "smileyparser.h"
 #include <smiley.h>
 #include <string.h>
 #include "gtkthemes.h"
 
-static char* get_fullpath (const char* filename)
+static char *
+get_fullpath(const char *filename)
 {
-	if (g_path_is_absolute (filename)) return g_strdup (filename);
-	else return g_build_path (g_get_current_dir (), filename, NULL);
+	if (g_path_is_absolute(filename))
+		return g_strdup(filename);
+	else
+		return g_build_path(g_get_current_dir(), filename, NULL);
 }
 
 static void
-parse_for_shortcut_plaintext (const char* text, const char* shortcut, const char* file, GString* ret) 
+parse_for_shortcut_plaintext(const char *text, const char *shortcut, const char *file, GString *ret)
 {
 	const char *tmp = text;
 
-	for(;*tmp;) {
-		const char *end = strstr (tmp, shortcut);
+	for (;*tmp;) {
+		const char *end = strstr(tmp, shortcut);
 		char *path;
 		char *escaped_path;
 
 		if (end == NULL) {
-			g_string_append (ret, tmp);
+			g_string_append(ret, tmp);
 			break;
 		}
-		path = get_fullpath (file);
-		escaped_path = g_markup_escape_text (path, -1);
+		path = get_fullpath(file);
+		escaped_path = g_markup_escape_text(path, -1);
 
-		g_string_append_len (ret, tmp, end-tmp);
-		g_string_append_printf (ret,"<img alt='%s' src='%s' />",
+		g_string_append_len(ret, tmp, end-tmp);
+		g_string_append_printf(ret,"<img alt='%s' src='%s' />",
 					shortcut, escaped_path);
-		g_free (path);
-		g_free (escaped_path);
-		g_assert (strlen (tmp) >= strlen (shortcut));
-		tmp = end + strlen (shortcut);
+		g_free(path);
+		g_free(escaped_path);
+		g_assert(strlen(tmp) >= strlen(shortcut));
+		tmp = end + strlen(shortcut);
 	}
 }
 
-static char*
-parse_for_shortcut (const char* markup, const char* shortcut, const char* file)
+static char *
+parse_for_shortcut(const char *markup, const char *shortcut, const char *file)
 {
-	GString* ret = g_string_new ("");
-	char *local_markup = g_strdup (markup);
-	char *escaped_shortcut = g_markup_escape_text (shortcut, -1);
+	GString* ret = g_string_new("");
+	char *local_markup = g_strdup(markup);
+	char *escaped_shortcut = g_markup_escape_text(shortcut, -1);
 
 	char *temp = local_markup;
-	
+
 	for (;*temp;) {
-		char *end = strchr (temp, '<');
+		char *end = strchr(temp, '<');
 		char *end_of_tag;
 
 		if (!end) {
-			parse_for_shortcut_plaintext (temp, escaped_shortcut, file, ret);
+			parse_for_shortcut_plaintext(temp, escaped_shortcut, file, ret);
 			break;
 		}
 
 		*end = 0;
-		parse_for_shortcut_plaintext (temp, escaped_shortcut, file, ret);
+		parse_for_shortcut_plaintext(temp, escaped_shortcut, file, ret);
 		*end = '<';
 
 		/* if this is well-formed, then there should be no '>' within
 		 * the tag. TODO: handle a comment tag better :( */
-		end_of_tag = strchr (end, '>');
+		end_of_tag = strchr(end, '>');
 		if (!end_of_tag) {
-			g_string_append (ret, end);
+			g_string_append(ret, end);
 			break;
 		}
 
-		g_string_append_len (ret, end, end_of_tag-end+1);
+		g_string_append_len(ret, end, end_of_tag - end + 1);
 
 		temp = end_of_tag + 1;
 	}
-	g_free (local_markup);
-	g_free (escaped_shortcut);
-	return g_string_free (ret, FALSE);
+	g_free(local_markup);
+	g_free(escaped_shortcut);
+	return g_string_free(ret, FALSE);
 }
 
-static char*
-parse_for_purple_smiley (const char* markup, PurpleSmiley *smiley)
+static char *
+parse_for_purple_smiley(const char *markup, PurpleSmiley *smiley)
 {
-	char *file = purple_smiley_get_full_path (smiley);
-	char *ret = parse_for_shortcut (markup, purple_smiley_get_shortcut (smiley), file);
-	g_free (file);
+	char *file = purple_smiley_get_full_path(smiley);
+	char *ret = parse_for_shortcut(markup, purple_smiley_get_shortcut(smiley), file);
+	g_free(file);
 	return ret;
 }
 
-static char*
-parse_for_smiley_list (const char* markup, GHashTable* smileys)
+static char *
+parse_for_smiley_list(const char *markup, GHashTable *smileys)
 {
 	GHashTableIter iter;
 	char *key, *value;
-	char *ret = g_strdup (markup);
+	char *ret = g_strdup(markup);
 
-	g_hash_table_iter_init (&iter, smileys);
-	while (g_hash_table_iter_next (&iter, (gpointer*)&key, (gpointer*)&value))
+	g_hash_table_iter_init(&iter, smileys);
+	while (g_hash_table_iter_next(&iter, (gpointer *)&key, (gpointer *)&value))
 	{
-		char* temp = parse_for_shortcut (ret, key, value);
-		g_free (ret);
+		char *temp = parse_for_shortcut(ret, key, value);
+		g_free(ret);
 		ret = temp;
 	}
+
 	return ret;
 }
 
-char*
-smiley_parse_markup (const char* markup, const char *proto_id) 
+char *
+smiley_parse_markup(const char *markup, const char *proto_id)
 {
-	GList *smileys = purple_smileys_get_all ();
-	char *temp = g_strdup (markup), *temp2;
+	GList *smileys = purple_smileys_get_all();
+	char *temp = g_strdup(markup), *temp2;
 	struct smiley_list *list;
 	const char *proto_name = "default";
 
 	if (proto_id != NULL) {
 		PurplePlugin *proto;
-		proto = purple_find_prpl (proto_id);
+		proto = purple_find_prpl(proto_id);
 		proto_name = proto->info->name;
 	}
 
 	/* unnecessarily slow, but lets manage for now. */
-	for (; smileys; smileys = g_list_next (smileys)) {
-		temp2 = parse_for_purple_smiley (temp, PURPLE_SMILEY (smileys->data));
-		g_free (temp);
+	for (; smileys; smileys = g_list_next(smileys)) {
+		temp2 = parse_for_purple_smiley(temp, PURPLE_SMILEY(smileys->data));
+		g_free(temp);
 		temp = temp2;
 	}
 
 	/* now for each theme smiley, observe that this does look nasty */
-	
 	if (!current_smiley_theme || !(current_smiley_theme->list)) {
-		printf ("theme does not exist\n");
+		purple_debug_warning("smiley", "theme does not exist\n");
 		return temp;
 	}
 
 	for (list = current_smiley_theme->list; list; list = list->next) {
-		if (g_str_equal (list->sml, proto_name)) {
-			temp2 = parse_for_smiley_list (temp, list->files);
-			g_free (temp);
+		if (g_str_equal(list->sml, proto_name)) {
+			temp2 = parse_for_smiley_list(temp, list->files);
+			g_free(temp);
 			temp = temp2;
 		}
 	}
============================================================
--- pidgin/smileyparser.h	a550c6ff5006870418f7aaf8bad73c2220c0773d
+++ pidgin/smileyparser.h	9a8fbab8a1527913561f61677b46d143e5232437
@@ -1,3 +1,25 @@
+/* pidgin
+ *
+ * Pidgin is the legal property of its developers, whose names are too numerous
+ * to list here.  Please refer to the COPYRIGHT file distributed with this
+ * source distribution.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02111-1301  USA
+ *
+ */
 
-char*
-smiley_parse_markup (const char* markup, const char* sml);
+char *
+smiley_parse_markup(const char *markup, const char *sml);
+
============================================================
--- pidgin/plugins/adiumthemes/message-style.c	3ddc889613a20911f1554099dd1a004fc8ec84cf
+++ pidgin/plugins/adiumthemes/message-style.c	946c46be8c5ae196cbbf52794acae500bb391bcb
@@ -1,21 +1,23 @@
-/*
- * Adium Message Styles
- * Copyright (C) 2009  Arnold Noronha <arnstein87 at gmail.com>
+/* pidgin
  *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License as
- * published by the Free Software Foundation; either version 2 of the
- * License, or (at your option) any later version.
+ * Pidgin is the legal property of its developers, whose names are too numerous
+ * to list here.  Please refer to the COPYRIGHT file distributed with this
+ * source distribution.
  *
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * General Public License for more details.
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
  *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
  * You should have received a copy of the GNU General Public License
  * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
- * 02111-1307, USA.
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02111-1301  USA
+ *
  */
 
 #include "message-style.h"
@@ -28,42 +30,42 @@ static void
 #include <util.h>
 
 static void
-glist_free_all_string (GList *list)
+glist_free_all_string(GList *list)
 {
 	GList *first = list;
-	for (; list; list = g_list_next (list)) 
-		g_free (list->data);
-	g_list_free (first);
+	for (; list; list = g_list_next(list))
+		g_free(list->data);
+	g_list_free(first);
 }
 
-static
-PidginMessageStyle* pidgin_message_style_new (const char* styledir)
+static PidginMessageStyle *
+pidgin_message_style_new(const char *styledir)
 {
-	PidginMessageStyle* ret = g_new0 (PidginMessageStyle, 1);
+	PidginMessageStyle *ret = g_new0(PidginMessageStyle, 1);
 
 	ret->ref_counter = 1;
-	ret->style_dir = g_strdup (styledir);
-	
+	ret->style_dir = g_strdup(styledir);
+
 	return ret;
 }
 
 /**
- * deallocate any memory used for info.plist options 
+ * deallocate any memory used for info.plist options
  */
 static void
-pidgin_message_style_unset_info_plist (PidginMessageStyle *style)
+pidgin_message_style_unset_info_plist(PidginMessageStyle *style)
 {
 	style->message_view_version = 0;
-	g_free (style->cf_bundle_name);
+	g_free(style->cf_bundle_name);
 	style->cf_bundle_name = NULL;
 
-	g_free (style->cf_bundle_identifier);
+	g_free(style->cf_bundle_identifier);
 	style->cf_bundle_identifier = NULL;
 
-	g_free (style->cf_bundle_get_info_string);
+	g_free(style->cf_bundle_get_info_string);
 	style->cf_bundle_get_info_string = NULL;
 
-	g_free (style->default_font_family);
+	g_free(style->default_font_family);
 	style->default_font_family = NULL;
 
 	style->default_font_size = 0;
@@ -72,112 +74,127 @@ pidgin_message_style_unset_info_plist (P
 	style->default_background_is_transparent = FALSE;
 	style->disable_custom_background = FALSE;
 
-	g_free (style->default_background_color);
+	g_free(style->default_background_color);
 	style->default_background_color = NULL;
-	
+
 	style->allow_text_colors = TRUE;
-	
-	g_free (style->image_mask);
+
+	g_free(style->image_mask);
 	style->image_mask = NULL;
-	g_free (style->default_variant);
+	g_free(style->default_variant);
 	style->default_variant = NULL;
 }
 
 
-void pidgin_message_style_unref (PidginMessageStyle *style)
+void
+pidgin_message_style_unref(PidginMessageStyle *style)
 {
-	if (!style) return;
+	if (!style)
+		return;
 	g_assert (style->ref_counter > 0);
 
 	style->ref_counter--;
-	if (style->ref_counter) return;
+	if (style->ref_counter)
+		return;
 
-	g_free (style->style_dir);
-	g_free (style->template_path);
-	
-	g_free (style->template_html);
-	g_free (style->incoming_content_html);
-	g_free (style->outgoing_content_html);
-	g_free (style->outgoing_next_content_html);
-	g_free (style->status_html);
-	g_free (style->basestyle_css);
+	g_free(style->style_dir);
+	g_free(style->template_path);
 
-	g_free (style);
+	g_free(style->template_html);
+	g_free(style->incoming_content_html);
+	g_free(style->outgoing_content_html);
+	g_free(style->outgoing_next_content_html);
+	g_free(style->status_html);
+	g_free(style->basestyle_css);
 
-	pidgin_message_style_unset_info_plist (style);
+	g_free(style);
+
+	pidgin_message_style_unset_info_plist(style);
 }
 
 void
-pidgin_message_style_save_state (const PidginMessageStyle *style)
+pidgin_message_style_save_state(const PidginMessageStyle *style)
 {
-	char *prefname = g_strdup_printf ("/plugins/gtk/adiumthemes/%s", style->cf_bundle_identifier);
-	char *variant = g_strdup_printf ("%s/variant", prefname);
+	char *prefname = g_strdup_printf("/plugins/gtk/adiumthemes/%s", style->cf_bundle_identifier);
+	char *variant = g_strdup_printf("%s/variant", prefname);
 
-	purple_debug_info ("webkit", "saving state with variant %s\n", style->variant);
-	purple_prefs_add_none (prefname);
-	purple_prefs_add_string (variant, "");
-	purple_prefs_set_string (variant, style->variant);
-	
-	g_free (prefname);
-	g_free (variant);
+	purple_debug_info("webkit", "saving state with variant %s\n", style->variant);
+	purple_prefs_add_none(prefname);
+	purple_prefs_add_string(variant, "");
+	purple_prefs_set_string(variant, style->variant);
+
+	g_free(prefname);
+	g_free(variant);
 }
 
 static void
-pidgin_message_style_load_state (PidginMessageStyle *style)
+pidgin_message_style_load_state(PidginMessageStyle *style)
 {
-	char *prefname = g_strdup_printf ("/plugins/gtk/adiumthemes/%s", style->cf_bundle_identifier);
-	char *variant = g_strdup_printf ("%s/variant", prefname);
+	char *prefname = g_strdup_printf("/plugins/gtk/adiumthemes/%s", style->cf_bundle_identifier);
+	char *variant = g_strdup_printf("%s/variant", prefname);
 
-	const char* value = purple_prefs_get_string (variant);
-	gboolean changed = !style->variant || !g_str_equal (style->variant, value);
+	const char* value = purple_prefs_get_string(variant);
+	gboolean changed = !style->variant || !g_str_equal(style->variant, value);
 
-	g_free (style->variant);
-	style->variant = g_strdup (value);
+	g_free(style->variant);
+	style->variant = g_strdup(value);
 
-	if (changed) pidgin_message_style_read_info_plist (style, style->variant);
+	if (changed)
+		pidgin_message_style_read_info_plist(style, style->variant);
 
-	g_free (prefname);
+	g_free(prefname);
 	g_free(variant);
 }
 
 
 static gboolean
-parse_info_plist_key_value (xmlnode* key, gpointer destination, const char* expected)
+parse_info_plist_key_value(xmlnode* key, gpointer destination, const char* expected)
 {
 	xmlnode *val = key->next;
 
-	for (; val && val->type != XMLNODE_TYPE_TAG; val = val->next);
-	if (!val) return FALSE;
-	
-	if (expected == NULL || g_str_equal (expected, "string")) {
-		char** dest = (char**) destination;
-		if (!g_str_equal (val->name, "string")) return FALSE;
-		if (*dest) g_free (*dest);
-		*dest = xmlnode_get_data_unescaped (val);
-	} else if (g_str_equal (expected, "integer")) {
-		int* dest = (int*) destination;
-		char* value = xmlnode_get_data_unescaped (val);
+	for (; val && val->type != XMLNODE_TYPE_TAG; val = val->next)
+		;
+	if (!val)
+		return FALSE;
 
-		if (!g_str_equal (val->name, "integer")) return FALSE;
-		*dest = atoi (value);
-		g_free (value);
-	} else if (g_str_equal (expected, "boolean")) {
-		gboolean *dest = (gboolean*) destination;
-		if (g_str_equal (val->name, "true")) *dest = TRUE;
-		else if (g_str_equal (val->name, "false")) *dest = FALSE;
-		else return FALSE;
+	if (expected == NULL || g_str_equal(expected, "string")) {
+		char **dest = (char **)destination;
+		if (!g_str_equal(val->name, "string"))
+			return FALSE;
+		if (*dest)
+			g_free(*dest);
+		*dest = xmlnode_get_data_unescaped(val);
+	} else if (g_str_equal(expected, "integer")) {
+		int *dest = (int *)destination;
+		char *value = xmlnode_get_data_unescaped(val);
+
+		if (!g_str_equal(val->name, "integer"))
+			return FALSE;
+		*dest = atoi(value);
+		g_free(value);
+	} else if (g_str_equal(expected, "boolean")) {
+		gboolean *dest = (gboolean *)destination;
+		if (g_str_equal(val->name, "true"))
+			*dest = TRUE;
+		else if (g_str_equal(val->name, "false"))
+			*dest = FALSE;
+		else
+			return FALSE;
 	} else return FALSE;
-	
+
 	return TRUE;
 }
 
-static
-gboolean str_for_key (const char *key, const char *found, const char *variant){
-	if (g_str_equal (key, found)) return TRUE;
-	if (!variant) return FALSE;
-	return (g_str_has_prefix (found, key) 
-		&& g_str_has_suffix (found, variant)
-		&& strlen (found) == strlen (key) + strlen (variant) + 1);
+static gboolean
+str_for_key(const char *key, const char *found, const char *variant)
+{
+	if (g_str_equal(key, found))
+		return TRUE;
+	if (!variant)
+		return FALSE;
+	return (g_str_has_prefix(found, key)
+		&& g_str_has_suffix(found, variant)
+		&& strlen(found) == strlen(key) + strlen(variant) + 1);
 }
 
 /**
@@ -185,55 +202,55 @@ void
  * the keys that take precedence depend on the value of the current variant.
  */
 void
-pidgin_message_style_read_info_plist (PidginMessageStyle *style, const char* variant)
+pidgin_message_style_read_info_plist(PidginMessageStyle *style, const char *variant)
 {
 	/* note that if a variant is used the option:VARIANTNAME takes precedence */
-	char *contents = g_build_filename (style->style_dir, "Contents", NULL);
-	xmlnode *plist = xmlnode_from_file (contents, "Info.plist", "Info.plist", "webkit"), *iter;
-	xmlnode *dict = xmlnode_get_child (plist, "dict");
+	char *contents = g_build_filename(style->style_dir, "Contents", NULL);
+	xmlnode *plist = xmlnode_from_file(contents, "Info.plist", "Info.plist", "webkit"), *iter;
+	xmlnode *dict = xmlnode_get_child(plist, "dict");
 
 	g_assert (dict);
-	for (iter = xmlnode_get_child (dict, "key"); iter; iter = xmlnode_get_next_twin (iter)) {
-		char* key = xmlnode_get_data_unescaped (iter);
+	for (iter = xmlnode_get_child(dict, "key"); iter; iter = xmlnode_get_next_twin(iter)) {
+		char* key = xmlnode_get_data_unescaped(iter);
 		gboolean pr = TRUE;
 
-		if (g_str_equal ("MessageViewVersion", key)) 
-			pr = parse_info_plist_key_value (iter, &style->message_view_version, "integer");
-		else if (g_str_equal ("CFBundleName", key))
-			pr = parse_info_plist_key_value (iter, &style->cf_bundle_name, "string");
-		else if (g_str_equal ("CFBundleIdentifier", key))
-			pr = parse_info_plist_key_value (iter, &style->cf_bundle_identifier, "string");
-		else if (g_str_equal ("CFBundleGetInfoString", key))
-			pr = parse_info_plist_key_value (iter, &style->cf_bundle_get_info_string, "string");
-		else if (str_for_key ("DefaultFontFamily", key, variant))
-			pr = parse_info_plist_key_value (iter, &style->default_font_family, "string");
-		else if (str_for_key ("DefaultFontSize", key, variant))
-			pr = parse_info_plist_key_value (iter, &style->default_font_size, "integer");
-		else if (str_for_key ("ShowsUserIcons", key, variant))
-			pr = parse_info_plist_key_value (iter, &style->shows_user_icons, "boolean");
-		else if (str_for_key ("DisableCombineConsecutive", key, variant))
-			pr = parse_info_plist_key_value (iter, &style->disable_combine_consecutive, "boolean");
-		else if (str_for_key ("DefaultBackgroundIsTransparent", key, variant))
-			pr = parse_info_plist_key_value (iter, &style->default_background_is_transparent, "boolean");
-		else if (str_for_key ("DisableCustomBackground", key, variant))
-			pr = parse_info_plist_key_value (iter, &style->disable_custom_background, "boolean");
-		else if (str_for_key ("DefaultBackgroundColor", key, variant))
-			pr = parse_info_plist_key_value (iter, &style->default_background_color, "string");
-		else if (str_for_key ("AllowTextColors", key, variant))
-			pr = parse_info_plist_key_value (iter, &style->allow_text_colors, "integer");
-		else if (str_for_key ("ImageMask", key, variant))
-			pr = parse_info_plist_key_value (iter, &style->image_mask, "string");
+		if (g_str_equal("MessageViewVersion", key))
+			pr = parse_info_plist_key_value(iter, &style->message_view_version, "integer");
+		else if (g_str_equal("CFBundleName", key))
+			pr = parse_info_plist_key_value(iter, &style->cf_bundle_name, "string");
+		else if (g_str_equal("CFBundleIdentifier", key))
+			pr = parse_info_plist_key_value(iter, &style->cf_bundle_identifier, "string");
+		else if (g_str_equal("CFBundleGetInfoString", key))
+			pr = parse_info_plist_key_value(iter, &style->cf_bundle_get_info_string, "string");
+		else if (str_for_key("DefaultFontFamily", key, variant))
+			pr = parse_info_plist_key_value(iter, &style->default_font_family, "string");
+		else if (str_for_key("DefaultFontSize", key, variant))
+			pr = parse_info_plist_key_value(iter, &style->default_font_size, "integer");
+		else if (str_for_key("ShowsUserIcons", key, variant))
+			pr = parse_info_plist_key_value(iter, &style->shows_user_icons, "boolean");
+		else if (str_for_key("DisableCombineConsecutive", key, variant))
+			pr = parse_info_plist_key_value(iter, &style->disable_combine_consecutive, "boolean");
+		else if (str_for_key("DefaultBackgroundIsTransparent", key, variant))
+			pr = parse_info_plist_key_value(iter, &style->default_background_is_transparent, "boolean");
+		else if (str_for_key("DisableCustomBackground", key, variant))
+			pr = parse_info_plist_key_value(iter, &style->disable_custom_background, "boolean");
+		else if (str_for_key("DefaultBackgroundColor", key, variant))
+			pr = parse_info_plist_key_value(iter, &style->default_background_color, "string");
+		else if (str_for_key("AllowTextColors", key, variant))
+			pr = parse_info_plist_key_value(iter, &style->allow_text_colors, "integer");
+		else if (str_for_key("ImageMask", key, variant))
+			pr = parse_info_plist_key_value(iter, &style->image_mask, "string");
 
 		if (!pr)
-			purple_debug_warning ("webkit", "Failed to parse key %s\n", key);
-		g_free (key);
+			purple_debug_warning("webkit", "Failed to parse key %s\n", key);
+		g_free(key);
 	}
 
-	xmlnode_free (plist);
+	xmlnode_free(plist);
 }
 
-PidginMessageStyle*
-pidgin_message_style_load (const char* styledir)
+PidginMessageStyle *
+pidgin_message_style_load(const char *styledir)
 {
 	/*
 	 * the loading process described:
@@ -247,14 +264,11 @@ pidgin_message_style_load (const char* s
 	 * and if that does not exist, we choose the first one in the
 	 * directory.
 	 */
-	
-	/* is this style already loaded? */
-	char   *file; /* temporary variable */
+	char *file;
 	PidginMessageStyle *style = NULL;
 
-	/* else we need to load it */
-	style = pidgin_message_style_new (styledir);
-	
+	style = pidgin_message_style_new(styledir);
+
 	/* load all other files */
 
 	/* The template path can either come from the theme, or can
@@ -262,187 +276,187 @@ pidgin_message_style_load (const char* s
 	style->template_path = g_build_filename(styledir, "Contents", "Resources", "Template.html", NULL);
 
 	if (!g_file_test(style->template_path, G_FILE_TEST_EXISTS)) {
-		g_free (style->template_path);
+		g_free(style->template_path);
 		style->template_path = g_build_filename(DATADIR, "pidgin", "webkit", "Template.html", NULL);
 	}
 
 	if (!g_file_get_contents(style->template_path, &style->template_html, NULL, NULL)) {
-		purple_debug_error ("webkit", "Could not locate a Template.html (%s)\n", style->template_path);
-		pidgin_message_style_unref (style);
+		purple_debug_error("webkit", "Could not locate a Template.html (%s)\n", style->template_path);
+		pidgin_message_style_unref(style);
 		return NULL;
 	}
 
 	file = g_build_filename(styledir, "Contents", "Resources", "Status.html", NULL);
 	if (!g_file_get_contents(file, &style->status_html, NULL, NULL)) {
-		purple_debug_info ("webkit", "%s could not find Resources/Status.html", styledir);
-		pidgin_message_style_unref (style);
-		g_free (file);
+		purple_debug_info("webkit", "%s could not find Resources/Status.html", styledir);
+		pidgin_message_style_unref(style);
+		g_free(file);
 		return NULL;
 	}
-	g_free (file);
+	g_free(file);
 
 	file = g_build_filename(styledir, "Contents", "Resources", "main.css", NULL);
 	if (!g_file_get_contents(file, &style->basestyle_css, NULL, NULL))
-		style->basestyle_css = g_strdup ("");
-	g_free (file);
-	
+		style->basestyle_css = g_strdup("");
+	g_free(file);
+
 	file = g_build_filename(styledir, "Contents", "Resources", "Header.html", NULL);
 	if (!g_file_get_contents(file, &style->header_html, NULL, NULL))
-		style->header_html = g_strdup ("");
-	g_free (file);
+		style->header_html = g_strdup("");
+	g_free(file);
 
 	file = g_build_filename(styledir, "Contents", "Resources", "Footer.html", NULL);
 	if (!g_file_get_contents(file, &style->footer_html, NULL, NULL))
-		style->footer_html = g_strdup ("");
-	g_free (file);
+		style->footer_html = g_strdup("");
+	g_free(file);
 
 	file = g_build_filename(styledir, "Contents", "Resources", "Incoming", "Content.html", NULL);
 	if (!g_file_get_contents(file, &style->incoming_content_html, NULL, NULL)) {
-		purple_debug_info ("webkit", "%s did not have a Incoming/Content.html\n", styledir);
-		pidgin_message_style_unref (style);
-		g_free (file);
+		purple_debug_info("webkit", "%s did not have a Incoming/Content.html\n", styledir);
+		pidgin_message_style_unref(style);
+		g_free(file);
 		return NULL;
 	}
-	g_free (file);
+	g_free(file);
 
 
 	/* according to the spec, the following are optional files */
 	file = g_build_filename(styledir, "Contents", "Resources", "Incoming", "NextContent.html", NULL);
 	if (!g_file_get_contents(file, &style->incoming_next_content_html, NULL, NULL)) {
-		style->incoming_next_content_html = g_strdup (style->incoming_content_html);
+		style->incoming_next_content_html = g_strdup(style->incoming_content_html);
 	}
-	g_free (file);
+	g_free(file);
 
 	file = g_build_filename(styledir, "Contents", "Resources", "Outgoing", "Content.html", NULL);
 	if (!g_file_get_contents(file, &style->outgoing_content_html, NULL, NULL)) {
 		style->outgoing_content_html = g_strdup(style->incoming_content_html);
 	}
-	g_free (file);
+	g_free(file);
 
 	file = g_build_filename(styledir, "Contents", "Resources", "Outgoing", "NextContent.html", NULL);
 	if (!g_file_get_contents(file, &style->outgoing_next_content_html, NULL, NULL)) {
-		style->outgoing_next_content_html = g_strdup (style->outgoing_content_html);
+		style->outgoing_next_content_html = g_strdup(style->outgoing_content_html);
 	}
 
-	pidgin_message_style_read_info_plist (style, NULL);
-	pidgin_message_style_load_state (style);
+	pidgin_message_style_read_info_plist(style, NULL);
+	pidgin_message_style_load_state(style);
 
 	/* non variant dependent Info.plist checks */
 	if (style->message_view_version < 3) {
-		purple_debug_info ("webkit", "%s is a legacy style (version %d) and will not be loaded\n", style->cf_bundle_name, style->message_view_version);
-		pidgin_message_style_unref (style);
+		purple_debug_info("webkit", "%s is a legacy style (version %d) and will not be loaded\n", style->cf_bundle_name, style->message_view_version);
+		pidgin_message_style_unref(style);
 		return NULL;
 	}
 
 	if (!style->variant)
 	{
-		GList *variants = pidgin_message_style_get_variants (style);
+		GList *variants = pidgin_message_style_get_variants(style);
 
 		if (variants)
-			pidgin_message_style_set_variant (style, variants->data);
+			pidgin_message_style_set_variant(style, variants->data);
 
-		glist_free_all_string (variants);
+		glist_free_all_string(variants);
 	}
 
 	return style;
 }
 
-PidginMessageStyle*
-pidgin_message_style_copy (const PidginMessageStyle *style)
+PidginMessageStyle *
+pidgin_message_style_copy(const PidginMessageStyle *style)
 {
-	/* it's at times like this that I miss C++ */
-	PidginMessageStyle *ret = pidgin_message_style_new (style->style_dir);
+	PidginMessageStyle *ret = pidgin_message_style_new(style->style_dir);
 
-	ret->variant = g_strdup (style->variant);
+	ret->variant = g_strdup(style->variant);
 	ret->message_view_version = style->message_view_version;
-	ret->cf_bundle_name = g_strdup (style->cf_bundle_name);
-	ret->cf_bundle_identifier = g_strdup (style->cf_bundle_identifier);
-	ret->cf_bundle_get_info_string = g_strdup (style->cf_bundle_get_info_string);
-	ret->default_font_family = g_strdup (style->default_font_family);
+	ret->cf_bundle_name = g_strdup(style->cf_bundle_name);
+	ret->cf_bundle_identifier = g_strdup(style->cf_bundle_identifier);
+	ret->cf_bundle_get_info_string = g_strdup(style->cf_bundle_get_info_string);
+	ret->default_font_family = g_strdup(style->default_font_family);
 	ret->default_font_size = style->default_font_size;
 	ret->shows_user_icons = style->shows_user_icons;
 	ret->disable_combine_consecutive = style->disable_combine_consecutive;
 	ret->default_background_is_transparent = style->default_background_is_transparent;
 	ret->disable_custom_background = style->disable_custom_background;
-	ret->default_background_color = g_strdup (style->default_background_color);
+	ret->default_background_color = g_strdup(style->default_background_color);
 	ret->allow_text_colors = style->allow_text_colors;
-	ret->image_mask = g_strdup (style->image_mask);
-	ret->default_variant = g_strdup (style->default_variant);
-	
-	ret->template_path = g_strdup (style->template_path);
-	ret->template_html = g_strdup (style->template_html);
-	ret->header_html = g_strdup (style->header_html);
-	ret->footer_html = g_strdup (style->footer_html);
-	ret->incoming_content_html = g_strdup (style->incoming_content_html);
-	ret->outgoing_content_html = g_strdup (style->outgoing_content_html);
-	ret->incoming_next_content_html = g_strdup (style->incoming_next_content_html);
-	ret->outgoing_next_content_html = g_strdup (style->outgoing_next_content_html);
-	ret->status_html = g_strdup (style->status_html);
-	ret->basestyle_css = g_strdup (style->basestyle_css);
+	ret->image_mask = g_strdup(style->image_mask);
+	ret->default_variant = g_strdup(style->default_variant);
+
+	ret->template_path = g_strdup(style->template_path);
+	ret->template_html = g_strdup(style->template_html);
+	ret->header_html = g_strdup(style->header_html);
+	ret->footer_html = g_strdup(style->footer_html);
+	ret->incoming_content_html = g_strdup(style->incoming_content_html);
+	ret->outgoing_content_html = g_strdup(style->outgoing_content_html);
+	ret->incoming_next_content_html = g_strdup(style->incoming_next_content_html);
+	ret->outgoing_next_content_html = g_strdup(style->outgoing_next_content_html);
+	ret->status_html = g_strdup(style->status_html);
+	ret->basestyle_css = g_strdup(style->basestyle_css);
 	return ret;
 }
 
 void
-pidgin_message_style_set_variant (PidginMessageStyle *style, const char *variant)
+pidgin_message_style_set_variant(PidginMessageStyle *style, const char *variant)
 {
 	/* I'm not going to test whether this variant is valid! */
-	g_free (style->variant);
-	style->variant = g_strdup (variant);
+	g_free(style->variant);
+	style->variant = g_strdup(variant);
 
-	pidgin_message_style_read_info_plist (style, variant);
-	
+	pidgin_message_style_read_info_plist(style, variant);
+
 	/* todo, the style has "changed". Ideally, I would like to use signals at this point. */
 }
 
-char* pidgin_message_style_get_variant (PidginMessageStyle *style)
+char *
+pidgin_message_style_get_variant(PidginMessageStyle *style)
 {
-	return g_strdup (style->variant);
+	return g_strdup(style->variant);
 }
 
 /**
  * Get a list of variants supported by the style.
  */
 GList*
-pidgin_message_style_get_variants (PidginMessageStyle *style) 
+pidgin_message_style_get_variants(PidginMessageStyle *style)
 {
 	GList *ret = NULL;
-        GDir *variants;
+	GDir *variants;
 	const char *css_file;
 	char *css;
 	char *variant_dir;
 
-	g_assert (style->style_dir);
+	g_assert(style->style_dir);
 	variant_dir = g_build_filename(style->style_dir, "Contents", "Resources", "Variants", NULL);
 
 	variants = g_dir_open(variant_dir, 0, NULL);
-	if (!variants) return NULL;
+	if (!variants)
+		return NULL;
 
 	while ((css_file = g_dir_read_name(variants)) != NULL) {
-		if (!g_str_has_suffix (css_file, ".css"))
+		if (!g_str_has_suffix(css_file, ".css"))
 			continue;
 
-		css = g_strndup (css_file, strlen (css_file) - 4);
+		css = g_strndup(css_file, strlen(css_file) - 4);
 		ret = g_list_append(ret, css);
 	}
 
 	g_dir_close(variants);
 	g_free(variant_dir);
 
-	ret = g_list_sort (ret, (GCompareFunc)g_strcmp0);
-	return ret;	
+	ret = g_list_sort(ret, (GCompareFunc)g_strcmp0);
+	return ret;
 }
 
-
-char* pidgin_message_style_get_css (PidginMessageStyle *style)
+char *
+pidgin_message_style_get_css(PidginMessageStyle *style)
 {
 	if (!style->variant) {
-		return g_build_filename (style->style_dir, "Contents", "Resources", "main.css", NULL);
+		return g_build_filename(style->style_dir, "Contents", "Resources", "main.css", NULL);
 	} else {
-		char *file = g_strdup_printf ("%s.css", style->variant);
-		char *ret = g_build_filename (style->style_dir, "Contents", "Resources", "Variants",  file, NULL);
-		g_free (file);
+		char *file = g_strdup_printf("%s.css", style->variant);
+		char *ret = g_build_filename(style->style_dir, "Contents", "Resources", "Variants",  file, NULL);
+		g_free(file);
 		return ret;
 	}
 }
 
-
============================================================
--- pidgin/plugins/adiumthemes/message-style.h	4132245016bbddc113fd6c227f839b56ad08e6f9
+++ pidgin/plugins/adiumthemes/message-style.h	9a6f59c65bf73047e1c41bc11c2d0821df1028cb
@@ -1,3 +1,24 @@
+/* pidgin
+ *
+ * Pidgin is the legal property of its developers, whose names are too numerous
+ * to list here.  Please refer to the COPYRIGHT file distributed with this
+ * source distribution.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02111-1301  USA
+ *
+ */
 
 #include <glib.h>
 
@@ -47,13 +68,14 @@ typedef struct _PidginMessageStyle {
 	char    *basestyle_css;
 } PidginMessageStyle;
 
-PidginMessageStyle* pidgin_message_style_load (const char* styledir);
-PidginMessageStyle* pidgin_message_style_copy (const PidginMessageStyle *style);
-void pidgin_message_style_save_state (const PidginMessageStyle *style);
-void pidgin_message_style_unref (PidginMessageStyle *style);
-void pidgin_message_style_read_info_plist (PidginMessageStyle *style, const char* variant);
-char* pidgin_message_style_get_variant (PidginMessageStyle *style);
-GList* pidgin_message_style_get_variants (PidginMessageStyle *style);
-void pidgin_message_style_set_variant (PidginMessageStyle *style, const char *variant);
+PidginMessageStyle *pidgin_message_style_load(const char *styledir);
+PidginMessageStyle *pidgin_message_style_copy(const PidginMessageStyle *style);
+void pidgin_message_style_save_state(const PidginMessageStyle *style);
+void pidgin_message_style_unref(PidginMessageStyle *style);
+void pidgin_message_style_read_info_plist(PidginMessageStyle *style, const char *variant);
+char *pidgin_message_style_get_variant(PidginMessageStyle *style);
+GList *pidgin_message_style_get_variants(PidginMessageStyle *style);
+void pidgin_message_style_set_variant(PidginMessageStyle *style, const char *variant);
 
-char* pidgin_message_style_get_css (PidginMessageStyle *style);
+char *pidgin_message_style_get_css(PidginMessageStyle *style);
+


More information about the Commits mailing list