Esempio n. 1
0
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 "jabber.h"
#include "jabber_iq.h"
#include "jabber_caps.h"
#include "version.h"

const JabberFeatCapPair g_JabberFeatCapPairs[] = {
	{ JABBER_FEAT_DISCO_INFO,           JABBER_CAPS_DISCO_INFO,           LPGENT("Supports Service Discovery info") },
	{ JABBER_FEAT_DISCO_ITEMS,          JABBER_CAPS_DISCO_ITEMS,          LPGENT("Supports Service Discovery items list") },
	{ JABBER_FEAT_ENTITY_CAPS,          JABBER_CAPS_ENTITY_CAPS,          LPGENT("Can inform about its Jabber capabilities") },
	{ JABBER_FEAT_SI,                   JABBER_CAPS_SI,                   LPGENT("Supports stream initiation (for filetransfers for ex.)") },
	{ JABBER_FEAT_SI_FT,                JABBER_CAPS_SI_FT,                LPGENT("Supports stream initiation for file transfers") },
	{ JABBER_FEAT_BYTESTREAMS,          JABBER_CAPS_BYTESTREAMS,          LPGENT("Supports file transfers via SOCKS5 Bytestreams") },
	{ JABBER_FEAT_IBB,                  JABBER_CAPS_IBB,                  LPGENT("Supports file transfers via In-Band Bytestreams") },
	{ JABBER_FEAT_OOB,                  JABBER_CAPS_OOB,                  LPGENT("Supports file transfers via Out-of-Band Bytestreams") },
	{ JABBER_FEAT_OOB2,                 JABBER_CAPS_OOB,                  LPGENT("Supports file transfers via Out-of-Band Bytestreams") },
	{ JABBER_FEAT_COMMANDS,             JABBER_CAPS_COMMANDS,             LPGENT("Supports execution of Ad-Hoc commands") },
	{ JABBER_FEAT_REGISTER,             JABBER_CAPS_REGISTER,             LPGENT("Supports in-band registration") },
	{ JABBER_FEAT_MUC,                  JABBER_CAPS_MUC,                  LPGENT("Supports multi-user chat") },
	{ JABBER_FEAT_CHATSTATES,           JABBER_CAPS_CHATSTATES,           LPGENT("Can report chat state in a chat session") },
	{ JABBER_FEAT_LAST_ACTIVITY,        JABBER_CAPS_LAST_ACTIVITY,        LPGENT("Can report information about the last activity of the user") },
	{ JABBER_FEAT_VERSION,              JABBER_CAPS_VERSION,              LPGENT("Can report own version information") },
	{ JABBER_FEAT_ENTITY_TIME,          JABBER_CAPS_ENTITY_TIME,          LPGENT("Can report local time of the user") },
Esempio n. 2
0
INT_PTR CALLBACK SendDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam)
{
	TSendContactsData* wndData = (TSendContactsData*)GetWindowLongPtr(hwndDlg, DWLP_USER);

	switch (msg) {
	case WM_INITDIALOG:
		TranslateDialogDefault(hwndDlg);
		SendMessage(hwndDlg, WM_SETICON, ICON_SMALL, (LPARAM)LoadIcon(hInst, MAKEINTRESOURCE(IDI_CONTACTS)));
		SetAllContactChecks(GetDlgItem(hwndDlg, IDC_LIST), lParam);
		WindowList_Add(g_hSendWindowList, hwndDlg, lParam);
		wndData = new TSendContactsData(lParam);
		SetWindowLongPtr(hwndDlg, DWLP_USER, (LONG_PTR)wndData);
		// new dlg init 
		wndData->hIcons[0] = InitMButton(hwndDlg, IDC_ADD, SKINICON_OTHER_ADDCONTACT, LPGENT("Add Contact Permanently to List"));
		wndData->hIcons[1] = InitMButton(hwndDlg, IDC_DETAILS, SKINICON_OTHER_USERDETAILS, LPGENT("View User's Details"));
		wndData->hIcons[2] = InitMButton(hwndDlg, IDC_HISTORY, SKINICON_OTHER_HISTORY, LPGENT("View User's History"));
		wndData->hIcons[3] = InitMButton(hwndDlg, IDC_USERMENU, SKINICON_OTHER_DOWNARROW, LPGENT("User Menu"));

		SendMessage(hwndDlg, DM_UPDATETITLE, 0, 0);
		// new dialog init done
		return TRUE;

	case WM_SETFOCUS:
		SetFocus(GetDlgItem(hwndDlg, IDC_LIST));
		break;

	case WM_NOTIFY:
		if (((LPNMHDR)lParam)->idFrom == IDC_LIST) {
			switch (((LPNMHDR)lParam)->code) {
			case CLN_NEWCONTACT:
			case CLN_LISTREBUILT: // rebuild list
				if (wndData) SetAllContactChecks(GetDlgItem(hwndDlg, IDC_LIST), wndData->hContact);
			}
		}
		break;

	case WM_TIMER:
		if (wParam == TIMERID_MSGSEND) {
			KillTimer(hwndDlg, wParam);
			wndData->ShowErrorDlg(hwndDlg, "The contacts send timed out.", TRUE);
		}
		break;

	case DM_ERRORDECIDED:
		EnableWindow(hwndDlg, TRUE);
		wndData->hError = NULL;
		switch (wParam) {
		case MSGERROR_CANCEL:
			wndData->UnhookProtoAck();
			if (wndData->uacklist.Count) {
				for (int i = 0; i < wndData->uacklist.Count; i++)
					delete g_aAckData.Remove(wndData->uacklist.Items[i]); // remove our ackdata & release structure

				mir_free(wndData->uacklist.Items);
				wndData->uacklist.Items = NULL;
				wndData->uacklist.Count = 0;
			}
			EnableDlgItem(hwndDlg, IDOK, TRUE);
			EnableDlgItem(hwndDlg, IDC_LIST, TRUE);
			ShowWindow(hwndDlg, SW_SHOWNORMAL);
			SetFocus(GetDlgItem(hwndDlg, IDC_LIST));
			break;

		case MSGERROR_DONE:
			// contacts were delivered succesfully after timeout
			SetFocus(GetDlgItem(hwndDlg, IDC_LIST));
			wndData->UnhookProtoAck();
			break;

		case MSGERROR_RETRY:// resend timeouted packets
			for (int i = 0; i < wndData->uacklist.Count; i++) {
				TAckData *lla = g_aAckData.Remove(wndData->uacklist.Items[i]);
				HANDLE hProcc = (HANDLE)CallContactService(wndData->hContact, PSS_CONTACTS, MAKEWPARAM(0, lla->nContacts), (LPARAM)lla->aContacts);

				if (!hProcc) { // if fatal do not include
					wndData->uacklist.Remove(wndData->uacklist.Items[i]);
					delete lla; // release the structure
					continue;
				}
				else {
					// update process code
					wndData->uacklist.Items[i] = hProcc;
					g_aAckData.Add(hProcc, lla);
				}
			}// collect TAckData for our window, resend
			break;
		}
		break;

	case WM_COMMAND:
		if (!lParam && CallService(MS_CLIST_MENUPROCESSCOMMAND, MAKEWPARAM(LOWORD(wParam), MPCF_CONTACTMENU), (LPARAM)wndData->hContact))
			break;

		switch (LOWORD(wParam)) {
		case IDOK:
			if (IsWindowEnabled(GetDlgItem(hwndDlg, IDOK))) {
				MCONTACT hContact, hItem;
				wndData->ClearContacts(); // do not include contacts twice

				HWND hList = GetDlgItem(hwndDlg, IDC_LIST);
				hContact = FindFirstClistContact(hList, &hItem);
				while (hContact) {
					// build list of contacts to send
					if (SendMessage(hList, CLM_GETCHECKMARK, (WPARAM)hItem, 0))
						wndData->AddContact(hContact);

					hContact = FindNextClistContact(hList, hContact, &hItem);
				}
				/* send contacts */
				if (!wndData->SendContacts(hwndDlg))
					break;

				SetTimer(hwndDlg, TIMERID_MSGSEND, db_get_dw(NULL, "SRMsg", "MessageTimeout", TIMEOUT_MSGSEND), NULL);
			}
			break;

		case IDCANCEL:
			DestroyWindow(hwndDlg);
			break;

		case ID_SELECTALL:
			{
				// select all contacts
				HWND hwndList = GetDlgItem(hwndDlg, IDC_LIST);
				MCONTACT hItem, hContact = FindFirstClistContact(hwndList, &hItem);
				while (hContact) {
					SendMessage(hwndList, CLM_SETCHECKMARK, (WPARAM)hItem, 1);
					hContact = FindNextClistContact(hwndList, hContact, &hItem);
				}
			}
			break;
	
		case IDC_USERMENU:
			{
				RECT rc;
				GetWindowRect(GetDlgItem(hwndDlg, IDC_USERMENU), &rc);
				HMENU hMenu = Menu_BuildContactMenu(wndData->hContact);
				TrackPopupMenu(hMenu, 0, rc.left, rc.bottom, 0, hwndDlg, NULL);
				DestroyMenu(hMenu);
			}
			break;

		case IDC_HISTORY:
			CallService(MS_HISTORY_SHOWCONTACTHISTORY, (WPARAM)wndData->hContact, 0);
			break;

		case IDC_DETAILS:
			CallService(MS_USERINFO_SHOWDIALOG, (WPARAM)wndData->hContact, 0);
			break;

		case IDC_ADD:
			DialogAddContactExecute(hwndDlg, wndData->hContact);
			break;
		}
		break;

	case HM_EVENTSENT:
		{
			ACKDATA *ack = (ACKDATA*)lParam;
			if (ack->type != ACKTYPE_CONTACTS)
				break;

			TAckData *ackData = g_aAckData.Get(ack->hProcess);
			if (ackData == NULL)
				break;    // on unknown hprocc go away

			if (ackData->hContact != ack->hContact)
				break; // this is not ours, strange

			if (ack->result == ACKRESULT_FAILED) {
				// some process failed, show error dialog
				KillTimer(hwndDlg, TIMERID_MSGSEND);
				wndData->ShowErrorDlg(hwndDlg, (char *)ack->lParam, TRUE);
				// ackData get used in error handling, released there
				break;
			}

			DBEVENTINFO dbei = { sizeof(dbei) };
			dbei.szModule = GetContactProto(ackData->hContact);
			dbei.eventType = EVENTTYPE_CONTACTS;
			dbei.flags = DBEF_SENT | DBEF_UTF;
			dbei.timestamp = time(NULL);
			//make blob
			TCTSend* maSend = (TCTSend*)_alloca(ackData->nContacts*sizeof(TCTSend));
			memset(maSend, 0, (ackData->nContacts * sizeof(TCTSend)));
			dbei.cbBlob = 0;
			char* pBlob;
			int i;
			for (i = 0; i < ackData->nContacts; i++) {
				// prepare data & count size
				maSend[i].mcaNick = mir_utf8encodeT(pcli->pfnGetContactDisplayName(ackData->aContacts[i], 0));
				maSend[i].mcaUIN = mir_utf8encodeT(ptrT(GetContactUID(ackData->aContacts[i])));
				dbei.cbBlob += (DWORD)strlennull(maSend[i].mcaUIN) + (DWORD)strlennull((char*)maSend[i].mcaNick) + 2;
			}
			dbei.pBlob = (PBYTE)_alloca(dbei.cbBlob);
			for (i = 0, pBlob = (char*)dbei.pBlob; i < ackData->nContacts; i++) {
				strcpynull(pBlob, (char*)maSend[i].mcaNick);
				pBlob += strlennull(pBlob) + 1;
				strcpynull(pBlob, maSend[i].mcaUIN);
				pBlob += strlennull(pBlob) + 1;
			}
			db_event_add(ackData->hContact, &dbei);
			g_aAckData.Remove(ack->hProcess); // do not release here, still needed
			wndData->uacklist.Remove(ack->hProcess); // packet confirmed
			for (i = 0; i < ackData->nContacts; i++) {
				mir_free(maSend[i].mcaUIN);
				mir_free(maSend[i].mcaNick);
			}
			delete ackData; // all done, release structure
			if (!wndData->uacklist.Count) {
				SkinPlaySound("SentContacts");
				KillTimer(hwndDlg, TIMERID_MSGSEND);

				if (wndData->hError)
					SendMessage(wndData->hError, DM_ERRORDECIDED, MSGERROR_DONE, 0);

				SendMessage(hwndDlg, WM_CLOSE, 0, 0); // all packets confirmed, close the dialog
			}
		}
		break;
	
	case WM_MEASUREITEM:
		return Menu_MeasureItem((LPMEASUREITEMSTRUCT)lParam);

	case WM_DRAWITEM:
		DrawProtocolIcon(hwndDlg, lParam, wndData->hContact);
		return Menu_DrawItem((LPDRAWITEMSTRUCT)lParam);

	case DM_UPDATETITLE:
		UpdateDialogTitle(hwndDlg, wndData ? wndData->hContact : NULL, TranslateT("Send Contacts to"));
		if (wndData)
			UpdateDialogAddButton(hwndDlg, wndData->hContact);
		break;

	case WM_CLOSE:
		wndData->UnhookProtoAck();
		DestroyWindow(hwndDlg);
		break;

	case WM_DESTROY:
		WindowList_Remove(g_hSendWindowList, hwndDlg);
		delete wndData;
		break;
	}

	return FALSE;
}
Esempio n. 3
0
/**
 * Sounds initialization
 */
void FacebookProto::InitSounds()
{
	SkinAddNewSoundExT("Notification", m_tszUserName, LPGENT("Notification"));
	SkinAddNewSoundExT("NewsFeed", m_tszUserName, LPGENT("News Feed"));
	SkinAddNewSoundExT("OtherEvent", m_tszUserName, LPGENT("Other Event"));
}
Esempio n. 4
0
					//perform LOCALTOTIMESTAMP
					res = (DWORD)ll - TimeZone_ToLocal(0);
					//nevel look for Year/Month/Day/Hour/Minute/Second again
					db_set_dw(hcontact, S_MOD, "seenTS", res);
				}
			}
		}
	}

	if (st)
		memcpy(st, &lst, sizeof(SYSTEMTIME));

	return res;
}

TCHAR *weekdays[] = { LPGENT("Sunday"), LPGENT("Monday"), LPGENT("Tuesday"), LPGENT("Wednesday"), LPGENT("Thursday"), LPGENT("Friday"), LPGENT("Saturday") };
TCHAR *wdays_short[] = { LPGENT("Sun."), LPGENT("Mon."), LPGENT("Tue."), LPGENT("Wed."), LPGENT("Thu."), LPGENT("Fri."), LPGENT("Sat.") };
TCHAR *monthnames[] = { LPGENT("January"), LPGENT("February"), LPGENT("March"), LPGENT("April"), LPGENT("May"), LPGENT("June"), LPGENT("July"), LPGENT("August"), LPGENT("September"), LPGENT("October"), LPGENT("November"), LPGENT("December") };
TCHAR *mnames_short[] = { LPGENT("Jan."), LPGENT("Feb."), LPGENT("Mar."), LPGENT("Apr."), LPGENT("May"), LPGENT("Jun."), LPGENT("Jul."), LPGENT("Aug."), LPGENT("Sep."), LPGENT("Oct."), LPGENT("Nov."), LPGENT("Dec.") };

TCHAR* ParseString(TCHAR *szstring, MCONTACT hcontact)
{
#define MAXSIZE 1024
	static TCHAR sztemp[MAXSIZE + 1];
	TCHAR szdbsetting[128];
	TCHAR *charPtr;
	int isetting = 0;
	DWORD dwsetting = 0;
	struct in_addr ia;
	DBVARIANT dbv;
Esempio n. 5
0
INT_PTR CALLBACK DlgProcPopupGeneral(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
{
	static bool bDlgInit = false;	//some controls send WM_COMMAND before or during WM_INITDIALOG

	static OPTTREE_OPTION *statusOptions = NULL;
	static int statusOptionsCount = 0;
	if (statusOptions) {
		int index;
		if (OptTree_ProcessMessage(hwnd, msg, wParam, lParam, &index, IDC_STATUSES, statusOptions, statusOptionsCount))
			return TRUE;
	}

	switch (msg) {
	case WM_INITDIALOG:
		//Seconds of delay
		CheckDlgButton(hwnd, IDC_INFINITEDELAY, PopupOptions.InfiniteDelay);
		CheckDlgButton(hwnd, IDC_LEAVEHOVERED, PopupOptions.LeaveHovered);
		EnableWindow(GetDlgItem(hwnd, IDC_SECONDS), !PopupOptions.InfiniteDelay);
		EnableWindow(GetDlgItem(hwnd, IDC_SECONDS_STATIC1), !PopupOptions.InfiniteDelay);
		EnableWindow(GetDlgItem(hwnd, IDC_SECONDS_STATIC2), !PopupOptions.InfiniteDelay);
		EnableWindow(GetDlgItem(hwnd, IDC_LEAVEHOVERED), !PopupOptions.InfiniteDelay);
		SetDlgItemInt(hwnd, IDC_SECONDS, PopupOptions.Seconds, FALSE);
		SendDlgItemMessage(hwnd, IDC_SECONDS_SPIN, UDM_SETRANGE, 0, (LPARAM)MAKELONG(SETTING_LIFETIME_MAX, SETTING_LIFETIME_MIN));

		//Dynamic Resize
		CheckDlgButton(hwnd, IDC_DYNAMICRESIZE, PopupOptions.DynamicResize);
		SetDlgItemText(hwnd, IDC_USEMAXIMUMWIDTH, PopupOptions.DynamicResize ? LPGENT("Maximum width") : LPGENT("Width"));
		//Minimum Width
		CheckDlgButton(hwnd, IDC_USEMINIMUMWIDTH, PopupOptions.UseMinimumWidth);
		SendDlgItemMessage(hwnd, IDC_MINIMUMWIDTH_SPIN, UDM_SETRANGE, 0, (LPARAM)MAKELONG(SETTING_MAXIMUMWIDTH_MAX, SETTING_MINIMUMWIDTH_MIN));
		SetDlgItemInt(hwnd, IDC_MINIMUMWIDTH, PopupOptions.MinimumWidth, FALSE);
		//Maximum Width
		PopupOptions.UseMaximumWidth = PopupOptions.DynamicResize ? PopupOptions.UseMaximumWidth : TRUE;
		CheckDlgButton(hwnd, IDC_USEMAXIMUMWIDTH, PopupOptions.UseMaximumWidth);
		SendDlgItemMessage(hwnd, IDC_MAXIMUMWIDTH_SPIN, UDM_SETRANGE, 0, (LPARAM)MAKELONG(SETTING_MAXIMUMWIDTH_MAX, SETTING_MINIMUMWIDTH_MIN));
		SetDlgItemInt(hwnd, IDC_MAXIMUMWIDTH, PopupOptions.MaximumWidth, FALSE);
		//And finally let's enable/disable them.
		EnableWindow(GetDlgItem(hwnd, IDC_USEMINIMUMWIDTH), PopupOptions.DynamicResize);
		EnableWindow(GetDlgItem(hwnd, IDC_MINIMUMWIDTH), PopupOptions.DynamicResize && PopupOptions.UseMinimumWidth);
		EnableWindow(GetDlgItem(hwnd, IDC_MINIMUMWIDTH_SPIN), PopupOptions.DynamicResize && PopupOptions.UseMinimumWidth);
		EnableWindow(GetDlgItem(hwnd, IDC_MAXIMUMWIDTH), PopupOptions.UseMaximumWidth);
		EnableWindow(GetDlgItem(hwnd, IDC_MAXIMUMWIDTH_SPIN), PopupOptions.UseMaximumWidth);

		//Position combobox.
		{
			HWND hCtrl = GetDlgItem(hwnd, IDC_WHERE);
			ComboBox_SetItemData(hCtrl, ComboBox_AddString(hCtrl, TranslateT("Upper left corner")), POS_UPPERLEFT);
			ComboBox_SetItemData(hCtrl, ComboBox_AddString(hCtrl, TranslateT("Lower left corner")), POS_LOWERLEFT);
			ComboBox_SetItemData(hCtrl, ComboBox_AddString(hCtrl, TranslateT("Lower right corner")), POS_LOWERRIGHT);
			ComboBox_SetItemData(hCtrl, ComboBox_AddString(hCtrl, TranslateT("Upper right corner")), POS_UPPERRIGHT);
			SendDlgItemMessage(hwnd, IDC_WHERE, CB_SETCURSEL, PopupOptions.Position, 0);
		}
		//Configure popup area
		{
			HWND hCtrl = GetDlgItem(hwnd, IDC_CUSTOMPOS);
			SendMessage(hCtrl, BUTTONSETASFLATBTN, TRUE, 0);
			SendMessage(hCtrl, BUTTONADDTOOLTIP, (WPARAM)_T("Popup area"), BATF_TCHAR);
			SendMessage(hCtrl, BM_SETIMAGE, IMAGE_ICON, (LPARAM)IcoLib_GetIcon(ICO_OPT_RESIZE, 0));
		}
		//Spreading combobox
		{
			HWND hCtrl = GetDlgItem(hwnd, IDC_LAYOUT);
			ComboBox_SetItemData(hCtrl, ComboBox_AddString(hCtrl, TranslateT("Horizontal")), SPREADING_HORIZONTAL);
			ComboBox_SetItemData(hCtrl, ComboBox_AddString(hCtrl, TranslateT("Vertical")), SPREADING_VERTICAL);
			SendDlgItemMessage(hwnd, IDC_LAYOUT, CB_SETCURSEL, PopupOptions.Spreading, 0);
		}
		//miscellaneous
		CheckDlgButton(hwnd, IDC_REORDERPOPUPS, PopupOptions.ReorderPopups);

		//Popup enabled
		CheckDlgButton(hwnd, IDC_POPUPENABLED, PopupOptions.ModuleIsEnabled ? BST_UNCHECKED : BST_CHECKED);
		CheckDlgButton(hwnd, IDC_DISABLEINFS, PopupOptions.DisableWhenFullscreen);
		EnableWindow(GetDlgItem(hwnd, IDC_DISABLEINFS), PopupOptions.ModuleIsEnabled);
		EnableWindow(GetDlgItem(hwnd, IDC_STATUSES), PopupOptions.ModuleIsEnabled);

		//new status options
		{
			int protocolCount = 0;
			PROTOACCOUNT **protocols;
			ProtoEnumAccounts(&protocolCount, &protocols);
			DWORD globalFlags = 0;
			for (int i = 0; i < protocolCount; ++i) {
				DWORD protoFlags = CallProtoService(protocols[i]->szModuleName, PS_GETCAPS, PFLAGNUM_2, 0);
				globalFlags |= protoFlags;
				statusOptionsCount += CountStatusModes(protoFlags);
			}
			statusOptionsCount += CountStatusModes(globalFlags);

			statusOptions = new OPTTREE_OPTION[statusOptionsCount];

			int pos = AddStatusModes(statusOptions, 0, LPGENT("Global Status"), globalFlags);
			for (int i = 0; i < protocolCount; ++i) {
				DWORD protoFlags = CallProtoService(protocols[i]->szModuleName, PS_GETCAPS, PFLAGNUM_2, 0);
				if (!CountStatusModes(protoFlags))
					continue;
				
				TCHAR prefix[128];
				mir_sntprintf(prefix, SIZEOF(prefix), LPGENT("Protocol Status")_T("/%s"), protocols[i]->tszAccountName);
				pos = AddStatusModes(statusOptions, pos, prefix, protoFlags);
			}

			int index;
			OptTree_ProcessMessage(hwnd, msg, wParam, lParam, &index, IDC_STATUSES, statusOptions, statusOptionsCount);

			for (int i = 0; i < protocolCount; ++i) {
				DWORD protoFlags = CallProtoService(protocols[i]->szModuleName, PS_GETCAPS, PFLAGNUM_2, 0);
				if (!CountStatusModes(protoFlags))
					continue;

				char prefix[128];
				mir_snprintf(prefix, sizeof(prefix), "Protocol Status/%s", protocols[i]->szModuleName);

				TCHAR pszSettingName[256];
				mir_sntprintf(pszSettingName, SIZEOF(pszSettingName), LPGENT("Protocol Status")_T("/%s"), protocols[i]->tszAccountName);
				OptTree_SetOptions(hwnd, IDC_STATUSES, statusOptions, statusOptionsCount, db_get_dw(NULL, MODULNAME, prefix, 0), pszSettingName);
			}
			OptTree_SetOptions(hwnd, IDC_STATUSES, statusOptions, statusOptionsCount, db_get_dw(NULL, MODULNAME, "Global Status", 0), LPGENT("Global Status"));
		}

		TranslateDialogDefault(hwnd);	//do it on end of WM_INITDIALOG
		bDlgInit = true;
		return TRUE;

	case WM_COMMAND:
		switch (HIWORD(wParam)) {
		case BN_CLICKED:	//Button controls
			switch (LOWORD(wParam)) {
			case IDC_INFINITEDELAY:
				PopupOptions.InfiniteDelay = !PopupOptions.InfiniteDelay;
				EnableWindow(GetDlgItem(hwnd, IDC_SECONDS), !PopupOptions.InfiniteDelay);
				EnableWindow(GetDlgItem(hwnd, IDC_SECONDS_STATIC1), !PopupOptions.InfiniteDelay);
				EnableWindow(GetDlgItem(hwnd, IDC_SECONDS_STATIC2), !PopupOptions.InfiniteDelay);
				EnableWindow(GetDlgItem(hwnd, IDC_LEAVEHOVERED), !PopupOptions.InfiniteDelay);
				SendMessage(GetParent(hwnd), PSM_CHANGED, 0, 0);
				break;

			case IDC_LEAVEHOVERED:
				PopupOptions.LeaveHovered = !PopupOptions.LeaveHovered;
				SendMessage(GetParent(hwnd), PSM_CHANGED, 0, 0);
				break;

			case IDC_DYNAMICRESIZE:
				PopupOptions.DynamicResize = !PopupOptions.DynamicResize;
				EnableWindow(GetDlgItem(hwnd, IDC_USEMINIMUMWIDTH), PopupOptions.DynamicResize);
				EnableWindow(GetDlgItem(hwnd, IDC_MINIMUMWIDTH), PopupOptions.DynamicResize && PopupOptions.UseMinimumWidth);
				EnableWindow(GetDlgItem(hwnd, IDC_MINIMUMWIDTH_SPIN), PopupOptions.DynamicResize && PopupOptions.UseMinimumWidth);
				SetDlgItemText(hwnd, IDC_USEMAXIMUMWIDTH, PopupOptions.DynamicResize ? TranslateT("Maximum width") : TranslateT("Width"));
				if (!PopupOptions.DynamicResize) {
					PopupOptions.UseMaximumWidth = TRUE;
					CheckDlgButton(hwnd, IDC_USEMAXIMUMWIDTH, BST_CHECKED);
					EnableWindow(GetDlgItem(hwnd, IDC_USEMAXIMUMWIDTH), TRUE);
					EnableWindow(GetDlgItem(hwnd, IDC_MAXIMUMWIDTH), TRUE);
					EnableWindow(GetDlgItem(hwnd, IDC_MAXIMUMWIDTH_SPIN), TRUE);
				}
				SendMessage(GetParent(hwnd), PSM_CHANGED, 0, 0);
				break;

			case IDC_USEMINIMUMWIDTH:
				PopupOptions.UseMinimumWidth = !PopupOptions.UseMinimumWidth;
				EnableWindow(GetDlgItem(hwnd, IDC_MINIMUMWIDTH), PopupOptions.UseMinimumWidth);
				EnableWindow(GetDlgItem(hwnd, IDC_MINIMUMWIDTH_SPIN), PopupOptions.UseMinimumWidth);
				SendMessage(GetParent(hwnd), PSM_CHANGED, 0, 0);
				break;

			case IDC_USEMAXIMUMWIDTH:
				PopupOptions.UseMaximumWidth = Button_GetCheck((HWND)lParam);
				if (!PopupOptions.DynamicResize) { //ugly - set always on if DynamicResize = off
					CheckDlgButton(hwnd, LOWORD(wParam), BST_CHECKED);
					PopupOptions.UseMaximumWidth = TRUE;
				}
				EnableWindow(GetDlgItem(hwnd, IDC_MAXIMUMWIDTH), PopupOptions.UseMaximumWidth);
				EnableWindow(GetDlgItem(hwnd, IDC_MAXIMUMWIDTH_SPIN), PopupOptions.UseMaximumWidth);
				SendMessage(GetParent(hwnd), PSM_CHANGED, 0, 0);
				break;

			case IDC_CUSTOMPOS:
				{
					RECT rcButton, rcBox;
					HWND hwndBox = CreateDialog(hInst, MAKEINTRESOURCE(IDD_POSITION), NULL, PositionBoxDlgProc);
					GetWindowRect((HWND)lParam, &rcButton);
					GetWindowRect(hwndBox, &rcBox);
					MoveWindow(hwndBox,
						rcButton.right - (rcBox.right - rcBox.left) + 15,
						rcButton.bottom + 3,
						rcBox.right - rcBox.left,
						rcBox.bottom - rcBox.top,
						FALSE);

					SetWindowLongPtr(hwndBox, GWL_EXSTYLE, GetWindowLongPtr(hwndBox, GWL_EXSTYLE) | WS_EX_LAYERED);
					SetLayeredWindowAttributes(hwndBox, NULL, 0, LWA_ALPHA);
					ShowWindow(hwndBox, SW_SHOW);
					for (int i = 0; i <= 255; i += 15) {
						SetLayeredWindowAttributes(hwndBox, NULL, i, LWA_ALPHA);
						UpdateWindow(hwndBox);
						Sleep(1);
					}
					SetWindowLongPtr(hwndBox, GWL_EXSTYLE, GetWindowLongPtr(hwndBox, GWL_EXSTYLE) & ~WS_EX_LAYERED);

					ShowWindow(hwndBox, SW_SHOW);
					SendMessage(GetParent(hwnd), PSM_CHANGED, 0, 0);
				}
				break;

			case IDC_REORDERPOPUPS:
				{
					PopupOptions.ReorderPopups = !PopupOptions.ReorderPopups;
					PopupOptions.ReorderPopupsWarning = PopupOptions.ReorderPopups ? db_get_b(NULL, MODULNAME, "ReorderPopupsWarning", TRUE) : TRUE;
					SendMessage(GetParent(hwnd), PSM_CHANGED, 0, 0);
				}
				break;

			case IDC_POPUPENABLED:
				{
					int chk = IsDlgButtonChecked(hwnd, IDC_POPUPENABLED);
					if (PopupOptions.ModuleIsEnabled&&chk || !PopupOptions.ModuleIsEnabled && !chk)
						svcEnableDisableMenuCommand(0, 0);
					EnableWindow(GetDlgItem(hwnd, IDC_STATUSES), PopupOptions.ModuleIsEnabled);
					EnableWindow(GetDlgItem(hwnd, IDC_DISABLEINFS), PopupOptions.ModuleIsEnabled);
				}
				break;

			case IDC_DISABLEINFS:
				PopupOptions.DisableWhenFullscreen = !PopupOptions.DisableWhenFullscreen;
				SendMessage(GetParent(hwnd), PSM_CHANGED, 0, 0);
				break;

			case IDC_PREVIEW:
				PopupPreview();
				break;
			}
			break;

		case CBN_SELCHANGE:		//ComboBox controls
			switch (LOWORD(wParam)) {
			//lParam = Handle to the control
			case IDC_WHERE:
				PopupOptions.Position = ComboBox_GetItemData((HWND)lParam, ComboBox_GetCurSel((HWND)lParam));
				SendMessage(GetParent(hwnd), PSM_CHANGED, 0, 0);
				break;
			case IDC_LAYOUT:
				PopupOptions.Spreading = ComboBox_GetItemData((HWND)lParam, ComboBox_GetCurSel((HWND)lParam));
				SendMessage(GetParent(hwnd), PSM_CHANGED, 0, 0);
				break;
			}
			break;

		case EN_CHANGE:			//Edit controls change
			if (!bDlgInit) break;
			switch (LOWORD(wParam)) {
			//lParam = Handle to the control
			case IDC_SECONDS:
				{
					int seconds = GetDlgItemInt(hwnd, LOWORD(wParam), NULL, FALSE);
					if (seconds >= SETTING_LIFETIME_MIN &&
						seconds <= SETTING_LIFETIME_MAX &&
						seconds != PopupOptions.Seconds) {
							PopupOptions.Seconds = seconds;
							SendMessage(GetParent(hwnd), PSM_CHANGED, 0, 0);
					}
				}
				break;
			case IDC_MINIMUMWIDTH:
				{
					int temp = GetDlgItemInt(hwnd, IDC_MINIMUMWIDTH, NULL, FALSE);
					if (temp >= SETTING_MINIMUMWIDTH_MIN &&
						temp <= SETTING_MAXIMUMWIDTH_MAX &&
						temp != PopupOptions.MinimumWidth) {
							PopupOptions.MinimumWidth = temp;
							SendMessage(GetParent(hwnd), PSM_CHANGED, 0, 0);
					}
				}
				break;
			case IDC_MAXIMUMWIDTH:
				{
					int temp = GetDlgItemInt(hwnd, IDC_MAXIMUMWIDTH, NULL, FALSE);
					if (temp >= SETTING_MINIMUMWIDTH_MIN &&
						temp <= SETTING_MAXIMUMWIDTH_MAX &&
						temp != PopupOptions.MaximumWidth) {
							PopupOptions.MaximumWidth = temp;
							SendMessage(GetParent(hwnd), PSM_CHANGED, 0, 0);
					}
				}
				break;
			}//end switch(idCtrl)
			break;

		case EN_KILLFOCUS:		//Edit controls lost fokus
			switch (LOWORD(wParam)) {
			//lParam = Handle to the control
			case IDC_SECONDS:
				{
					int seconds = GetDlgItemInt(hwnd, LOWORD(wParam), NULL, FALSE);
					if (seconds > SETTING_LIFETIME_MAX)
						PopupOptions.Seconds = SETTING_LIFETIME_MAX;
					else if (seconds < SETTING_LIFETIME_MIN)
						PopupOptions.Seconds = SETTING_LIFETIME_MIN;
					if (seconds != PopupOptions.Seconds) {
						SetDlgItemInt(hwnd, LOWORD(wParam), PopupOptions.Seconds, FALSE);
						ErrorMSG(SETTING_LIFETIME_MIN, SETTING_LIFETIME_MAX);
						SetFocus((HWND)lParam);
					}
				}
				break;
			case IDC_MINIMUMWIDTH:
				{
					int temp = GetDlgItemInt(hwnd, LOWORD(wParam), NULL, FALSE);
					if (temp < SETTING_MINIMUMWIDTH_MIN)
						PopupOptions.MinimumWidth = SETTING_MINIMUMWIDTH_MIN;
					else if (temp > SETTING_MAXIMUMWIDTH_MAX)
						PopupOptions.MinimumWidth = SETTING_MAXIMUMWIDTH_MAX;
					if (temp != PopupOptions.MinimumWidth) {
						SetDlgItemInt(hwnd, LOWORD(wParam), PopupOptions.MinimumWidth, FALSE);
						ErrorMSG(SETTING_MINIMUMWIDTH_MIN, SETTING_MAXIMUMWIDTH_MAX);
						SetFocus((HWND)lParam);
						break;
					}
					if (temp > PopupOptions.MaximumWidth) {
						PopupOptions.MaximumWidth = min(temp, SETTING_MAXIMUMWIDTH_MAX);
						SetDlgItemInt(hwnd, IDC_MAXIMUMWIDTH, PopupOptions.MaximumWidth, FALSE);
					}
				}
				break;
			case IDC_MAXIMUMWIDTH:
				{
					int temp = GetDlgItemInt(hwnd, LOWORD(wParam), NULL, FALSE);
					if (temp >= SETTING_MAXIMUMWIDTH_MAX)
						PopupOptions.MaximumWidth = SETTING_MAXIMUMWIDTH_MAX;
					else if (temp < SETTING_MINIMUMWIDTH_MIN)
						PopupOptions.MaximumWidth = SETTING_MINIMUMWIDTH_MIN;
					if (temp != PopupOptions.MaximumWidth) {
						SetDlgItemInt(hwnd, LOWORD(wParam), PopupOptions.MaximumWidth, FALSE);
						ErrorMSG(SETTING_MINIMUMWIDTH_MIN, SETTING_MAXIMUMWIDTH_MAX);
						SetFocus((HWND)lParam);
						break;
					}
					if (temp < PopupOptions.MinimumWidth) {
						PopupOptions.MinimumWidth = max(temp, SETTING_MINIMUMWIDTH_MIN);
						SetDlgItemInt(hwnd, IDC_MINIMUMWIDTH, PopupOptions.MinimumWidth, FALSE);
					}
				}
				break;
			}
			break;
		}
		break;

	case WM_NOTIFY:
		switch (((LPNMHDR)lParam)->idFrom) {
		case 0:
			switch (((LPNMHDR)lParam)->code) {
			case PSN_RESET:
				LoadOption_General();
				return TRUE;

			case PSN_APPLY:
				//Seconds
				db_set_b(NULL, MODULNAME, "InfiniteDelay", PopupOptions.InfiniteDelay);
				db_set_w(NULL, MODULNAME, "Seconds", (WORD)PopupOptions.Seconds);
				db_set_b(NULL, MODULNAME, "LeaveHovered", PopupOptions.LeaveHovered);

				//Dynamic Resize
				db_set_b(NULL, MODULNAME, "DynamicResize", PopupOptions.DynamicResize);
				db_set_b(NULL, MODULNAME, "UseMinimumWidth", PopupOptions.UseMinimumWidth);
				db_set_w(NULL, MODULNAME, "MinimumWidth", PopupOptions.MinimumWidth);
				db_set_b(NULL, MODULNAME, "UseMaximumWidth", PopupOptions.UseMaximumWidth);
				db_set_w(NULL, MODULNAME, "MaximumWidth", PopupOptions.MaximumWidth);

				//Position
				db_set_b(NULL, MODULNAME, "Position", (BYTE)PopupOptions.Position);

				//Configure popup area
				db_set_w(NULL, MODULNAME, "gapTop", (WORD)PopupOptions.gapTop);
				db_set_w(NULL, MODULNAME, "gapBottom", (WORD)PopupOptions.gapBottom);
				db_set_w(NULL, MODULNAME, "gapLeft", (WORD)PopupOptions.gapLeft);
				db_set_w(NULL, MODULNAME, "gapRight", (WORD)PopupOptions.gapRight);
				db_set_w(NULL, MODULNAME, "spacing", (WORD)PopupOptions.spacing);

				//Spreading
				db_set_b(NULL, MODULNAME, "Spreading", (BYTE)PopupOptions.Spreading);

				//miscellaneous
				Check_ReorderPopups(hwnd);	//this save also PopupOptions.ReorderPopups

				//disable When
				db_set_b(NULL, MODULNAME, "DisableWhenFullscreen", PopupOptions.DisableWhenFullscreen);

				//new status options
				{
					int protocolCount;
					PROTOACCOUNT **protocols;
					ProtoEnumAccounts(&protocolCount, &protocols);

					for (int i = 0; i < protocolCount; ++i) {
						char prefix[128];
						mir_snprintf(prefix, SIZEOF(prefix), "Protocol Status/%s", protocols[i]->szModuleName);

						TCHAR pszSettingName[256];
						mir_sntprintf(pszSettingName, SIZEOF(pszSettingName), _T("Protocol Status/%s"), protocols[i]->tszAccountName);
						db_set_dw(NULL, MODULNAME, prefix, OptTree_GetOptions(hwnd, IDC_STATUSES, statusOptions, statusOptionsCount, pszSettingName));
					}
					db_set_dw(NULL, MODULNAME, "Global Status", OptTree_GetOptions(hwnd, IDC_STATUSES, statusOptions, statusOptionsCount, _T("Global Status")));
				}
				return TRUE;
			}
			break;

		case IDC_MINIMUMWIDTH_SPIN:
			{
				LPNMUPDOWN lpnmud = (LPNMUPDOWN)lParam;
				int temp = lpnmud->iPos + lpnmud->iDelta;
				if (temp > PopupOptions.MaximumWidth) {
					PopupOptions.MaximumWidth = min(temp, SETTING_MAXIMUMWIDTH_MAX);
					SetDlgItemInt(hwnd, IDC_MAXIMUMWIDTH, PopupOptions.MaximumWidth, FALSE);
				}
			}
			break;

		case IDC_MAXIMUMWIDTH_SPIN:
			{
				LPNMUPDOWN lpnmud = (LPNMUPDOWN)lParam;
				int temp = lpnmud->iPos + lpnmud->iDelta;
				if (temp < PopupOptions.MinimumWidth) {
					PopupOptions.MinimumWidth = max(temp, SETTING_MINIMUMWIDTH_MIN);
					SetDlgItemInt(hwnd, IDC_MINIMUMWIDTH, PopupOptions.MinimumWidth, FALSE);
				}
			}
		}
		break;

	case WM_DESTROY:
		if (statusOptions) {
			for (int i = 0; i < statusOptionsCount; ++i) {
				mir_free(statusOptions[i].pszOptionName);
				mir_free(statusOptions[i].pszSettingName);
			}
			delete [] statusOptions;
			statusOptions = NULL;
			statusOptionsCount = 0;
			bDlgInit = false;
		}
		break;
	}
	return FALSE;
}
Esempio n. 6
0
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 "..\..\core\commonheaders.h"

#define NAMEORDERCOUNT 9
static TCHAR* nameOrderDescr[ NAMEORDERCOUNT ] =
{
	LPGENT("My custom name (not movable)"),
	LPGENT("Nick"),
	LPGENT("FirstName"),
	LPGENT("E-mail"),
	LPGENT("LastName"),
	LPGENT("Username"),
	LPGENT("FirstName LastName"),
	LPGENT("LastName FirstName"),
	LPGENT("'(Unknown contact)' (not movable)")
};

BYTE nameOrder[NAMEORDERCOUNT];

static int GetDatabaseString(CONTACTINFO *ci, const char* setting, DBVARIANT* dbv)
{
	if (strcmp(ci->szProto, "CList") && CallProtoService(ci->szProto, PS_GETCAPS, PFLAGNUM_4, 0) & PF4_INFOSETTINGSVC) {
Esempio n. 7
0
		cfg::eCache[nextCacheEntry].status_item = NULL;
		cfg::eCache[nextCacheEntry].dwCFlags = 0;
		cfg::eCache[nextCacheEntry].dwXMask = CalcXMask(hContact);
		GetCachedStatusMsg(nextCacheEntry, const_cast<char *>(szProto));
		cfg::eCache[nextCacheEntry].dwLastMsgTime = INTSORT_GetLastMsgTime(hContact);
		iFound = nextCacheEntry++;
		LeaveCriticalSection(&cachecs);
	}
	return iFound;
}

static struct {
	UINT 	id;
	TCHAR*	name;
} _tagFSINFO[] = {
	FONTID_CONTACTS, LPGENT("Standard contacts"),
	FONTID_INVIS, LPGENT("Online contacts to whom you have a different visibility"),
	FONTID_OFFLINE, LPGENT("Offline contacts"),
	FONTID_OFFINVIS, LPGENT("Offline contacts to whom you have a different visibility"),
	FONTID_NOTONLIST, LPGENT("Contacts which are 'not on list'"),
	FONTID_GROUPS, LPGENT("Groups"),
	FONTID_GROUPCOUNTS, LPGENT("Group member counts"),
	FONTID_DIVIDERS, LPGENT("Dividers"),
	FONTID_STATUS, LPGENT("Status mode"),
	FONTID_FRAMETITLE, LPGENT("Frame titles"),
	FONTID_EVENTAREA, LPGENT("Event area"),
	FONTID_TIMESTAMP, LPGENT("Contact list local time"),
	0, NULL
};

struct ColorOptionsList {
Esempio n. 8
0
///////////////////////////////////////////////////////
// Load / unload

BOOL WINAPI DllMain(HINSTANCE hinstDLL, DWORD, LPVOID)
{
	hInst = hinstDLL;
	return TRUE;
}

/////////////////////////////////////////////////////////////////////////////
// Fonts

static LPCTSTR s_fonts[FLT_FONTIDS] =
{
	{ LPGENT("Standard contacts") },
	{ LPGENT("Online contacts to whom you have a different visibility") },
	{ LPGENT("Offline contacts") },
	{ LPGENT("Offline contacts to whom you have a different visibility") },
	{ LPGENT("Contacts which are 'not on list'") }
};

///////////////////////////////////////////////////////
// Hooked events

static int OnContactDeleted(WPARAM hContact, LPARAM)
{
	ThumbInfo *pThumb = thumbList.FindThumbByContact(hContact);
	if (pThumb) {
		pThumb->DeleteContactPos();
		thumbList.RemoveThumb(pThumb);
Esempio n. 9
0
		LPGENT("Messages (outgoing)"),
		LPGENT("Messages (all)"),
		LPGENT("Messages (in/out ratio)"),
		LPGENT("Chats (incoming)"),
		LPGENT("Chats (outgoing)"),
		LPGENT("Chats (all)"),
		LPGENT("Chats (in/out ratio)"),
	};

	array_each_(i, sourceTexts)
	{
		Opt.addComboItem(m_hSource, TranslateTS(sourceTexts[i]));
	}

	static const TCHAR* unitTexts[] = {
		LPGENT("Hours"),
		LPGENT("Days"),
		LPGENT("Weeks"),
	};

	array_each_(i, unitTexts)
	{
		Opt.addComboItem(m_hBlockUnit, TranslateTS(unitTexts[i]));
	}

	Opt.setComboSelected(m_hSource       , 4 * m_nSource + m_nSourceType);
	Opt.setEditNumber   (m_hIgnoreOld    , m_nIgnoreOld                 );
	Opt.setRadioChecked (m_hVisMode      , m_nVisMode                   );
	Opt.setEditNumber   (m_hHODGroup     , m_nHODGroup                  );
	Opt.setEditNumber   (m_hDOWGroup     , m_nDOWGroup                  );
	Opt.setComboSelected(m_hBlockUnit    , m_nBlockUnit                 );
Esempio n. 10
0
int OnModulesLoaded(WPARAM wParam, LPARAM lParam)
{
	HookEvent(ME_DB_CONTACT_SETTINGCHANGED, OnContactSettingChanged);
	HookEvent(ME_TTB_MODULELOADED, OnTopToolBarModuleLoaded);
	
	SkinAddNewSoundExT(BIRTHDAY_NEAR_SOUND, LPGENT("WhenWasIt"), LPGENT("Birthday near"));
	SkinAddNewSoundExT(BIRTHDAY_TODAY_SOUND, LPGENT("WhenWasIt"), LPGENT("Birthday today"));
	
	UpdateTimers();

	CLISTMENUITEM cl = { sizeof(cl) };
	cl.position = 10000000;
	cl.pszPopupName = LPGEN("Birthdays (When Was It)");

	cl.pszService = MS_WWI_CHECK_BIRTHDAYS;
	cl.icolibItem = hCheckMenu;
	cl.pszName = LPGEN("Check for birthdays");
	hmCheckBirthdays = Menu_AddMainMenuItem(&cl);
	
	cl.pszService = MS_WWI_LIST_SHOW;
	cl.pszName = LPGEN("Birthday list");
	cl.icolibItem = hListMenu;
	hmBirthdayList = Menu_AddMainMenuItem(&cl);
	
	cl.pszService = MS_WWI_REFRESH_USERDETAILS;
	cl.position = 10100000;
	cl.pszName = LPGEN("Refresh user details");
	cl.icolibItem = hRefreshUserDetails;
	hmRefreshDetails = Menu_AddMainMenuItem(&cl);
	
	cl.pszService = MS_WWI_IMPORT_BIRTHDAYS;
	cl.position = 10200000;
	cl.pszName = LPGEN("Import birthdays");
	cl.icolibItem = hImportBirthdays;
	hmImportBirthdays = Menu_AddMainMenuItem(&cl);
	
	cl.pszService = MS_WWI_EXPORT_BIRTHDAYS;
	cl.pszName = LPGEN("Export birthdays");
	cl.icolibItem = hExportBirthdays;
	hmExportBirthdays = Menu_AddMainMenuItem(&cl);
	
	cl.pszService = MS_WWI_ADD_BIRTHDAY;
	cl.position = 10000000;
	cl.icolibItem = hAddBirthdayContact;
	cl.pszName = LPGEN("Add/change user &birthday");
	hmAddChangeBirthday = Menu_AddContactMenuItem(&cl);

	// Register hotkeys
	HOTKEYDESC hotkey = { sizeof(hotkey) };
	hotkey.pszSection = LPGEN("Birthdays");

	hotkey.pszName = "wwi_birthday_list";
	hotkey.pszDescription = LPGEN("Birthday list");
	hotkey.pszService = MS_WWI_LIST_SHOW;
	Hotkey_Register(&hotkey);
		
	hotkey.pszName = "wwi_check_birthdays";
	hotkey.pszDescription = LPGEN("Check for birthdays");
	hotkey.pszService = MS_WWI_CHECK_BIRTHDAYS;
	Hotkey_Register(&hotkey);
	
	return 0;
}
Esempio n. 11
0
void DlgOption::SubOutput::onWMInitDialog()
{
	TranslateDialogDefault(getHWnd());

	// init option tree(s)
	m_Options << GetDlgItem(getHWnd(), IDC_OPTIONS);

	// settings
	OptionsCtrl::Item hTemp;
	OptionsCtrl::Item hTemp2;

	hTemp                              = m_Options.insertGroup(NULL, TranslateT("Contact filtering and totals"), OptionsCtrl::OCF_ROOTGROUP | OptionsCtrl::OCF_NODISABLECHILDS);
		m_hRemoveEmptyContacts          = m_Options.insertCheck(hTemp, TranslateT("Remove contacts with empty history"));
		m_hRemoveOutChatsZero           = m_Options.insertCheck(hTemp, TranslateT("Remove contacts with only incoming chats"), OptionsCtrl::OCF_DISABLECHILDSONUNCHECK);
			m_hRemoveOutBytesZero        = m_Options.insertCheck(m_hRemoveOutChatsZero, TranslateT("Remove only if you never answered"));
		m_hRemoveInChatsZero            = m_Options.insertCheck(hTemp, TranslateT("Remove contacts with only outgoing chats"), OptionsCtrl::OCF_DISABLECHILDSONUNCHECK);
			m_hRemoveInBytesZero         = m_Options.insertCheck(m_hRemoveInChatsZero, TranslateT("Remove only if contact never answered"));
		m_hOmitContacts                 = m_Options.insertCheck(hTemp, TranslateT("Limit number of contacts in statistics"), OptionsCtrl::OCF_DISABLECHILDSONUNCHECK);
			hTemp2                       = m_Options.insertGroup(m_hOmitContacts, TranslateT("Criteria"));
				m_hOmitByValue            = m_Options.insertCheck(hTemp2, TranslateT("Omit contacts that didn't produce a certain amount of data"), OptionsCtrl::OCF_DISABLECHILDSONUNCHECK);
					m_hOmitByValueData     = m_Options.insertCombo(m_hOmitByValue, TranslateT("Omit if"));
					m_hOmitByValueLimit    = m_Options.insertEdit(m_hOmitByValue, TranslateT("...is less than"), _T(""), OptionsCtrl::OCF_NUMBER);
				m_hOmitByTime             = m_Options.insertCheck(hTemp2, TranslateT("Omit contacts that were inactive for some time"), OptionsCtrl::OCF_DISABLECHILDSONUNCHECK);
					m_hOmitByTimeDays      = m_Options.insertEdit(m_hOmitByTime, TranslateT("Maximum inactivity time (days)"), _T(""), OptionsCtrl::OCF_NUMBER);
				m_hOmitByRank             = m_Options.insertCheck(hTemp2, TranslateT("Omit all contacts not in \"Top n\""), OptionsCtrl::OCF_DISABLECHILDSONUNCHECK);
					m_hOmitNumOnTop        = m_Options.insertEdit(m_hOmitByRank, TranslateT("Number of contacts in \"Top n\""), _T("10"), OptionsCtrl::OCF_NUMBER);
			m_hOmittedInTotals           = m_Options.insertCheck(m_hOmitContacts, TranslateT("Include omitted contacts in totals"));
			m_hOmittedInExtraRow         = m_Options.insertCheck(m_hOmitContacts, TranslateT("Include totals of omitted contacts in additional row"));
		m_hCalcTotals                   = m_Options.insertCheck(hTemp, TranslateT("Include totals in statistics"));
	hTemp                              = m_Options.insertGroup(NULL, TranslateT("Table header"), OptionsCtrl::OCF_ROOTGROUP | OptionsCtrl::OCF_NODISABLECHILDS);
		m_hTableHeader                  = m_Options.insertCheck(hTemp, TranslateT("Output header"), OptionsCtrl::OCF_DISABLECHILDSONUNCHECK | OptionsCtrl::OCF_DISABLED | OptionsCtrl::OCF_NODISABLECHILDS);
			m_hTableHeaderRepeat         = m_Options.insertEdit(m_hTableHeader, TranslateT("Repeat header every n contacts (0=don't repeat)"), _T("0"), OptionsCtrl::OCF_NUMBER);
			m_hTableHeaderVerbose        = m_Options.insertCheck(m_hTableHeader, TranslateT("Make column titles more verbose"));
			m_hHeaderTooltips            = m_Options.insertCheck(m_hTableHeader, TranslateT("Show tooltips with detailed information in column titles"), OptionsCtrl::OCF_DISABLECHILDSONUNCHECK);
				m_hHeaderTooltipsIfCustom = m_Options.insertCheck(m_hHeaderTooltips, TranslateT("Only show if a custom title was entered or if titles are not verbose"));
	m_hSort                            = m_Options.insertGroup(NULL, TranslateT("Sorting"), OptionsCtrl::OCF_ROOTGROUP);
	hTemp                              = m_Options.insertGroup(NULL, TranslateT("HTML file generation"), OptionsCtrl::OCF_ROOTGROUP);
		m_hNick                         = m_Options.insertEdit(hTemp, TranslateT("Own nick for statistics"));
	    hTemp2                         = m_Options.insertGroup(hTemp, TranslateT("Output files and folders"));
			m_hOutputVariables           = m_Options.insertCheck(hTemp2, TranslateT("Substitute variables in output file name and subfolder for additional files"));
			m_hOutputFile                = m_Options.insertEdit(hTemp2, TranslateT("Output file"));
			m_hOutputExtraToFolder       = m_Options.insertCheck(hTemp2, TranslateT("Output additional files to subfolder"), OptionsCtrl::OCF_DISABLECHILDSONUNCHECK);
				m_hOutputExtraFolder      = m_Options.insertEdit(m_hOutputExtraToFolder, TranslateT("Subfolder for additional files"));
			m_hOverwriteAlways           = m_Options.insertCheck(hTemp2, TranslateT("Always overwrite already existing files (dangerous!)"));
		hTemp2                          = m_Options.insertGroup(hTemp, TranslateT("Auto open statistics after being generated..."));
			m_hAutoOpenOptions           = m_Options.insertCheck(hTemp2, TranslateT("...via button \"Create statistics\" in options"));
			m_hAutoOpenStartup           = m_Options.insertCheck(hTemp2, TranslateT("...on Miranda NG startup"));
			m_hAutoOpenMenu              = m_Options.insertCheck(hTemp2, TranslateT("...via Miranda NG main menu"));

	// our sort levels
	static const TCHAR* sortLevels[Settings::cNumSortLevels] = {
		LPGENT("First sort by"),
		LPGENT("Then sort by"),
		LPGENT("Finally sort by")
	};

	// our sort keys
	static const struct {
		int key;
		TCHAR* desc;
	} sortKeys[] = {
		{ Settings::skNick              , LPGENT("Nick")                                  },
		{ Settings::skProtocol          , LPGENT("Protocol")                              },
		{ Settings::skGroup             , LPGENT("Group")                                 },
		{ Settings::skBytesIn           , LPGENT("Characters (incoming, absolute)")       },
		{ Settings::skBytesOut          , LPGENT("Characters (outgoing, absolute)")       },
		{ Settings::skBytesTotal        , LPGENT("Characters (all, absolute)")            },
		{ Settings::skBytesInAvg        , LPGENT("Characters (incoming, average)")        },
		{ Settings::skBytesOutAvg       , LPGENT("Characters (outgoing, average)")        },
		{ Settings::skBytesTotalAvg     , LPGENT("Characters (all, average)")             },
		{ Settings::skMessagesIn        , LPGENT("Messages (incoming, absolute)")         },
		{ Settings::skMessagesOut       , LPGENT("Messages (outgoing, absolute)")         },
		{ Settings::skMessagesTotal     , LPGENT("Messages (all, absolute)")              },
		{ Settings::skMessagesInAvg     , LPGENT("Messages (incoming, average)")          },
		{ Settings::skMessagesOutAvg    , LPGENT("Messages (outgoing, average)")          },
		{ Settings::skMessagesTotalAvg  , LPGENT("Messages (all, average)")               },
		{ Settings::skChatsIn           , LPGENT("Chats (incoming, absolute)")            },
		{ Settings::skChatsOut          , LPGENT("Chats (outgoing, absolute)")            },
		{ Settings::skChatsTotal        , LPGENT("Chats (all, absolute)")                 },
		{ Settings::skChatsInAvg        , LPGENT("Chats (incoming, average)")             },
		{ Settings::skChatsOutAvg       , LPGENT("Chats (outgoing, average)")             },
		{ Settings::skChatsTotalAvg     , LPGENT("Chats (all, average)")                  },
		{ Settings::skChatDurationTotal , LPGENT("Chat duration (total)")                 },
		{ Settings::skChatDurationMin   , LPGENT("Chat duration (minimum)")               },
		{ Settings::skChatDurationAvg   , LPGENT("Chat duration (average)")               },
		{ Settings::skChatDurationMax   , LPGENT("Chat duration (maximum)")               },
		{ Settings::skTimeOfFirstMessage, LPGENT("Time of first message to/from contact") },
		{ Settings::skTimeOfLastMessage , LPGENT("Time of last message to/from contact")  },
	};

	m_SortKeyToIndex.resize(Settings::skLAST - Settings::skFIRST + 1);
	m_IndexToSortKey.resize(array_len(sortKeys));

	array_each_(i, sortKeys)
	{
		m_IndexToSortKey[i] = sortKeys[i].key;
		m_SortKeyToIndex[sortKeys[i].key] = i;
	}
Esempio n. 12
0
bool SmileyPackType::LoadSmileyFileMSL(CMString &tbuf, bool onlyInfo, CMString &modpath)
{
	CMString pathstr, packstr;
	{
		_TPattern *pathsplit = _TPattern::compile(_T("(.*\\\\)(.*)\\.|$"));
		_TMatcher *m0 = pathsplit->createTMatcher(modpath);
		m0->findFirstMatch();
		pathstr = m0->getGroup(1);
		packstr = m0->getGroup(2);
		delete m0;
		delete pathsplit;
	}
	{
		_TPattern *otherf = _TPattern::compile(
			_T("^\\s*(Name|Author|Date|Version|ButtonSmiley)\\s*=\\s*\"(.*)\""),
			_TPattern::MULTILINE_MATCHING);

		_TMatcher *m0 = otherf->createTMatcher(tbuf);
		while (m0->findNextMatch()) {
			if (m0->getGroup(1) == _T("Name")) m_Name = m0->getGroup(2);
			if (m0->getGroup(1) == _T("Author")) m_Author = m0->getGroup(2);
			if (m0->getGroup(1) == _T("Date")) m_Date = m0->getGroup(2);
			if (m0->getGroup(1) == _T("Version")) m_Version = m0->getGroup(2);
			if (m0->getGroup(1) == _T("ButtonSmiley")) m_ButtonSmiley = m0->getGroup(2);
		}
		delete m0;
		delete otherf;
	}

	if (!onlyInfo) {
		selec.x = selec.y = win.x = win.y = 0;
		{
			_TPattern *pat = _TPattern::compile(
				_T("^\\s*(Selection|Window)Size\\s*=\\s*(\\d+)\\s*,\\s*(\\d+)"),
				_TPattern::MULTILINE_MATCHING);
			_TMatcher *m0 = pat->createTMatcher(tbuf);
			while (m0->findNextMatch()) {
				POINT tpt;
				tpt.x = _ttol(m0->getGroup(2).c_str());
				tpt.y = _ttol(m0->getGroup(3).c_str());

				if (m0->getGroup(1) == _T("Selection"))
					selec = tpt;
				else if (m0->getGroup(1) == _T("Window"))
					win = tpt;
			}
			delete m0;
			delete pat;
		}

		_TPattern *smiley = _TPattern::compile(
			_T("^\\s*Smiley(\\*)?\\s*=")	// Is Hidden
			_T("(?:\\s*\"(.*)\")")			// Smiley file name
			_T("(?:[\\s,]+(\\-?\\d+))")		// Icon resource id
			_T("(?:[\\s,]+(R|S)?\"(.*?)\")")	// Trigger text
			_T("(?:[\\s,]+\"(.*?)\")?")		// Tooltip or insert text
			_T("(?:[\\s,]+\"(.*?)\")?"),		// Tooltip text
			_TPattern::MULTILINE_MATCHING);

		SmileyVectorType hiddenSmileys;
		unsigned smnum = 0;
		{
			_TMatcher *m0 = smiley->createTMatcher(tbuf);
			while (m0->findNextMatch()) {
				CMString resname = m0->getGroup(2);
				if (resname.Find(_T("http://")) != -1) {
					if (GetSmileyFile(resname, packstr))
						continue;
				}
				else if (!resname.IsEmpty())
					resname.Insert(0, pathstr);

				SmileyType *dat = new SmileyType;

				const int iconIndex = _ttol(m0->getGroup(3).c_str());

				dat->SetHidden(m0->getStartingIndex(1) >= 0);
				if (m0->getStartingIndex(4) >= 0) {
					dat->SetRegEx(m0->getGroup(4) == _T("R"));
					dat->SetService(m0->getGroup(4) == _T("S"));
				}
				dat->m_TriggerText = m0->getGroup(5);
				if (dat->IsRegEx()) {
					if (m0->getStartingIndex(6) >= 0)
						ReplaceAllSpecials(m0->getGroup(6), dat->m_InsertText);

					if (m0->getStartingIndex(7) >= 0)
						ReplaceAllSpecials(m0->getGroup(7), dat->m_ToolText);
					else
						dat->m_ToolText = dat->m_InsertText;
				}
				else {
					if (m0->getStartingIndex(6) >= 0)
						ReplaceAllSpecials(m0->getGroup(6), dat->m_ToolText);
					else
						ReplaceAllSpecials(dat->m_TriggerText, dat->m_ToolText);
				}

				bool noerr;
				if (resname.IsEmpty()) {
					dat->SetHidden(true);
					dat->SetText(true);
					noerr = true;
				}
				else noerr = dat->LoadFromResource(resname, iconIndex);

				if (dat->IsHidden())
					hiddenSmileys.insert(dat);
				else
					m_SmileyList.insert(dat);

				if (!noerr) {
					static const TCHAR errmsg[] = LPGENT("Smiley #%u in file %s for smiley pack %s not found.");
					TCHAR msgtxt[1024];
					mir_sntprintf(msgtxt, TranslateTS(errmsg), smnum, resname.c_str(), modpath.c_str());
					CallService(MS_NETLIB_LOG, (WPARAM)hNetlibUser, _T2A(msgtxt));
					errorFound = true;
				}
				smnum++;
			}
			delete smiley;
			delete m0;
		}

		m_VisibleCount = m_SmileyList.getCount();

		m_SmileyList.splice(hiddenSmileys);

		AddTriggersToSmileyLookup();
	}

	return true;
}
Esempio n. 13
0
bool SmileyPackType::LoadSmileyFile(const CMString& filename, const CMString& packname, bool onlyInfo, bool noerr)
{
	Clear();

	if (filename.IsEmpty()) {
		m_Name = _T("Nothing loaded");
		return false;
	}

	CMString modpath;
	pathToAbsolute(filename, modpath);

	// Load xep file
	int fh = _topen(modpath.c_str(), _O_BINARY | _O_RDONLY);
	if (fh == -1) {
		if (!noerr) {
			static const TCHAR errmsg[] = LPGENT("Smiley pack %s for category \"%s\" not found.\nSelect correct smiley pack in the Options -> Customize -> Smileys.");
			TCHAR msgtxt[1024];
			mir_sntprintf(msgtxt, TranslateTS(errmsg), modpath.c_str(), packname);
			ReportError(msgtxt);
		}

		m_Name = _T("Nothing loaded");
		return false;
	}

	m_Filename = filename;

	// Find file size
	const long flen = _filelength(fh);

	// Allocate file buffer
	char* buf = new char[flen + sizeof(wchar_t)];

	// Read xep file in
	int len = _read(fh, buf, flen);
	*(wchar_t*)(buf + len) = 0;

	// Close file
	_close(fh);

	CMString tbuf;

	if (len > 2 && *(wchar_t*)buf == 0xfeff)
		tbuf = W2T_SM((wchar_t*)buf + 1);
	else if (len > 3 && buf[0] == '\xef' && buf[1] == '\xbb' && buf[2] == '\xbf')
		tbuf = W2T_SM(A2W_SM(buf + 3, CP_UTF8));
	else
		tbuf = A2T_SM(buf);

	delete[] buf;

	bool res;
	if (filename.Find(_T(".xep")) == -1)
		res = LoadSmileyFileMSL(tbuf, onlyInfo, modpath);
	else
		res = LoadSmileyFileXEP(tbuf, onlyInfo, modpath);

	if (errorFound)
		ReportError(TranslateT("There were problems loading smiley pack (it should be corrected).\nSee network log for details."));

	return res;
}
Esempio n. 14
0
	mdb_env_set_mapsize(m_pMdbEnv, m_dwFileSize);

	int mode = MDB_NOSYNC | MDB_NOSUBDIR;
	if (m_bReadOnly)
		mode += MDB_RDONLY;
	else
		mode += MDB_WRITEMAP;
	return mdb_env_open(m_pMdbEnv, _T2A(m_tszProfileName), mode, 0664) == MDB_SUCCESS;
}

/////////////////////////////////////////////////////////////////////////////////////////

static DWORD DatabaseCorrupted = 0;
static const TCHAR *msg = NULL;
static DWORD dwErr = 0;
static TCHAR tszPanic[] = LPGENT("Miranda has detected corruption in your database. This corruption may be fixed by DbChecker plugin. Please download it from http://miranda-ng.org/p/DbChecker/. Miranda will now shut down.");

void __cdecl dbpanic(void *)
{
	if (msg) {
		if (dwErr == ERROR_DISK_FULL)
			msg = TranslateT("Disk is full. Miranda will now shut down.");

		TCHAR err[256];
		mir_sntprintf(err, SIZEOF(err), msg, TranslateT("Database failure. Miranda will now shut down."), dwErr);

		MessageBox(0, err, TranslateT("Database Error"), MB_SETFOREGROUND | MB_TOPMOST | MB_APPLMODAL | MB_ICONWARNING | MB_OK);
	}
	else MessageBox(0, TranslateTS(tszPanic), TranslateT("Database Panic"), MB_SETFOREGROUND | MB_TOPMOST | MB_APPLMODAL | MB_ICONWARNING | MB_OK);
	TerminateProcess(GetCurrentProcess(), 255);
}
Esempio n. 15
0
////////////////////////////////////////////////////////////////////////////////

typedef struct
{
	UINT control;
	UINT icon;
	int  type;
	TCHAR *tooltip;
} controlinfo;


static controlinfo ctrls[] =
{
	// IDC_SCROLL & IDC_PAUSE must be first
	{IDC_SCROLL, IDI_SCROLL, BUTTONSETASFLATBTN, LPGENT("Scrolling (Ctrl+Q)")},
	{IDC_PAUSE, IDI_STARTED, BUTTONSETASFLATBTN, LPGENT("Pause logging(Ctrl+P)")},
	{IDC_SAVE, IDI_SAVE, BUTTONSETASFLATBTN, LPGENT("Save log to file (Ctrl+S)")},
	{IDC_COPY, IDI_COPY, BUTTONSETASFLATBTN, LPGENT("Copy selected log (Ctrl+C)")},
	{IDC_DELETE, IDI_DELETE, BUTTONSETASFLATBTN, LPGENT("Delete selected (Del)")},
	{IDC_OPTIONS, IDI_OPTIONS, BUTTONSETASFLATBTN, LPGENT("Log options (Ctrl+O)")},
	{IDC_STARTALL, IDI_START, BUTTONSETASFLATBTN, LPGENT("Start logging in all tabs")},
	{IDC_PAUSEALL, IDI_PAUSE, BUTTONSETASFLATBTN, LPGENT("Pause logging in all tabs")},
	{IDC_CLOSE, IDI_CLOSE, BUTTONSETASFLATBTN, LPGENT("Close tab (Ctrl+W)")},
};

////////////////////////////////////////////////////////////////////////////////

static LRESULT CALLBACK SubclassProc(HWND hwnd,UINT msg,WPARAM wParam,LPARAM lParam)
{
	int ctrl;
Esempio n. 16
0
void ColSplitTimeline::impl_configToUI(OptionsCtrl& Opt, OptionsCtrl::Item hGroup)
{
	OptionsCtrl::Group hTemp;
	OptionsCtrl::Radio hTempRadio;

	m_hSource                 = Opt.insertCombo(hGroup, TranslateT("Data source"));
	m_hIgnoreOld              = Opt.insertEdit(hGroup, TranslateT("Drop everything older than (days, 0=no limit)"), _T(""), OptionsCtrl::OCF_NUMBER);
	hTemp                     = Opt.insertGroup(hGroup, TranslateT("\"Split\" type"));
		m_hVisMode             = Opt.insertRadio(hTemp, NULL, TranslateT("Hours of day"), OptionsCtrl::OCF_DISABLECHILDSONUNCHECK);
			m_hHODGroup         = Opt.insertEdit (m_hVisMode, TranslateT("Number of days to group"), _T(""), OptionsCtrl::OCF_NUMBER);
		hTempRadio             = Opt.insertRadio(hTemp, m_hVisMode, TranslateT("Days of week"), OptionsCtrl::OCF_DISABLECHILDSONUNCHECK);
			m_hDOWGroup         = Opt.insertEdit (hTempRadio, TranslateT("Number of weeks to group"), _T(""), OptionsCtrl::OCF_NUMBER);
		hTempRadio             = Opt.insertRadio(hTemp, m_hVisMode, TranslateT("Custom (for experts only)"), OptionsCtrl::OCF_DISABLECHILDSONUNCHECK);
			hTemp               = Opt.insertGroup(hTempRadio, TranslateT("Column setup"));
				m_hBlockUnit     = Opt.insertCombo(hTemp, TranslateT("Block unit"));
				m_hUnitsPerBlock = Opt.insertEdit (hTemp, TranslateT("Units per block"), _T(""), OptionsCtrl::OCF_NUMBER);
				m_hBlocks        = Opt.insertEdit (hTemp, TranslateT("Blocks per column"), _T(""), OptionsCtrl::OCF_NUMBER);
			hTemp               = Opt.insertGroup(hTempRadio, TranslateT("Graph alignment"));
				m_hGraphAlign    = Opt.insertRadio(hTemp, NULL, TranslateT("Align on day boundary"));
				                   Opt.insertRadio(hTemp, m_hGraphAlign, TranslateT("Align on week boundary"));
			m_hCustomGroup      = Opt.insertEdit (hTempRadio, TranslateT("Number of columns to group"), _T(""), OptionsCtrl::OCF_NUMBER);
	m_hTopPerColumn           = Opt.insertCheck(hGroup, TranslateT("Calculate maximum per column (not per graph)"));

	static const TCHAR* sourceTexts[] = {
		LPGENT("Characters (incoming)"),
		LPGENT("Characters (outgoing)"),
		LPGENT("Characters (all)"),
		LPGENT("Characters (in/out ratio)"),
		LPGENT("Messages (incoming)"),
		LPGENT("Messages (outgoing)"),
		LPGENT("Messages (all)"),
		LPGENT("Messages (in/out ratio)"),
		LPGENT("Chats (incoming)"),
		LPGENT("Chats (outgoing)"),
		LPGENT("Chats (all)"),
		LPGENT("Chats (in/out ratio)"),
	};

	array_each_(i, sourceTexts)
	{
		Opt.addComboItem(m_hSource, TranslateTS(sourceTexts[i]));
	}
Esempio n. 17
0
static int OnSystemModulesLoaded(WPARAM wParam,LPARAM lParam)
{
	CreateServiceFunction(MS_CONSOLE_SHOW_HIDE, ShowHideConsole);

	FontIDT fid = {0};
	fid.cbSize = sizeof(fid);
	_tcscpy(fid.group,_T("Console"));
	_tcscpy(fid.name,TranslateT("Text"));
	strcpy(fid.dbSettingsGroup,"Console");
	strcpy(fid.prefix,"ConsoleFont");
	_tcscpy(fid.backgroundGroup,_T("Console"));
	_tcscpy(fid.backgroundName,_T("Background"));
	fid.flags = FIDF_DEFAULTVALID;
	fid.deffontsettings.charset = DEFAULT_CHARSET;
	fid.deffontsettings.colour = RGB(0, 0, 0);
	fid.deffontsettings.size = 10;
	fid.deffontsettings.style = 0;
	_tcsncpy(fid.deffontsettings.szFace, _T("Courier"), LF_FACESIZE);
	FontRegisterT(&fid);

	HookEvent(ME_FONT_RELOAD,OnFontChange);

	ColourIDT cid = {0};
	cid.cbSize=sizeof(cid);
	_tcscpy(cid.group,_T("Console"));
	_tcscpy(cid.name,_T("Background"));
	strcpy(cid.dbSettingsGroup,"Console");
	strcpy(cid.setting,"BgColor");
	cid.defcolour = RGB(255,255,255);
	ColourRegisterT(&cid);

	HookEvent(ME_COLOUR_RELOAD, OnColourChange);

	HOTKEYDESC hkd = {0};
	hkd.cbSize = sizeof(hkd);
	hkd.pszName = "Console_Show_Hide";
	hkd.pszDescription = LPGEN("Show/Hide Console");
	hkd.pszSection = "Main";
	hkd.pszService = MS_CONSOLE_SHOW_HIDE;
	hkd.DefHotKey = HOTKEYCODE(HOTKEYF_EXT, 'C');
	Hotkey_Register(&hkd);

	if (hwndConsole && IsWindow(hwndConsole))
	{
		HookEvent(ME_TTB_MODULELOADED, OnTTBLoaded);

		CLISTMENUITEM mi = { sizeof(mi) };
		mi.flags = CMIF_TCHAR;
		mi.hIcon = hIcons[0];
		mi.ptszPopupName = LPGENT("&Help");
		mi.popupPosition = 2000090000;
		mi.position = 1000000000;
		mi.ptszName = (IsWindowVisible(hwndConsole)) ? LPGENT("Hide Console") : LPGENT("Show Console");
		mi.pszService = MS_CONSOLE_SHOW_HIDE;
		hMenu = Menu_AddMainMenuItem(&mi);

		OnFontChange(0,0);
		OnColourChange(0,0);

		if (db_get_b(NULL,"Console","ShowAtStart",0) || db_get_b(NULL,"Console","Show",1))
			ShowConsole(1);
		else
			ShowConsole(0);
	}

	return 0;
}
Esempio n. 18
0
Miranda ICQ: the free icq client for MS Windows
Copyright (C) 2000-2  Richard Hughes, Roland Rabien & Tristan Van de Vreede
*/

#include "stdafx.h"

CLIST_INTERFACE *pcli;
HINSTANCE hinstance;

HGENMENU hToggle, hEnableMenu;
BOOL gbVarsServiceExist = FALSE;
INT interval;
int hLangpack;

TCHAR* ptszDefaultMsg[] = {
	LPGENT("I am currently away. I will reply to you when I am back."),
	LPGENT("I am currently very busy and can't spare any time to talk with you. Sorry..."),
	LPGENT("I am not available right now."),
	LPGENT("I am now doing something, I will talk to you later."),
	LPGENT("I am on the phone right now. I will get back to you very soon."),
	LPGENT("I am having meal right now. I will get back to you very soon.")
};

PLUGININFOEX pluginInfoEx = {
	sizeof(PLUGININFOEX),
	__PLUGIN_NAME,
	PLUGIN_MAKE_VERSION(__MAJOR_VERSION, __MINOR_VERSION, __RELEASE_NUM, __BUILD_NUM),
	__DESCRIPTION,
	__AUTHOR,
	__AUTHOREMAIL,
	__COPYRIGHT,
Esempio n. 19
0
static BOOLEAN CheckAnniversaries(HANDLE hContact, MTime &Now, CEvent &evt, BOOLEAN bNotify)
{
    INT numAnniversaries = 0;
    INT Diff;
    MAnnivDate mta;
    INT i;
    TCHAR szAnniv[MAX_PATH];
    TCHAR strMsg[MAX_SECONDLINE];
    BOOLEAN bOverflow = FALSE;
    WORD wDaysEarlier;

    if ((gRemindOpts.RemindState == REMIND_ANNIV) || (gRemindOpts.RemindState == REMIND_ALL))
    {
        for (i = 0; i < ANID_LAST && !mta.DBGetAnniversaryDate(hContact, i); i++)
        {
            mta.DBGetReminderOpts(hContact);

            if (mta.RemindOption() != BST_UNCHECKED)
            {
                wDaysEarlier = (mta.RemindOption() == BST_CHECKED) ? mta.RemindOffset() : -1;
                if (wDaysEarlier == (WORD)-1)
                {
                    wDaysEarlier = gRemindOpts.wDaysEarlier;
                }

                Diff = mta.CompareDays(Now);
                if ((Diff >= 0) && (Diff <= wDaysEarlier))
                {
                    if (evt._wDaysLeft > Diff)
                    {
                        evt._wDaysLeft = Diff;
                        evt._eType = CEvent::ANNIVERSARY;
                    }
                    numAnniversaries++;

                    // create displayed text for popup
                    if (bNotify && !bOverflow)
                    {
                        // first anniversary found
                        if (numAnniversaries == 1)
                        {
                            mir_sntprintf(szAnniv, MAX_PATH,
                                          TranslateT("%s has the following anniversaries:\0"),
                                          ContactGender(hContact));
                            mir_tcsncpy(strMsg, szAnniv, mir_tcslen(szAnniv));
                        }
                        switch (Diff)
                        {
                        case 0:
                        {
                            mir_sntprintf(szAnniv, MAX_PATH,
                                          TranslateT("%d. %s today\0"),
                                          mta.Age(), mta.Description());
                        }
                        break;

                        case 1:
                        {
                            mir_sntprintf(szAnniv, MAX_PATH,
                                          TranslateT("%d. %s tomorrow\0"),
                                          mta.Age() + 1, mta.Description());
                        }
                        break;

                        default:
                        {
                            mir_sntprintf(szAnniv, MAX_PATH,
                                          TranslateT("%d. %s in %d days\0"),
                                          mta.Age() + 1, mta.Description(), Diff);
                        }
                        }
                        if (mir_tcslen(szAnniv) >= MAX_SECONDLINE - mir_tcslen(strMsg))
                        {
                            if (strMsg)
                                mir_tcsncat(strMsg, _T("\n...\0"), SIZEOF(strMsg));
                            else
                                mir_tcsncpy(strMsg, _T("\n...\0"), mir_tcslen(_T("\n...\0")));
                            bOverflow = TRUE;
                        }
                        else
                        {
                            if (strMsg)
                                mir_tcsncat(strMsg, _T("\n- \0"), SIZEOF(strMsg));
                            else
                                mir_tcsncpy(strMsg, _T("\n- \0"), mir_tcslen(_T("\n- \0")));
                            mir_tcsncat(strMsg, szAnniv, SIZEOF(strMsg));
                        }
                    }
                }
            }
        }
    }
    // show one popup for all anniversaries
    if (numAnniversaries != 0 && bNotify)
    {
        NotifyWithPopup(hContact, CEvent::ANNIVERSARY, Diff, LPGENT("Anniversaries"), strMsg);
    }
    return numAnniversaries != 0;
}
Esempio n. 20
0
///////////////////////////////////////////////////////
// Load / unload

BOOL WINAPI DllMain(HINSTANCE hinstDLL, DWORD, LPVOID)
{
	hInst = hinstDLL;
	return TRUE;
}

/////////////////////////////////////////////////////////////////////////////
// Fonts

static LPCTSTR s_fonts[FLT_FONTIDS] =
{
	{ LPGENT("Standard contacts") },
	{ LPGENT("Online contacts to whom you have a different visibility") },
	{ LPGENT("Offline contacts") },
	{ LPGENT("Offline contacts to whom you have a different visibility") },
	{ LPGENT("Contacts which are 'not on list'") }
};

///////////////////////////////////////////////////////
// Hooked events

static int OnContactDeleted(WPARAM hContact, LPARAM)
{
	ThumbInfo *pThumb = thumbList.FindThumbByContact(hContact);
	if (pThumb) {
		pThumb->DeleteContactPos();
		thumbList.RemoveThumb(pThumb);
Esempio n. 21
0
static int ModulesLoaded(WPARAM, LPARAM)
{
	char temp[MAX_PATH];
	CallService(MS_SYSTEM_GETVERSIONTEXT, (WPARAM)_countof(temp), (LPARAM)temp);
	crs_a2t(vertxt, temp);

	if (ServiceExists(MS_FOLDERS_REGISTER_PATH)) {
		replaceStrT(profpath, _T("%miranda_userdata%"));

		// Removed because it isn't available on Load()
		//		hCrashLogFolder = FoldersRegisterCustomPathT(PluginName, LPGEN("Crash Reports"), CrashLogFolder);
		hVerInfoFolder = FoldersRegisterCustomPathT(PluginName, LPGEN("Version Information"), VersionInfoFolder);

		HookEvent(ME_FOLDERS_PATH_CHANGED, FoldersPathChanged);
		FoldersPathChanged(0, 0);
	}

	CMenuItem mi;
	mi.root = Menu_CreateRoot(MO_MAIN, LPGENT("Version Information"), 2000089999, GetIconHandle(IDI_VI));

	SET_UID(mi, 0x52930e40, 0xb2ee, 0x4433, 0xad, 0x77, 0xf5, 0x42, 0xe, 0xf6, 0x57, 0xc1);
	mi.position = 2000089995;
	mi.name.a = LPGEN("Copy to clipboard");
	mi.hIcolibItem = GetIconHandle(IDI_VITOCLIP);
	mi.pszService = MS_CRASHDUMPER_STORETOCLIP;
	Menu_AddMainMenuItem(&mi);

	SET_UID(mi, 0x54109094, 0x494e, 0x4535, 0x9c, 0x3a, 0xf6, 0x9e, 0x9a, 0xf7, 0xcd, 0xbe);
	mi.position = 2000089996;
	mi.name.a = LPGEN("Store to file");
	mi.hIcolibItem = GetIconHandle(IDI_VITOFILE);
	mi.pszService = MS_CRASHDUMPER_STORETOFILE;
	Menu_AddMainMenuItem(&mi);

	SET_UID(mi, 0x4004f9ee, 0x2c5a, 0x420a, 0xb1, 0x54, 0x3e, 0x47, 0xc1, 0xde, 0x46, 0xec);
	mi.position = 2000089997;
	mi.name.a = LPGEN("Show");
	mi.hIcolibItem = GetIconHandle(IDI_VISHOW);
	mi.pszService = MS_CRASHDUMPER_VIEWINFO;
	Menu_AddMainMenuItem(&mi);

	SET_UID(mi, 0x8526469a, 0x8ab4, 0x4dd4, 0xad, 0xbf, 0x51, 0xfd, 0x71, 0x10, 0xd3, 0x3c);
	mi.position = 2000089998;
	mi.name.a = LPGEN("Show with DLLs");
	mi.hIcolibItem = GetIconHandle(IDI_VIUPLOAD);
	mi.pszService = MS_CRASHDUMPER_VIEWINFO;
	Menu_ConfigureItem(Menu_AddMainMenuItem(&mi), MCI_OPT_EXECPARAM, 1);

	SET_UID(mi, 0xc6e3b558, 0xe1e8, 0x4cce, 0x96, 0x8, 0xc6, 0x89, 0x1b, 0x79, 0xf3, 0x7e);
	mi.position = 2000089999;
	mi.name.a = LPGEN("Upload");
	mi.hIcolibItem = GetIconHandle(IDI_VIUPLOAD);
	mi.pszService = MS_CRASHDUMPER_UPLOAD;
	Menu_AddMainMenuItem(&mi);

	SET_UID(mi, 0xa23da95a, 0x7624, 0x4343, 0x8c, 0xc0, 0xa6, 0x16, 0xbc, 0x30, 0x13, 0x8c);
	mi.position = 2000089999;
	mi.name.a = LPGEN("Copy link to clipboard");
	mi.hIcolibItem = GetIconHandle(IDI_LINKTOCLIP);//need icon
	mi.pszService = MS_CRASHDUMPER_URLTOCLIP;
	Menu_AddMainMenuItem(&mi);

	if (catchcrashes && !needrestart) {
		SET_UID(mi, 0xecae52f2, 0xd601, 0x4f85, 0x87, 0x9, 0xec, 0x8e, 0x84, 0xfe, 0x1b, 0x3c);
		mi.position = 2000099990;
		mi.name.a = LPGEN("Open crash report directory");
		mi.hIcolibItem = Skin_GetIconHandle(SKINICON_EVENT_FILE);
		mi.pszService = MS_CRASHDUMPER_URL;
		Menu_AddMainMenuItem(&mi);
	}

	SET_UID(mi, 0x6b19be3, 0xfb7d, 0x457d, 0x85, 0xde, 0xe0, 0x26, 0x4c, 0x87, 0x35, 0xf4);
	mi.position = 2000099991;
	mi.name.a = LPGEN("Open online Version Info");
	mi.hIcolibItem = Skin_GetIconHandle(SKINICON_EVENT_URL);
	mi.pszService = MS_CRASHDUMPER_URL;
	Menu_ConfigureItem(Menu_AddMainMenuItem(&mi), MCI_OPT_EXECPARAM, 1);

	HOTKEYDESC hk = { 0 };
	hk.cbSize = sizeof(hk);
	hk.pszSection = PluginName;

	hk.pszDescription = LPGEN("Copy Version Info to clipboard");
	hk.pszName = "CopyVerInfo";
	hk.pszService = MS_CRASHDUMPER_STORETOCLIP;
	Hotkey_Register(&hk);

	hk.pszDescription = LPGEN("Show Version Info");
	hk.pszName = "ShowVerInfo";
	hk.pszService = MS_CRASHDUMPER_VIEWINFO;
	Hotkey_Register(&hk);

	UploadInit();

	if (catchcrashes && !needrestart)
		SetExceptionHandler();

	HookEvent(ME_TTB_MODULELOADED, ToolbarModulesLoaded);

	if (servicemode)
		ViewVersionInfo(0, 0);
	else if (db_get_b(NULL, PluginName, "UploadChanged", 0) && !ProcessVIHash(false))
		UploadVersionInfo(0, 0xa1);

	return 0;
}
Esempio n. 22
0
	mi.flags = CMIM_FLAGS | (GetWindowLongPtr(pcli->hwndContactTree, GWL_STYLE) & CLS_HIDEEMPTYGROUPS ? CMIF_CHECKED : 0);
	Menu_ModifyItem(hHideEmptyGroupsMenuItem, &mi);

	mi.flags = CMIM_FLAGS | (GetWindowLongPtr(pcli->hwndContactTree, GWL_STYLE) & CLS_USEGROUPS ? 0 : CMIF_CHECKED);
	Menu_ModifyItem(hDisableGroupsMenuItem, &mi);

	mi.flags = CMIM_FLAGS;
	Menu_ModifyItem(hGroupMainMenuItemProxy, &mi);

	mi.flags = CMIM_FLAGS;
	Menu_ModifyItem(hAppearanceMenuItemProxy, &mi);
	return 0;
}

IconItemT iconItem[] = {
	{ LPGENT("New group"),    "new_group", IDI_ADDGROUP },
	{ LPGENT("Contact list"), "clist",     IDI_CLIST }
};

void InitIconLibMenuIcons(void)
{
	Icon_RegisterT(g_hInst, LPGENT("Contact list"), iconItem, SIZEOF(iconItem));
}

void InitGroupMenus(void)
{
	CreateServiceFunction("CLISTMENUSGroup/ExecService", GroupMenuExecService);
	CreateServiceFunction("CLISTMENUSGroup/FreeOwnerDataGroupMenu", FreeOwnerDataGroupMenu);
	CreateServiceFunction("CLISTMENUSGroup/GroupMenuonAddService", GroupMenuonAddService);
	CreateServiceFunction("CLISTMENUSGroup/HideGroupsHelper", HideGroupsHelper);
	CreateServiceFunction("CLISTMENUSGroup/UseGroupsHelper", UseGroupsHelper);
Esempio n. 23
0
extern "C" __declspec(dllexport) int Load(void)
{
	mir_getLP(&pluginInfo);
	mir_getCLI();

	CoInitialize(NULL);

	// Is first run?
	if ( db_get_b(NULL, MODULE_NAME, "FirstRun", 1)) {
		// Show dialog
		int ret = DialogBoxParam(hInst, MAKEINTRESOURCE(IDD_FIRST_RUN), NULL, FirstRunDlgProc, 0);
		if (ret == 0)
			return -1;

		// Write settings

		db_set_b(NULL, MODULE_NAME, "LogToDisk", 1);

		if (ret == IDC_MIR_SAME)
			db_set_b(NULL, MODULE_NAME, "LogKeepSameFolder", 1);
		else
			db_set_b(NULL, MODULE_NAME, "LogKeepSameFolder", 0);

		if (ret == IDC_MIR_SHORT || ret == IDC_SHORT || ret == IDC_DUP)
			db_set_b(NULL, MODULE_NAME, "LogPerContactFolders", 1);
		else
			db_set_b(NULL, MODULE_NAME, "LogPerContactFolders", 0);

		if (ret == IDC_DUP)
			db_set_b(NULL, MODULE_NAME, "StoreAsHash", 0);
		else
			db_set_b(NULL, MODULE_NAME, "StoreAsHash", 1);

		if (ret == IDC_MIR_SAME || ret == IDC_MIR_PROTO || ret == IDC_MIR_SHORT)
			db_set_b(NULL, MODULE_NAME, "LogToHistory", 1);
		else
			db_set_b(NULL, MODULE_NAME, "LogToHistory", 0);

		db_set_b(NULL, MODULE_NAME, "FirstRun", 0);
	}

	LoadOptions();

	HookEvent(ME_SYSTEM_MODULESLOADED,ModulesLoaded);
	HookEvent(ME_SYSTEM_PRESHUTDOWN, PreShutdown);
	HookEvent(ME_OPT_INITIALISE, OptInit);
	HookEvent(ME_SKIN2_ICONSCHANGED, IcoLibIconsChanged);
	HookEvent(ME_CLIST_PREBUILDCONTACTMENU, PreBuildContactMenu);

	CreateServiceFunction(MS_AVATARHISTORY_ENABLED, IsEnabled);
	CreateServiceFunction(MS_AVATARHISTORY_GET_CACHED_AVATAR, GetCachedAvatar);

	if (CallService(MS_DB_GETPROFILEPATHT, MAX_PATH, (LPARAM)profilePath) != 0)
		mir_tstrcpy(profilePath, _T(".")); // Failed, use current dir

	SkinAddNewSoundExT("avatar_changed",LPGENT("Avatar History"),LPGENT("Contact changed avatar"));
	SkinAddNewSoundExT("avatar_removed",LPGENT("Avatar History"),LPGENT("Contact removed avatar"));

	hAvatarWindowsList = WindowList_Create();

	SetupIcoLib();
	InitMenuItem();
	return 0;
}
Esempio n. 24
0
void InitIconLibMenuIcons(void)
{
	Icon_RegisterT(g_hInst, LPGENT("Contact list"), iconItem, SIZEOF(iconItem));
}
Esempio n. 25
0
#define F_UNICODE	0x100

#define F_REPLACED	0x200
#define F_DELETED	0x400


typedef struct {
	HWND hwnd; // hwnd to item list
	TCHAR* search; // text to find
	TCHAR* replace; // text to replace
	int options; // or'd about items
} FindInfo;


ColumnsSettings csResultList[] = {
	{ LPGENT("Result"),  0, "Search0width", 100 },
	{ LPGENT("Contact"), 1, "Search1width", 100 },
	{ LPGENT("Module"),  2, "Search2width", 100 },
	{ LPGENT("Setting"), 3, "Search3width", 100 },
	{ LPGENT("Value"),   4, "Search4width", 150 },
	{0}
};


void __cdecl FindSettings(LPVOID di);


int FindDialogResize(HWND, LPARAM, UTILRESIZECONTROL *urc)
{
	switch (urc->wId) {
	case IDC_LIST:
Esempio n. 26
0
	DWORD bytesWritten;
	WriteFile(m_hDbFile, &m_dbHeader, sizeof(m_dbHeader), &bytesWritten, NULL);

	DBContact user = { 0 };
	user.signature = DBCONTACT_SIGNATURE;
	SetFilePointer(m_hDbFile, m_dbHeader.ofsUser, NULL, FILE_BEGIN);
	WriteFile(m_hDbFile, &user, sizeof(DBContact), &bytesWritten, NULL);
	FlushFileBuffers(m_hDbFile);
	return 0;
}

/////////////////////////////////////////////////////////////////////////////////////////

static TCHAR tszOldHeaders[] = 
	LPGENT("This profile is too old to be updated with PluginUpdater, your database must be converted first.\n\nWould you like to read how to fix this?");

int CDb3Mmap::CheckDbHeaders(bool bInteractive)
{
	if (memcmp(m_dbHeader.signature, &dbSignatureU, sizeof(m_dbHeader.signature)) &&
		 memcmp(m_dbHeader.signature, &dbSignatureE, sizeof(m_dbHeader.signature)))
	{
		if (!memcmp(&m_dbHeader.signature, &dbSignatureIM, sizeof(m_dbHeader.signature)) ||
			 !memcmp(&m_dbHeader.signature, &dbSignatureSA, sizeof(m_dbHeader.signature)))
			return EGROKPRF_OBSOLETE;

		if (!memcmp(&m_dbHeader.signature, &dbSignatureSD, sizeof(m_dbHeader.signature))) {
			if (bInteractive)
				if (IDYES == MessageBox(NULL, TranslateTS(tszOldHeaders), TranslateT("Obsolete database format"), MB_YESNO | MB_ICONWARNING)) {
					TCHAR tszCurPath[MAX_PATH];
					GetModuleFileName(NULL, tszCurPath, SIZEOF(tszCurPath));
Esempio n. 27
0
namespace NSJabberRegistry
{
	// http://jabber.org/network/serverinfo
	static TJabberDataFormRegisry_Field form_type_serverinfo[] =
	{
		{ _T("abuse-addresses"),		JDFT_LIST_MULTI,		LPGENT("One or more addresses for communication related to abusive traffic") },
		{ _T("feedback-addresses"),		JDFT_LIST_MULTI,		LPGENT("One or more addresses for customer feedback") },
		{ _T("sales-addresses"),		JDFT_LIST_MULTI,		LPGENT("One or more addresses for communication related to sales and marketing") },
		{ _T("security-addresses"),		JDFT_LIST_MULTI,		LPGENT("One or more addresses for communication related to security concerns") },
		{ _T("support-addresses"),		JDFT_LIST_MULTI,		LPGENT("One or more addresses for customer support") },
	};

	// http://jabber.org/protocol/admin
	static TJabberDataFormRegisry_Field form_type_admin[] =
	{
		{ _T("accountjid"),				JDFT_JID_SINGLE,	LPGENT("The Jabber ID of a single entity to which an operation applies") },
		{ _T("accountjids"),			JDFT_JID_MULTI,		LPGENT("The Jabber ID of one or more entities to which an operation applies") },
		{ _T("activeuserjids"),			JDFT_JID_MULTI,		LPGENT("The Jabber IDs associated with active sessions") },
		{ _T("activeusersnum"),			JDFT_TEXT_SINGLE,	LPGENT("The number of online entities that are active") },
		{ _T("adminjids"),				JDFT_JID_MULTI,		LPGENT("A list of entities with administrative privileges") },
		{ _T("announcement"),			JDFT_TEXT_MULTI,	LPGENT("The text of an announcement to be sent to active users or all users") },
		{ _T("blacklistjids"),			JDFT_JID_MULTI,		LPGENT("A list of entities with whom communication is blocked") },
		{ _T("delay"),					JDFT_LIST_MULTI,	LPGENT("The number of seconds to delay before applying a change") },
		{ _T("disableduserjids"),		JDFT_JID_MULTI,		LPGENT("The Jabber IDs that have been disabled") },
		{ _T("disabledusersnum"),		JDFT_TEXT_SINGLE,	LPGENT("The number of disabled entities") },
		{ _T("email"),					JDFT_TEXT_SINGLE,	LPGENT("The email address for a user") },
		{ _T("given_name"),				JDFT_TEXT_SINGLE,	LPGENT("The given (first) name of a user") },
		{ _T("idleusersnum"),			JDFT_TEXT_SINGLE,	LPGENT("The number of online entities that are idle") },
		{ _T("ipaddresses"),			JDFT_LIST_MULTI,	LPGENT("The IP addresses of an account's online sessions") },
		{ _T("lastlogin"),				JDFT_TEXT_SINGLE,	LPGENT("The last login time (per XEP-0082) of a user") },
		{ _T("loginsperminute"),		JDFT_TEXT_SINGLE,	LPGENT("The number of logins per minute for an account") },
		{ _T("max_items"),				JDFT_LIST_SINGLE,	LPGENT("The maximum number of items associated with a search or list") },
		{ _T("motd"),					JDFT_TEXT_MULTI,	LPGENT("The text of a message of the day") },
		{ _T("onlineresources"),		JDFT_TEXT_SINGLE,	LPGENT("The names of an account's online sessions") },
		{ _T("onlineuserjids"),			JDFT_JID_MULTI,		LPGENT("The Jabber IDs associated with online users") },
		{ _T("onlineusersnum"),			JDFT_TEXT_SINGLE,	LPGENT("The number of online entities") },
		{ _T("password"),				JDFT_TEXT_PRIVATE,	LPGENT("The password for an account") },
		{ _T("password-verify"),		JDFT_TEXT_PRIVATE,	LPGENT("Password verification") },
		{ _T("registereduserjids"),		JDFT_JID_MULTI,		LPGENT("A list of registered entities") },
		{ _T("registeredusersnum"),		JDFT_TEXT_SINGLE,	LPGENT("The number of registered entities") },
		{ _T("rostersize"),				JDFT_TEXT_SINGLE,	LPGENT("Number of roster items for an account") },
		{ _T("stanzaspersecond"),		JDFT_TEXT_SINGLE,	LPGENT("The number of stanzas being sent per second by an account") },
		{ _T("surname"),				JDFT_TEXT_SINGLE,	LPGENT("The family (last) name of a user") },
		{ _T("welcome"),				JDFT_TEXT_MULTI,	LPGENT("The text of a welcome message") },
		{ _T("whitelistjids"),			JDFT_JID_MULTI,		LPGENT("A list of entities with whom communication is allowed") },
	};

	// http://jabber.org/protocol/muc#register
	static TJabberDataFormRegisry_Field form_type_muc_register[] =
	{
		{ _T("muc#register_first"),		JDFT_TEXT_SINGLE,	LPGENT("First Name") },
		{ _T("muc#register_last"),		JDFT_TEXT_SINGLE,	LPGENT("Last Name") },
		{ _T("muc#register_roomnick"),	JDFT_TEXT_SINGLE,	LPGENT("Desired Nickname") },
		{ _T("muc#register_url"),		JDFT_TEXT_SINGLE,	LPGENT("Your URL") },
		{ _T("muc#register_email"),		JDFT_TEXT_SINGLE,	LPGENT("Email Address") },
		{ _T("muc#register_faqentry"),	JDFT_TEXT_MULTI,	LPGENT("FAQ Entry") },
	};

	// http://jabber.org/protocol/muc#roomconfig
	static TJabberDataFormRegisry_Field form_type_muc_roomconfig[] =
	{
		{ _T("muc#roomconfig_allowinvites"),			JDFT_BOOLEAN,		LPGENT("Whether to allow occupants to invite others") },
		{ _T("muc#roomconfig_changesubject"),			JDFT_BOOLEAN,		LPGENT("Whether to allow occupants to change subject") },
		{ _T("muc#roomconfig_enablelogging"),			JDFT_BOOLEAN,		LPGENT("Whether to enable logging of room conversations") },
		{ _T("muc#roomconfig_lang"),					JDFT_TEXT_SINGLE,	LPGENT("Natural language for room discussions") },
		{ _T("muc#roomconfig_maxusers"),				JDFT_LIST_SINGLE,	LPGENT("Maximum number of room occupants") },
		{ _T("muc#roomconfig_membersonly"),				JDFT_BOOLEAN,		LPGENT("Whether to make room members-only") },
		{ _T("muc#roomconfig_moderatedroom"),			JDFT_BOOLEAN,		LPGENT("Whether to make room moderated") },
		{ _T("muc#roomconfig_passwordprotectedroom"),	JDFT_BOOLEAN,		LPGENT("Whether a password is required to enter") },
		{ _T("muc#roomconfig_persistentroom"),			JDFT_BOOLEAN,		LPGENT("Whether to make room persistent") },
		{ _T("muc#roomconfig_presencebroadcast"),		JDFT_LIST_MULTI,	LPGENT("Roles for which presence is broadcast") },
		{ _T("muc#roomconfig_publicroom"),				JDFT_BOOLEAN,		LPGENT("Whether to allow public searching for room") },
		{ _T("muc#roomconfig_roomadmins"),				JDFT_JID_MULTI,		LPGENT("Full list of room admins") },
		{ _T("muc#roomconfig_roomdesc"),				JDFT_TEXT_SINGLE,	LPGENT("Short description of room") },
		{ _T("muc#roomconfig_roomname"),				JDFT_TEXT_SINGLE,	LPGENT("Natural-language room name") },
		{ _T("muc#roomconfig_roomowners"),				JDFT_JID_MULTI,		LPGENT("Full list of room owners") },
		{ _T("muc#roomconfig_roomsecret"),				JDFT_TEXT_PRIVATE,	LPGENT("The room password") },
		{ _T("muc#roomconfig_whois"),					JDFT_LIST_SINGLE,	LPGENT("Affiliations that may discover real JIDs of occupants") },
	};

	// http://jabber.org/protocol/pubsub#publish-options
	static TJabberDataFormRegisry_Field form_type_publish_options[] =
	{
		{ _T("pubsub#access_model"),	JDFT_LIST_SINGLE,	LPGENT("Precondition: node configuration with the specified access model") },
	};

	// http://jabber.org/protocol/pubsub#subscribe_authorization
	static TJabberDataFormRegisry_Field form_type_subscribe_auth[] =
	{
		{ _T("pubsub#allow"),			JDFT_BOOLEAN,		LPGENT("Whether to allow the subscription") },
		{ _T("pubsub#subid"),			JDFT_TEXT_SINGLE,	LPGENT("The SubID of the subscription") },
		{ _T("pubsub#node"),			JDFT_TEXT_SINGLE,	LPGENT("The NodeID of the relevant node") },
		{ _T("pubsub#subscriber_jid"),	JDFT_JID_SINGLE,	LPGENT("The address (JID) of the subscriber") },
	};

	// http://jabber.org/protocol/pubsub#subscribe_options
	static TJabberDataFormRegisry_Field form_type_subscribe_options[] =
	{
		{ _T("pubsub#deliver"),				JDFT_BOOLEAN,		LPGENT("Whether an entity wants to receive or disable notifications") },
		{ _T("pubsub#digest"),				JDFT_BOOLEAN,		LPGENT("Whether an entity wants to receive digests (aggregations) of notifications or all notifications individually") },
		{ _T("pubsub#digest_frequency"),	JDFT_TEXT_SINGLE,	LPGENT("The minimum number of milliseconds between sending any two notification digests") },
		{ _T("pubsub#expire"),				JDFT_TEXT_SINGLE,	LPGENT("The date and time at which a leased subscription will end or has ended") },
		{ _T("pubsub#include_body"),		JDFT_BOOLEAN,		LPGENT("Whether an entity wants to receive an XMPP message body in addition to the payload format") },
		{ _T("pubsub#show-values"),			JDFT_LIST_MULTI,	LPGENT("The presence states for which an entity wants to receive notifications") },
		{ _T("pubsub#subscription_type"),	JDFT_LIST_SINGLE,	_T("") },
		{ _T("pubsub#subscription_depth"),	JDFT_LIST_SINGLE,	_T("") },
	};

	// http://jabber.org/protocol/pubsub#node_config
	static TJabberDataFormRegisry_Field form_type_node_config[] =
	{
		{ _T("pubsub#access_model"),					JDFT_LIST_SINGLE,	LPGENT("Who may subscribe and retrieve items") },
		{ _T("pubsub#body_xslt"),						JDFT_TEXT_SINGLE,	LPGENT("The URL of an XSL transformation which can be applied to payloads in order to generate an appropriate message body element.") },
		{ _T("pubsub#collection"),						JDFT_TEXT_SINGLE,	LPGENT("The collection with which a node is affiliated") },
		{ _T("pubsub#dataform_xslt"),					JDFT_TEXT_SINGLE,	LPGENT("The URL of an XSL transformation which can be applied to the payload format in order to generate a valid Data Forms result that the client could display using a generic Data Forms rendering engine") },
		{ _T("pubsub#deliver_payloads"),				JDFT_BOOLEAN,		LPGENT("Whether to deliver payloads with event notifications") },
		{ _T("pubsub#itemreply"),						JDFT_LIST_SINGLE,	LPGENT("Whether owners or publisher should receive replies to items") },
		{ _T("pubsub#children_association_policy"),		JDFT_LIST_SINGLE,	LPGENT("Who may associate leaf nodes with a collection") },
		{ _T("pubsub#children_association_whitelist"),	JDFT_JID_MULTI,		LPGENT("The list of JIDs that may associated leaf nodes with a collection") },
		{ _T("pubsub#children"),						JDFT_TEXT_MULTI,	LPGENT("The child nodes (leaf or collection) associated with a collection") },
		{ _T("pubsub#children_max"),					JDFT_TEXT_SINGLE,	LPGENT("The maximum number of child nodes that can be associated with a collection") },
		{ _T("pubsub#max_items"),						JDFT_TEXT_SINGLE,	LPGENT("The maximum number of items to persist") },
		{ _T("pubsub#max_payload_size"),				JDFT_TEXT_SINGLE,	LPGENT("The maximum payload size in bytes") },
		{ _T("pubsub#node_type"),						JDFT_LIST_SINGLE,	LPGENT("Whether the node is a leaf (default) or a collection") },
		{ _T("pubsub#notify_config"),					JDFT_BOOLEAN,		LPGENT("Whether to notify subscribers when the node configuration changes") },
		{ _T("pubsub#notify_delete"),					JDFT_BOOLEAN,		LPGENT("Whether to notify subscribers when the node is deleted") },
		{ _T("pubsub#notify_retract"),					JDFT_BOOLEAN,		LPGENT("Whether to notify subscribers when items are removed from the node") },
		{ _T("pubsub#persist_items"),					JDFT_BOOLEAN,		LPGENT("Whether to persist items to storage") },
		{ _T("pubsub#presence_based_delivery"),			JDFT_BOOLEAN,		LPGENT("Whether to deliver notifications to available users only") },
		{ _T("pubsub#publish_model"),					JDFT_LIST_SINGLE,	LPGENT("The publisher model") },
		{ _T("pubsub#replyroom"),						JDFT_JID_MULTI,		LPGENT("The specific multi-user chat rooms to specify for replyroom") },
		{ _T("pubsub#replyto"),							JDFT_JID_MULTI,		LPGENT("The specific JID(s) to specify for replyto") },
		{ _T("pubsub#roster_groups_allowed"),			JDFT_LIST_MULTI,	LPGENT("The roster group(s) allowed to subscribe and retrieve items") },
		{ _T("pubsub#send_item_subscribe"),				JDFT_BOOLEAN,		LPGENT("Whether to send items to new subscribers") },
		{ _T("pubsub#subscribe"),						JDFT_BOOLEAN,		LPGENT("Whether to allow subscriptions") },
		{ _T("pubsub#title"),							JDFT_TEXT_SINGLE,	LPGENT("A friendly name for the node") },
		{ _T("pubsub#type"),							JDFT_TEXT_SINGLE,	LPGENT("The type of node data, usually specified by the namespace of the payload (if any); MAY be list-single rather than text-single") },
	};

	// http://jabber.org/protocol/pubsub#meta-data
	static TJabberDataFormRegisry_Field form_type_metadata[] =
	{
		{ _T("pubsub#contact"),			JDFT_JID_MULTI,		LPGENT("The JIDs of those to contact with questions") },
		{ _T("pubsub#creation_date"),	JDFT_TEXT_SINGLE,	LPGENT("The date and time when the node was created") },
		{ _T("pubsub#creator"),			JDFT_JID_SINGLE,	LPGENT("The JID of the node creator") },
		{ _T("pubsub#description"),		JDFT_TEXT_SINGLE,	LPGENT("A description of the node") },
		{ _T("pubsub#language"),		JDFT_TEXT_SINGLE,	LPGENT("The default language of the node") },
		{ _T("pubsub#num_subscribers"),	JDFT_TEXT_SINGLE,	LPGENT("The number of subscribers to the node") },
		{ _T("pubsub#owner"),			JDFT_JID_MULTI,		LPGENT("The JIDs of those with an affiliation of owner") },
		{ _T("pubsub#publisher"),		JDFT_JID_MULTI,		LPGENT("The JIDs of those with an affiliation of publisher") },
		{ _T("pubsub#title"),			JDFT_TEXT_SINGLE,	LPGENT("The name of the node") },
		{ _T("pubsub#type"),			JDFT_TEXT_SINGLE,	LPGENT("Payload type") },
	};

	// http://jabber.org/protocol/rc
	static TJabberDataFormRegisry_Field form_type_rc[] =
	{
		{ _T("auto-auth"),			JDFT_BOOLEAN,		LPGENT("Whether to automatically authorize subscription requests") },
		{ _T("auto-files"),			JDFT_BOOLEAN,		LPGENT("Whether to automatically accept file transfers") },
		{ _T("auto-msg"),			JDFT_BOOLEAN,		LPGENT("Whether to automatically open new messages") },
		{ _T("auto-offline"),		JDFT_BOOLEAN,		LPGENT("Whether to automatically go offline when idle") },
		{ _T("sounds"),				JDFT_BOOLEAN,		LPGENT("Whether to play sounds") },
		{ _T("files"),				JDFT_LIST_MULTI,	LPGENT("A list of pending file transfers") },
		{ _T("groupchats"),			JDFT_LIST_MULTI,	LPGENT("A list of joined group chat rooms") },
		{ _T("status"),				JDFT_LIST_SINGLE,	LPGENT("A presence or availability status") },
		{ _T("status-message"),		JDFT_TEXT_MULTI,	LPGENT("The status message text") },
		{ _T("status-priority"),	JDFT_TEXT_SINGLE,	LPGENT("The new priority for the client") },
	};

	// jabber:iq:register
	static TJabberDataFormRegisry_Field form_type_register[] =
	{
		{ _T("username"),	JDFT_TEXT_SINGLE,	LPGENT("Account name associated with the user") },
		{ _T("nick"),		JDFT_TEXT_SINGLE,	LPGENT("Familiar name of the user") },
		{ _T("password"),	JDFT_TEXT_PRIVATE,	LPGENT("Password or secret for the user") },
		{ _T("name"),		JDFT_TEXT_SINGLE,	LPGENT("Full name of the user") },
		{ _T("first"),		JDFT_TEXT_SINGLE,	LPGENT("First name or given name of the user") },
		{ _T("last"),		JDFT_TEXT_SINGLE,	LPGENT("Last name, surname, or family name of the user") },
		{ _T("email"),		JDFT_TEXT_SINGLE,	LPGENT("Email address of the user") },
		{ _T("address"),	JDFT_TEXT_SINGLE,	LPGENT("Street portion of a physical or mailing address") },
		{ _T("city"),		JDFT_TEXT_SINGLE,	LPGENT("Locality portion of a physical or mailing address") },
		{ _T("state"),		JDFT_TEXT_SINGLE,	LPGENT("Region portion of a physical or mailing address") },
		{ _T("zip"),		JDFT_TEXT_SINGLE,	LPGENT("Postal code portion of a physical or mailing address") },
	};

	// jabber:iq:search
	static TJabberDataFormRegisry_Field form_type_search[] =
	{
		{ _T("first"),	JDFT_TEXT_SINGLE,	LPGENT("First Name") },
		{ _T("last"),	JDFT_TEXT_SINGLE,	LPGENT("Family Name") },
		{ _T("nick"),	JDFT_TEXT_SINGLE,	LPGENT("Nickname") },
		{ _T("email"),	JDFT_TEXT_SINGLE,	LPGENT("Email Address") },
	};

	// urn:xmpp:ssn
	static TJabberDataFormRegisry_Field form_type_ssn[] =
	{
		{ _T("accept"),									JDFT_BOOLEAN,		LPGENT("Whether to accept the invitation") },
		{ _T("continue"),								JDFT_TEXT_SINGLE,	LPGENT("Another resource with which to continue the session") },
		{ _T("disclosure"),								JDFT_LIST_SINGLE,	LPGENT("Disclosure of content, decryption keys or identities") },
		{ _T("http://jabber.org/protocol/chatstates"),	JDFT_LIST_SINGLE,	LPGENT("Whether may send Chat State Notifications per XEP-0085") },
		{ _T("http://jabber.org/protocol/xhtml-im"),	JDFT_LIST_SINGLE,	LPGENT("Whether allowed to use XHTML-IM formatting per XEP-0071") },
		{ _T("language"),								JDFT_LIST_SINGLE,	LPGENT("Primary written language of the chat (each value appears in order of preference and conforms to RFC 4646 and the IANA registry)") },
		{ _T("logging"),								JDFT_LIST_SINGLE,	LPGENT("Whether allowed to log messages (i.e., whether Off-The-Record mode is required)") },
		{ _T("renegotiate"),							JDFT_BOOLEAN,		LPGENT("Whether to renegotiate the session") },
		{ _T("security"),								JDFT_LIST_SINGLE,	LPGENT("Minimum security level") },
		{ _T("terminate"),								JDFT_BOOLEAN,		LPGENT("Whether to terminate the session") },
		{ _T("urn:xmpp:receipts"),						JDFT_BOOLEAN,		LPGENT("Whether to enable Message Receipts per XEP-0184") },
	};

	TJabberDataFormRegisry_Form form_types[] =
	{
	/*0157*/	{ _T("http://jabber.org/network/serverinfo"),						form_type_serverinfo,			SIZEOF(form_type_serverinfo) },
	/*0133*/	{ _T("http://jabber.org/protocol/admin"),							form_type_admin,				SIZEOF(form_type_admin) },
	/*0045*/	{ _T("http://jabber.org/protocol/muc#register"),					form_type_muc_register,			SIZEOF(form_type_muc_register) },
	/*0045*/	{ _T("http://jabber.org/protocol/muc#roomconfig"),					form_type_muc_roomconfig,		SIZEOF(form_type_muc_roomconfig) },
	/*0060*/	{ _T("http://jabber.org/protocol/pubsub#publish-options"),			form_type_publish_options,		SIZEOF(form_type_publish_options) },
	/*0060*/	{ _T("http://jabber.org/protocol/pubsub#subscribe_authorization"),	form_type_subscribe_auth,		SIZEOF(form_type_subscribe_auth) },
	/*0060*/	{ _T("http://jabber.org/protocol/pubsub#subscribe_options"),		form_type_subscribe_options,	SIZEOF(form_type_subscribe_options) },
	/*0060*/	{ _T("http://jabber.org/protocol/pubsub#node_config"),				form_type_node_config,			SIZEOF(form_type_node_config) },
	/*0060*/	{ _T("http://jabber.org/protocol/pubsub#meta-data"),				form_type_metadata,				SIZEOF(form_type_metadata) },
	/*0146*/	{ _T("http://jabber.org/protocol/rc"),								form_type_rc,					SIZEOF(form_type_rc) },
	/*0077*/	{ _T("jabber:iq:register"),											form_type_register,				SIZEOF(form_type_register) },
	/*0055*/	{ _T("jabber:iq:search"),											form_type_search,				SIZEOF(form_type_search) },
	/*0155*/	{ _T("urn:xmpp:ssn"),												form_type_ssn,					SIZEOF(form_type_ssn) },
	};
};
Esempio n. 28
0
INT_PTR StatusMenuCheckService(WPARAM wParam, LPARAM)
{
	PCheckProcParam pcpp = (PCheckProcParam)wParam;
	if (!pcpp)
		return TRUE;

	PMO_IntMenuItem timi = MO_GetIntMenuItem(pcpp->MenuItemHandle);
	if (!timi)
		return TRUE;

	StatusMenuExecParam *smep = (StatusMenuExecParam*)pcpp->MenuItemOwnerData;
	if (smep && !smep->status && smep->custom) {
		if (wildcmp(smep->svc, "*XStatus*")) {
			int XStatus;
			CUSTOM_STATUS cs = { sizeof(cs) };
			cs.flags = CSSF_MASK_STATUS;
			cs.status = &XStatus;
			if (CallProtoServiceInt(NULL, smep->proto, PS_GETCUSTOMSTATUSEX, 0, (LPARAM)&cs) != 0)
				XStatus = 0;

			char buf[255];
			mir_snprintf(buf, SIZEOF(buf), "*XStatus%d", XStatus);

			bool check = wildcmp(smep->svc, buf) != 0;
			bool reset = wildcmp(smep->svc, "*XStatus0") != 0;

			if (check)
				timi->mi.flags |= CMIF_CHECKED;
			else
				timi->mi.flags &= ~CMIF_CHECKED;

			if (reset || check) {
				PMO_IntMenuItem timiParent = MO_GetIntMenuItem(timi->mi.root);
				if (timiParent) {
					CLISTMENUITEM mi2 = { sizeof(mi2) };
					mi2.flags = CMIM_NAME | CMIF_TCHAR;
					mi2.ptszName = TranslateTH(timi->mi.hLangpack, timi->mi.hIcon ? timi->mi.ptszName : LPGENT("Custom status"));

					timiParent = MO_GetIntMenuItem(timi->mi.root);

					MenuItemData it = { 0 };

					if (FindMenuHandleByGlobalID(hStatusMenu, timiParent, &it)) {
						MENUITEMINFO mi = { 0 };
						TCHAR d[100];
						GetMenuString(it.OwnerMenu, it.position, d, SIZEOF(d), MF_BYPOSITION);

						mi.cbSize = sizeof(mi);
						mi.fMask = MIIM_STRING | MIIM_STATE;
						if (timi->iconId != -1) {
							mi.fMask |= MIIM_BITMAP;
							if (IsWinVerVistaPlus() && IsThemeActive()) {
								if (timi->hBmp == NULL)
									timi->hBmp = ConvertIconToBitmap(NULL, timi->parent->m_hMenuIcons, timi->iconId);
								mi.hbmpItem = timi->hBmp;
							}
							else mi.hbmpItem = HBMMENU_CALLBACK;
						}

						mi.fState |= (check && !reset ? MFS_CHECKED : MFS_UNCHECKED);
						mi.dwTypeData = mi2.ptszName;
						SetMenuItemInfo(it.OwnerMenu, it.position, TRUE, &mi);
					}

					Menu_ModifyItem(timi->mi.root, &mi2);
					timiParent->iconId = timi->iconId;
					if (timiParent->hBmp) DeleteObject(timiParent->hBmp);
					timiParent->hBmp = NULL;
				}
			}
		}
	}
	else if (smep && smep->status && !smep->custom) {
		int curProtoStatus = (smep->proto) ? CallProtoServiceInt(NULL, smep->proto, PS_GETSTATUS, 0, 0) : cli.pfnGetAverageMode(NULL);
		if (smep->status == curProtoStatus)
			timi->mi.flags |= CMIF_CHECKED;
		else
			timi->mi.flags &= ~CMIF_CHECKED;
	}
	else if ((!smep || smep->proto) && timi->mi.pszName) {
		int curProtoStatus = 0;
		BOOL IconNeedDestroy = FALSE;
		char* prot;
		if (smep)
			prot = smep->proto;
		else {
			char *prn = mir_u2a(timi->mi.ptszName);
			prot = NEWSTR_ALLOCA(prn);
			if (prn) mir_free(prn);
		}
		if (Proto_GetAccount(prot) == NULL)
			return TRUE;

		if ((curProtoStatus = CallProtoServiceInt(NULL, prot, PS_GETSTATUS, 0, 0)) == CALLSERVICE_NOTFOUND)
			curProtoStatus = 0;

		if (curProtoStatus >= ID_STATUS_OFFLINE && curProtoStatus < ID_STATUS_IDLE)
			timi->mi.hIcon = LoadSkinProtoIcon(prot, curProtoStatus);
		else {
			timi->mi.hIcon = (HICON)CallProtoServiceInt(NULL, prot, PS_LOADICON, PLI_PROTOCOL | PLIF_SMALL, 0);
			if (timi->mi.hIcon == (HICON)CALLSERVICE_NOTFOUND)
				timi->mi.hIcon = NULL;
			else
				IconNeedDestroy = TRUE;
		}

		if (timi->mi.hIcon) {
			timi->mi.flags |= CMIM_ICON;
			MO_ModifyMenuItem(timi, &timi->mi);
			if (IconNeedDestroy) {
				DestroyIcon(timi->mi.hIcon);
				timi->mi.hIcon = NULL;
			}
			else IcoLib_ReleaseIcon(timi->mi.hIcon, 0);
		}
	}

	return TRUE;
}
Esempio n. 29
0
/**
 * This is the message procedure for my nice looking message box
 *
 * @param	hDlg		- window handle
 * @param	uMsg		- message to handle
 * @param	wParam		- message specific parameter
 * @param	lParam		- message specific parameter
 *
 * @return	TRUE, FALSE, IDOK, IDYES, IDALL, IDNO or IDCANCEL
 **/
static INT_PTR CALLBACK MsgBoxProc(HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
{
	static int retOk = IDOK;
	static int retAll = IDALL;
	static int retNon = IDNONE;
	static int retCancel = IDCANCEL;

	switch (uMsg) {
	case WM_INITDIALOG:
		{
			LPMSGBOX pMsgBox = (LPMSGBOX)lParam;
			if (PtrIsValid(pMsgBox)) {
				int icoWidth = 0;
				int InfoBarHeight = 0;
				HFONT hNormalFont;

				hNormalFont = (HFONT)SendDlgItemMessage(hDlg, TXT_NAME, WM_GETFONT, 0, 0);
				if (pMsgBox->uType & MB_INFOBAR) {
					LOGFONT lf;

					// set bold font for name in description area
					GetObject(hNormalFont, sizeof(lf), &lf);
					lf.lfWeight = FW_BOLD;
					hNormalFont = CreateFontIndirect(&lf);

					// set infobar's textfont
					SendDlgItemMessage(hDlg, TXT_NAME, WM_SETFONT, (WPARAM)hNormalFont, 0);

					// set infobar's logo icon
					SendDlgItemMessage(hDlg, ICO_DLGLOGO, STM_SETIMAGE, IMAGE_ICON,
						(pMsgBox->hiLogo ? (LPARAM)pMsgBox->hiLogo : (LPARAM)IcoLib_GetIcon(ICO_DLG_DETAILS,TRUE)));

					// enable headerbar
					ShowWindow(GetDlgItem(hDlg, TXT_NAME), SW_SHOW);
					ShowWindow(GetDlgItem(hDlg, ICO_DLGLOGO), SW_SHOW);
				}
				else {
					RECT rc;
					GetClientRect(GetDlgItem(hDlg, TXT_NAME), &rc);
					InfoBarHeight = rc.bottom;

					if (pMsgBox->hiLogo)
						SendMessage(hDlg, WM_SETICON, ICON_BIG, (LPARAM)pMsgBox->hiLogo);
				}

				// draw the desired status icon
				HICON hIcon = MsgLoadIcon(pMsgBox);
				if (hIcon)
					SendDlgItemMessage(hDlg, ICO_MSGDLG, STM_SETIMAGE, IMAGE_ICON, (LPARAM)hIcon);
				else {
					RECT ws;
					GetWindowRect(GetDlgItem(hDlg, ICO_MSGDLG), &ws);
					icoWidth = ws.right - ws.left;
					ShowWindow(GetDlgItem(hDlg, ICO_MSGDLG), SW_HIDE);
				}

				// resize the messagebox and reorganize the buttons
				if (HDC hDC = GetDC(hDlg)) {
					POINT mpt = { 0, 0 };
					RECT ws = { 0, 0, 0, 0 };
					int txtWidth=0, txtHeight=0, needX, needY;
					RECT rcDlg;
					SIZE ts;
					LPTSTR h, rs;

					SelectObject(hDC, hNormalFont);
					// get message text width and height
					if(pMsgBox->ptszMsg) for (rs=h=pMsgBox->ptszMsg; ; ++h) {
						if (*h=='\n' || !*h) {
							GetTextExtentPoint32(hDC, rs, h-rs, &ts);
							if (ts.cx > txtWidth)
								txtWidth = ts.cx;
							txtHeight += ts.cy;
							if (!*h)
								break;
							rs = h+1;
						}
					}
					// increase width if info text requires more
					if((pMsgBox->uType&MB_INFOBAR) && pMsgBox->ptszInfoText && *pMsgBox->ptszInfoText){
						//int multiline = 0;
						RECT rcico; GetClientRect(GetDlgItem(hDlg,ICO_DLGLOGO), &rcico);
						rcico.right = rcico.right*100/66; // padding
						for(rs=h=pMsgBox->ptszInfoText; ; ++h) {
							if (*h=='\n' || !*h) {
								GetTextExtentPoint32(hDC, rs, h-rs, &ts);
								ts.cx += rcico.right;
								if (ts.cx > txtWidth)
									txtWidth = ts.cx;
								if (!*h)
									break;
								rs = h+1;
								//++multiline;
							}
						}
						/* used by SendSS, disabled for UserInfoEx for now
						if(!multiline)
							SetWindowLongPtr(GetDlgItem(hDlg,TXT_NAME), GWL_STYLE, GetWindowLongPtr(GetDlgItem(hDlg,TXT_NAME), GWL_STYLE)|SS_CENTERIMAGE); */
					}
					ReleaseDC(hDlg, hDC);

					// calc new dialog size
					GetWindowRect(hDlg, &rcDlg);
					GetWindowRect(GetDlgItem(hDlg, TXT_MESSAGE), &ws);
					needX = txtWidth - (ws.right - ws.left) - icoWidth;
					needY = max(0, txtHeight - (ws.bottom - ws.top) + 5);
					rcDlg.left -= needX/2; rcDlg.right += needX/2;
					rcDlg.top -= (needY-InfoBarHeight)/2; rcDlg.bottom += (needY-InfoBarHeight)/2;

					// resize dialog window
					MoveWindow(hDlg, rcDlg.left, rcDlg.top, rcDlg.right - rcDlg.left, rcDlg.bottom - rcDlg.top, FALSE);
					ClientToScreen(hDlg, &mpt);

					MoveCtrl(hDlg, STATIC_WHITERECT, -mpt.x, -mpt.y, needX, needY - InfoBarHeight);
					MoveCtrl(hDlg, TXT_NAME, -mpt.x, -mpt.y, needX, 0);
					MoveCtrl(hDlg, ICO_DLGLOGO, -mpt.x + needX, -mpt.y, 0, 0);
					MoveCtrl(hDlg, ICO_MSGDLG, -mpt.x, -mpt.y - InfoBarHeight, 0, 0);
					MoveCtrl(hDlg, TXT_MESSAGE, -mpt.x - icoWidth, -mpt.y - InfoBarHeight, needX, needY);
					MoveCtrl(hDlg, STATIC_LINE2, -mpt.x, -mpt.y + needY - InfoBarHeight, needX, 0);

					//
					// Do pushbutton positioning
					//
					RECT rcOk, rcAll, rcNone, rcCancel;

					// get button rectangles
					GetWindowRect(GetDlgItem(hDlg, IDOK), &rcOk);
					OffsetRect(&rcOk, -mpt.x, -mpt.y + needY - InfoBarHeight);

					GetWindowRect(GetDlgItem(hDlg, IDALL), &rcAll);
					OffsetRect(&rcAll, -mpt.x, -mpt.y + needY - InfoBarHeight);

					GetWindowRect(GetDlgItem(hDlg, IDNONE), &rcNone);
					OffsetRect(&rcNone, -mpt.x, -mpt.y + needY - InfoBarHeight);

					GetWindowRect(GetDlgItem(hDlg, IDCANCEL), &rcCancel);
					OffsetRect(&rcCancel, -mpt.x, -mpt.y + needY - InfoBarHeight);

					LONG okWidth = rcOk.right - rcOk.left;
					LONG allWidth = rcAll.right - rcAll.left;
					LONG noneWidth = rcNone.right - rcNone.left;
					LONG caWidth = rcCancel.right - rcCancel.left;
					LONG dlgMid = (rcDlg.right - rcDlg.left) / 2;

					// load button configuration
					switch (MB_TYPE(pMsgBox->uType)) {
					case MB_OK:
						rcOk.left = dlgMid - (okWidth / 2);
						rcOk.right = rcOk.left + okWidth;
						ShowWindow(GetDlgItem(hDlg, IDOK), SW_SHOW);
						break;

					case MB_OKCANCEL:
						retOk = IDRETRY;
						SetDlgItemText(hDlg, IDOK, LPGENT("OK"));
						retCancel = IDCANCEL;
						SetDlgItemText(hDlg, IDCANCEL, LPGENT("Cancel"));
						rcOk.left = dlgMid - okWidth - 10;
						rcOk.right = rcOk.left + okWidth;
						rcCancel.left = dlgMid + 10;
						rcCancel.right = rcCancel.left + caWidth;
						ShowWindow(GetDlgItem(hDlg, IDOK), SW_SHOW);
						ShowWindow(GetDlgItem(hDlg, IDCANCEL), SW_SHOW);
						break;

					case MB_RETRYCANCEL:
						retOk = IDRETRY;
						SetDlgItemText(hDlg, IDOK, LPGENT("Retry"));
						retCancel = IDCANCEL;
						SetDlgItemText(hDlg, IDCANCEL, LPGENT("Cancel"));
						rcOk.left = dlgMid - okWidth - 10;
						rcOk.right = rcOk.left + okWidth;
						rcCancel.left = dlgMid + 10;
						rcCancel.right = rcCancel.left + caWidth;
						ShowWindow(GetDlgItem(hDlg, IDOK), SW_SHOW);
						ShowWindow(GetDlgItem(hDlg, IDCANCEL), SW_SHOW);
						break;

					case MB_YESNO:
						retOk = IDYES;
						SetDlgItemText(hDlg, IDOK, LPGENT("Yes"));
						retCancel = IDNO;
						SetDlgItemText(hDlg, IDCANCEL, LPGENT("No"));
						rcOk.left = dlgMid - okWidth - 10;
						rcOk.right = rcOk.left + okWidth;
						rcCancel.left = dlgMid + 10;
						rcCancel.right = rcCancel.left + caWidth;
						ShowWindow(GetDlgItem(hDlg, IDOK), SW_SHOW);
						ShowWindow(GetDlgItem(hDlg, IDCANCEL), SW_SHOW);
						break;

					case MB_ABORTRETRYIGNORE:
						retOk = IDABORT;
						SetDlgItemText(hDlg, IDOK, LPGENT("Abort"));
						retAll = IDABORT;
						SetDlgItemText(hDlg, IDALL, LPGENT("Retry"));
						retCancel = IDCANCEL;
						SetDlgItemText(hDlg, IDCANCEL, LPGENT("Ignore"));
						rcAll.left = dlgMid - (allWidth / 2);
						rcAll.right = rcAll.left + allWidth;
						rcOk.left = rcAll.left - okWidth - 5;
						rcOk.right = rcOk.left + okWidth;
						rcCancel.left = rcAll.right + 5;
						rcCancel.right = rcCancel.left + caWidth;
						ShowWindow(GetDlgItem(hDlg, IDOK), SW_SHOW);
						ShowWindow(GetDlgItem(hDlg, IDALL), SW_SHOW);
						ShowWindow(GetDlgItem(hDlg, IDCANCEL), SW_SHOW);
						break;

					case MB_YESNOCANCEL:
						retOk = IDYES;
						SetDlgItemText(hDlg, IDOK, LPGENT("Yes"));
						retAll = IDNO;
						SetDlgItemText(hDlg, IDALL, LPGENT("No"));
						retCancel = IDCANCEL;
						SetDlgItemText(hDlg, IDCANCEL, LPGENT("Cancel"));
						rcAll.left = dlgMid - (allWidth / 2);
						rcAll.right = rcAll.left + allWidth;
						rcOk.left = rcAll.left - okWidth - 5;
						rcOk.right = rcOk.left + okWidth;
						rcCancel.left = rcAll.right + 5;
						rcCancel.right = rcCancel.left + caWidth;
						ShowWindow(GetDlgItem(hDlg, IDOK), SW_SHOW);
						ShowWindow(GetDlgItem(hDlg, IDALL), SW_SHOW);
						ShowWindow(GetDlgItem(hDlg, IDCANCEL), SW_SHOW);
						break;

					case MB_YESALLNO:
						retOk = IDYES;
						SetDlgItemText(hDlg, IDOK, LPGENT("Yes"));
						retAll = IDALL;
						SetDlgItemText(hDlg, IDALL, LPGENT("All"));
						//retNon = IDNONE;
						SetDlgItemText(hDlg, IDNONE, LPGENT("None"));
						retCancel = IDNO;
						SetDlgItemText(hDlg, IDCANCEL, LPGENT("No"));
						rcCancel.right = rcDlg.right - rcDlg.left - 10;
						rcCancel.left = rcCancel.right - caWidth;
						rcNone.right = rcCancel.left - 5;
						rcNone.left = rcNone.right - noneWidth;
						rcAll.right = rcNone.left - 5;
						rcAll.left = rcAll.right - allWidth;
						rcOk.right = rcAll.left - 5;
						rcOk.left = rcOk.right - okWidth;
						// show buttons
						ShowWindow(GetDlgItem(hDlg, IDOK), SW_SHOW);
						ShowWindow(GetDlgItem(hDlg, IDALL), SW_SHOW);
						ShowWindow(GetDlgItem(hDlg, IDNONE), SW_SHOW);
						ShowWindow(GetDlgItem(hDlg, IDCANCEL), SW_SHOW);
						break;

					default:
						rcOk.left = dlgMid - (okWidth / 2);
						rcOk.right = rcOk.left + okWidth;
					}

					MoveWindow(GetDlgItem(hDlg, IDOK), rcOk.left, rcOk.top, rcOk.right - rcOk.left, rcOk.bottom - rcOk.top, FALSE);
					MoveWindow(GetDlgItem(hDlg, IDALL), rcAll.left, rcAll.top, rcAll.right - rcAll.left, rcAll.bottom - rcAll.top, FALSE);
					MoveWindow(GetDlgItem(hDlg, IDNONE), rcNone.left, rcNone.top, rcNone.right - rcNone.left, rcNone.bottom - rcNone.top, FALSE);
					MoveWindow(GetDlgItem(hDlg, IDCANCEL), rcCancel.left, rcCancel.top, rcCancel.right - rcCancel.left, rcCancel.bottom - rcCancel.top, FALSE);
				}

				// set text's
				SetWindowText(hDlg, pMsgBox->ptszTitle);
				SetDlgItemText(hDlg, TXT_NAME, pMsgBox->ptszInfoText);
				SetDlgItemText(hDlg, TXT_MESSAGE, pMsgBox->ptszMsg);

				TranslateDialogDefault(hDlg);
				return TRUE;
			}
		}
		break;

	case WM_CTLCOLORSTATIC:
		switch (GetWindowLongPtr((HWND)lParam, GWLP_ID)) {
		case STATIC_WHITERECT:
		case ICO_DLGLOGO:
		case ICO_MSGDLG:
		case TXT_MESSAGE:
		case TXT_NAME:
			SetTextColor((HDC)wParam, GetSysColor(COLOR_WINDOWTEXT));
			return GetSysColor(COLOR_WINDOW);
		}
		break;

	case WM_COMMAND:
		switch (LOWORD(wParam)) {
		case IDOK:
			EndDialog(hDlg, retOk);
			break;
		case IDCANCEL:
			EndDialog(hDlg, retCancel);
			break;
		case IDALL:
			EndDialog(hDlg, retAll);
			break;
		case IDNONE:
			EndDialog(hDlg, retNon);
		}
		break;

	case WM_DESTROY:
		DeleteObject((HFONT)SendDlgItemMessage(hDlg, TXT_NAME, WM_GETFONT, 0, 0));
		break;
	}
	return FALSE;
}
Esempio n. 30
0
/**
 * Dialog procedure for the about/nodes information propertysheetpage
 *
 * @param	 hDlg	- handle to the dialog window
 * @param	 uMsg	- the message to handle
 * @param	 wParam	- parameter
 * @param	 lParam	- parameter
 *
 * @return	different values
 **/
INT_PTR CALLBACK PSPProcEdit(HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM lParam, const CHAR *pszSetting)
{
	switch (uMsg) {
	case WM_INITDIALOG:
		{
			CCtrlList *pCtrlList = CCtrlList::CreateObj(hDlg);
			if (pCtrlList) {
				HFONT hBoldFont;
				PSGetBoldFont(hDlg, hBoldFont);
				SendDlgItemMessage(hDlg, IDC_PAGETITLE, WM_SETFONT, (WPARAM)hBoldFont, 0);

				if (!mir_strcmp(pszSetting, SET_CONTACT_MYNOTES))
					SetDlgItemText(hDlg, IDC_PAGETITLE, LPGENT("My notes:"));
				else
					SetDlgItemText(hDlg, IDC_PAGETITLE, LPGENT("About:"));

				TranslateDialogDefault(hDlg);
				
				pCtrlList->insert(CEditCtrl::CreateObj(hDlg, EDIT_ABOUT, pszSetting, DBVT_TCHAR));

				// remove static edge in aero mode
				if (IsAeroMode())
					SetWindowLongPtr(GetDlgItem(hDlg, EDIT_ABOUT), GWL_EXSTYLE, GetWindowLongPtr(GetDlgItem(hDlg, EDIT_ABOUT), GWL_EXSTYLE) & ~WS_EX_STATICEDGE);

				SendDlgItemMessage(hDlg, EDIT_ABOUT, EM_SETEVENTMASK, 0, /*ENM_KEYEVENTS | */ENM_LINK | ENM_CHANGE);
				SendDlgItemMessage(hDlg, EDIT_ABOUT, EM_AUTOURLDETECT, TRUE, NULL);
				if (!lParam) SendDlgItemMessage(hDlg, EDIT_ABOUT, EM_LIMITTEXT, 1024, NULL);
			}
		}
		break;
		
	case WM_NOTIFY:
		{
			switch (((LPNMHDR)lParam)->idFrom) 
			{
			// notification handler for richedit control
			case EDIT_ABOUT:
				{
					switch (((LPNMHDR)lParam)->code) {

					// notification handler for a link within the richedit control
					case EN_LINK:
						return CEditCtrl::GetObj(((LPNMHDR)lParam)->hwndFrom)->LinkNotificationHandler((ENLINK *)lParam);
					}
				}
				return FALSE;
			}
		}
		break;

	case WM_COMMAND:
		{
			switch (LOWORD(wParam)) {
			case EDIT_ABOUT:
				{
					if (HIWORD(wParam) == EN_CHANGE)
					{
						CBaseCtrl *pResult;

						pResult = CBaseCtrl::GetObj((HWND)lParam);
						if (PtrIsValid(pResult) && (pResult->_cbSize == sizeof(CBaseCtrl)))
							pResult->OnChangedByUser(HIWORD(wParam));
					}
				}
			}
		}
		return FALSE;
	}
	return PSPBaseProc(hDlg, uMsg, wParam, lParam);
}