int CList_RoomDoubleclicked(WPARAM wParam, LPARAM lParam) { DBVARIANT dbv; char *szProto; BOOL bRedrawFlag = FALSE; bool fCreate = false; HANDLE hContact = (HANDLE)wParam; if (!hContact) return 0; szProto = (char*)CallService(MS_PROTO_GETCONTACTBASEPROTO, (WPARAM) hContact, 0); if (MM_FindModule(szProto)) { if (M->GetByte(hContact, szProto, "ChatRoom", 0) == 0) return 0; if (!M->GetTString(hContact, szProto, "ChatRoomID", &dbv)) { SESSION_INFO* si = SM_FindSession(dbv.ptszVal, szProto); if (si) { // is the "toggle visibility option set, so we need to close the window? if (si->hWnd != NULL && M->GetByte("Chat", "ToggleVisibility", 0) == 1 && !CallService(MS_CLIST_GETEVENT, (WPARAM)hContact, 0) && IsWindowVisible(si->hWnd) && !IsIconic(si->pContainer->hwnd)) { PostMessage(si->hWnd, GC_CLOSEWINDOW, 0, 0); DBFreeVariant(&dbv); return 1; } else fCreate = true; ShowRoom(si, WINDOW_VISIBLE, TRUE); if(lParam && fCreate) { SendMessage(si->hWnd, DM_ACTIVATEME, 0, 0); if(si->dat) SetForegroundWindow(si->dat->pContainer->hwnd); } } DBFreeVariant(&dbv); return 1; } } return 0; }
int CList_RoomDoubleclicked( WPARAM wParam, LPARAM lParam ) { DBVARIANT dbv; char *szProto; BOOL bRedrawFlag = FALSE; HANDLE hContact = (HANDLE)wParam; if ( !hContact ) return 0; szProto = ( char* )CallService(MS_PROTO_GETCONTACTBASEPROTO, (WPARAM) hContact, 0); if ( MM_FindModule(szProto)) { if ( DBGetContactSettingByte( hContact, szProto, "ChatRoom", 0 ) == 0 ) return 0; if ( !DBGetContactSettingTString( hContact, szProto, "ChatRoomID", &dbv )) { SESSION_INFO* si = SM_FindSession( dbv.ptszVal, szProto ); if ( si ) { // is the "toggle visibility option set, so we need to close the window? if (si->hWnd != NULL && DBGetContactSettingByte(NULL, "Chat", "ToggleVisibility", 0)==1 && !CallService(MS_CLIST_GETEVENT, (WPARAM)hContact, 0) && IsWindowVisible(si->hWnd) && !IsIconic(si->hWnd)) { if (g_Settings.TabsEnable) SendMessage(si->hWnd, GC_REMOVETAB, 1, (LPARAM) si ); else PostMessage(si->hWnd, GC_CLOSEWINDOW, 0, 0); DBFreeVariant(&dbv); return 1; } ShowRoom(si, WINDOW_VISIBLE, TRUE); } DBFreeVariant(&dbv); return 1; } } return 0; }
static INT_PTR DoControl(GCEVENT * gce, WPARAM wp) { if ( gce->pDest->iType == GC_EVENT_CONTROL ) { switch (wp) { case WINDOW_HIDDEN: { SESSION_INFO* si = SM_FindSession(gce->pDest->ptszID, gce->pDest->pszModule); if (si) { si->bInitDone = TRUE; SetActiveSession(si->ptszID, si->pszModule); if (si->hWnd) ShowRoom(si, wp, FALSE); } } return 0; case WINDOW_MINIMIZE: case WINDOW_MAXIMIZE: case WINDOW_VISIBLE: case SESSION_INITDONE: { SESSION_INFO* si = SM_FindSession(gce->pDest->ptszID, gce->pDest->pszModule); if (si) { si->bInitDone = TRUE; if (wp != SESSION_INITDONE || DBGetContactSettingByte(NULL, "Chat", "PopupOnJoin", 0) == 0) ShowRoom(si, wp, TRUE); return 0; } } break; case SESSION_OFFLINE: SM_SetOffline(gce->pDest->ptszID, gce->pDest->pszModule); // fall through case SESSION_ONLINE: SM_SetStatus( gce->pDest->ptszID, gce->pDest->pszModule, wp==SESSION_ONLINE?ID_STATUS_ONLINE:ID_STATUS_OFFLINE); break; case WINDOW_CLEARLOG: { SESSION_INFO* si = SM_FindSession(gce->pDest->ptszID, gce->pDest->pszModule); if ( si ) { LM_RemoveAll(&si->pLog, &si->pLogEnd); si->iEventCount = 0; si->LastTime = 0; } break; } case SESSION_TERMINATE: return SM_RemoveSession(gce->pDest->ptszID, gce->pDest->pszModule); } SM_SendMessage(gce->pDest->ptszID, gce->pDest->pszModule, GC_EVENT_CONTROL + WM_USER + 500, wp, 0); } else if (gce->pDest->iType == GC_EVENT_CHUID && gce->pszText) { SM_ChangeUID( gce->pDest->ptszID, gce->pDest->pszModule, gce->ptszNick, gce->ptszText); } else if (gce->pDest->iType == GC_EVENT_CHANGESESSIONAME && gce->pszText) { SESSION_INFO* si = SM_FindSession(gce->pDest->ptszID, gce->pDest->pszModule); if ( si ) { replaceStr( &si->ptszName, gce->ptszText ); if (si->hWnd) SendMessage(si->hWnd, DM_UPDATETITLEBAR, 0, 0); } } else if (gce->pDest->iType == GC_EVENT_SETITEMDATA) { SESSION_INFO* si = SM_FindSession(gce->pDest->ptszID, gce->pDest->pszModule); if (si) si->dwItemData = gce->dwItemData; } else if (gce->pDest->iType ==GC_EVENT_GETITEMDATA) { SESSION_INFO* si = SM_FindSession(gce->pDest->ptszID, gce->pDest->pszModule); if (si) { gce->dwItemData = si->dwItemData; return si->dwItemData; } return 0; } else if (gce->pDest->iType ==GC_EVENT_SETSBTEXT) { SESSION_INFO* si = SM_FindSession(gce->pDest->ptszID, gce->pDest->pszModule); if (si) { replaceStr( &si->ptszStatusbarText, gce->ptszText ); if ( si->ptszStatusbarText ) DBWriteContactSettingTString(si->windowData.hContact, si->pszModule, "StatusBar", si->ptszStatusbarText); else DBWriteContactSettingString(si->windowData.hContact, si->pszModule, "StatusBar", ""); if (si->hWnd) { SendMessage(si->hWnd, DM_UPDATESTATUSBAR, 0, 0); } } } else if (gce->pDest->iType == GC_EVENT_ACK) { SM_SendMessage(gce->pDest->ptszID, gce->pDest->pszModule, GC_ACKMESSAGE, 0, 0); } else if (gce->pDest->iType == GC_EVENT_SENDMESSAGE && gce->pszText) { SM_SendUserMessage( gce->pDest->ptszID, gce->pDest->pszModule, gce->ptszText); } else if (gce->pDest->iType == GC_EVENT_SETSTATUSEX) { SM_SetStatusEx( gce->pDest->ptszID, gce->pDest->pszModule, gce->ptszText, gce->dwItemData); } else return 1; return 0; }
static void __stdcall ShowRoomFromPopup(void * pi) { SESSION_INFO *si = (SESSION_INFO*) pi; ShowRoom(si, WINDOW_VISIBLE, TRUE); }