Skip to content

Instantly share code, notes, and snippets.

View prof7bit's full-sized avatar

Bernd K. prof7bit

  • Hannover, Germany
View GitHub Profile
procedure OnLogin(Account: PPurpleAccount); cdecl;
var
Client: TTorChatPurpleClient;
Status: PPurpleStatus;
TorChatBuddy: TABuddy;
PurpleBuddy: PPurpleBuddy;
TorchatList: TABuddyList;
PurpleList: PGSList;
ID : String;
@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
@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: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: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);
{ This function is not what it seems to be. It will NOT simply be called
with the filename already known (as one might assume when looking
at its signature) instead it will be called with filename=nil when
the user clicks on the "Send File..." menu item. At this time there
has not yet been a file dialog to select the file, this will happen
when we call purple_xfer_request(). All the rest is then done from
within the callbacks that we are registering here. }
procedure torchat_send_file(gc: PPurpleConnection; who, filename: PChar); cdecl;
var
xfer: PPurpleXfer;
@prof7bit
prof7bit / gist:2967955
Created June 21, 2012 19:27
how is this supposed to work in 3.0.0, my private file descriptors are none of Pidgin's business!
/**
* Starts a file transfer.
*
* Either @a fd must be specified <i>or</i> @a ip and @a port on a
* file receive transfer. On send, @a fd must be specified, and
* @a ip and @a port are ignored.
*
* Prior to libpurple 2.6.0, passing '0' to @a fd was special-cased to
* allow the protocol plugin to facilitate the file transfer itself. As of
* 2.6.0, this is supported (for backward compatibility), but will be
procedure TBuddy.OnProxyConnect(ASocket: TLSocket);
type
TSocksReqestHeader = packed record
Typ : Byte;
Cmd : Byte;
Port : Word;
Addr4 : DWord;
end;
var
ReqHeader: TSocksReqestHeader;
@prof7bit
prof7bit / .gitignore
Last active March 17, 2022 09:13
The portfolio rebalancing bot will buy and sell to maintain a constant asset allocation ratio of exactly 50/50 = fiat/BTC
/.project
@prof7bit
prof7bit / _stoploss.py
Created April 22, 2013 18:01
A simple stop loss bot. Adjust STOP_PRICE and STOP_VOLUME to your needs. The file can be reloaded after editing without restarting goxtool by simply pressing the l key.
"""
a simple stop loss bot.
adjust STOP_PRICE and STOP_VOLUME to your needs.
The file can be reloaded after editing without
restarting goxtool by simply pressing the l key.
"""
import strategy
import goxapi
# pylint: disable=C0301