diff options
author | mataes2007 <mataes2007@e753b5eb-9565-29b2-b5c5-2cc6f99dfbcb> | 2011-11-26 15:41:10 +0000 |
---|---|---|
committer | mataes2007 <mataes2007@e753b5eb-9565-29b2-b5c5-2cc6f99dfbcb> | 2011-11-26 15:41:10 +0000 |
commit | f04d64869f3b1de54fb343f28f955584780001b8 (patch) | |
tree | 5453dc10de3d980de79ffe019fa0b5fcb692a27d /gtalkext/tipper_items.cpp | |
parent | 7aff1e4cb053394db57c2814d5fe1e6493e0cc75 (diff) |
Project folders rename part 3
git-svn-id: http://miranda-plugins.googlecode.com/svn/trunk@215 e753b5eb-9565-29b2-b5c5-2cc6f99dfbcb
Diffstat (limited to 'gtalkext/tipper_items.cpp')
-rw-r--r-- | gtalkext/tipper_items.cpp | 157 |
1 files changed, 0 insertions, 157 deletions
diff --git a/gtalkext/tipper_items.cpp b/gtalkext/tipper_items.cpp deleted file mode 100644 index f09be10..0000000 --- a/gtalkext/tipper_items.cpp +++ /dev/null @@ -1,157 +0,0 @@ -//***************************************************************************************
-//
-// Google Extension plugin for the Miranda IM's Jabber protocol
-// Copyright (c) 2011 bems@jabber.org, George Hazan (ghazan@jabber.ru)
-//
-// 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.
-//
-//***************************************************************************************
-
-#include "StdAfx.h"
-#include "tipper_items.h"
-#include "resources.h"
-
-static const int MAX_TIPPER_ITEM_PROP = 6 ;
-
-static const LPSTR VALUE_SETTING_PROP = "DIValue%d";
-static const LPSTR LABEL_SETTING_PROP = "DILabel%d";
-
-static const LPSTR LAST_WRITTEN_LABEL_SETTING = "LastWrittenTipperLabel";
-
-static LPSTR TipperItemProps[MAX_TIPPER_ITEM_PROP] = {
- LABEL_SETTING_PROP,
- "DILineAbove%d",
- "DITipperVarsFirst%d",
- "DIValNewline%d",
- VALUE_SETTING_PROP,
- "DIVisible%d"
-};
-
-static const LPSTR TIPPER_ITEMS_MOD_NAME = "Tipper_Items";
-static const LPSTR TIPPER_ITEM_COUNT_SETTING = "DINumValues";
-static const LPTSTR UNREAD_THREADS_RAW = _T("%raw:") _T(SHORT_PLUGIN_NAME) _T("/UnreadThreads%");
-static const LPTSTR UNREAD_THREADS_LABEL = _T("Unread threads:");
-
-void ShiftTipperSettings(LPSTR buff, int count, LPSTR format)
-{
- for (int i = count; i > 0; i--) {
- DBCONTACTWRITESETTING cws;
- DBCONTACTGETSETTING cgs;
- cgs.szModule = TIPPER_ITEMS_MOD_NAME;
- sprintf(buff, format, i - 1);
- cgs.szSetting = buff;
- cgs.pValue = &cws.value;
-
- if (CallService(MS_DB_CONTACT_GETSETTING, 0, (LPARAM)&cgs)) break;
- __try {
- if (DBVT_ASCIIZ == cws.value.type) {
- DBFreeVariant(&cws.value);
- cws.value.type = DBVT_WCHAR;
- if (CallService(MS_DB_CONTACT_GETSETTING_STR, 0, (LPARAM)&cgs)) break;
- }
-
- if (CallService(MS_DB_CONTACT_GETSETTING_STR, 0, (LPARAM)&cgs)) break;
-
- cws.szModule = TIPPER_ITEMS_MOD_NAME;
- sprintf(buff, format, i);
- cws.szSetting = buff;
- CallService(MS_DB_CONTACT_WRITESETTING, 0, (LPARAM)&cws);
- }
- __finally {
- DBFreeVariant(&cws.value);
- }
- }
-}
-
-void SetLabelProp(int index, LPSTR setting)
-{
- sprintf(setting, LABEL_SETTING_PROP, index);
-
- DBVARIANT dbv1 = {0};
- if (!DBGetContactSettingTString(0, TIPPER_ITEMS_MOD_NAME, setting, &dbv1))
- __try {
- DBVARIANT dbv2 = {0};
- if (!DBGetContactSettingTString(0, SHORT_PLUGIN_NAME, LAST_WRITTEN_LABEL_SETTING, &dbv2))
- __try {
- if (!lstrcmp(dbv1.ptszVal, dbv2.ptszVal)) {
- LPTSTR label = TranslateTS(UNREAD_THREADS_LABEL);
- DBWriteContactSettingTString(0, SHORT_PLUGIN_NAME, LAST_WRITTEN_LABEL_SETTING, label);
- DBWriteContactSettingTString(0, TIPPER_ITEMS_MOD_NAME, setting, label);
- }
- }
- __finally {
- DBFreeVariant(&dbv2);
- }
- }
- __finally {
- DBFreeVariant(&dbv1);
- }
-}
-
-void AddTipperItem()
-{
- unsigned short itemCount = DBGetContactSettingWord(0, TIPPER_ITEMS_MOD_NAME,
- TIPPER_ITEM_COUNT_SETTING , unsigned short(-1));
- if (unsigned short(-1) == itemCount) return;
-
- int i, l = 0;
- for (i = itemCount; i > 0; i /= 10) l++; // var setting path
- l += 30; // const setting part
-
- LPSTR setting = (LPSTR)malloc(l * sizeof(TCHAR));
- __try {
- for (i = 0; i < itemCount; i++) {
- sprintf(setting, VALUE_SETTING_PROP, i);
-
- DBVARIANT dbv = {0};
- if (!DBGetContactSettingTString(0, TIPPER_ITEMS_MOD_NAME, setting, &dbv))
- __try {
- if (!lstrcmp(UNREAD_THREADS_RAW, dbv.ptszVal)) {
- SetLabelProp(i, setting);
- return;
- }
- }
- __finally {
- DBFreeVariant(&dbv);
- }
- }
-
- for (i = 0; i < MAX_TIPPER_ITEM_PROP; i++)
- ShiftTipperSettings(setting, itemCount, TipperItemProps[i]);
-
- #define WRITE_TIPPER_PROP(type, index, value)\
- sprintf(setting, TipperItemProps[##index##], 0);\
- DBWriteContactSetting##type##(0, TIPPER_ITEMS_MOD_NAME, setting, ##value##)
-
- LPTSTR label = TranslateTS(UNREAD_THREADS_LABEL);
-
- DBWriteContactSettingTString(0, SHORT_PLUGIN_NAME, LAST_WRITTEN_LABEL_SETTING, label);
-
- WRITE_TIPPER_PROP(TString, 0, label);
- WRITE_TIPPER_PROP(Byte, 1, 0);
- WRITE_TIPPER_PROP(Byte, 2, 0);
- WRITE_TIPPER_PROP(Byte, 3, 0);
- WRITE_TIPPER_PROP(TString, 4, UNREAD_THREADS_RAW);
- WRITE_TIPPER_PROP(Byte, 5, 1);
-
- #undef WRITE_TIPPER_PROP
- }
- __finally {
- free(setting);
- }
-
- DBWriteContactSettingWord(0, TIPPER_ITEMS_MOD_NAME,
- TIPPER_ITEM_COUNT_SETTING, itemCount + 1);
-}
\ No newline at end of file |