soc.2009.vulture: 64309067: Basics of buddy-adding.

gdick at soc.pidgin.im gdick at soc.pidgin.im
Tue Aug 4 16:06:45 EDT 2009


-----------------------------------------------------------------
Revision: 643090673de0c83ad8f9880e40268444586abf11
Ancestor: d61f640fe4584ba7d22f1a0d188a2d1dbdf3a4b3
Author: gdick at soc.pidgin.im
Date: 2009-08-04T19:47:59
Branch: im.pidgin.soc.2009.vulture
URL: http://d.pidgin.im/viewmtn/revision/info/643090673de0c83ad8f9880e40268444586abf11

Modified files:
        vulture/purpleblist.c vulture/purpleblist.h
        vulture/purplequeue.c vulture/purplequeue.h
        vulture/resource.h vulture/vulture-res.rc
        vulture/vultureblist.c vulture/vulturedlg.c
        vulture/vulturedlg.h

ChangeLog: 

Basics of buddy-adding.

-------------- next part --------------
============================================================
--- vulture/purpleblist.c	358fceb92083a5be00be4c3ecd64f31e254f9be4
+++ vulture/purpleblist.c	2f5388abdfb2297fc2f094c9942a69f29ac1f073
@@ -729,3 +729,68 @@ void PurpleBuddyIconChanged(PurpleBuddy 
 	 * will be done in response to the conversation-updated signal.
 	 */
 }
+
+
+/**
+ * Retrieves a list of groups from the buddy list.
+ *
+ * @return GList* of VULTURE_BLIST_NODEs representing all groups. The caller
+ * should free the list by calling VultureFreeGroupList.
+ */
+GList* PurpleGetGroups(void)
+{
+	GList *lpglistGroups = NULL;
+	PurpleBlistNode *lpblnRover;
+
+	for(lpblnRover = purple_get_blist()->root; lpblnRover; lpblnRover = lpblnRover->next)
+	{
+		if(PURPLE_BLIST_NODE_IS_GROUP(lpblnRover))
+		{
+			VULTURE_BLIST_NODE *lpvblistnode = lpblnRover->ui_data;
+			VultureBListNodeAddRef(lpvblistnode);
+			lpglistGroups = g_list_prepend(lpglistGroups, lpvblistnode);
+		}
+	}
+
+	return g_list_reverse(lpglistGroups);
+}
+
+
+/**
+ * Frees a list returned by PurpleGetGroups.
+ *
+ * @param	lpglistGroups		List to free.
+ */
+void VultureFreeGroupList(GList *lpglistGroups)
+{
+	GList *lpglistRover;
+
+	for(lpglistRover = lpglistGroups; lpglistRover; lpglistRover = lpglistRover->next)
+		VultureBListNodeRelease(lpglistRover->data);
+
+	g_list_free(lpglistGroups);
+}
+
+
+/**
+ * Adds a buddy.
+ *
+ * @param	lpvabd	New buddy's details.
+ */
+void PurpleAddBuddy(VULTURE_ADD_BUDDY_DATA *lpvabd)
+{
+	PurpleBuddy *lpbuddy;
+	gchar *szUsernameUTF8, *szAliasUTF8;
+
+	szUsernameUTF8 = VultureTCHARToUTF8(lpvabd->szUsername);
+	szAliasUTF8 = lpvabd->szAlias ? VultureTCHARToUTF8(lpvabd->szAlias) : NULL;
+
+	lpbuddy = purple_buddy_new(lpvabd->lppac, szUsernameUTF8, szAliasUTF8);
+	purple_blist_add_buddy(lpbuddy, NULL, lpvabd->lpvblistnodeGroup ? (PurpleGroup*)lpvabd->lpvblistnodeGroup->lpblistnode : NULL, NULL);
+	purple_account_add_buddy(lpvabd->lppac, lpbuddy);
+
+	PurpleBlistUpdateNode(purple_get_blist(), (PurpleBlistNode*)lpbuddy);
+
+	if(szAliasUTF8) g_free(szAliasUTF8);
+	g_free(szUsernameUTF8);
+}
============================================================
--- vulture/purpleblist.h	7c4a22afbf7ad86eaa68607aa86214e5ae53b79a
+++ vulture/purpleblist.h	deafd04422fb9bb6db02aa288959790c35fb33ec
@@ -31,6 +31,16 @@
 #include "purple.h"
 
 
+
+typedef struct _VULTURE_ADD_BUDDY_DATA
+{
+	PurpleAccount		*lppac;
+	LPTSTR			szUsername;
+	LPTSTR			szAlias;
+	VULTURE_BLIST_NODE	*lpvblistnodeGroup;
+} VULTURE_ADD_BUDDY_DATA;
+
+
 void PurpleBlistNewNode(PurpleBlistNode *lpblistnode);
 void PurpleBlistUpdateNode(PurpleBuddyList *lpbuddylist, PurpleBlistNode *lpblistnode);
 void PurpleBlistRemoveNode(PurpleBuddyList *lpbuddylist, PurpleBlistNode *lpblistnode);
@@ -44,6 +54,9 @@ void PurpleBuddyIconChanged(PurpleBuddy 
 void PurpleDeleteBlistNode(PurpleBlistNode *lpblistnode);
 void PurpleCommonMakeMenu(HMENU hmenu, PurpleBlistNode *lpblistnode);
 void PurpleBuddyIconChanged(PurpleBuddy *lpbuddy);
+GList* PurpleGetGroups(void);
+void VultureFreeGroupList(GList *lpglistGroups);
+void PurpleAddBuddy(VULTURE_ADD_BUDDY_DATA *lpvabd);
 
 
 static INLINE void VultureBListNodeAddRef(VULTURE_BLIST_NODE *lpvblnode) { InterlockedIncrement(&lpvblnode->lRefCount); }
============================================================
--- vulture/purplequeue.c	eed2f2a320fff388c7928c6ec9b52d519a5892cc
+++ vulture/purplequeue.c	2412a1984936e493910cf521d31a7a4084bd533f
@@ -408,6 +408,14 @@ static void DispatchPurpleCall(PURPLE_CA
 		
 		break;
 
+	case PC_GETGROUPS:
+		*((GList**)lppurplecall->lpvParam) = PurpleGetGroups();
+		break;
+
+	case PC_ADDBUDDY:
+		PurpleAddBuddy(lppurplecall->lpvParam);
+		break;
+
 	case PC_QUIT:
 		purple_core_quit();
 		g_main_loop_quit(g_lpgmainloop);
============================================================
--- vulture/purplequeue.h	c4de7e75926aed165aa95580586e8847d83daa59
+++ vulture/purplequeue.h	5abffc449ba30bd32dc7d429b66c9f8ba00cecc2
@@ -112,6 +112,12 @@ enum PURPLE_CALL_ID
 
 	/* (VULTURE_GET_BLIST_NODE_ICON*) */
 	PC_GETBLISTNODEICON,
+
+	/* (GList**) Return address for list. */
+	PC_GETGROUPS,
+
+	/* (VULTURE_ADD_BUDDY_DATA*) */
+	PC_ADDBUDDY,
 };
 
 
============================================================
--- vulture/resource.h	4806444826b8f8ce52dfdfad6cc050a5ecaec786
+++ vulture/resource.h	c0eb395d784bb3af7e1c8517af53e9f26221a1af
@@ -2,24 +2,27 @@
 #define IDC_STATIC (-1)
 #endif
 
-#define IDC_BTN_ACCOUNT_ADD                     40005
-#define IDC_BTN_ACCOUNT_DELETE                  40007
-#define IDC_BTN_ACCOUNT_PROPERTIES              40006
-#define IDC_BUDDY_ICON                          1002
-#define IDC_CBEX_ACCOUNTS                       1000
-#define IDC_CBEX_STATUS                         1004
-#define IDC_EDIT_STATUSMSG                      40003
-#define IDC_LIST_ACCOUNTS                       1003
-#define IDC_RICHEDIT_CONV                       40008
-#define IDC_RICHEDIT_INPUT                      40010
-#define IDC_STATIC_DETAILS                      1001
-#define IDC_STATIC_ICON                         40014
-#define IDC_STATIC_NAME                         40011
-#define IDC_STATIC_STATUS                       40013
-#define IDC_STATIC_TOPIC                        40013
-#define IDC_TAB_CONVERSATIONS                   1001
-#define IDC_TREE_BLIST                          40004
-#define IDC_TREE_NAMES                          1002
+#define IDC_BTN_ACCOUNT_ADD                     1001
+#define IDC_BTN_ACCOUNT_DELETE                  1002
+#define IDC_BTN_ACCOUNT_PROPERTIES              1003
+#define IDC_BUDDY_ICON                          1004
+#define IDC_CBEX_ACCOUNTS                       1005
+#define IDC_CBEX_STATUS                         1006
+#define IDC_EDIT_STATUSMSG                      1007
+#define IDC_LIST_ACCOUNTS                       1008
+#define IDC_RICHEDIT_CONV                       1009
+#define IDC_RICHEDIT_INPUT                      1010
+#define IDC_STATIC_DETAILS                      1011
+#define IDC_STATIC_ICON                         1012
+#define IDC_STATIC_NAME                         1013
+#define IDC_STATIC_STATUS                       1014
+#define IDC_STATIC_TOPIC                        1015
+#define IDC_TAB_CONVERSATIONS                   1016
+#define IDC_TREE_BLIST                          1017
+#define IDC_TREE_NAMES                          1018
+#define IDC_EDIT_USERNAME                       1019
+#define IDC_EDIT_ALIAS                          1020
+#define IDC_CBEX_GROUP                          1021
 
 
 #define IDD_ACCOUNTS                            101
@@ -29,12 +32,14 @@
 #define IDD_IM                                  105
 #define IDD_JOINCHAT                            106
 #define IDD_STATUS                              107
+#define IDD_ADDBUDDY                            108
 
 
 #define IDM_BLIST                               1001
 #define IDM_BLIST_ACCOUNTS_MANAGE               40001
 #define IDM_BLIST_BUDDIES_CLOSE                 40000
 #define IDM_BLIST_BUDDIES_JOINCHAT              40002
+#define IDM_BLIST_BUDDIES_ADDBUDDY              40003
 
 #define IDM_BLIST_CONTEXT                       1002
 #define IDM_BLIST_CONTEXT_ACTIVATE              40201
============================================================
--- vulture/vulture-res.rc	e2d01a0597f1e5b47b5809f0b7c72b95e4be85fd
+++ vulture/vulture-res.rc	fb6421d7465b5960c5b00bddd2c296bdb6dc8c56
@@ -16,8 +16,10 @@ IDM_BLIST MENU
 {
     POPUP "&Buddies"
     {
-        MENUITEM "&Join a Chat...\tCtrl+J", IDM_BLIST_BUDDIES_JOINCHAT
+        MENUITEM "&Join Chat...\tCtrl+J", IDM_BLIST_BUDDIES_JOINCHAT
         MENUITEM SEPARATOR
+	MENUITEM "&Add Buddy...\tCtrl+B", IDM_BLIST_BUDDIES_ADDBUDDY
+	MENUITEM SEPARATOR
         MENUITEM "&Close", IDM_BLIST_BUDDIES_CLOSE
     }
     POPUP "&Accounts"
@@ -126,6 +128,28 @@ LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_U
 
 
 LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_UK
+IDD_ADDBUDDY DIALOG 0, 0, 204, 132
+STYLE DS_3DLOOK | DS_CENTER | DS_MODALFRAME | DS_SHELLFONT | WS_VISIBLE | WS_BORDER | WS_CAPTION | WS_DLGFRAME | WS_POPUP | WS_SYSMENU
+CAPTION "Add Buddy"
+FONT 8, "Ms Shell Dlg"
+{
+    DEFPUSHBUTTON   "OK", IDOK, 95, 115, 50, 14, BS_DEFPUSHBUTTON
+    PUSHBUTTON      "Cancel", IDCANCEL, 150, 115, 50, 14, BS_PUSHBUTTON
+    LTEXT           "Please choose an account, and then enter the details of the buddy that you would like to add to the buddy list.", IDC_STATIC, 5, 5, 195, 20, SS_LEFT
+    LTEXT           "&Account:", IDC_STATIC, 5, 32, 35, 10, SS_LEFT
+    CONTROL         "", IDC_CBEX_ACCOUNTS, "ComboBoxEx32", 0x50010003, 45, 30, 155, 90
+    GROUPBOX        "Buddy Details", IDC_STATIC, 5, 50, 195, 58
+    LTEXT           "&Username:", IDC_STATIC, 15, 62, 50, 10, SS_LEFT
+    EDITTEXT        IDC_EDIT_USERNAME, 75, 60, 120, 12, ES_AUTOHSCROLL
+    LTEXT           "A&lias (optional):", IDC_STATIC, 15, 77, 50, 10, SS_LEFT
+    EDITTEXT        IDC_EDIT_ALIAS, 75, 75, 120, 12
+    LTEXT           "&Group:", IDC_STATIC, 15, 92, 50, 10, SS_LEFT
+    CONTROL         "", IDC_CBEX_GROUP, "ComboBoxEx32", 0x50010003, 75, 90, 120, 90
+}
+
+
+
+LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_UK
 IDD_BLIST DIALOG 0, 0, 186, 95
 STYLE DS_3DLOOK | DS_CENTER | DS_CONTROL | DS_SHELLFONT | WS_VISIBLE | WS_CHILDWINDOW
 FONT 8, "Ms Shell Dlg"
@@ -178,7 +202,7 @@ STYLE DS_3DLOOK | DS_CENTER | DS_MODALFR
 LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_UK
 IDD_JOINCHAT DIALOG 0, 0, 204, 132
 STYLE DS_3DLOOK | DS_CENTER | DS_MODALFRAME | DS_SHELLFONT | WS_VISIBLE | WS_BORDER | WS_CAPTION | WS_DLGFRAME | WS_POPUP | WS_SYSMENU
-CAPTION "Join a Chat"
+CAPTION "Join Chat"
 FONT 8, "Ms Shell Dlg"
 {
     DEFPUSHBUTTON   "OK", IDOK, 95, 115, 50, 14, BS_DEFPUSHBUTTON
@@ -232,6 +256,7 @@ IDR_ACCEL_MAIN ACCELERATORS
 {
     "A",            IDM_BLIST_ACCOUNTS_MANAGE, VIRTKEY, CONTROL
     "J",            IDM_BLIST_BUDDIES_JOINCHAT, VIRTKEY, CONTROL
+    "B",            IDM_BLIST_BUDDIES_ADDBUDDY, VIRTKEY, CONTROL
 }
 
 
@@ -247,4 +272,4 @@ 1                  RT_MANIFEST    ".\\ma
 //
 // Bitmap resources
 //
-IDB_STATUS_ICONS        BITMAP "res\\status.bmp"
\ No newline at end of file
+IDB_STATUS_ICONS        BITMAP "res\\status.bmp"
============================================================
--- vulture/vultureblist.c	cd2c4f55c1ba2d92df1e12cb4ed7149b88dedcc8
+++ vulture/vultureblist.c	78f3432457999c2373511eb7cdb686173803ed6e
@@ -199,6 +199,25 @@ static LRESULT CALLBACK MainWndProc(HWND
 
 			return 0;
 
+		case IDM_BLIST_BUDDIES_ADDBUDDY:
+			{
+				VULTURE_ADD_BUDDY_DATA vabd;
+
+				if(VultureAddBuddyDlg(hwnd, &vabd))
+				{
+					VultureSingleSyncPurpleCall(PC_ADDBUDDY, &vabd);
+
+					if(vabd.lpvblistnodeGroup)
+						VultureBListNodeRelease(vabd.lpvblistnodeGroup);
+
+					ProcHeapFree(vabd.szUsername);
+					if(vabd.szAlias)
+						ProcHeapFree(vabd.szAlias);
+				}
+			}
+
+			return 0;
+
 		case IDM_BLIST_BUDDIES_CLOSE:
 			SendMessage(hwnd, WM_CLOSE, 0, 0);
 			return 0;
============================================================
--- vulture/vulturedlg.c	5d5486acfea1f2b4b6ccfeab6aa96f4f82004b23
+++ vulture/vulturedlg.c	0cc97b3baf63bbff30e6c33f590187c14e0836ef
@@ -31,6 +31,7 @@
 #include "acctmanager.h"
 #include "purplequeue.h"
 #include "purpleacct.h"
+#include "purpleblist.h"
 
 
 typedef struct _JOIN_DLG_FIELD
@@ -62,10 +63,13 @@ static void AutoEnableJoinDlgOKButton(HW
 static HWND CreateJoinDlgEdit(HWND hwndDlg, int iFieldNum, BOOL bNumber, BOOL bSecret);
 static void UpdateJoinChatFields(HWND hwndDlg, GList **lplpglistFields, int *lpiMaxShowFields);
 static void AutoEnableJoinDlgOKButton(HWND hwndDlg, GList *lpglistFields);
+static INT_PTR CALLBACK AddBuddyDlgProc(HWND hwndDlg, UINT uiMsg, WPARAM wParam, LPARAM lParam);
+static void AutoEnableBuddyDlgOKButton(HWND hwndDlg);
+static void PopulateGroupsCombo(HWND hwndCBEx, GList *lpglistGroups);
 
 
 /**
- * Displays the "Join a Chat" dialogue.
+ * Displays the "Join Chat" dialogue.
  *
  * @param	hwndParent	Parent window handle.
  * @param[out]	lpvjcd		Details of chat to join are returned here.
@@ -79,7 +83,7 @@ BOOL VultureJoinChatDlg(HWND hwndParent,
 
 
 /**
- * Dialogue procedure for "Join a Chat" dialogue.
+ * Dialogue procedure for "Join Chat" dialogue.
  *
  * @param	hwndDlg		Dialogue window handle.
  * @param	uiMsg		Message ID.
@@ -491,3 +495,186 @@ static void AutoEnableJoinDlgOKButton(HW
 	else
 		EnableWindow(hwndOK, TRUE);
 }
+
+
+/**
+ * Displays the "Add Buddy" dialogue.
+ *
+ * @param	hwndParent	Parent window handle.
+ * @param[out]	lpvabd		Details of buddy to add are returned here.
+ *
+ * @return TRUE iff OKed.
+ */
+BOOL VultureAddBuddyDlg(HWND hwndParent, VULTURE_ADD_BUDDY_DATA *lpvabd)
+{
+	return (BOOL)DialogBoxParam(g_hInstance, MAKEINTRESOURCE(IDD_ADDBUDDY), hwndParent, AddBuddyDlgProc, (LPARAM)lpvabd);
+}
+
+
+/**
+ * Dialogue procedure for "Add Buddy" dialogue.
+ *
+ * @param	hwndDlg		Dialogue window handle.
+ * @param	uiMsg		Message ID.
+ * @param	wParam		Message-specific.
+ * @param	lParam		Message-specific.
+ *
+ * @return Usually TRUE if message processed and FALSE otherwise. There are
+ * some exceptions for particular messages.
+ */
+static INT_PTR CALLBACK AddBuddyDlgProc(HWND hwndDlg, UINT uiMsg, WPARAM wParam, LPARAM lParam)
+{
+	static GList *s_lpglistAccounts = NULL;
+	static GList *s_lpglistGroups = NULL;
+	static VULTURE_ADD_BUDDY_DATA *s_lpvabd = NULL;
+
+	switch(uiMsg)
+	{
+	case WM_INITDIALOG:
+		{
+			VULTURE_GET_ACCOUNTS vgetaccounts;
+
+			/* We return stuff here. */
+			s_lpvabd = (VULTURE_ADD_BUDDY_DATA*)lParam;
+
+			/* Get online accounts. */
+			vgetaccounts.bOnlineOnly = TRUE;
+			VultureSingleSyncPurpleCall(PC_GETACCOUNTS, &vgetaccounts);
+			s_lpglistAccounts = vgetaccounts.lpglistAccounts;
+
+			/* Populate combo and select first item. */
+			PopulateAccountsCombo(GetDlgItem(hwndDlg, IDC_CBEX_ACCOUNTS), s_lpglistAccounts);
+			if(SendDlgItemMessage(hwndDlg, IDC_CBEX_ACCOUNTS, CB_GETCOUNT, 0, 0) > 0)
+				SendDlgItemMessage(hwndDlg, IDC_CBEX_ACCOUNTS, CB_SETCURSEL, 0, 0);
+
+			/* Get all groups. */
+			VultureSingleSyncPurpleCall(PC_GETGROUPS, &s_lpglistGroups);
+
+			/* Populate combo and select first item. */
+			PopulateGroupsCombo(GetDlgItem(hwndDlg, IDC_CBEX_GROUP), s_lpglistGroups);
+			if(SendDlgItemMessage(hwndDlg, IDC_CBEX_GROUP, CB_GETCOUNT, 0, 0) > 0)
+				SendDlgItemMessage(hwndDlg, IDC_CBEX_GROUP, CB_SETCURSEL, 0, 0);
+
+			AutoEnableBuddyDlgOKButton(hwndDlg);
+		}
+
+		/* Let the system set the focus. */
+		return TRUE;
+
+	case WM_COMMAND:
+		/* Should really make sure this comes from an edit control, but
+		 * no harm done.
+		 */
+		if(HIWORD(wParam) == EN_CHANGE)
+			AutoEnableBuddyDlgOKButton(hwndDlg);
+
+		switch(LOWORD(wParam))
+		{
+		case IDOK:
+			{
+				COMBOBOXEXITEM cbexitem;
+				int cch;
+
+				/* Get the selected account. */
+				cbexitem.mask = CBEIF_LPARAM;
+				cbexitem.iItem = SendDlgItemMessage(hwndDlg, IDC_CBEX_ACCOUNTS, CB_GETCURSEL, 0, 0);
+				SendDlgItemMessage(hwndDlg, IDC_CBEX_ACCOUNTS, CBEM_GETITEM, 0, (LPARAM)&cbexitem);
+				s_lpvabd->lppac = ((VULTURE_ACCOUNT*)cbexitem.lParam)->lppac;
+
+				/* Get the selected group. */
+				cbexitem.mask = CBEIF_LPARAM;
+				cbexitem.iItem = SendDlgItemMessage(hwndDlg, IDC_CBEX_GROUP, CB_GETCURSEL, 0, 0);
+				SendDlgItemMessage(hwndDlg, IDC_CBEX_GROUP, CBEM_GETITEM, 0, (LPARAM)&cbexitem);
+				s_lpvabd->lpvblistnodeGroup = (VULTURE_BLIST_NODE*)cbexitem.lParam;
+
+				if(s_lpvabd->lpvblistnodeGroup)
+					VultureBListNodeAddRef(s_lpvabd->lpvblistnodeGroup);
+
+				cch = GetWindowTextLength(GetDlgItem(hwndDlg, IDC_EDIT_USERNAME)) + 1;
+				s_lpvabd->szUsername = ProcHeapAlloc(cch * sizeof(TCHAR));
+				GetDlgItemText(hwndDlg, IDC_EDIT_USERNAME, s_lpvabd->szUsername, cch);
+
+				cch = GetWindowTextLength(GetDlgItem(hwndDlg, IDC_EDIT_ALIAS)) + 1;
+				if(cch > 1)
+				{
+					s_lpvabd->szAlias = ProcHeapAlloc(cch * sizeof(TCHAR));
+					GetDlgItemText(hwndDlg, IDC_EDIT_ALIAS, s_lpvabd->szAlias, cch);
+				}
+				else
+					s_lpvabd->szAlias = NULL;
+
+				EndDialog(hwndDlg, TRUE);
+			}
+
+			return TRUE;
+
+		case IDCANCEL:
+			EndDialog(hwndDlg, FALSE);
+			return TRUE;
+		}
+
+		break;
+
+	case WM_DESTROY:
+		VultureFreeAccountList(s_lpglistAccounts);
+		VultureFreeGroupList(s_lpglistGroups);
+		return TRUE;
+	}
+
+	return FALSE;
+}
+
+
+/**
+ * Enables or disables the OK button in the add-buddy or IM dialogues according
+ * to the states of other controls.
+ *
+ * @param	hwndDlg		Add-buddy dialogue.
+ */
+static void AutoEnableBuddyDlgOKButton(HWND hwndDlg)
+{
+	HWND hwndOK = GetDlgItem(hwndDlg, IDOK);
+	BOOL bEnable = SendDlgItemMessage(hwndDlg, IDC_CBEX_ACCOUNTS, CB_GETCURSEL, 0, 0) >= 0 && GetWindowTextLength(GetDlgItem(hwndDlg, IDC_EDIT_USERNAME)) > 0;
+
+	if(!bEnable)
+	{
+		/* Don't leave the focus on a disabled control. */
+		if(GetFocus() == hwndOK)
+			SendMessage(hwndDlg, WM_NEXTDLGCTL, 0, 0);
+
+		EnableWindow(hwndOK, FALSE);
+	}
+	else
+		EnableWindow(hwndOK, TRUE);
+}
+
+
+/**
+ * Populates a ComboBoxEx control with groups.
+ *
+ * @param	hwndCBEx		ComboBoxEx control window handle.
+ * @param	lpglistGroups		Accounts to add.
+ */
+static void PopulateGroupsCombo(HWND hwndCBEx, GList *lpglistGroups)
+{
+	GList *lpglistRover;
+	COMBOBOXEXITEM cbexitem;
+
+	SendMessage(hwndCBEx, CB_RESETCONTENT, 0, 0);
+
+	cbexitem.mask = CBEIF_TEXT | CBEIF_LPARAM;
+	cbexitem.iItem = -1;
+
+	/* Add each group. */
+	for(lpglistRover = lpglistGroups; lpglistRover; lpglistRover = lpglistRover->next)
+	{
+		VULTURE_BLIST_NODE *lpvblistnode = (VULTURE_BLIST_NODE*)lpglistRover->data;
+
+		if(lpvblistnode->szNodeText)
+		{
+			cbexitem.pszText = lpvblistnode->szNodeText;
+			cbexitem.lParam = (LPARAM)lpvblistnode;
+			SendMessage(hwndCBEx, CBEM_INSERTITEM, 0, (LPARAM)&cbexitem);
+		}
+	}
+}
============================================================
--- vulture/vulturedlg.h	5a96cfa2add01c5e64f30453a267e8d5dd09e043
+++ vulture/vulturedlg.h	5f0e633ff0ff9bbbb50702a6796c1fcfa4e43dd0
@@ -27,7 +27,10 @@
 #include <windows.h>
 #include <glib.h>
 
+#include "purple.h"
 #include "acctmanager.h"
+#include "vultureblist.h"
+#include "purpleblist.h"
 
 
 typedef struct _VULTURE_JOIN_CHAT_DATA
@@ -44,6 +47,7 @@ BOOL VultureJoinChatDlg(HWND hwndParent,
 
 
 BOOL VultureJoinChatDlg(HWND hwndParent, VULTURE_JOIN_CHAT_DATA *lpvjcd);
+BOOL VultureAddBuddyDlg(HWND hwndParent, VULTURE_ADD_BUDDY_DATA *lpvabd);
 
 
 #endif


More information about the Commits mailing list