Пример #1
0
/***********************************
**
**  Shows the History window. 
**
**  Macro returns:
**
**     No macro return value.
**
**  Function returns: TRUE
**
***********************************/
BOOL CALLBACK HistoryMacroProc
( 
  HMACROENGINE hMacroEngine, 
  HGLOBAL hAppData, 
  HGLOBAL hMacroData, 
  MACRORETVAL __far * MacroRetValPtr 
)
{
  HLPMACRODATAPTR HelpMacroDataPtr;
  HWND  hDataWnd;
  
  /* Lock app. data. */
  HelpMacroDataPtr = ( HLPMACRODATAPTR ) GlobalLock( hAppData );
      
  /* Get data window's handle. */
  hDataWnd = HelpMacroDataPtr->hDataWnd;

  /* Unlock app. data. */
  GlobalUnlock( hAppData );
      
  /* Show the history window. */
  ShowHistory( hDataWnd );
  
  /* No macro syntax errors. */
  return( TRUE );
}
Пример #2
0
void PyConsoleCtrl::Dec()
{
	//go to previous in history
	--idx;
	if(idx < 0)
	{
		idx = 0;
//		Clear(); //no clear at beginning of history
	}
//	else
		ShowHistory(idx);
}
Пример #3
0
void PyConsoleCtrl::Inc()
{
	//got to next in hostory and display it
	++idx;
	if(idx >= ac.GetCount())
	{
		idx = ac.GetCount();
		Clear();
	}
	else
		ShowHistory(idx);
}
Пример #4
0
int UpdateValues(WPARAM hContact, LPARAM lparam)
{
	// to make this code faster
	if (!hContact)
		return 0;

	DBCONTACTWRITESETTING *cws = (DBCONTACTWRITESETTING *)lparam;
	char *szProto = GetContactProto(hContact);

	if (cws->value.type == DBVT_DWORD && !strcmp(cws->szSetting, "LastSeen") && !mir_strcmp(cws->szModule, szProto)) {
		DBWriteTimeTS(cws->value.dVal, hContact);
		
		HWND hwnd = WindowList_Find(g_pUserInfo, hContact);
		if (hwnd != NULL)
			SendMessage(hwnd, WM_REFRESH_UI, hContact, 0);
		return 0;
	}

	BOOL isIdleEvent = includeIdle ? (strcmp(cws->szSetting, "IdleTS") == 0) : 0;
	if (strcmp(cws->szSetting, "Status") && strcmp(cws->szSetting, "StatusTriger") && (isIdleEvent == 0))
		return 0;
	
	if (!strcmp(cws->szModule, S_MOD)) {
		// here we will come when Settings/SeenModule/StatusTriger is changed
		WORD prevStatus = db_get_w(hContact, S_MOD, "OldStatus", ID_STATUS_OFFLINE);
		if (includeIdle) {
			if (db_get_b(hContact, S_MOD, "OldIdle", 0))
				prevStatus &= 0x7FFF;
			else
				prevStatus |= 0x8000;
		}
		if ((cws->value.wVal | 0x8000) <= ID_STATUS_OFFLINE) {
			// avoid repeating the offline status
			if ((prevStatus | 0x8000) <= ID_STATUS_OFFLINE)
				return 0;

			db_set_b(hContact, S_MOD, "Offline", 1);
			{
				char str[MAXMODULELABELLENGTH + 9];

				mir_snprintf(str, "OffTime-%s", szProto);
				DWORD t = db_get_dw(NULL, S_MOD, str, 0);
				if (!t)
					t = time(NULL);
				DBWriteTimeTS(t, hContact);
			}

			if (!db_get_b(NULL, S_MOD, "IgnoreOffline", 1)) {
				if (g_bFileActive)
					FileWrite(hContact);

				char *sProto = GetContactProto(hContact);
				if (CallProtoService(sProto, PS_GETSTATUS, 0, 0) > ID_STATUS_OFFLINE) {
					myPlaySound(hContact, ID_STATUS_OFFLINE, prevStatus);
					if (db_get_b(NULL, S_MOD, "UsePopups", 0))
						ShowPopup(hContact, sProto, ID_STATUS_OFFLINE);
				}

				if (db_get_b(NULL, S_MOD, "KeepHistory", 0))
					HistoryWrite(hContact);

				if (db_get_b(hContact, S_MOD, "OnlineAlert", 0))
					ShowHistory(hContact, 1);
			}

		}
		else {
			if (cws->value.wVal == prevStatus && !db_get_b(hContact, S_MOD, "Offline", 0))
				return 0;

			DBWriteTimeTS(time(NULL), hContact);

			if (g_bFileActive) FileWrite(hContact);
			if (prevStatus != cws->value.wVal) myPlaySound(hContact, cws->value.wVal, prevStatus);
			if (db_get_b(NULL, S_MOD, "UsePopups", 0))
				if (prevStatus != cws->value.wVal)
					ShowPopup(hContact, GetContactProto(hContact), cws->value.wVal | 0x8000);

			if (db_get_b(NULL, S_MOD, "KeepHistory", 0)) HistoryWrite(hContact);
			if (db_get_b(hContact, S_MOD, "OnlineAlert", 0)) ShowHistory(hContact, 1);
			db_set_b(hContact, S_MOD, "Offline", 0);
		}
	}
	else if (hContact && IsWatchedProtocol(cws->szModule) && !db_get_b(hContact, cws->szModule, "ChatRoom", false)) {
		// here we will come when <User>/<module>/Status is changed or it is idle event and if <module> is watched
		if (CallProtoService(cws->szModule, PS_GETSTATUS, 0, 0) > ID_STATUS_OFFLINE) {
			mir_cslock lck(csContacts);
			logthread_info *p = arContacts.find((logthread_info*)&hContact);
			if (p == NULL) {
				p = (logthread_info*)mir_calloc(sizeof(logthread_info));
				p->hContact = hContact;
				mir_strncpy(p->sProtoName, cws->szModule, _countof(p->sProtoName));
				arContacts.insert(p);
				mir_forkthread(waitThread, p);
			}
			p->currStatus = isIdleEvent ? db_get_w(hContact, cws->szModule, "Status", ID_STATUS_OFFLINE) : cws->value.wVal;
		}
	}

	return 0;
}
Пример #5
0
/*
Handles the messages sent by clicking the contact's menu item
*/
int MenuitemClicked(WPARAM wparam,LPARAM lparam)
{
	ShowHistory((HANDLE)wparam, 0);
	return 0;
}
Пример #6
0
/*
Handles the messages sent by clicking the contact's menu item
*/
INT_PTR MenuitemClicked(WPARAM wparam,LPARAM)
{
	ShowHistory((MCONTACT)wparam, 0);
	return 0;
}