All pastes #1682507 Raw Edit

zhuravlik

public diff v1 · immutable
#1682507 ·published 2009-11-22 17:34 UTC
rendered paste body
diff -Nur ./freedcpp.orig/linux/hub.cc ./freedcpp/linux/hub.cc--- ./freedcpp.orig/linux/hub.cc	2009-11-21 16:59:27.000000000 +0300+++ ./freedcpp/linux/hub.cc	2009-11-21 21:32:26.000000000 +0300@@ -118,6 +118,7 @@ 	g_signal_connect(getWidget("browseItem"), "activate", G_CALLBACK(onBrowseItemClicked_gui), (gpointer)this); 	g_signal_connect(getWidget("matchItem"), "activate", G_CALLBACK(onMatchItemClicked_gui), (gpointer)this); 	g_signal_connect(getWidget("msgItem"), "activate", G_CALLBACK(onMsgItemClicked_gui), (gpointer)this);+	g_signal_connect(getWidget("pmsgItem"), "activate", G_CALLBACK(onPublicMsgItemClicked_gui), (gpointer)this); 	g_signal_connect(getWidget("grantItem"), "activate", G_CALLBACK(onGrantItemClicked_gui), (gpointer)this); 	g_signal_connect(getWidget("copyLinkItem"), "activate", G_CALLBACK(onCopyURIClicked_gui), (gpointer)this); 	g_signal_connect(getWidget("openLinkItem"), "activate", G_CALLBACK(onOpenLinkClicked_gui), (gpointer)this);@@ -135,7 +136,7 @@ 	gint panePosition = WGETI("nick-pane-position"); 	if (panePosition > 10) 	{-		gint width;+		gint width, height; 		GtkWindow *window = GTK_WINDOW(WulforManager::get()->getMainWindow()->getContainer()); 		gtk_window_get_size(window, &width, NULL); 		gtk_paned_set_position(GTK_PANED(getWidget("pane")), width - panePosition);@@ -172,6 +173,10 @@ { 	disconnect_client(); +	unordered_map<string, GdkPixbuf *>::iterator it;+	for (it = userIcons.begin(); it != userIcons.end(); ++it)+		g_object_unref(G_OBJECT(it->second));+ 	// Save the pane position 	gint width; 	GtkWindow *window = GTK_WINDOW(WulforManager::get()->getMainWindow()->getContainer());@@ -180,6 +185,9 @@ 	if (panePosition > 10) 		WSET("nick-pane-position", panePosition); +	WSET("chat-window-visible", GTK_WIDGET_VISIBLE(getWidget("chatScroll")));++ 	gtk_widget_destroy(getWidget("passwordDialog"));  	if (handCursor)@@ -259,6 +267,7 @@ 		gtk_list_store_set(nickStore, &iter, 			nickView.col("Nick"), params["Nick"].c_str(), 			nickView.col("Shared"), shared,+			nickView.col("IP"), params["IP"].c_str(), 			nickView.col("Description"), params["Description"].c_str(), 			nickView.col("Tag"), params["Tag"].c_str(),  			nickView.col("Connection"), params["Connection"].c_str(),@@ -290,6 +299,7 @@ 		gtk_list_store_insert_with_values(nickStore, &iter, userMap.size(), 			nickView.col("Nick"), params["Nick"].c_str(), 			nickView.col("Shared"), shared,+			nickView.col("IP"), params["IP"].c_str(), 			nickView.col("Description"), params["Description"].c_str(), 			nickView.col("Tag"), params["Tag"].c_str(),  			nickView.col("Connection"), params["Connection"].c_str(),@@ -999,6 +1009,7 @@ 				return TRUE; 		} 	}+	  	return FALSE; }@@ -1454,6 +1465,29 @@ 			else 				gtk_widget_show_all(hub->getWidget("scrolledwindow2")); 		}+		else if (command == _("chat"))+		{+			if (GTK_WIDGET_VISIBLE(hub->getWidget("chatScroll")))+				gtk_widget_hide(hub->getWidget("chatScroll"));+			else+				gtk_widget_show_all(hub->getWidget("chatScroll"));+		}+		else if (command == _("exec"))+		{+			FILE *pipe = popen( param.c_str(), "r" );+			gchar* cmd_result;+			gsize lennn = 0;+			GIOChannel* gioc = g_io_channel_unix_new(fileno(pipe));+			GIOStatus sttt = g_io_channel_read_to_end(gioc, &cmd_result, &lennn, NULL);+			if (sttt == G_IO_STATUS_NORMAL)+			{+				F2 *func = new F2( hub, &Hub::sendMessage_client, string(cmd_result), true );+				WulforManager::get()->dispatchClientFunc(func);+			}+			g_io_channel_close(gioc);+			g_free(cmd_result);+			pclose(pipe);+		}							 		else if (BOOLSETTING(SEND_UNKNOWN_COMMANDS)) 		{ 			func2 = new F2(hub, &Hub::sendMessage_client, text, false);@@ -1472,6 +1506,41 @@ 	} } +void Hub::onPublicMsgItemClicked_gui(GtkMenuItem *item, gpointer data)+{+	Hub *hub = (Hub *)data;++	if (gtk_tree_selection_count_selected_rows(hub->nickSelection) > 0)+	{+		string nicks;+		GtkTreeIter iter;+		GtkTreePath *path;+		GList *list = gtk_tree_selection_get_selected_rows(hub->nickSelection, NULL);++		for (GList *i = list; i; i = i->next)+		{+			path = (GtkTreePath *)i->data;+			if (gtk_tree_model_get_iter(GTK_TREE_MODEL(hub->nickStore), &iter, path))+			{+				nicks += hub->nickView.getString(&iter, "Nick") + ' ';+			}+			gtk_tree_path_free(path);+		}+		g_list_free(list);++		if (!nicks.empty())+		{+			nicks.erase(nicks.length() - 1);+			nicks += ": ";+			gint tmp_pos = gtk_editable_get_position( GTK_EDITABLE( hub->getWidget("chatEntry") ));+			gtk_editable_insert_text(GTK_EDITABLE(hub->getWidget("chatEntry")), nicks.c_str(), -1, &tmp_pos);+			gtk_widget_grab_focus(hub->getWidget("chatEntry"));+			gtk_editable_set_position(GTK_EDITABLE(hub->getWidget("chatEntry")), tmp_pos);+		}+	}+}+										+ void Hub::onCopyNickItemClicked_gui(GtkMenuItem *item, gpointer data) { 	Hub *hub = (Hub *)data;@@ -1923,6 +1992,7 @@ 	params["Connection"] = id.getConnection(); 	params["eMail"] = id.getEmail(); 	params["CID"] = id.getUser()->getCID().toBase32();+	params["IP"] = id.getIp(); }  void Hub::on(ClientListener::Connecting, Client *) throw()diff -Nur ./freedcpp.orig/linux/hub.hh ./freedcpp/linux/hub.hh--- ./freedcpp.orig/linux/hub.hh	2009-11-21 16:59:27.000000000 +0300+++ ./freedcpp/linux/hub.hh	2009-11-21 19:53:39.000000000 +0300@@ -109,6 +109,7 @@ 		static void onBrowseItemClicked_gui(GtkMenuItem *item, gpointer data); 		static void onMatchItemClicked_gui(GtkMenuItem *item, gpointer data); 		static void onMsgItemClicked_gui(GtkMenuItem *item, gpointer data);+		static void onPublicMsgItemClicked_gui(GtkMenuItem *item, gpointer data); 		static void onGrantItemClicked_gui(GtkMenuItem *item, gpointer data); 		static void onRemoveUserItemClicked_gui(GtkMenuItem *item, gpointer data); 		static void onCopyURIClicked_gui(GtkMenuItem *item, gpointer data);@@ -150,6 +151,7 @@ 		virtual void on(dcpp::ClientListener::SearchFlood, dcpp::Client *, const std::string &message) throw();  		std::tr1::unordered_map<std::string, std::string> userMap;+		std::tr1::unordered_map<std::string, GdkPixbuf *> userIcons; 		std::tr1::unordered_map<std::string, GtkTreeIter> userIters; 		GtkTextTag *TagsMap[TAG_LAST]; 		std::string completionKey;@@ -158,6 +160,7 @@ 		GtkListStore *nickStore; 		GtkTreeSelection *nickSelection; 		GtkTextBuffer *chatBuffer;+		GtkEntry *chatEntry; 		GtkTextMark *chatMark, *start_mark, *end_mark, *tag_mark, *emot_mark; 		gint oldType; 		std::vector<std::string> history;diff -Nur ./freedcpp.orig/glade/favoritehubs.glade ./freedcpp/glade/favoritehubs.glade--- ./freedcpp.orig/glade/favoritehubs.glade	2009-11-21 16:59:27.000000000 +0300+++ ./freedcpp/glade/favoritehubs.glade	2009-11-21 19:53:39.000000000 +0300@@ -132,7 +132,9 @@                       </packing>                     </child>                     <child>-                      <widget class="GtkEntry" id="entryDescription">+		      <widget class="GtkEntry" id="entryDescription">+			<property name="width_request">200</property>+			<property name="invisible_char">*</property>                         <property name="visible">True</property>                         <property name="activates_default">True</property>                         <property name="can_focus">True</property>@@ -147,6 +149,8 @@                     </child>                     <child>                       <widget class="GtkEntry" id="entryAddress">+			<property name="width_request">200</property>+			<property name="invisible_char">*</property>                         <property name="visible">True</property>                         <property name="activates_default">True</property>                         <property name="can_focus">True</property>@@ -161,6 +165,8 @@                     </child>                     <child>                       <widget class="GtkEntry" id="entryName">+			<property name="width_request">200</property>+			<property name="invisible_char">*</property>                         <property name="visible">True</property>                         <property name="activates_default">True</property>                         <property name="can_focus">True</property>@@ -280,6 +286,7 @@                         <property name="visible">True</property>                         <property name="activates_default">True</property>                         <property name="can_focus">True</property>+			<property name="invisible_char">*</property>                       </widget>                       <packing>                         <property name="left_attach">1</property>@@ -310,6 +317,7 @@                         <property name="visible">True</property>                         <property name="activates_default">True</property>                         <property name="can_focus">True</property>+			<property name="invisible_char">*</property>                       </widget>                       <packing>                         <property name="left_attach">1</property>diff -Nur ./freedcpp.orig/glade/hub.glade ./freedcpp/glade/hub.glade--- ./freedcpp.orig/glade/hub.glade	2009-11-21 16:59:27.000000000 +0300+++ ./freedcpp/glade/hub.glade	2009-11-21 21:10:14.000000000 +0300@@ -240,6 +240,13 @@       </widget>     </child>     <child>+      <widget class="GtkMenuItem" id="pmsgItem">+        <property name="visible">True</property>+        <property name="label" translatable="yes">_Public message</property>+        <property name="use_underline">True</property>+      </widget>+    </child>+    <child>       <widget class="GtkMenuItem" id="favoriteUserItem">         <property name="visible">True</property>         <property name="label" translatable="yes">_Add to favorites</property>diff -Nur ./freedcpp.orig/glade/privatemessage.glade ./freedcpp/glade/privatemessage.glade--- ./freedcpp.orig/glade/privatemessage.glade	2009-11-21 16:59:27.000000000 +0300+++ ./freedcpp/glade/privatemessage.glade	2009-11-21 19:53:39.000000000 +0300@@ -26,6 +26,11 @@       </widget>     </child>     <child>+	<widget class="GtkHBox" id="chatHBox">+        <property name="visible">True</property>+        <property name="spacing">4</property>+         <child>+       <widget class="GtkEntry" id="entry">         <property name="visible">True</property>         <property name="can_focus">True</property>@@ -37,6 +42,25 @@         <property name="position">1</property>       </packing>     </child>++          <child>+              <widget class="GtkButton" id="emotButton">+                <property name="visible">True</property>+                <property name="relief">GTK_RELIEF_NORMAL</property>+                <property name="tooltip" translatable="yes">Emoticons</property>+              </widget>+              <packing>+                <property name="position">2</property>+                <property name="expand">False</property>+              </packing>+          </child>+      </widget>+      <packing>+        <property name="expand">False</property>+        <property name="position">2</property>+      </packing>+    </child>+   </widget>   <widget class="GtkMenu" id="magnetMenu">     <child>@@ -66,6 +90,7 @@       </widget>     </child>   </widget>+  <widget class="GtkMenu" id="emotPacksMenu"></widget>   <widget class="GtkMenu" id="linkMenu">     <child>       <widget class="GtkMenuItem" id="copyLinkItem">