Пример #1
0
void CBDCApp::DrawToday()
{
	struct list_entry_t ple; 
	trillianListInitialize(ple);

	ple.section_id		= m_sectionID;
	ple.parent_id		= m_knowngroupID;
	ple.unique_id		= -1; 
	ple.group			= 0;
	ple.section			= 0; 
	ple.inline_editing	= 0;
	ple.drag_and_drop	= 0; 
	ple.expanded		= 1; 

	ple.font.flags = 0x1;
	ple.font.skin_name = "recent-online";
	ple.font.select_fore = "recent-online-fore";
	ple.font.hover_fore = "recent-online-fore";
	ple.font.normal_fore = "recent-online-fore";

	ASSERT( m_pproc );
	if( m_pproc )
		ple.previous_id	= m_pproc->GetNextID(&CDate());
	else
		ple.previous_id	= -1;

	CString c = CDate().GetDateString() + " (today)";
	ple.tooltip			= c.GetBuffer(0);
	ple.text			= c.GetBuffer(0);
	ple.data			= NULL;

	// icon
	ple.left_icons = (struct list_bmp_t *)malloc(sizeof(struct list_bmp_t));
	trillianInitialize((*ple.left_icons));

	ple.left_icons->num_states	= 1;
	ple.left_icons->bitmap		= (HBITMAP *)malloc(sizeof(HBITMAP));
	ple.left_icons->location		= (RECT *)malloc(sizeof(RECT));

	ple.left_icons->bitmap[0] = m_pbmpListentry_today;

	ple.left_icons->location[0].left	=  0;
	ple.left_icons->location[0].top		=  0;
	ple.left_icons->location[0].bottom	= 18;
	ple.left_icons->location[0].right	= 18;

	ple.num_left_icons = 1;

	// You'll need the UniqueID for any further manipulation, so store it somewhere nice
	m_todayID = m_plugin_send(MYGUID, "listAddEntry", (void *)&ple);

	// Free what needs to be freed
	FreeIcons(&ple);
}
Пример #2
0
int Chat_Unload(void)
{
	DBWriteContactSettingWord(NULL, "Chat", "SplitterX", (WORD)g_Settings.iSplitterX);

	CList_SetAllOffline(TRUE, NULL);

	mir_free( pszActiveWndID );
	mir_free( pszActiveWndModule );

	DestroyHookableEvents();

	DestroyMenu(g_hMenu);
	FreeIcons();
	OptionsUnInit();
	DeleteCriticalSection(&cs);
	return 0;
}
Пример #3
0
void CBDCApp::UpdateIcon(CBirthday * pbd)
{
	if( pbd->m_listid_bd >= 0 )
	{
		{
			struct list_entry_t ple;

			trillianListInitialize(ple);

			ple.unique_id = pbd->m_listid_bd; 

			// icon
			MakeIconLeft( &ple,
				pbd->m_confirmed?1:0);
			MakeIconRight( &ple,
				pbd->m_medium);

			// You'll need the UniqueID for any further manipulation, so store it somewhere nice
			m_plugin_send(MYGUID, "listUpdateIcon", (void *)&ple);

			FreeIcons(&ple);
		}
		{
			struct list_entry_t ple;

			trillianListInitialize(ple);

			ple.unique_id = pbd->m_listid_bd; 

			if(pbd->m_date.IsDateOfYear())
			{
				ple.font.flags = 0x1;
				ple.font.skin_name = "recent-online";
				ple.font.select_fore = "recent-online-fore";
				ple.font.hover_fore = "recent-online-fore";
				ple.font.normal_fore = "recent-online-fore";
			}
			else
			{
			}
			m_plugin_send(MYGUID, "listUpdateFont", (void *)&ple);
		}
	}
}
Пример #4
0
int Chat_Unload(void)
{
	if (!PluginConfig.m_chat_enabled)
		return 0;

	DBWriteContactSettingWord(NULL, "Chat", "SplitterX", (WORD)g_Settings.iSplitterX);
	DBWriteContactSettingWord(NULL, "Chat", "splitY", (WORD)g_Settings.iSplitterY);

	CList_SetAllOffline(TRUE, NULL);

	mir_free(pszActiveWndID);
	mir_free(pszActiveWndModule);

	DestroyMenu(g_hMenu);
	DestroyServiceFunctions();
	DestroyHookableEvents();
	FreeIcons();
	OptionsUnInit();
	UnhookEvents();
	return 0;
}
Пример #5
0
int __declspec(dllexport) Unload(void)
{
    DBWriteContactSettingWord(NULL, "Chat", "SplitterX", (WORD)g_Settings.iSplitterX);
    DBWriteContactSettingWord(NULL, "Chat", "SplitterY", (WORD)g_Settings.iSplitterY);
    DBWriteContactSettingDword(NULL, "Chat", "roomx", g_Settings.iX);
    DBWriteContactSettingDword(NULL, "Chat", "roomy", g_Settings.iY);
    DBWriteContactSettingDword(NULL, "Chat", "roomwidth" , g_Settings.iWidth);
    DBWriteContactSettingDword(NULL, "Chat", "roomheight", g_Settings.iHeight);

    CList_SetAllOffline(TRUE, NULL);

    mir_free( pszActiveWndID );
    mir_free( pszActiveWndModule );

    DestroyMenu(g_hMenu);
    DestroyServiceFunctions();
    DestroyHookableEvents();
    FreeIcons();
    OptionsUnInit();
    FreeLibrary(GetModuleHandleA("riched20.dll"));
    UnhookEvents();
    return 0;
}
Пример #6
0
void CBDCApp::DrawBirthday(CBirthday *pbd)
{
	struct list_entry_t ple;

	trillianListInitialize(ple);

	ple.previous_id		= -2; 
	ple.section_id		= m_sectionID;
	ple.unique_id		= -1; 
	ple.group			= 0;
	ple.section			= 0; 
	ple.inline_editing	= 0;
	ple.drag_and_drop	= 0; 
	ple.expanded		= 1; 
	ple.callback		= ::listCallback;

	AssignString(&ple.tooltip, pbd->GetTooltip());
	ASSERT(m_pproc);
	if( m_pproc )
	{
		AssignString(&ple.text, pbd->GetText(m_pproc->GetSuffix(), m_pproc->DrawLeftInfo()));
	}
	else
	{
		AssignString(&ple.text, pbd->GetText(SUFFIX_NONE));
	}

	ple.data			= (void*)pbd;

	// icon
	MakeIconLeft( &ple, pbd->m_confirmed?1:0);

	// right icon
	MakeIconRight( &ple, pbd->m_medium);

	if(pbd->m_date.IsDateOfYear())
	{
		ple.font.flags = 0x1;
		ple.font.skin_name = "recent-online";
		ple.font.select_fore = "recent-online-fore";
		ple.font.hover_fore = "recent-online-fore";
		ple.font.normal_fore = "recent-online-fore";
	}

	AddMenu(MENU_EDIT, "&Edit...", &ple.menu_entry, pbd);
	AddMenu(MENU_CONFIRM, "&Confirm...", &ple.menu_entry, pbd);
	AddMenu(MENU_REMOVE, "&Remove...", &ple.menu_entry, pbd);

	if( pbd->m_medium == MEDIUM_ICQ )
	{
		AddMenu(MENU_RELOAD, "&Reload...", &ple.menu_entry, pbd);
	}

	// You'll need the UniqueID for any further manipulation, so store it somewhere nice
	pbd->m_listid_bd = m_plugin_send(MYGUID, "listAddEntry", (void *)&ple);

	// Free what needs to be freed
	FreeMenus(&ple.menu_entry);
	free(ple.text);
	free(ple.tooltip);
	FreeIcons(&ple);
}
Пример #7
0
void CBDCApp::DrawKnown(CBirthday *pbd, bool bSorted/*=true*/)
{
	struct list_entry_t ple;

	trillianListInitialize(ple);

	ple.section_id		= m_sectionID;
	ple.parent_id		= m_knowngroupID;
	ple.unique_id		= -1; 
	ple.group			= 0;
	ple.section			= 0; 
	ple.inline_editing	= 0;
	ple.drag_and_drop	= 0; 
	ple.expanded		= 1; 
	ple.callback		= ::listCallback;

	ASSERT( m_pproc );
	if( bSorted && m_pproc )
		ple.previous_id	= m_pproc->GetPreviousID(pbd);
	else
		ple.previous_id	= -1;

	AssignString(&ple.tooltip, pbd->GetTooltip());
	ASSERT(m_pproc);
	if( m_pproc )
	{
		AssignString(&ple.text, pbd->GetText(m_pproc->GetSuffix(), m_pproc->DrawLeftInfo()));
	}
	else
	{
		AssignString(&ple.text, pbd->GetText(SUFFIX_NONE));
	}

	ple.data			= (void*)pbd;

	// left icon
	ple.left_icons		= (struct list_bmp_t *)malloc(sizeof(struct list_bmp_t));
	trillianInitialize((*ple.left_icons));
	
	ple.left_icons->num_states	= 1;

	ple.left_icons->bitmap		= (HBITMAP *)malloc(sizeof(HBITMAP));
	ple.left_icons->bitmap[0]	= m_pbmpListentry_known;

	ple.left_icons->location	= (RECT *)malloc(sizeof(RECT));
	ple.left_icons->location[0].left	=  0;
	ple.left_icons->location[0].top		=  0;
	ple.left_icons->location[0].bottom	= 18;
	ple.left_icons->location[0].right	= 18;

	ple.num_left_icons = 1;

	// right icon
	MakeIconRight( &ple,
		pbd->m_medium);

	AddMenu(MENU_ADD, "&Add...", &ple.menu_entry);
	AddMenu(MENU_EDIT, "&Edit...", &ple.menu_entry, pbd);
	AddMenu(MENU_REMOVE, "&Remove...", &ple.menu_entry, pbd);

	if( pbd->m_medium == MEDIUM_ICQ )
	{
		AddMenu(MENU_RELOAD, "Re&load...", &ple.menu_entry, pbd);
	}

	// You'll need the UniqueID for any further manipulation, so store it somewhere nice
	pbd->m_listid_known = m_plugin_send(MYGUID, "listAddEntry", (void *)&ple); 

	FreeMenus(&ple.menu_entry);
	free(ple.text);
	free(ple.tooltip);
	FreeIcons(&ple);
}
Пример #8
0
int FileIconCollection::ReadDirectory(ieIDirectoryEnumerator *&pEnum, PCTCHAR pcszPath, muiSize whIcon_, IconSortFunc *pSortFunc)
{
	if (bReadingImages || bSavingCache) {
		if (bReadingImages) {
			bCancelReads = true;
			tg.cancel();
		}
		tg.wait();
		bReadingImages = bSavingCache = false;
	}

	bool bGotPath = pcszPath && *pcszPath;
	bool bSamePath = bGotPath && (_tcsicmp(pcszPath, szPath) == 0);
	
	FileIcon *pOldIcons = nullptr;
	if (pFirstIcon && bSamePath) {
		// Same path -> Save a copy of previous icons that we can retrieve the new icons from for all files that hasn't changed
		pOldIcons = pFirstIcon;
		pFirstIcon = pLastIcon = nullptr;
	} else {
		FreeIcons();
	}

	if (!bGotPath) return 0;

	// Store new path
	int nPathLen = _tcslen(pcszPath);
	memcpy(szPath, pcszPath, (nPathLen+1)*sizeof(*pcszPath));

	bInclSubDirs = false;
	bCancelReads = false;

	// Read icon cache file (if present)
	tg.run([&] { Cache.Load(szPath, whIcon_); });

    // Create a list of icons for all files in the directory
	int iNumIcons = 0;

	for (;;) {	// (repeat until we've got a list where the directory hasn't changed during the enumeration)

		ieIDirectoryEnumerator *pOldEnum = pEnum;
		pEnum = g_ieFM.DirCache.CreateEnumerator(szPath);
		if (pOldEnum) pOldEnum->Release();

		const ieDirectoryFileInfo *pDFI;	

		if (((nPathLen == 2) || (nPathLen == 3)) && (szPath[1] == ':')) {

			// Special case for root path: then add drive letters
			int iCurDrive = _totupper(szPath[0]) - 'A';
			DWORD dwDriveMap = GetLogicalDrives();
			TCHAR szFile[4] = _T("X:\\");

			for (int i = 32; i--; ) {
			
				if (!(dwDriveMap & (1<<i))) continue;
				if (i == iCurDrive) continue;
				szFile[0] = 'A' + i;

				AddIcon(szFile, 0, 0, true);
				iNumIcons++;
			}
		}

		if (!pEnum) break;	// No files?

		// Enumerate files

		for (PCTCHAR pcszName = nullptr; pEnum->IsStillValid() && (pcszName = pEnum->NextFile(pcszName, &pDFI)) != nullptr;) {
	
			// Ignore hidden files
			if (pDFI->bHiddenFile) continue;

			// Ignore . directory
			int nNameLen = _tcslen(pcszName);
			if ((nNameLen == 1) && (pcszName[0] == '.') && (pcszName[1] == 0))
				continue;

			// Ignore .iei and .iea files
			if (!pDFI->bSubDirectory) {
	   			if ((nNameLen > 4) && (pcszName[nNameLen-4] == '.') && ((pcszName[nNameLen-3] == 'i') || (pcszName[nNameLen-3] == 'I')) && ((pcszName[nNameLen-2] == 'e') || (pcszName[nNameLen-2] == 'E')) && ((pcszName[nNameLen-1] == 'i') || (pcszName[nNameLen-1] == 'I') || (pcszName[nNameLen-1] == 'A') || (pcszName[nNameLen-1] == 'A')))
					continue;
			}

			// Expand to full file path
			TCHAR szFile[MAX_PATH];
			int nFileLen = nPathLen;
			memcpy(szFile, szPath, nFileLen*sizeof(*szPath));
			szFile[nFileLen++] = '\\';
			memcpy(szFile+nFileLen, pcszName, (nNameLen+1)*sizeof(*pcszName));
			nFileLen += nNameLen;

			// See if we can re-use any old icon...
			FileIcon *pThis = pOldIcons;

			while (pThis) {
				if (	(pThis->GetFileSize() == pDFI->qwSize)							// Must have same file size
					&&	(pThis->GetFileTime() == pDFI->ftFileTime)						// ... and time stampe
					&&	(pThis->GetFileStrLength() == nFileLen)							// ... and length
					&&	!memcmp(pThis->GetFileStr(), szFile, nFileLen*sizeof(*szFile))	// ... and name
					&&	((pThis->GetType() != fitImage) || pThis->HasImage()) )			// ... and if it's an image, we must've read the image thumbnail...
					break;
				pThis = pThis->NextIcon();
			}

			if (pThis) {
		
				// Yes, unlink from old chain and re-use it in the new chain
				if (pThis == pOldIcons) pOldIcons = pThis->NextIcon();
				pThis->UnlinkIcon();

				if (!pFirstIcon) pFirstIcon = pThis;
				pThis->LinkIcon(pLastIcon, nullptr);
				pLastIcon = pThis;

			} else {

				// No, so create new icon
				AddIcon(szFile, pDFI->qwSize, pDFI->ftFileTime, pDFI->bSubDirectory);
			}

			iNumIcons++;
		}

		if (pEnum->IsStillValid()) {
			// Success!
			break;
		}

		// Directory has changed during the enumeration -> Try again (save any icons read as old icons that can be re-used)
		if (pFirstIcon) {
			pLastIcon->LinkIcon(pLastIcon->PrevIcon(), pOldIcons);
			pOldIcons = pFirstIcon;
		} 
		pFirstIcon = pLastIcon = nullptr;
		iNumIcons = 0;
	}

	// Free any remaining old icons
	for (;;) {
		FileIcon *pThis = pOldIcons;
		if (!pThis) break;
		pOldIcons = pThis->NextIcon();
		delete pThis;
	}

	// Sort new icons?
	if (pSortFunc && (pSortFunc != ByImageSize)) {
		Sort(pSortFunc);
	}

	// Wait for cache file to load
	tg.wait();

	whIcon = whIcon_;
	if (!whIcon.w) whIcon.w = pCfg->idx.iIconX;
	if (!whIcon.h) whIcon.h = pCfg->idx.iIconY;

	// Return the number of FileIcon's created
	return iNumIcons;
}
Пример #9
0
FileIconCollection::~FileIconCollection()
{
	tg.wait();
	FreeIcons();
}