Hi,
1: how register plugin as "protocol"(so miranda show's it in protocols) ?
ZeroMemory(@pd, SizeOf(pd));
pd.cbSize:= SizeOf(TPROTOCOLDESCRIPTOR);
pd.szName:= MPHANTOMUSER_MODULE_NAME;
pd.type_:= PROTOTYPE_PROTOCOL;
CallService(MS_PROTO_REGISTERMODULE, 0, lParam(@pd));
That I registred plugin as Protocol plugin. Next I hook on various events.
2: i kno how to add "contact" to db, but how send this contact online? (away/NA/etc...)
function OnSetStatus(wParam: WPARAM; lParam: LPARAM): int; cdecl;
var
i, Count :LongInt;
hContact :THandle;
OldStatus :Int;
begin
OldStatus:= Status;
Status:= wParam;
case Status of
ID_STATUS_OFFLINE :Status:= ID_STATUS_OFFLINE;
ID_STATUS_ONLINE :Status:= ID_STATUS_ONLINE;
ID_STATUS_AWAY :Status:= ID_STATUS_ONLINE;
ID_STATUS_DND :Status:= ID_STATUS_ONLINE;
ID_STATUS_NA :Status:= ID_STATUS_ONLINE;
ID_STATUS_OCCUPIED :Status:= ID_STATUS_ONLINE;
ID_STATUS_FREECHAT :Status:= ID_STATUS_ONLINE;
ID_STATUS_INVISIBLE :Status:= ID_STATUS_ONLINE;
ID_STATUS_ONTHEPHONE :Status:= ID_STATUS_ONLINE;
ID_STATUS_OUTTOLUNCH :Status:= ID_STATUS_ONLINE;
else
Status:= ID_STATUS_OFFLINE;
end;
ProtoBroadcastAck(MPHANTOMUSER_MODULE_NAME, 0, ACKTYPE_STATUS, ACKRESULT_SUCCESS, OldStatus, status);
Count:= PluginLink.CallService(MS_DB_CONTACT_GETCOUNT, 0, 0);
hContact:= PluginLink.CallService(MS_DB_CONTACT_FINDFIRST, 0, 0);
for i:= 1 to Count do
begin
if IsPhantomUser(hContact) then
begin
DBWriteContactSettingDWord(hContact, MPHANTOMUSER_MODULE_NAME, 'Status', StatusPerContactType(Status, hContact));
end;
hContact:= PluginLink.CallService(MS_DB_CONTACT_FINDNEXT, Dword(HContact), 0);
end;
Result:= 0;
end;
That I set user on-line.
Best regards,