diff options
Diffstat (limited to 'plugins/TipperYM/src')
| -rw-r--r-- | plugins/TipperYM/src/options.cpp | 22 | ||||
| -rw-r--r-- | plugins/TipperYM/src/options.h | 12 | ||||
| -rw-r--r-- | plugins/TipperYM/src/popwin.cpp | 2 | ||||
| -rw-r--r-- | plugins/TipperYM/src/preset_items.cpp | 1 | ||||
| -rw-r--r-- | plugins/TipperYM/src/resource.h | 1 | ||||
| -rw-r--r-- | plugins/TipperYM/src/subst.cpp | 16 | ||||
| -rw-r--r-- | plugins/TipperYM/src/subst.h | 2 | ||||
| -rw-r--r-- | plugins/TipperYM/src/version.h | 2 | 
8 files changed, 55 insertions, 3 deletions
diff --git a/plugins/TipperYM/src/options.cpp b/plugins/TipperYM/src/options.cpp index 6a8ee4e2c9..2d9c01ed4d 100644 --- a/plugins/TipperYM/src/options.cpp +++ b/plugins/TipperYM/src/options.cpp @@ -187,6 +187,8 @@ bool LoadDI(DISPLAYITEM *di, int index)  		db_free(&dbv);
  	}
 +	mir_snprintf(setting, SIZEOF(setting), "DIType%d", index);
 +	di->type = (DisplayItemType)db_get_b(0, MODULE_ITEMS, setting, DIT_ALL);
  	mir_snprintf(setting, SIZEOF(setting), "DILineAbove%d", index);
  	di->bLineAbove = (db_get_b(0, MODULE_ITEMS, setting, 0) == 1);
  	mir_snprintf(setting, SIZEOF(setting), "DIValNewline%d", index);
 @@ -219,6 +221,8 @@ void SaveDI(DISPLAYITEM *di, int index)  		db_set_s(0, MODULE_ITEMS, setting, buff);
  	}
 +	mir_snprintf(setting, SIZEOF(setting), "DIType%d", index);
 +	db_set_b(0, MODULE_ITEMS, setting, (BYTE)di->type);
  	mir_snprintf(setting, SIZEOF(setting), "DILineAbove%d", index);
  	db_set_b(0, MODULE_ITEMS, setting, di->bLineAbove ? 1 : 0);
  	mir_snprintf(setting, SIZEOF(setting), "DIValNewline%d", index);
 @@ -580,6 +584,14 @@ INT_PTR CALLBACK DlgProcAddItem(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lP  			SetDlgItemText(hwndDlg, IDC_ED_LABEL, di->swzLabel);
  			SetDlgItemText(hwndDlg, IDC_ED_VALUE, di->swzValue);
 +			for (int i = 0; i < SIZEOF(displayItemTypes); i++)
 +			{
 +				int index = SendDlgItemMessage(hwndDlg, IDC_CMB_TYPE, CB_ADDSTRING, (WPARAM)-1, (LPARAM)TranslateTS(displayItemTypes[i].title));
 +				SendDlgItemMessage(hwndDlg, IDC_CMB_TYPE, CB_SETITEMDATA, index, (LPARAM)displayItemTypes[i].type);
 +				if (displayItemTypes[i].type == di->type)
 +					SendDlgItemMessage(hwndDlg, IDC_CMB_TYPE, CB_SETCURSEL, index, 0);
 +			}
 +
  			CheckDlgButton(hwndDlg, IDC_CHK_LINEABOVE, di->bLineAbove ? TRUE : FALSE);
  			CheckDlgButton(hwndDlg, IDC_CHK_VALNEWLINE, di->bValueNewline ? TRUE : FALSE);
  			CheckDlgButton(hwndDlg, IDC_CHK_PARSETIPPERFIRST, di->bParseTipperVarsFirst ? TRUE : FALSE);
 @@ -603,11 +615,19 @@ INT_PTR CALLBACK DlgProcAddItem(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lP  						GetDlgItemText(hwndDlg, IDC_ED_LABEL, di->swzLabel, LABEL_LEN);
  						GetDlgItemText(hwndDlg, IDC_ED_VALUE, di->swzValue, VALUE_LEN);
 +						int sel = SendDlgItemMessage(hwndDlg, IDC_CMB_TYPE, CB_GETCURSEL, 0, 0);
 +						int type = SendDlgItemMessage(hwndDlg, IDC_CMB_TYPE, CB_GETITEMDATA, sel, 0);
 +						for (int i = 0; i < SIZEOF(displayItemTypes); i++)
 +						{
 +							if (displayItemTypes[i].type == type)
 +								di->type = displayItemTypes[i].type;
 +						}
 +
  						di->bLineAbove = (IsDlgButtonChecked(hwndDlg, IDC_CHK_LINEABOVE) ? true : false);
  						di->bValueNewline = (IsDlgButtonChecked(hwndDlg, IDC_CHK_VALNEWLINE) ? true : false);
  						di->bParseTipperVarsFirst = (IsDlgButtonChecked(hwndDlg, IDC_CHK_PARSETIPPERFIRST) ? true : false);
 -						int sel = SendDlgItemMessage(hwndDlg, IDC_CMB_PRESETITEMS, CB_GETCURSEL, 0, 0);
 +						sel = SendDlgItemMessage(hwndDlg, IDC_CMB_PRESETITEMS, CB_GETCURSEL, 0, 0);
  						if (sel != CB_ERR)
  						{
  							TCHAR buff[256];
 diff --git a/plugins/TipperYM/src/options.h b/plugins/TipperYM/src/options.h index 32c2009b8a..c3c649ded5 100644 --- a/plugins/TipperYM/src/options.h +++ b/plugins/TipperYM/src/options.h @@ -41,14 +41,26 @@ typedef struct {  	TCHAR *swzTooltip;
  } OPTBUTTON;
 +typedef enum { DIT_ALL = 0, DIT_CONTACTS = 1, DIT_CHATS = 2 } DisplayItemType;
  typedef struct {
  	TCHAR swzLabel[LABEL_LEN];
  	TCHAR swzValue[VALUE_LEN];
 +	DisplayItemType type;
  	bool bLineAbove, bValueNewline;
  	bool bIsVisible;
  	bool bParseTipperVarsFirst;
  } DISPLAYITEM;
 +// display item types
 +static struct {
 +	DisplayItemType type;
 +	TCHAR* title;
 +} displayItemTypes[] = {
 +	{ DIT_ALL, LPGENT("Show for all contact types") },
 +	{ DIT_CONTACTS, LPGENT("Show only for contacts") },
 +	{ DIT_CHATS, LPGENT("Show only for chatrooms") }
 +};
 +
  typedef enum {DVT_DB = 0, DVT_PROTODB = 1} DisplaySubstType;
  typedef struct {
  	TCHAR swzName[LABEL_LEN];
 diff --git a/plugins/TipperYM/src/popwin.cpp b/plugins/TipperYM/src/popwin.cpp index 441db0effa..c2b01d3bf8 100644 --- a/plugins/TipperYM/src/popwin.cpp +++ b/plugins/TipperYM/src/popwin.cpp @@ -1054,7 +1054,7 @@ LRESULT CALLBACK PopupWindowProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lPa  				DIListNode *node = opt.diList;
  				TCHAR buff_label[LABEL_LEN], buff[VALUE_LEN];
  				while (node) {
 -					if (node->di.bIsVisible) {
 +					if (node->di.bIsVisible && CheckContactType(pwd->hContact, node->di)) {
  						if (GetLabelText(pwd->hContact, node->di, buff_label, LABEL_LEN) && GetValueText(pwd->hContact, node->di, buff, VALUE_LEN)) {
  							if (node->di.bLineAbove // we have a line above
  								&& pwd->iRowCount > 0 // and we're not the first row
 diff --git a/plugins/TipperYM/src/preset_items.cpp b/plugins/TipperYM/src/preset_items.cpp index 373911704f..e6e5cce468 100644 --- a/plugins/TipperYM/src/preset_items.cpp +++ b/plugins/TipperYM/src/preset_items.cpp @@ -22,6 +22,7 @@ Boston, MA 02111-1307, USA.  PRESETITEM presetItems[] = 
  {
 +	"account", LPGENT("Account"), LPGENT("Account:"), _T("%sys:account%"), 0, 0, 0,
  	"birth", LPGENT("Birthday"), LPGENT("Birthday:"), _T("%birthday_date% (%birthday_age%) @ Next: %birthday_next%"), "birthdate", "birthage", "birthnext",
  	"client", LPGENT("Client"), LPGENT("Client:"), _T("%raw:/MirVer%"), 0, 0, 0,
  	"email", LPGENT("Email"), LPGENT("Email:"), _T("%raw:/e-mail%"), 0, 0, 0,
 diff --git a/plugins/TipperYM/src/resource.h b/plugins/TipperYM/src/resource.h index 0e850b25ea..5f14e5a4b2 100644 --- a/plugins/TipperYM/src/resource.h +++ b/plugins/TipperYM/src/resource.h @@ -111,6 +111,7 @@  #define IDC_CHK_USEPROTOSMILEYS         1106
  #define IDC_CHK_ONLYISOLATED            1107
  #define IDC_CMB_PRESETITEMS             1111
 +#define IDC_CMB_TYPE                    1112
  #define IDC_CHK_LIMITMSG                1113
  #define IDC_ED_CHARCOUNT                1114
  #define IDC_SPIN_CHARCOUNT              1115
 diff --git a/plugins/TipperYM/src/subst.cpp b/plugins/TipperYM/src/subst.cpp index 36dadd8b6d..6fdf551015 100644 --- a/plugins/TipperYM/src/subst.cpp +++ b/plugins/TipperYM/src/subst.cpp @@ -63,6 +63,22 @@ bool DBGetContactSettingAsString(HANDLE hContact, const char *szModuleName, cons  	return buff[0] ? true : false;
  }
 +bool CheckContactType(HANDLE hContact, const DISPLAYITEM &di)
 +{
 +	if (di.type == DIT_ALL)
 +		return true;
 +
 +	char *szProto = GetContactProto(hContact);	
 +	if (szProto) {
 +		if (db_get_b(hContact, szProto, "ChatRoom", 0) != 0)
 +			return di.type == DIT_CHATS;
 +		else
 +			return di.type == DIT_CONTACTS;
 +	}
 +
 +	return false;
 +}
 +
  void StripBBCodesInPlace(TCHAR *swzText)
  {
  	if (!db_get_b(0, MODULE, "StripBBCodes", 1))
 diff --git a/plugins/TipperYM/src/subst.h b/plugins/TipperYM/src/subst.h index d8cbf39d45..7df4a13cca 100644 --- a/plugins/TipperYM/src/subst.h +++ b/plugins/TipperYM/src/subst.h @@ -24,6 +24,8 @@ Boston, MA 02111-1307, USA.  bool GetLabelText(HANDLE hContact, const DISPLAYITEM &di, TCHAR *buff, int iBufflen);
  bool GetValueText(HANDLE hContact, const DISPLAYITEM &di, TCHAR *buff, int iBufflen);
 +bool CheckContactType(HANDLE hContact, const DISPLAYITEM &di);
 +
  void StripBBCodesInPlace(TCHAR *text);
  // can be used with hContact == 0 to get uid for a given proto
 diff --git a/plugins/TipperYM/src/version.h b/plugins/TipperYM/src/version.h index 1fca504129..3493167c92 100644 --- a/plugins/TipperYM/src/version.h +++ b/plugins/TipperYM/src/version.h @@ -1,7 +1,7 @@  #define __MAJOR_VERSION				2
  #define __MINOR_VERSION				1
  #define __RELEASE_NUM				0
 -#define __BUILD_NUM					4
 +#define __BUILD_NUM					5
  #define __FILEVERSION_STRING		__MAJOR_VERSION,__MINOR_VERSION,__RELEASE_NUM,__BUILD_NUM
  | 
