Example #1
0
void LoadOption_Actions() {
	PopUpOptions.actions			= DBGetContactSettingDword(NULL, MODULNAME, "Actions",
									  ACT_ENABLE|ACT_RIGHTICONS|ACT_DEF_KEEPWND|ACT_DEF_IMONLY|
									  ACT_DEF_NOGLOBAL|ACT_DEF_MESSAGE|ACT_DEF_DETAILS|ACT_DEF_MENU|
									  ACT_DEF_ADD|ACT_DEF_DISMISS|ACT_DEF_PIN);
	PopUpOptions.overrideLeft		= DBGetContactSettingDword(NULL,MODULNAME, "OverrideLeft", 0);
	PopUpOptions.overrideMiddle		= DBGetContactSettingDword(NULL,MODULNAME, "OverrideMiddle", 0);
	PopUpOptions.overrideRight		= DBGetContactSettingDword(NULL,MODULNAME, "OverrideRight", 0);
}
Example #2
0
void LoadPosition(HWND hWnd, char *wndName)
{	
	char buffer[512];
	int x,y ;
	mir_snprintf(buffer, SIZEOF(buffer), "%sPosX", wndName);
	x = DBGetContactSettingDword(0, __INTERNAL_NAME, buffer, ((GetSystemMetrics(SM_CXSCREEN)) / 2)-130);
	mir_snprintf(buffer, SIZEOF(buffer), "%sPosY", wndName);
	y = DBGetContactSettingDword(0, __INTERNAL_NAME, buffer, ((GetSystemMetrics(SM_CYSCREEN))/ 2)-80);
	SetWindowPos(hWnd, NULL, x, y, 0, 0, SWP_NOZORDER | SWP_NOOWNERZORDER | SWP_NOSIZE);
}
Example #3
0
void showPopupMsg(HANDLE hContact, LPCSTR lpzText, HICON hIcon, int type) {

        // type:
        // 0 - error
        // 1 - key sent
        // 2 - key recv
        // 3 - established
        // 4 - disabled
        // 5 - msg recv
        // 6 - msg sent
        //

	if(!bPopupExists) return;

	char nback[32]; mir_snprintf(nback,sizeof(nback),"popup%dback", $type);
	char ntext[32]; mir_snprintf(ntext,sizeof(ntext),"popup%dtext", $type);
	char ntime[32]; mir_snprintf(ntime,sizeof(ntime),"popup%dtime", $type);

	COLORREF colorBack = (COLORREF)DBGetContactSettingDword(0,szModuleName,nback,(DWORD)RGB(230,230,255));
	COLORREF colorText = (COLORREF)DBGetContactSettingDword(0,szModuleName,ntext,(DWORD)RGB(0,0,0));
	int timeout = (int)DBGetContactSettingWord(0,szModuleName,ntime,0);

	if( bCoreUnicode && bPopupUnicode ) {
		POPUPDATAW ppd;
		memset(&ppd,0,sizeof(POPUPDATAW));
		ppd.lchContact = hContact;
		ppd.lchIcon = hIcon;
		LPWSTR lpwzContactName = (LPWSTR)CallService(MS_CLIST_GETCONTACTDISPLAYNAME,(WPARAM)hContact,GCMDF_UNICODE);
		wcscpy(ppd.lpwzContactName, lpwzContactName);
		LPWSTR lpwzText = mir_a2u(lpzText);
		wcscpy(ppd.lpwzText, TranslateW(lpwzText));
		mir_free(lpwzText);
		ppd.colorBack = colorBack;
		ppd.colorText = colorText;
		ppd.iSeconds = timeout;
//		ppd.PluginWindowProc = (WNDPROC)PopupDlgProc;
//		ppd.PluginData = NULL;
		CallService(MS_POPUP_ADDPOPUPW, (WPARAM)&ppd, 0);
	}
	else {
		POPUPDATAEX ppd;
		memset(&ppd,0,sizeof(POPUPDATAEX));
		ppd.lchContact = hContact;
		ppd.lchIcon = hIcon;
		LPSTR lpzContactName = (LPSTR)CallService(MS_CLIST_GETCONTACTDISPLAYNAME,(WPARAM)hContact,0);
		strcpy(ppd.lpzContactName, lpzContactName);
		strcpy(ppd.lpzText, Translate(lpzText));
		ppd.colorBack = colorBack;
		ppd.colorText = colorText;
		ppd.iSeconds = timeout;
//		ppd.PluginWindowProc = (WNDPROC)PopupDlgProc;
//		ppd.PluginData = NULL;
		CallService(MS_POPUP_ADDPOPUPEX, (WPARAM)&ppd, 0);
	}
}
Example #4
0
int FacebookProto::OnPrebuildContactMenu(WPARAM wParam,LPARAM lParam)
{
	HANDLE hContact = reinterpret_cast<HANDLE>(wParam);
	if(IsMyContact(hContact/*, true*/)) {
		bool hide = (DBGetContactSettingDword(hContact, m_szModuleName, FACEBOOK_KEY_DELETED, 0)
			|| DBGetContactSettingDword(hContact, m_szModuleName, FACEBOOK_KEY_CONTACT_TYPE, 0) );
		ShowContactMenus(true, hide);
	}

	return 0;
}
Example #5
0
static DWORD GetMask(HANDLE hContact)
{
	DWORD mask=DBGetContactSettingDword(hContact,"Ignore","Mask1",(DWORD)(-1));
	if(mask==(DWORD)(-1)) {
		if(hContact==NULL) mask=0;
		else {
			if(DBGetContactSettingByte(hContact,"CList","Hidden",0) || DBGetContactSettingByte(hContact,"CList","NotOnList",0))
				mask=DBGetContactSettingDword(NULL,"Ignore","Mask1",0);
			else
				mask=DBGetContactSettingDword(NULL,"Ignore","Default1",0);
		}
	}
	return mask;
}
Example #6
0
void LoadOptions() {
	options.default_timeout = DBGetContactSettingDword(0, MODULE, "DefaultTimeout", 7);
	options.win_width = DBGetContactSettingDword(0, MODULE, "WinWidth", 220);
	options.win_max_height = DBGetContactSettingDword(0, MODULE, "WinMaxHeight", 400);
	options.location = (PopupLocation)DBGetContactSettingByte(0, MODULE, "Location", (BYTE)PL_BOTTOMRIGHT);
	options.opacity = DBGetContactSettingByte(0, MODULE, "Opacity", 75);
	options.border = (DBGetContactSettingByte(0, MODULE, "Border", 1) == 1);
	options.round = (DBGetContactSettingByte(0, MODULE, "RoundCorners", 1) == 1);
	options.av_round = (DBGetContactSettingByte(0, MODULE, "AvatarRoundCorners", 1) == 1);
	options.animate = (DBGetContactSettingByte(0, MODULE, "Animate", 1) == 1);
	options.trans_bg = (DBGetContactSettingByte(0, MODULE, "TransparentBg", 0) == 1);
	options.use_mim_monitor = (DBGetContactSettingByte(0, MODULE, "UseMimMonitor", 1) == 1);
	options.right_icon = (DBGetContactSettingByte(0, MODULE, "RightIcon", 0) == 1);
	options.av_layout = PAV_NONE; // corrected in LoadModuleDependentOptions function above
	options.av_size = DBGetContactSettingDword(0, MODULE, "AVSize", 40); //tweety
	options.text_indent = DBGetContactSettingDword(0, MODULE, "TextIndent", 22); 
	options.global_hover = (DBGetContactSettingByte(0, MODULE, "GlobalHover", 1) == 1); 
	options.time_layout = PT_RIGHT; // corrected in LoadModuleDependentOptions function above

	char buff[128];
	for(int i = 0; i < 10; i++) {
		sprintf(buff, "DisableStatus%d", i - 1); // -1 because i forgot offline status earlier!
		options.disable_status[i] = (DBGetContactSettingByte(0, MODULE, buff, 0) == 1);
	}

	options.disable_full_screen = (DBGetContactSettingByte(0, MODULE, "DisableFullScreen", 1) == 1);
	options.drop_shadow = (DBGetContactSettingByte(0, MODULE, "DropShadow", 0) == 1);
	options.sb_width = DBGetContactSettingDword(0, MODULE, "SidebarWidth", 22);
	options.padding = DBGetContactSettingDword(0, MODULE, "Padding", 4);
	options.av_padding = DBGetContactSettingDword(0, MODULE, "AvatarPadding", 4);
}
Example #7
0
int cfg::getCache(const HANDLE hContact, const char *szProto)
{
    int i, iFound = -1;

    for(i = 0; i < nextCacheEntry; i++) {
        if(eCache[i].hContact == hContact) {
            iFound = i;
            break;
        }
    }
    if(iFound == -1) {
		EnterCriticalSection(&cachecs);
        if(nextCacheEntry == maxCacheEntry) {
            maxCacheEntry += 100;
            cfg::eCache = (TExtraCache *)realloc(cfg::eCache, maxCacheEntry * sizeof(TExtraCache));
        }
        memset(&cfg::eCache[nextCacheEntry], 0, sizeof(TExtraCache));
		cfg::eCache[nextCacheEntry].hContact = hContact;
        memset(cfg::eCache[nextCacheEntry].iExtraImage, 0xff, MAXEXTRACOLUMNS);
        cfg::eCache[nextCacheEntry].iExtraValid = 0;
        cfg::eCache[nextCacheEntry].valid = FALSE;
        cfg::eCache[nextCacheEntry].bStatusMsgValid = 0;
        cfg::eCache[nextCacheEntry].statusMsg = NULL;
        cfg::eCache[nextCacheEntry].status_item = NULL;
        LoadSkinItemToCache(&cfg::eCache[nextCacheEntry], szProto);
        cfg::eCache[nextCacheEntry].dwCFlags = 0;
        cfg::eCache[nextCacheEntry].dwDFlags = DBGetContactSettingDword(hContact, "CList", "CLN_Flags", 0);
        cfg::eCache[nextCacheEntry].dwXMask = CalcXMask(hContact);
        GetCachedStatusMsg(nextCacheEntry, const_cast<char *>(szProto));
		cfg::eCache[nextCacheEntry].dwLastMsgTime = INTSORT_GetLastMsgTime(hContact);
        iFound = nextCacheEntry++;
		LeaveCriticalSection(&cachecs);
    }
    return iFound;
}
Example #8
0
int GetStatsuBarProtoRect(HWND hwnd,char *szProto,RECT *rc)
{
	int nParts,nPanel;
	ProtocolData *PD;
	int startoffset=DBGetContactSettingDword(NULL,"StatusBar","FirstIconOffset",0);
	
	if (!UseOwnerDrawStatusBar) startoffset=0;

	nParts=SendMessage(hwnd,SB_GETPARTS,0,0);
	FillMemory(rc,sizeof(RECT),0);

	for (nPanel=0;nPanel<nParts;nPanel++)
	{
		PD=(ProtocolData *)SendMessage(pcli->hwndStatus,SB_GETTEXT,(WPARAM)nPanel,(LPARAM)0);
		if ( PD == NULL )
			return(0);
	
		if (!strcmp(szProto,PD->RealName))
		{
			SendMessage(hwnd,SB_GETRECT,(WPARAM)nPanel,(LPARAM)rc);
			rc->left+=startoffset;
			rc->right+=startoffset;
			return(0);
		}
	}
	return (0);
}
void load_listbox_items() {

	HANDLE hContact = ( HANDLE )CallService( MS_DB_CONTACT_FINDFIRST, 0, 0 );
	LISTITEM pa;
	DBVARIANT dbv;
	char *proto;

	listbox_items.destroy();
	while ( hContact != NULL ) {
		proto = ( char* )CallService( MS_PROTO_GETCONTACTBASEPROTO, ( WPARAM )hContact,0 );
		if ( proto && !strcmp( PROTO, proto)) {
			pa.hContact = hContact;
			if(!DBGetContactSettingTString(pa.hContact, PROTO, "TZName", &dbv)) {
				for (int j = 0; j < timezone_list.getCount(); ++j) {
					if(!_tcscmp(timezone_list[j].tcName, dbv.ptszVal)) {
						pa.timezone_list_index = timezone_list[j].list_index;
						break;
					}
				}
				DBFreeVariant(&dbv);
			} else
				pa.timezone_list_index = DBGetContactSettingDword(pa.hContact, PROTO, "TimezoneListIndex", -1);
			if(!DBGetContactSettingTString(pa.hContact, PROTO, "Nick", &dbv)) {
				_tcsncpy(pa.pszText, dbv.ptszVal, MAX_NAME_LENGTH);
				DBFreeVariant(&dbv);
			}

			listbox_items.insert(new LISTITEM(pa));
		}

		hContact = ( HANDLE )CallService( MS_DB_CONTACT_FINDNEXT,( WPARAM )hContact, 0 );
	}	
}
Example #10
0
int GetProtoIndex(char * szName)
{
    DWORD i;
    char buf[11];
    char * name;
    DWORD pc;
    if (!szName) return -1;
    
    pc=DBGetContactSettingDword(NULL,"Protocols","ProtoCount",-1);
    for (i=0; i<pc; i++)
    {
        itoa(i,buf,10);
        name=DBGetString(NULL,"Protocols",buf);
        if (name)
        {
            if (!MyStrCmp(name,szName))
            {
                mir_free(name);
                return i;
            }
            mir_free(name);
        }
    }
    return -1;
}
Example #11
0
INT_PTR ContactMenuDefault(WPARAM wParam, LPARAM lParam) {
	HANDLE hSub = (HANDLE)wParam,
		hMeta = (HANDLE)DBGetContactSettingDword(hSub, MODULE, "Handle", 0);
	
	MetaAPI_SetDefaultContact((WPARAM)hMeta, (LPARAM)hSub);
	return 0;
}
Example #12
0
void TlenGetAvatarFileName(JABBER_LIST_ITEM *item, char* pszDest, int cbLen)
{
	int tPathLen;
	int format = PA_FORMAT_PNG;
	char* szFileType;
	if (item != NULL) {
		format = item->avatarFormat;
	} else if (jabberThreadInfo != NULL) {
		format = jabberThreadInfo->avatarFormat;
	} else {
		format = DBGetContactSettingDword(NULL, jabberProtoName, "AvatarFormat", PA_FORMAT_UNKNOWN);
	}
	CallService( MS_DB_GETPROFILEPATH, cbLen, (LPARAM) pszDest );
	tPathLen = strlen( pszDest );
	tPathLen += mir_snprintf( pszDest + tPathLen, cbLen - tPathLen, "\\%s\\", jabberModuleName  );
	CreateDirectoryA( pszDest, NULL );
	szFileType = "png";
	switch(format) {
		case PA_FORMAT_JPEG: szFileType = "jpg";   break;
		case PA_FORMAT_ICON: szFileType = "ico";   break;
		case PA_FORMAT_PNG:  szFileType = "png";   break;
		case PA_FORMAT_GIF:  szFileType = "gif";   break;
		case PA_FORMAT_BMP:  szFileType = "bmp";   break;
	}
	if ( item != NULL ) {
		char* hash;
		hash = JabberSha1(item->jid);
		mir_snprintf( pszDest + tPathLen, MAX_PATH - tPathLen, "%s.%s", hash, szFileType );
		mir_free( hash );
	} else {
		mir_snprintf( pszDest + tPathLen, MAX_PATH - tPathLen, "%s_avatar.%s", jabberProtoName, szFileType );
	}
}
Example #13
0
void UpgradeCheck(void)
{
    DWORD dwVersion = DBGetContactSettingDword(NULL, "Chat", "OldVersion", PLUGIN_MAKE_VERSION(0,2,9,9));
    if (	pluginInfo.version > dwVersion)
    {
        if (dwVersion < PLUGIN_MAKE_VERSION(0,3,0,0))
        {
            DBDeleteContactSetting(NULL, "ChatFonts",	"Font18");
            DBDeleteContactSetting(NULL, "ChatFonts",	"Font18Col");
            DBDeleteContactSetting(NULL, "ChatFonts",	"Font18Set");
            DBDeleteContactSetting(NULL, "ChatFonts",	"Font18Size");
            DBDeleteContactSetting(NULL, "ChatFonts",	"Font18Sty");
            DBDeleteContactSetting(NULL, "ChatFonts",	"Font19");
            DBDeleteContactSetting(NULL, "ChatFonts",	"Font19Col");
            DBDeleteContactSetting(NULL, "ChatFonts",	"Font19Set");
            DBDeleteContactSetting(NULL, "ChatFonts",	"Font19Size");
            DBDeleteContactSetting(NULL, "ChatFonts",	"Font19Sty");
            DBDeleteContactSetting(NULL, "Chat",		"ColorNicklistLines");
            DBDeleteContactSetting(NULL, "Chat",		"NicklistIndent");
            DBDeleteContactSetting(NULL, "Chat",		"NicklistRowDist");
            DBDeleteContactSetting(NULL, "Chat",		"ShowFormatButtons");
            DBDeleteContactSetting(NULL, "Chat",		"ShowLines");
            DBDeleteContactSetting(NULL, "Chat",		"ShowName");
            DBDeleteContactSetting(NULL, "Chat",		"ShowTopButtons");
            DBDeleteContactSetting(NULL, "Chat",		"SplitterX");
            DBDeleteContactSetting(NULL, "Chat",		"SplitterY");
            DBDeleteContactSetting(NULL, "Chat",		"IconFlags");
            DBDeleteContactSetting(NULL, "Chat",		"LogIndentEnabled");
        }
    }

    DBWriteContactSettingDword(NULL, "Chat", "OldVersion", pluginInfo.version);
}
HANDLE Meta_GetActive(HANDLE hMeta) {
    HANDLE hActive = 0;
    if(DBGetContactSettingByte(hMeta, MODULE, "ForceDefault", 0))
        hActive = (HANDLE)MetaAPI_GetDefault((WPARAM)hMeta, 0);
    if(!hActive) {
        if((hActive = (HANDLE)DBGetContactSettingDword(hMeta, MODULE, "ForceSend", 0)) == 0) {
            if((hActive = (HANDLE)DBGetContactSettingDword(hMeta, MODULE, "TempDefault", 0)) == 0) {
                hActive = Meta_GetMostOnline(hMeta);
                if(ContactStatus(hActive, ContactProto(hActive)) == ID_STATUS_OFFLINE) {
                    hActive = Meta_GetMostOnlineSupporting(hMeta, PFLAGNUM_4, PF4_IMSENDOFFLINE);
                }
            }
        }
    }
    return hActive;
}
static void _ExtFrames_GetFrameDBOption(EXTFRAMEWND * pExtFrm)
{
	//   Each known frame order per 1 000 000
    //	 Each Unknown frame but absent during saving per 10 000
	//   Each new unknown per 100 
	static DWORD NextUnknownOrder=100;		
	char szKey[100]={0};
	DWORD dwOrderInDB;
	if (!mir_strcmpi(pExtFrm->efrm.szFrameNameID,"My Contacts"))
		dwOrderInDB=0xFFFFFFFF;
	else
	{
		_snprintf(szKey,sizeof(szKey), EXTFRAMEORDERDBPREFIX "%s",pExtFrm->efrm.szFrameNameID);
		dwOrderInDB=DBGetContactSettingDword(NULL,EXTFRAMEMODULE,szKey,0);
		if (!dwOrderInDB)
		{
			dwOrderInDB=NextUnknownOrder;
			NextUnknownOrder+=100;
		}
		else
		    NextUnknownOrder = dwOrderInDB + 100;
	}
	pExtFrm->efrm.dwOrder=dwOrderInDB;
	
}
Example #16
0
int FacebookProto::RemoveFriend(WPARAM wParam,LPARAM lParam)
{
	if (wParam == NULL)
	{ // self contact
	//	CallService(MS_UTILS_OPENURL,1,reinterpret_cast<LPARAM>(FACEBOOK_URL_PROFILE));
		return 0;
	}
	
	if (isOffline())
		return 0;

	if (MessageBox( 0, TranslateT("Are you sure?"), TranslateT("Delete contact from server list"), MB_ICONWARNING | MB_YESNO | MB_DEFBUTTON2 ) != IDYES)
		return 0;

	HANDLE hContact = reinterpret_cast<HANDLE>(wParam);

	DBVARIANT dbv;			
	if( !DBGetContactSettingString(hContact,m_szModuleName,FACEBOOK_KEY_ID,&dbv) )
	{
		if (!isOffline()) {
			std::string* id = new std::string(dbv.pszVal);
			ForkThread( &FacebookProto::DeleteContactFromServer, this, ( void* )id );
			DBFreeVariant(&dbv);

			if ( !DBGetContactSettingDword(hContact, m_szModuleName, FACEBOOK_KEY_DELETED, 0) )
				DBWriteContactSettingDword(hContact, m_szModuleName, FACEBOOK_KEY_DELETED, ::time(NULL));
		}
	}

	return 0;
}
void Meta_Assign(HANDLE hSub, HANDLE hMeta) {
    metaMap[hMeta].add(hSub);
    DBWriteContactSettingDword(hSub, MODULE, "ParentMetaID", DBGetContactSettingDword(hMeta, MODULE, META_ID, -1));
    DBWriteContactSettingDword(hSub, MODULE, "Handle", (DWORD)hMeta);
    DBWriteContactSettingByte(hSub, MODULE, "IsSubcontact", 1);
    if(MetaEnabled()) {
        if(!meta_group_hack_disabled)
            DBWriteContactSettingByte(hSub, "CList", "Hidden", 1);
    } else // shouldn't happen, as the menu option is hidden when metas are disabled...
        DBWriteContactSettingByte(hMeta, "CList", "Hidden", 1);

    CallService(MS_IGNORE_IGNORE, (WPARAM)hSub, (WPARAM)IGNOREEVENT_USERONLINE);

    DBVARIANT dbv;
    if(DBGetContactSettingUTF8String(hMeta, "CList", "MyHandle", &dbv)) {
        if(!DBGetContactSettingUTF8String(hSub, "CList", "MyHandle", &dbv)) {
            DBWriteContactSettingUTF8String(hMeta, "CList", "MyHandle", dbv.pszVal);
            DBFreeVariant(&dbv);
        }
    } else
        DBFreeVariant(&dbv);

    if(DBGetContactSettingUTF8String(hMeta, MODULE, "Nick", &dbv)) {
        char *subProto = ContactProto(hSub);
        if(subProto) {
            if(!DBGetContactSettingUTF8String(hSub, subProto, "Nick", &dbv)) {
                DBWriteContactSettingUTF8String(hMeta, MODULE, "Nick", dbv.pszVal);
                DBFreeVariant(&dbv);
            }
        }
    } else
        DBFreeVariant(&dbv);

    FireSubcontactsChanged(hMeta);
}
int MirandaSkinnedDialog::getSettting(const char *name, int defVal, bool global)
{
	char setting[SETTING_NAME_SIZE];
	getSettingName(setting, name, global);

	return DBGetContactSettingDword(NULL, getModule(), setting, defVal);
}
Example #19
0
void InitOptions() {
	hEventOptInit = HookEvent(ME_OPT_INITIALISE, OptInit);
	DBVARIANT dbv;
	if(!DBGetContactSettingTString(0, MODULE, "Host", &dbv)) { 
		options.host = strdup(dbv.pszVal);
		DBFreeVariant(&dbv);
	}
	if(!DBGetContactSettingTString(0, MODULE, "Username", &dbv)) {
		options.username = strdup(dbv.pszVal);
		DBFreeVariant(&dbv);
	}
	if(!DBGetContactSettingTString(0, MODULE, "Password", &dbv)) {
		options.password = strdup(dbv.pszVal);
		DBFreeVariant(&dbv);
	}
	if(!DBGetContactSettingTString(0, MODULE, "CIDName", &dbv)) {
		options.cid_name = strdup(dbv.pszVal);
		DBFreeVariant(&dbv);
	}
	if(!DBGetContactSettingTString(0, MODULE, "CIDNumber", &dbv)) {
		options.cid_number = strdup(dbv.pszVal);
		DBFreeVariant(&dbv);
	}

	iaxc_audio_device *dev;
	int nDevs, in, out, ring;
	iaxc_audio_devices_get(&dev, &nDevs, &in, &out, &ring);
	if(!DBGetContactSettingTString(0, MODULE, "DeviceIn", &dbv)) {
		for(int i = 0; i < nDevs; i++) {
			if((dev[i].capabilities & IAXC_AD_INPUT) && strcmp(dbv.pszVal, dev[i].name) == 0) in = i;
		}
		DBFreeVariant(&dbv);
	}
	if(!DBGetContactSettingTString(0, MODULE, "DeviceOut", &dbv)) {
		for(int i = 0; i < nDevs; i++) {
			if((dev[i].capabilities & IAXC_AD_OUTPUT) && strcmp(dbv.pszVal, dev[i].name) == 0) out = i;
		}
		DBFreeVariant(&dbv);
	}
	/*
	if(!DBGetContactSettingTString(0, MODULE, "DeviceRing", &dbv)) {
		for(int i = 0; i < nDevs; i++) {
			if((dev[i].capabilities & IAXC_AD_RING) && strcmp(dbv.pszVal, dev[i].name) == 0) ring = i;
		}
		DBFreeVariant(&dbv);
	}
	*/

	options.port = DBGetContactSettingDword(0, MODULE, "Port", 4569);
	iaxc_audio_devices_set(in, out, ring);

	options.dlgHotkey = DBGetContactSettingWord(0, MODULE, "DlgHotkey", 0);
	options.pop_dial_in = (DBGetContactSettingByte(0, MODULE, "PopupDial", 1) == 1);
	options.pop_dial_out = (DBGetContactSettingByte(0, MODULE, "PopupDialOut", 0) == 1);
	
	options.mic_boost = (DBGetContactSettingByte(0, MODULE, "MicBoost", 0) == 1);
	iaxc_mic_boost_set(options.mic_boost ? 1 : 0);
	//options.mic_boost = (iaxc_mic_boost_get() != 0);
}
int GetColourW(WPARAM wParam, LPARAM lParam) {		
	ColourIDW *colour_id = (ColourIDW *)wParam;
	for(ColourIDWList::Iterator i = colour_id_list_w.start(); i.has_val(); i.next()) {
		if(wcscmp(i.val().first.group, colour_id->group) == 0 && wcscmp(i.val().first.name, colour_id->name) == 0)
			return (int)DBGetContactSettingDword(NULL, i.val().first.dbSettingsGroup, i.val().first.setting, i.val().first.defcolour);
	}

	return -1;
}
Example #21
0
void removeWindow(HANDLE hContact) 
{
	DWORD frameId = DBGetContactSettingDword(hContact, WEATHERPROTONAME, "mwin", 0);

	WindowList_Remove(hMwinWindowList, WindowList_Find(hMwinWindowList, hContact));
	CallService(MS_CLIST_FRAMES_REMOVEFRAME, frameId, 0);

	DBWriteContactSettingDword(hContact, WEATHERPROTONAME, "mwin", 0);
	DBDeleteContactSetting(hContact, "CList", "Hidden");
}
Example #22
0
int BuildContactMenu(WPARAM wparam,LPARAM lparam) 
{
	CLISTMENUITEM mi = {0};

	mi.cbSize = sizeof(mi);
	mi.flags = CMIM_FLAGS | 
		(DBGetContactSettingDword((HANDLE)wparam, WEATHERPROTONAME, "mwin", 0) ? CMIF_CHECKED : 0);
	CallService(MS_CLIST_MODIFYMENUITEM, (WPARAM)hMwinMenu, (LPARAM)&mi);
	return 0;
}
Example #23
0
void LoadOptions() {
	options.ping_period = DBGetContactSettingDword(NULL, PROTO, "PingPeriod", DEFAULT_PING_PERIOD);
	
	options.ping_timeout = DBGetContactSettingDword(NULL, PROTO, "PingTimeout", DEFAULT_PING_TIMEOUT);
	//CallService(PROTO "/SetPingTimeout", (WPARAM)options.ping_timeout, 0);
	options.show_popup = (DBGetContactSettingByte(NULL, PROTO, "ShowPopup", DEFAULT_SHOW_POPUP ? 1 : 0) == 1);
	options.show_popup2 = (DBGetContactSettingByte(NULL, PROTO, "ShowPopup2", DEFAULT_SHOW_POPUP2 ? 1 : 0) == 1);
	options.block_reps = (DBGetContactSettingByte(NULL, PROTO, "BlockReps", DEFAULT_BLOCK_REPS ? 1 : 0) == 1);
	options.logging = (DBGetContactSettingByte(NULL, PROTO, "LoggingEnabled", DEFAULT_LOGGING_ENABLED ? 1 : 0) == 1);

	options.rstatus = DBGetContactSettingWord(NULL, PROTO, "RespondingStatus", ID_STATUS_ONLINE);
	options.nrstatus = DBGetContactSettingWord(NULL, PROTO, "NotRespondingStatus", ID_STATUS_AWAY);
	options.tstatus = DBGetContactSettingWord(NULL, PROTO, "TestingStatus", ID_STATUS_OCCUPIED);
	options.off_status = DBGetContactSettingWord(NULL, PROTO, "DisabledStatus", ID_STATUS_DND);

	if(options.rstatus == options.off_status) {
		options.rstatus = ID_STATUS_ONLINE;
		if(options.off_status == ID_STATUS_ONLINE)
			options.off_status = ID_STATUS_DND;
	}
	if(options.nrstatus == options.off_status) {
		options.rstatus = ID_STATUS_AWAY;
		if(options.off_status == ID_STATUS_AWAY)
			options.off_status = ID_STATUS_DND;
	}
	if(options.tstatus == options.off_status) {
		options.tstatus = ID_STATUS_OCCUPIED;
		if(options.off_status == ID_STATUS_OCCUPIED)
			options.off_status = ID_STATUS_DND;
	}
	
	options.no_test_status = (DBGetContactSettingByte(NULL, PROTO, "NoTestStatus", DEFAULT_NO_TEST_STATUS ? 1 : 0) == 1);
	options.hide_proto = (DBGetContactSettingByte(NULL, PROTO, "HideProtocol", DEFAULT_HIDE_PROTOCOL ? 1 : 0) == 1);
	options.use_status_msg = (DBGetContactSettingByte(NULL, PROTO, "UseStatusMessage", DEFAULT_USE_STATUS_MESSAGE ? 1 : 0) == 1);

	options.retries = DBGetContactSettingDword(NULL, PROTO, "Retries", 0);
	
	CallService(PROTO "/GetLogFilename", (WPARAM)MAX_PATH, (LPARAM)options.log_filename);

	ICMP::get_instance()->set_timeout(options.ping_timeout * 1000);
	
}
Example #24
0
/** Set contact as MetaContact default
*
* Set the given contact to be the default one for the metacontact to which it is linked.
*
* @param wParam :	\c HANDLE to the MetaContact to be set as default
* @param lParam :	\c HWND to the clist window
					(This means the function has been called via the contact menu).
*/
INT_PTR Meta_Default(WPARAM wParam,LPARAM lParam)
{
	HANDLE hMeta;

	if((hMeta = (HANDLE)DBGetContactSettingDword((HANDLE)wParam,META_PROTO,"Handle",0)) != 0)
	{ // the wParam is a subcontact
		DBWriteContactSettingDword(hMeta, META_PROTO, "Default", (DWORD)Meta_GetContactNumber((HANDLE)wParam));
		NotifyEventHooks(hEventDefaultChanged, (WPARAM)hMeta, (LPARAM)(HANDLE)wParam);
	}
	return 0;
}
Example #25
0
ExtraIcon * ExtraIconGroup::getCurrentItem(HANDLE hContact) const
{
	int id = (int) DBGetContactSettingDword(hContact, MODULE_NAME, name.c_str(), 0);
	if (id < 1)
		return NULL;

	for (unsigned int i = 0; i < items.size(); ++i)
		if (id == items[i]->getID())
			return items[i];

	return NULL;
}
Example #26
0
// read in addresses from old pingplug
void import_ping_addresses() {
	int count = DBGetContactSettingDword(0, "PingPlug", "NumEntries", 0);
	PINGADDRESS pa;

	EnterCriticalSection(&list_cs);
	list_items.clear();
	for(int index = 0; index < count; index++) {
		import_ping_address(index, pa);
		list_items.add(pa);
	}
	write_ping_addresses();
	LeaveCriticalSection(&list_cs);
}
Example #27
0
// read in addresses from old pingplug
void import_ping_addresses() {
	int count = DBGetContactSettingDword(0, "PingPlug", "NumEntries", 0);
	PINGADDRESS pa;

	EnterCriticalSection(&list_cs);
	list_items.clear();
	for(int index = 0; index < count; index++) {
		import_ping_address(index, pa);
		list_items.push_back(pa);
	}
	std::sort(list_items.begin(), list_items.end(), SAscendingSort());
	write_ping_addresses();
	LeaveCriticalSection(&list_cs);
}
HANDLE GetMetaHandle(DWORD id) {
    HANDLE hContact = (HANDLE)CallService( MS_DB_CONTACT_FINDFIRST, 0, 0);
    char *proto;
    while(hContact) {
        proto = ContactProto(hContact);
        if(proto && !strcmp(proto, MODULE)) {
            DWORD mid = DBGetContactSettingDword(hContact, MODULE, META_ID, (DWORD)-1);
            if(mid == id) return hContact;
        }

        hContact = ( HANDLE )CallService( MS_DB_CONTACT_FINDNEXT,( WPARAM )hContact, 0 );
    }
    return 0;
}
Example #29
0
void LoadOptions() {
	options.ping_period = DBGetContactSettingDword(NULL, PLUG, "PingPeriod", DEFAULT_PING_PERIOD);
	
	options.ping_timeout = DBGetContactSettingDword(NULL, PLUG, "PingTimeout", DEFAULT_PING_TIMEOUT);
	CallService(PLUG "/SetPingTimeout", (WPARAM)options.ping_timeout, 0);
	options.show_popup = (DBGetContactSettingByte(NULL, PLUG, "ShowPopup", DEFAULT_SHOW_POPUP ? 1 : 0) == 1);
	options.show_popup2 = (DBGetContactSettingByte(NULL, PLUG, "ShowPopup2", DEFAULT_SHOW_POPUP2 ? 1 : 0) == 1);
	options.block_reps = (DBGetContactSettingByte(NULL, PLUG, "BlockReps", DEFAULT_BLOCK_REPS ? 1 : 0) == 1);
	options.logging = (DBGetContactSettingByte(NULL, PLUG, "LoggingEnabled", DEFAULT_LOGGING_ENABLED ? 1 : 0) == 1);

	options.no_test_icon = (DBGetContactSettingByte(NULL, PLUG, "NoTestStatus", DEFAULT_NO_TEST_ICON ? 1 : 0) == 1);

	options.indent = DBGetContactSettingWord(NULL, PLUG, "Indent", 0);
	options.row_height = DBGetContactSettingWord(NULL, PLUG, "RowHeight", GetSystemMetrics(SM_CYSMICON));

	options.retries = DBGetContactSettingDword(NULL, PLUG, "Retries", 0);

	CallService(PLUG "/GetLogFilename", (WPARAM)MAX_PATH, (LPARAM)options.log_filename);

	ICMP::get_instance()->set_timeout(options.ping_timeout * 1000);
	
	options.attach_to_clist = (DBGetContactSettingByte(NULL, PLUG, "AttachToClist", DEFAULT_ATTACH_TO_CLIST ? 1 : 0) == 1);
	options.log_csv = (DBGetContactSettingByte(NULL, PLUG, "LogCSV", 0) == 1);
}
Example #30
0
static int SendChunkW(WCHAR *chunk, HANDLE hContact, char *szSvc, DWORD dwFlags)
{
	BYTE	*pBuf = NULL;
	int		wLen = lstrlenW(chunk), id;
	DWORD	memRequired = (wLen + 1) * sizeof(WCHAR);
	DWORD	codePage = DBGetContactSettingDword(hContact, SRMSGMOD_T, "ANSIcodepage", CP_ACP);
	int		mbcsSize = WideCharToMultiByte(codePage, 0, chunk, -1, (char *)pBuf, 0, 0, 0);

	memRequired += mbcsSize;
	pBuf = (BYTE *)mir_alloc(memRequired);
	WideCharToMultiByte(codePage, 0, chunk, -1, (char *)pBuf, mbcsSize, 0, 0);
	CopyMemory(&pBuf[mbcsSize], chunk, (wLen + 1) * sizeof(WCHAR));
	id = CallContactService(hContact, szSvc, dwFlags, (LPARAM)pBuf);
	mir_free(pBuf);
	return id;
}