Skip to content

Instantly share code, notes, and snippets.

View prof7bit's full-sized avatar

Bernd K. prof7bit

  • Hannover, Germany
View GitHub Profile
@prof7bit
prof7bit / gist:2867664
Created June 4, 2012 10:31
socks4a - not complicated at all :-)
procedure TBuddy.InitiateConnect;
begin
WriteLn('TBuddy.InitiateConnect() ' + ID);
with FLnetClient do begin
OnConnect := @Self.OnProxyConnect;
OnReceive := @Self.OnProxyReceive;
OnDisconnect := @Self.OnProxyDisconect;
OnError := @Self.OnProxyError;
end;
FLnetClient.Connect(Client.TorHost, Client.TorPort);
@prof7bit
prof7bit / gist:2859681
Created June 2, 2012 19:29
Why is it popping up the chat window immediately even if I have set it to hide them?
procedure TTorChatPurpleClient.OnInstantMessage(ABuddy: IBuddy; AText: String);
var
conv: PPurpleConversation;
im: PPurpleConvIm;
time: time_t;
begin
conv :=purple_find_conversation_with_account(
PURPLE_CONV_TYPE_IM,
PChar(ABuddy.ID),
purple_account
@prof7bit
prof7bit / gist:2842807
Created May 31, 2012 11:34
Am I going to call for trouble or will this work?
{ WinSock2 patch for larger TFDSet (1024 instead of 64).
These types and functions are identical with the ones from WinSock2, the
only difference is the value of FD_SETSIZE and therefore a larger TFDSet
array. Putting this unit *after* the winsock2 unit into your uses clause
will make these new definitions take precedence.
}
unit lws2override;
{$mode objfpc}{$H+}
@prof7bit
prof7bit / gist:2660700
Created May 11, 2012 16:12
Why doesn't it update the GUI, did I forget something?
procedure TTorChatPurpleClient.OnBuddyStatusChange(ABuddy: TABuddy);
var
buddy: PPurpleBuddy;
presence : PPurplePresence;
status_id: PChar;
begin
WriteLn('TTorChatPurpleClient.OnBuddyStatusChange()');
buddy := purple_find_buddy(purple_account, PChar(ABuddy.ID));
if Assigned(buddy) then begin
case ABuddy.Status of
procedure OnLogin(Account: PPurpleAccount); cdecl;
var
Client: TTorChatPurpleClient;
Status: PPurpleStatus;
TorChatBuddy: TABuddy;
PurpleBuddy: PPurpleBuddy;
TorchatList: TABuddyList;
PurpleList: PGSList;
ID : String;
@prof7bit
prof7bit / crc16.pas
Created August 5, 2014 22:09
crc16 in Pascal
procedure CRC16_Update(var CRC: Word; Data: Byte);
var
I: Integer;
begin
CRC := CRC xor (Word(Data));
for I := 0 to 7 do begin
if (CRC and 1) <> 0 then
CRC := (CRC shr 1) xor $A001
else
CRC := CRC shr 1;
procedure CRC16_Xmodem_Update(var CRC: Word; Data: Byte);
var
I: Integer;
begin
CRC := CRC xor (Word(Data) shl 8);
for I := 0 to 7 do begin
if (CRC and $8000) <> 0 then
CRC := (CRC shl 1) xor $1021
else
CRC := CRC shl 1;