soc.2009.vulture: 4c641a45: Show topic in chat windows.

gdick at soc.pidgin.im gdick at soc.pidgin.im
Fri Jul 10 18:05:57 EDT 2009


-----------------------------------------------------------------
Revision: 4c641a45f91c1495f955896078cbbd55325b02b0
Ancestor: 644f7d71ea77a3f757bc517c382692ecbb059694
Author: gdick at soc.pidgin.im
Date: 2009-07-10T15:28:01
Branch: im.pidgin.soc.2009.vulture
URL: http://d.pidgin.im/viewmtn/revision/info/4c641a45f91c1495f955896078cbbd55325b02b0

Modified files:
        vulture/purpleconv.c vulture/purpleconv.h
        vulture/purplequeue.c vulture/purplequeue.h
        vulture/resource.h vulture/vulture-res.rc
        vulture/vultureconv.c

ChangeLog: 

Show topic in chat windows.

-------------- next part --------------
============================================================
--- vulture/purpleconv.c	4cf844cdbdfed251b3f922afb29135909139959f
+++ vulture/purpleconv.c	1bb4be6687816e6000534a0859b0494c0f8b97fc
@@ -404,3 +404,20 @@ void VultureFreeChatRemoveUsers(VULTURE_
 
 	g_free(lpvchatremoveusers);
 }
+
+
+/**
+ * Gets the topic of a chat.
+ *
+ * @param	lpconv	Conversation.
+ */
+LPTSTR PurpleChatGetTopic(PurpleConversation *lpconv)
+{
+	const char *szTopic;
+
+	if(!lpconv)
+		return NULL;
+
+	szTopic = purple_conv_chat_get_topic(lpconv->u.chat);
+	return szTopic ? VultureUTF8ToTCHAR(szTopic) : NULL;
+}
============================================================
--- vulture/purpleconv.h	b52731404d292f613c1565675e704a4b136e8ed1
+++ vulture/purpleconv.h	bc8eb08620d9962543dfdd5fb9a3ecef9d76447c
@@ -48,6 +48,7 @@ void VultureFreeChatRemoveUsers(VULTURE_
 void VultureFreeRenameUser(VULTURE_CHAT_RENAME_USER *lpvchatrenameuser);
 void PurpleChatRemoveUsers(PurpleConversation *lpconv, GList *lpglistUsers);
 void VultureFreeChatRemoveUsers(VULTURE_CHAT_REMOVE_USERS *lpvchatremoveusers);
+LPTSTR PurpleChatGetTopic(PurpleConversation *lpconv);
 
 
 #endif
============================================================
--- vulture/purplequeue.c	aefd0f450cf55356eab36138441a3bacbb78d7f8
+++ vulture/purplequeue.c	fbdd2c87a68f0e6fb6e96eb54fa4c2adbd45f746
@@ -250,6 +250,14 @@ static void DispatchPurpleCall(PURPLE_CA
 		
 		break;
 
+	case PC_CHATGETTOPIC:
+		{
+			VULTURE_CONV_GET_STRING *lpvcgetstr = (VULTURE_CONV_GET_STRING*)lppurplecall->lpvParam;
+			lpvcgetstr->sz = PurpleChatGetTopic(lpvcgetstr->lpvconv->lpconv);
+		}
+		
+		break;
+
 	case PC_QUIT:
 		purple_core_quit();
 		g_main_loop_quit(g_lpgmainloop);
============================================================
--- vulture/purplequeue.h	4bc3d10785ade94dbdb0d1b8f7ac8ffb2bf5a1c8
+++ vulture/purplequeue.h	f0bf6fb7098a47d99424a8113626642eb0219501
@@ -65,7 +65,7 @@ enum PURPLE_CALL_ID
 	/* (VULTURE_BLIST_NODE*) Node double-clicked.  */
 	PC_BLISTNODEDBLCLKED,
 
-	/* (VULTURE_CONV_GET_TITLE*) */
+	/* (VULTURE_CONV_GET_STRING*) Retrieves the conversation's title. */
 	PC_CONVGETTITLE,
 
 	/* (VULTURE_IM_GET_STATUS_MSG*) */
@@ -76,6 +76,9 @@ enum PURPLE_CALL_ID
 
 	/* (VULTURE_JOIN_CHAT_DATA*) */
 	PC_JOINCHAT,
+
+	/* (VULTURE_CONV_GET_STRING*) Retrieves the chat's topic. */
+	PC_CHATGETTOPIC,
 };
 
 
============================================================
--- vulture/resource.h	ddf3bb2fa6ec549bff5742e152ead714e18c3b32
+++ vulture/resource.h	182bceccaa34fbadf949daca176c25530e1afcf6
@@ -38,3 +38,4 @@
 #define IDC_RICHEDIT_INPUT                      40010
 #define IDC_STATIC_NAME                         40011
 #define IDC_STATIC_STATUS                       40013
+#define IDC_STATIC_TOPIC                        40013
============================================================
--- vulture/vulture-res.rc	f13aaa069d5d50d7050fc47275c3a8778ef1cceb
+++ vulture/vulture-res.rc	d6066954a1e5c18392fd0b65e7693ebe1b178b30
@@ -76,9 +76,12 @@ FONT 8, "Ms Shell Dlg"
 STYLE DS_3DLOOK | DS_CENTER | DS_SHELLFONT | WS_CHILDWINDOW | WS_DISABLED
 FONT 8, "Ms Shell Dlg"
 {
-    CONTROL         "", IDC_RICHEDIT_CONV, RICHEDIT_CLASS, WS_TABSTOP | WS_VSCROLL | WS_BORDER | ES_AUTOVSCROLL | ES_MULTILINE | ES_READONLY, 5, 5, 245, 180
+    CONTROL         "", IDC_RICHEDIT_CONV, RICHEDIT_CLASS, WS_TABSTOP | WS_VSCROLL | WS_BORDER | ES_AUTOVSCROLL | ES_MULTILINE | ES_READONLY, 5, 35, 245, 180
     CONTROL         "", IDC_RICHEDIT_INPUT, RICHEDIT_CLASS, WS_TABSTOP | WS_BORDER | ES_MULTILINE | ES_WANTRETURN, 5, 190, 245, 40
-    CONTROL         "", IDC_TREE_NAMES, WC_TREEVIEW, WS_TABSTOP | WS_BORDER | TVS_INFOTIP | TVS_NOHSCROLL | TVS_FULLROWSELECT, 255, 5, 65, 225
+    CONTROL         "", IDC_TREE_NAMES, WC_TREEVIEW, WS_TABSTOP | WS_BORDER | TVS_INFOTIP | TVS_NOHSCROLL | TVS_FULLROWSELECT, 255, 35, 65, 225
+    CONTROL         "", IDC_STATIC, WC_STATIC, SS_BITMAP, 5, 5, 20, 17
+    LTEXT           "", IDC_STATIC_NAME, 40, 5, 275, 8, SS_LEFT
+    LTEXT           "", IDC_STATIC_TOPIC, 40, 15, 275, 8, SS_LEFT
 }
 
 
@@ -118,7 +121,7 @@ FONT 8, "Ms Shell Dlg"
     PUSHBUTTON      "Cancel", IDCANCEL, 150, 115, 50, 14, BS_PUSHBUTTON
     LTEXT           "Please choose an account, and then enter the details of the chat that you wish to join.", IDC_STATIC, 5, 5, 195, 20, SS_LEFT
     LTEXT           "&Account:", IDC_STATIC, 5, 32, 35, 10, SS_LEFT
-    CONTROL         "", IDC_CBEX_ACCOUNTS, "ComboBoxEx32", 0x50000003, 45, 30, 155, 90
+    CONTROL         "", IDC_CBEX_ACCOUNTS, "ComboBoxEx32", 0x50010003, 45, 30, 155, 90
     GROUPBOX        "Details", IDC_STATIC_DETAILS, 5, 50, 195, 58
 }
 
============================================================
--- vulture/vultureconv.c	f670f8343fce3ee2ca257db8712b18e556a9077d
+++ vulture/vultureconv.c	2115c4a2ce53c2d2f6e624770728f11092a30bda
@@ -238,6 +238,11 @@ static LRESULT CALLBACK ConvContainerWnd
 					break;
 
 				default:
+					/* If we don't know what to do with it,
+					 * forward it to the conversastion
+					 * window itself.
+					 */
+					SendMessage(lpvcchanged->lpvconv->hwndConv, uiMsg, wParam, lParam);
 					break;
 				}
 
@@ -563,6 +568,23 @@ static INT_PTR CALLBACK ChatDlgProc(HWND
 			}
 
 			break;
+
+		case VUIMSG_CONVCHANGED:
+			{
+				VULTURE_CONV_CHANGED *lpvcchanged = (VULTURE_CONV_CHANGED*)lParam;
+
+				if(lpvcchanged->pcut == PURPLE_CONV_UPDATE_TOPIC)
+				{
+					VULTURE_CONV_GET_STRING vcgetstring;
+
+					vcgetstring.lpvconv = lpvcchanged->lpvconv;
+					VultureSingleSyncPurpleCall(PC_CHATGETTOPIC, &vcgetstring);
+					SetDlgItemText(hwndDlg, IDC_STATIC_TOPIC, vcgetstring.sz ? vcgetstring.sz : TEXT(""));
+					if(vcgetstring.sz) g_free(vcgetstring.sz);
+				}
+			}
+
+			break;
 		}
 
 		break;
@@ -705,7 +727,7 @@ static void ResizeActiveConversationWind
 }
 
 
-#define CONV_IM_TOP_MARGIN		48
+#define CONV_TOP_MARGIN		48
 
 /**
  * Repositions and resizes controls in a conversation window.
@@ -717,24 +739,21 @@ static void RepositionConvControls(HWND 
 	RECT rcClient;
 	VULTURE_CONVERSATION *lpvconv = (VULTURE_CONVERSATION*)GetWindowLongPtr(hwndConvDlg, GWLP_USERDATA);
 	HDWP hdwp = BeginDeferWindowPos(lpvconv->convtype == PURPLE_CONV_TYPE_CHAT ? 3 : 2);
-	int cxLeft, cyTopMargin;
+	int cxLeft;
 
 	GetClientRect(hwndConvDlg, &rcClient);
 
 	/* Width of input and output controls. */
 	cxLeft = rcClient.right - 2 * CONV_DLG_MARGIN - (lpvconv->convtype == PURPLE_CONV_TYPE_CHAT ? (CONV_DLG_MARGIN + g_cxNames) : 0);
 
-	/* Space for buddy's name, icon and so on. */
-	cyTopMargin = lpvconv->convtype == PURPLE_CONV_TYPE_IM ? CONV_IM_TOP_MARGIN : 0;
-
 	hdwp = DeferWindowPos(
 		hdwp,
 		GetDlgItem(hwndConvDlg, IDC_RICHEDIT_CONV),
 		NULL,
 		CONV_DLG_MARGIN,
-		CONV_DLG_MARGIN + cyTopMargin,
+		CONV_DLG_MARGIN + CONV_TOP_MARGIN,
 		cxLeft,
-		rcClient.bottom - g_cyInput - 3 * CONV_DLG_MARGIN - cyTopMargin,
+		rcClient.bottom - g_cyInput - 3 * CONV_DLG_MARGIN - CONV_TOP_MARGIN,
 		SWP_NOACTIVATE | SWP_NOZORDER);
 
 	hdwp = DeferWindowPos(
@@ -754,9 +773,9 @@ static void RepositionConvControls(HWND 
 			GetDlgItem(hwndConvDlg, IDC_TREE_NAMES),
 			NULL,
 			2 * CONV_DLG_MARGIN + cxLeft,
-			CONV_DLG_MARGIN,
+			CONV_DLG_MARGIN + CONV_TOP_MARGIN,
 			g_cxNames,
-			rcClient.bottom - 2 * CONV_DLG_MARGIN - cyTopMargin,
+			rcClient.bottom - 2 * CONV_DLG_MARGIN - CONV_TOP_MARGIN,
 			SWP_NOACTIVATE | SWP_NOZORDER);
 	}
 


More information about the Commits mailing list