BOOL SM_AddEvent(const TCHAR* pszID, const char* pszModule, GCEVENT * gce, BOOL bIsHighlighted) { SESSION_INFO *pTemp = m_WndList, *pLast = NULL; if (!pszID || !pszModule) return TRUE; while ( pTemp != NULL ) { if ( !lstrcmpi( pTemp->ptszID, pszID ) && !lstrcmpiA(pTemp->pszModule,pszModule)) { LOGINFO * li = LM_AddEvent(&pTemp->pLog, &pTemp->pLogEnd); pTemp->iEventCount += 1; li->iType = gce->pDest->iType; li->ptszNick = mir_tstrdup( gce->ptszNick ); li->ptszText = mir_tstrdup( gce->ptszText ); li->ptszStatus = mir_tstrdup( gce->ptszStatus ); li->ptszUserInfo = mir_tstrdup( gce->ptszUserInfo ); li->bIsMe = gce->bIsMe; li->time = gce->time; li->bIsHighlighted = bIsHighlighted; if (g_Settings.iEventLimit > 0 && pTemp->iEventCount > g_Settings.iEventLimit + 20) { LM_TrimLog(&pTemp->pLog, &pTemp->pLogEnd, pTemp->iEventCount - g_Settings.iEventLimit); pTemp->iEventCount = g_Settings.iEventLimit; return FALSE; } return TRUE; } pLast = pTemp; pTemp = pTemp->next; } return TRUE; }
BOOL SM_AddEvent(char *pszID, char * pszModule, GCEVENT * gce, BOOL bIsHighlighted) { SESSION_INFO *pTemp = m_WndList, *pLast = NULL; if(!pszID || !pszModule) return TRUE; while (pTemp != NULL) { if (!lstrcmpiA(pTemp->pszID,pszID) && !lstrcmpiA(pTemp->pszModule,pszModule)) { LOGINFO * li = LM_AddEvent(&pTemp->pLog, &pTemp->pLogEnd); pTemp->iEventCount += 1; li->iType = gce->pDest->iType; if(gce->pszNick ) { li->pszNick = (char*)malloc(lstrlenA(gce->pszNick) + 1); lstrcpyA(li->pszNick, gce->pszNick); } if(gce->pszText) { li->pszText = (char*)malloc(lstrlenA(gce->pszText) + 1); lstrcpyA(li->pszText, gce->pszText); } if(gce->pszStatus) { li->pszStatus = (char*)malloc(lstrlenA(gce->pszStatus) + 1); lstrcpyA(li->pszStatus, gce->pszStatus); } if(gce->pszUserInfo) { li->pszUserInfo = (char*)malloc(lstrlenA(gce->pszUserInfo) + 1); lstrcpyA(li->pszUserInfo, gce->pszUserInfo); } li->bIsMe = gce->bIsMe; li->time = gce->time; li->bIsHighlighted = bIsHighlighted; if(g_Settings.iEventLimit > 0 && pTemp->iEventCount > g_Settings.iEventLimit + 20) { LM_TrimLog(&pTemp->pLog, &pTemp->pLogEnd, pTemp->iEventCount - g_Settings.iEventLimit); pTemp->wasTrimmed = TRUE; pTemp->iEventCount = g_Settings.iEventLimit; return TRUE; // FALSE } return TRUE; } pLast = pTemp; pTemp = pTemp->next; } return TRUE; }