Ejemplo n.º 1
0
int Service_Register(WPARAM wParam, LPARAM lParam)
{

	GCREGISTER *gcr = (GCREGISTER *)lParam;
	MODULEINFO * mi = NULL;
	if (gcr== NULL)
		return GC_REGISTER_ERROR;

	if (gcr->cbSize != SIZEOF_STRUCT_GCREGISTER_V1)
		return GC_REGISTER_WRONGVER;

	#ifndef _UNICODE
		if (gcr->dwFlags & GC_UNICODE)
			return GC_REGISTER_NOUNICODE;
	#endif

	EnterCriticalSection(&cs);

	mi = MM_AddModule( gcr->pszModule );
	if ( mi ) {
		mi->pszModDispName = mir_strdup( gcr->pszModuleDispName );
		mi->bBold = gcr->dwFlags&GC_BOLD;
		mi->bUnderline = gcr->dwFlags&GC_UNDERLINE ;
		mi->bItalics = gcr->dwFlags&GC_ITALICS ;
		mi->bColor = gcr->dwFlags&GC_COLOR ;
		mi->bBkgColor = gcr->dwFlags&GC_BKGCOLOR ;
		mi->bAckMsg = gcr->dwFlags&GC_ACKMSG ;
		mi->bChanMgr = gcr->dwFlags&GC_CHANMGR ;
		mi->iMaxText= gcr->iMaxText;
		mi->nColorCount = gcr->nColors;
		if ( gcr->nColors > 0) {
			mi->crColors = mir_alloc(sizeof(COLORREF) * gcr->nColors);
			memcpy(mi->crColors, gcr->pColors, sizeof(COLORREF) * gcr->nColors);
		}

		mi->OnlineIconIndex = -1;
		mi->hOnlineIcon = NULL;
		mi->hOnlineTalkIcon = NULL;
		mi->OfflineIconIndex = -1;
		mi->hOfflineIcon = NULL;
		mi->hOfflineTalkIcon = NULL;
		mi->pszHeader = Log_CreateRtfHeader(mi);

		CheckColorsInModule((char*)gcr->pszModule);
		CList_SetAllOffline(TRUE);

		LeaveCriticalSection(&cs);
		return 0;
	}

	LeaveCriticalSection(&cs);
	return GC_REGISTER_ERROR;
}
static INT_PTR Service_Register(WPARAM wParam, LPARAM lParam)
{
	GCREGISTER *gcr = (GCREGISTER *)lParam;
	MODULEINFO * mi = NULL;
	if (gcr== NULL)
		return GC_REGISTER_ERROR;

	if (gcr->cbSize != SIZEOF_STRUCT_GCREGISTER_V1)
		return GC_REGISTER_WRONGVER;

	#ifndef _UNICODE
		if (gcr->dwFlags & GC_UNICODE)
			return GC_REGISTER_NOUNICODE;
	#endif

	EnterCriticalSection(&cs);

	mi = MM_AddModule( gcr->pszModule );
	if ( mi ) {
		mi->ptszModDispName = a2tf( gcr->ptszModuleDispName, gcr->dwFlags );
		mi->bBold = gcr->dwFlags&GC_BOLD;
		mi->bUnderline = gcr->dwFlags&GC_UNDERLINE ;
		mi->bItalics = gcr->dwFlags&GC_ITALICS ;
		mi->bColor = gcr->dwFlags&GC_COLOR ;
		mi->bBkgColor = gcr->dwFlags&GC_BKGCOLOR ;
		mi->bFontSize = gcr->dwFlags&GC_FONTSIZE;
		mi->bAckMsg = gcr->dwFlags&GC_ACKMSG ;
		mi->bChanMgr = gcr->dwFlags&GC_CHANMGR ;
		mi->bSingleFormat = gcr->dwFlags&GC_SINGLEFORMAT;
		mi->iMaxText= gcr->iMaxText;
		mi->nColorCount = gcr->nColors;
		if ( gcr->nColors > 0) {
			mi->crColors = mir_alloc(sizeof(COLORREF) * gcr->nColors);
			memcpy(mi->crColors, gcr->pColors, sizeof(COLORREF) * gcr->nColors);
		}

		CheckColorsInModule((char*)gcr->pszModule);
		CList_SetAllOffline(TRUE, gcr->pszModule);

		LeaveCriticalSection(&cs);
		return 0;
	}

	LeaveCriticalSection(&cs);
	return GC_REGISTER_ERROR;
}