From 0902cdc3a5413dae6146e4079ec6f76efd96f14f Mon Sep 17 00:00:00 2001 From: George Hazan Date: Sat, 20 Feb 2021 12:24:24 +0300 Subject: unused pascal code cleaned --- plugins/Utils.pas/mircontacts.pas | 131 -------------------------------------- 1 file changed, 131 deletions(-) (limited to 'plugins/Utils.pas') diff --git a/plugins/Utils.pas/mircontacts.pas b/plugins/Utils.pas/mircontacts.pas index a88a972b70..93e0b0b057 100644 --- a/plugins/Utils.pas/mircontacts.pas +++ b/plugins/Utils.pas/mircontacts.pas @@ -9,14 +9,6 @@ uses //----- Contact info ----- -function GetContactProto(hContact: TMCONTACT; var SubContact: TMCONTACT; var SubProtocol: PAnsiChar): PAnsiChar; overload; -function GetContactDisplayName(hContact: TMCONTACT; Proto: PAnsiChar = nil; Contact: boolean = false): PWideChar; -function GetContactID(hContact: TMCONTACT; Proto: PAnsiChar = nil; Contact: boolean = false): PAnsiChar; - -function GetContactCodePage (hContact: TMCONTACT; Proto: PAnsiChar; var UsedDefault: boolean): Cardinal; overload; -function GetContactCodePage (hContact: TMCONTACT; const Proto: PAnsiChar = nil): Cardinal; overload; -function WriteContactCodePage(hContact: TMCONTACT; CodePage: Cardinal; Proto: PAnsiChar = nil): boolean; - function GetContactStatus(hContact:TMCONTACT):integer; //----- Contact type check ----- @@ -59,129 +51,6 @@ uses //----- Contact info ----- -function GetContactProto(hContact: TMCONTACT; var SubContact: TMCONTACT; var SubProtocol: PAnsiChar): PAnsiChar; -begin - Result := Proto_GetBaseAccountName(hContact); - if StrCmp(Result, META_PROTO)=0 then - begin - SubContact := db_mc_getMostOnline(hContact); - SubProtocol := Proto_GetBaseAccountName(SubContact); - end - else - begin - SubContact := hContact; - SubProtocol := Result; - end; -end; - -function GetContactDisplayName(hContact: TMCONTACT; Proto: PAnsiChar = nil; Contact: boolean = false): PWideChar; -var - pName, pUnk:PWideChar; -begin - if (hContact = 0) and Contact then - StrDupW(Result, TranslateW('Server')) - else - begin - if Proto = nil then - Proto := Proto_GetBaseAccountName(hContact); - pUnk := TranslateW('''(Unknown Contact)'''); - if Proto = nil then - StrDupW(Result, pUnk) - else - begin - pName := Contact_GetInfo(CNF_DISPLAY, hContact, Proto); - if pName <> nil then - begin - if StrCmpW(pName, pUnk)=0 then - AnsiToWide(GetContactID(hContact, Proto), Result, CP_ACP) - else - StrDupW(Result, pName); - mir_free(pName); - end - else - AnsiToWide(GetContactID(hContact, Proto), Result); - - if (Result = nil) or (Result^ = #0) then - AnsiToWide(Translate(Proto), Result, Langpack_GetDefaultCodePage); - end; - end; -end; - -function GetContactID(hContact: TMCONTACT; Proto: PAnsiChar = nil; Contact: boolean = false): PAnsiChar; -var - uid: PAnsiChar; - dbv: TDBVARIANT; - buf: array [0..15] of AnsiChar; - cp: Cardinal; -begin - Result := nil; - if not((hContact = 0) and Contact) then - begin - if Proto = nil then - Proto := Proto_GetBaseAccountName(hContact); - uid := Proto_GetUniqueId(Proto); - if (uid <> nil) then - begin - // db_get_s comparing to DBGetContactSetting don't translate strings - // when uType=0 (DBVT_ASIS) - if db_get_s(hContact, Proto, uid, @dbv, DBVT_ASIS) = 0 then - begin - case dbv._type of - DBVT_BYTE: StrDup(Result, IntToStr(buf,dbv.bVal)); - DBVT_WORD: StrDup(Result, IntToStr(buf,dbv.wVal)); - DBVT_DWORD: StrDup(Result, IntToStr(buf,dbv.dVal)); - DBVT_ASCIIZ: StrDup(Result, dbv.szVal.a); - DBVT_UTF8, - DBVT_WCHAR: begin - cp := Langpack_GetDefaultCodePage; - if dbv._type = DBVT_UTF8 then - UTF8ToAnsi(dbv.szVal.a, Result, cp) - else // dbv._type = DBVT_WCHAR then - WideToAnsi(dbv.szVal.w, Result, cp); - end; - end; - // free variant - db_free(@dbv); - end; - end; - end; -end; - -function GetContactCodePage(hContact: TMCONTACT; Proto: PAnsiChar; var UsedDefault: boolean) : Cardinal; -begin - if Proto = nil then - Proto := Proto_GetBaseAccountName(hContact); - if Proto = nil then - Result := Langpack_GetDefaultCodePage - else - begin - Result := DBReadWord(hContact, Proto, 'AnsiCodePage', $FFFF); - If Result = $FFFF then - Result := DBReadWord(0, Proto, 'AnsiCodePage', CP_ACP); - end; - UsedDefault := (Result = CP_ACP); - if UsedDefault then - Result := GetACP(); -end; - -function GetContactCodePage(hContact: TMCONTACT; const Proto: PAnsiChar = nil): Cardinal; -var - def: boolean; -begin - Result := GetContactCodePage(hContact, Proto, def); -end; - -function WriteContactCodePage(hContact: TMCONTACT; CodePage: Cardinal; Proto: PAnsiChar = nil): boolean; -begin - Result := false; - if Proto = nil then - Proto := Proto_GetBaseAccountName(hContact); - if Proto = nil then - exit; - DBWriteWord(hContact, Proto, 'AnsiCodePage', CodePage); - Result := True; -end; - function GetContactStatus(hContact:TMCONTACT):integer; var szProto:PAnsiChar; -- cgit v1.2.3