Exemplo n.º 1
1
extern "C" SAMETIME_API int Load(PLUGINLINK *link)
{

	pluginLink=link;

	if(!IsUnicodeOS()) {
		MessageBox(0, TranslateT("This plugin requires a Unicode capable Windows installation."), TranslateT("Sametime Error"), MB_OK | MB_ICONERROR);
		return 1;
	}

	if ( !ServiceExists( MS_DB_CONTACT_GETSETTING_STR )) {
		MessageBox( 0, TranslateT( "This plugin requires db3x plugin version 0.5.1.0 or later." ), TranslateT("Sametime Error"), MB_OK );
		return 1;
	}

	DuplicateHandle( GetCurrentProcess(), GetCurrentThread(), GetCurrentProcess(), &mainThread, THREAD_SET_CONTEXT, FALSE, 0 );
	mainThreadId = GetCurrentThreadId();

	previous_status = current_status = ID_STATUS_OFFLINE;

	if(ServiceExists(MS_LANGPACK_GETCODEPAGE))
		code_page = CallService(MS_LANGPACK_GETCODEPAGE, 0, 0);

	mir_getMMI(&mmi);
	mir_getUTFI(&utfi);


	if(ServiceExists(MS_DB_SETSETTINGRESIDENT)) { // 0.6+
		char buff[256];
		mir_snprintf(buff, 256, "%s/%s", PROTO, "Status");
		CallService(MS_DB_SETSETTINGRESIDENT, TRUE, (LPARAM)buff);
		mir_snprintf(buff, 256, "%s/%s", PROTO, "IdleTS");
		CallService(MS_DB_SETSETTINGRESIDENT, TRUE, (LPARAM)buff);
	}

	InitAwayMsg();
	InitCritSection();

	// Get module name from DLL file name
	{
		char* str1;
		char str2[MAX_PATH];

		GetModuleFileNameA(hInst, str2, MAX_PATH);
		str1 = strrchr(str2, '\\');
		if (str1 != NULL && strlen(str1+1) > 4) {
			strncpy(PROTO, str1+1, strlen(str1+1)-4);
			PROTO[strlen(str1+1)-3] = 0;
		}
		CharUpperA(PROTO);

		strcpy(PROTO_GROUPS, PROTO);
		strcat(PROTO_GROUPS, "_GROUPS");
	}

	PROTOCOLDESCRIPTOR pd = {0};
	pd.cbSize = sizeof(pd);
	pd.szName = PROTO;
	pd.type = PROTOTYPE_PROTOCOL;
	CallService(MS_PROTO_REGISTERMODULE,0,(LPARAM)&pd);

	InitUtils();

	CreatePluginServices();

	LoadOptions();

	//DeleteAllContacts();	//!!!
	
	SetAllOffline();

	HookEvent(ME_SYSTEM_MODULESLOADED, OnModulesLoaded);	
	HookEvent(ME_OPT_INITIALISE, OptInit );
	HookEvent(ME_SYSTEM_PRESHUTDOWN, OnPreShutdown);
	HookEvent(ME_SYSTEM_SHUTDOWN, OnShutdown);

	return 0;
}
Exemplo n.º 2
0
CMLan::CMLan()
{
	m_RequiredIp = 0;
	m_UseHostName = true;

	m_mirStatus = ID_STATUS_OFFLINE;
	m_pRootContact = 0;

	m_pRootContact = NULL;
	m_hCheckThread = NULL;

	m_handleId = 1;

	m_amesAway = NULL;
	m_amesNa = NULL;
	m_amesOccupied = NULL;
	m_amesDnd = NULL;
	m_amesFfc = NULL;

	m_pFileConnectionList = NULL;

	LoadSettings();

	InitializeCriticalSection(&m_csAccessClass);
	InitializeCriticalSection(&m_csReceiveThreadLock);
	InitializeCriticalSection(&m_csAccessAwayMes);
	InitializeCriticalSection(&m_csFileConnectionList);

	SetAllOffline();

	//m_hookIcqMsgReq = CreateHookableEvent(ME_ICQ_STATUSMSGREQ);
}
Exemplo n.º 3
0
void CMLan::StopChecking()
{
	EnterCriticalSection(&m_csAccessClass);
	if (m_hCheckThread)
	{
		TerminateThread(m_hCheckThread, 0);
		m_hCheckThread = NULL;
	}
	LeaveCriticalSection(&m_csAccessClass);
	EnterCriticalSection(&m_csReceiveThreadLock);
	m_mirStatus = ID_STATUS_OFFLINE;
	RequestStatus(false);
	StopListen();
	LeaveCriticalSection(&m_csReceiveThreadLock);

	TFileConnection* fc = m_pFileConnectionList;
	while (fc)
	{
		fc->Terminate();
		fc = fc->m_pNext;
	}
	while (m_pFileConnectionList)
		Sleep(10);

	SetAllOffline();
}