Example #1
0
static INT_PTR SetStatusText(WPARAM hContact, LPARAM lParam)
{
	StatusTextData *st = (StatusTextData*)lParam;
	if (st != NULL && st->cbSize != sizeof(StatusTextData))
		return 1;

	ParentWindowData *pdat;
	HWND hwnd = WindowList_Find(g_dat.hMessageWindowList, hContact);
	if (hwnd == NULL) {
		hwnd = SM_FindWindowByContact(hContact);
		if (hwnd == NULL)
			return 1;

		SESSION_INFO *si = (SESSION_INFO*)GetWindowLongPtr(hwnd, GWLP_USERDATA);
		if (si == NULL || si->parent == NULL)
			return 1;

		pdat = si->parent;
	}
	else {
		SrmmWindowData *dat = (SrmmWindowData*)GetWindowLongPtr(hwnd, GWLP_USERDATA);
		if (dat == NULL || dat->parent == NULL)
			return 1;

		pdat = dat->parent;
	}

	SendMessage(pdat->hwndStatus, SB_SETICON, 0, (LPARAM)(st == NULL ? 0 : st->hIcon));
	SendMessage(pdat->hwndStatus, SB_SETTEXT, 0, (LPARAM)(st == NULL ? _T("") : st->tszText));

	return 0;
}
Example #2
0
int StatusIconPressed(WPARAM wParam, LPARAM lParam)
{
	StatusIconClickData *sicd = (StatusIconClickData *) lParam;
	if (mir_strcmp(SRMMMOD, sicd->szModule))
		return 0;

	HWND hwnd = WindowList_Find(g_dat.hMessageWindowList, wParam);
	if (hwnd == NULL)
		hwnd = SM_FindWindowByContact(wParam);

	if (hwnd != NULL)
		SendMessage(hwnd, DM_SWITCHTYPING, 0, 0);
	return 0;
}
static int ModifyStatusIcon(WPARAM wParam, LPARAM lParam) {
	HANDLE hContact = (HANDLE)wParam;

	StatusIconData *sid = (StatusIconData *)lParam;
	struct StatusIconListNode *current = status_icon_list;

	while(current) {
		if(strcmp(current->sid.szModule, sid->szModule) == 0 && current->sid.dwId == sid->dwId) {
			if(!hContact) {
				current->sid.flags = sid->flags;
				if(sid->hIcon) {
					DestroyIcon(current->sid.hIcon);
					current->sid.hIcon = DuplicateIcon(NULL, sid->hIcon);
				}
				if(sid->hIconDisabled) {
					DestroyIcon(current->sid.hIconDisabled);
					current->sid.hIconDisabled = DuplicateIcon(NULL, sid->hIconDisabled);
				}
				if(sid->szTooltip) {
					if(current->sid.szTooltip) mir_free(current->sid.szTooltip);
					current->sid.szTooltip = mir_strdup(sid->szTooltip);
				}

				WindowList_Broadcast(g_dat->hParentWindowList, DM_STATUSICONCHANGE, 0, 0);
			} else {
				char buff[256];
				HWND hwnd;
				sprintf(buff, "SRMMStatusIconFlags%d", (int)sid->dwId);
				DBWriteContactSettingByte(hContact, sid->szModule, buff, (BYTE)sid->flags);
				hwnd = WindowList_Find(g_dat->hMessageWindowList, hContact);
				if (hwnd == NULL) {
					hwnd = SM_FindWindowByContact(hContact);

				}
				if (hwnd != NULL) {
					PostMessage(GetParent(hwnd), DM_STATUSICONCHANGE, 0, 0);
				}
			}
			return 0;
		}

		current = current->next;
	}

	return 1;
}
Example #4
0
static INT_PTR GetWindowData(WPARAM wParam, LPARAM lParam)
{
	MessageWindowInputData *mwid = (MessageWindowInputData*)wParam;
	if (mwid == NULL || mwid->cbSize != sizeof(MessageWindowInputData) || mwid->hContact == NULL || mwid->uFlags != MSG_WINDOW_UFLAG_MSG_BOTH)
		return 1;

	MessageWindowData *mwd = (MessageWindowData*)lParam;
	if (mwd == NULL || mwd->cbSize != sizeof(MessageWindowData))
		return 1;

	HWND hwnd = WindowList_Find(g_dat.hMessageWindowList, mwid->hContact);
	if (hwnd == NULL)
		hwnd = SM_FindWindowByContact(mwid->hContact);
	mwd->uFlags = MSG_WINDOW_UFLAG_MSG_BOTH;
	mwd->hwndWindow = hwnd;
	mwd->local = 0;
	mwd->uState = SendMessage(hwnd, DM_GETWINDOWSTATE, 0, 0);
	return 0;
}