summaryrefslogtreecommitdiff
path: root/plugins/Watrack/proto/proto.pas
diff options
context:
space:
mode:
Diffstat (limited to 'plugins/Watrack/proto/proto.pas')
-rw-r--r--plugins/Watrack/proto/proto.pas138
1 files changed, 6 insertions, 132 deletions
diff --git a/plugins/Watrack/proto/proto.pas b/plugins/Watrack/proto/proto.pas
index e26ce14f17..625e4fa031 100644
--- a/plugins/Watrack/proto/proto.pas
+++ b/plugins/Watrack/proto/proto.pas
@@ -84,129 +84,6 @@ begin
db_event_add(hContact, @dbeo);
end;
-{SEND-time text translation}
-(*
-const
- BufSize = 16384;
-
-function FormatToBBW(src:PWideChar):PWideChar;
-var
- buf:array [0..32] of WideChar;
- p:PWideChar;
- i,j:integer;
-begin
- result:=src;
- StrReplaceW(src,'{b}' ,'[b]');
- StrReplaceW(src,'{/b}' ,'[/b]');
- StrReplaceW(src,'{u}' ,'[u]');
- StrReplaceW(src,'{/u}' ,'[/u]');
- StrReplaceW(src,'{i}' ,'[i]');
- StrReplaceW(src,'{/i}' ,'[/i]');
- StrReplaceW(src,'{/cf}','[/color]');
- StrReplaceW(src,'{/bg}','');
- StrCopyW(buf,'[color=');
- repeat
- i:=StrPosW(src,'{cf');
- if i=0 then break;
- j:=i;
- dec(i);
- while (src[j]<>#0) and (src[j]<>'}') do inc(j);
- if src[j]='}' then inc(j);
- case StrToInt(src+i+3) of
- 4,10: p:='green]';
- 5,6: p:='red]';
- 7,14: p:='magenta]';
- 3,11,
- 12,13: p:='blue]';
- 8,9: p:='yellow]';
- 2,15: p:='black]';
- else
- {1,16:} p:='white]';
- end;
- StrCopyW(buf+7,p);
- StrCopyW(src+i,src+j);
- StrInsertW(buf,src,i);
- until false;
- repeat
- i:=StrIndex(src,'{bg');
- if i=0 then break;
- j:=i;
- dec(i);
- while (src[j]<>#0) and (src[j]<>'}') do inc(j);
- if src[j]='}' then inc(j);
- StrCopyW(src+i,src+j);
- until false;
-end;
-
-function SendMessageProcW(wParam:WPARAM; lParam:LPARAM):integer; cdecl;
-var
- ccs:PCCSDATA;
- uns,s,ss:pWideChar;
- p:PAnsiChar;
- present:boolean;
- i:integer;
-begin
- if DisablePlugin<>dsPermanent then
- begin
- ccs:=PCCSDATA(lParam);
- if ccs^.wParam=0 then
- present:=StrPos('%music%',PAnsiChar(ccs^.lParam))<>nil
- else // not needed?
- begin
- uns:=PWideChar(ccs^.lParam+StrLen(PAnsiChar(ccs^.lParam))+1);
- present:=StrPos(uns,'%music%')<>nil;
- end;
-
- if present then
- begin
- if CallService(MS_WAT_GETMUSICINFO,0,0)=WAT_RES_NOTFOUND then
- s:=nil
- else
- begin
- if SimpleMode<>BST_UNCHECKED then
- i:=0
- else
- i:=CallService(MS_PROTO_GETCONTACTBASEPROTO,ccs^.hContact,0);
- s:=GetMacros(TM_MESSAGE,i);
- end;
- // if s<>nil then // for empty strings
- begin
- mGetMem(ss,BufSize*SizeOf(pWideChar));
- FillChar(ss^,BufSize*SizeOf(pWideChar),0);
- if ccs^.wParam=0 then
- AnsiToWide(PAnsiChar(ccs^.lParam),uns,UserCP);
- StrCopyW(ss,uns);
- if ccs^.wParam=0 then
- mFreeMem(uns);
- StrReplaceW(ss,'%music%',s);
- mFreeMem(s);
- if StrPos(ss,'{')<>nil then
- FormatToBBW(ss);
- s:=PWideChar(ccs^.lParam);
- WideToAnsi(ss,p,UserCP);
- if ccs^.wParam=0 then
- begin
- ccs^.lParam:=tlparam(p);
- end
- else
- begin
- move(PAnsiChar(ss)^,(PAnsiChar(ss)+StrLen(p)+1)^,
- (StrLenW(ss)+1)*SizeOf(WideChar));
- StrCopy(PAnsiChar(ss),p);
- ccs^.lParam:=tlparam(ss);
- end;
- result:=CallService(MS_PROTO_CHAINSEND,wParam,lParam);
- mFreeMem(p);
- ccs^.lParam:=tlparam(s);
- mFreeMem(ss);
- exit;
- end;
- end;
- end;
- result:=CallService(MS_PROTO_CHAINSEND,wParam,lParam);
-end;
-*)
-
function ReceiveMessageProcW(wParam:WPARAM; lParam:LPARAM):int_ptr; cdecl;
const
bufsize = 4096*SizeOf(WideChar);
@@ -237,13 +114,13 @@ begin
(StrCmp(PPROTORECVEVENT(ccs^.lParam)^.szMessage.a,
wpRequest,Length(wpRequest))=0) then
begin
- StrCopy(PAnsiChar(buf),PAnsiChar(CallService(MS_PROTO_GETCONTACTBASEPROTO,ccs^.hContact,0)));
+ StrCopy(PAnsiChar(buf),Proto_GetProtoName(ccs^.hContact));
i:=DBReadWord(ccs^.hContact,PAnsiChar(buf),'ApparentMode');
StrCat(PAnsiChar(buf),PS_GETSTATUS);
if (i=ID_STATUS_OFFLINE) or
((i=0) and (CallService(PAnsiChar(buf),0,0)=ID_STATUS_INVISIBLE)) then
begin
- result:=CallService(MS_PROTO_CHAINRECV,wParam,lParam);
+ result:=Proto_ChainRecv(wParam,ccs);
end
else if DBReadByte(ccs^.hContact,strCList,ShareOptText,0)<>0 then
// or (NotListedAllow and (DBReadByte(ccs^.hContact,strCList,'NotOnList',0))
@@ -385,7 +262,7 @@ begin
Translate('You Get Error'),MB_ICONERROR);
end
else
- result:=CallService(MS_PROTO_CHAINRECV,wParam,lParam);
+ result:=Proto_ChainRecv(wParam,ccs);
mFreeMem(buf);
end;
@@ -409,7 +286,7 @@ begin
while hContact<>0 do
begin
if not IsChat(hContact) then
- CallService(MS_PROTO_ADDTOCONTACT,hContact,lparam(PluginShort));
+ Proto_AddToContact(hContact,PluginShort);
hContact:=db_find_next(hContact);
end;
end;
@@ -418,7 +295,7 @@ function HookAddUser(hContact:WPARAM;lParam:LPARAM):int; cdecl;
begin
result:=0;
if not IsChat(hContact) then
- CallService(MS_PROTO_ADDTOCONTACT,hContact,tlparam(PluginShort));
+ Proto_AddToContact(hContact,PluginShort);
end;
function OnContactMenu(hContact:WPARAM;lParam:LPARAM):int;cdecl;
@@ -442,12 +319,9 @@ begin
desc.cbSize:=PROTOCOLDESCRIPTOR_V3_SIZE;//SizeOf(desc);
desc.szName:=PluginShort;
desc._type :=PROTOTYPE_TRANSLATION;
+ Proto_RegisterModule(@desc);
- CallService(MS_PROTO_REGISTERMODULE,0,lparam(@desc));
-// CreateProtoServiceFunction(PluginShort,PSS_MESSAGE ,@SendMessageProcW);
-// CreateProtoServiceFunction(PluginShort,PSS_MESSAGEW,@SendMessageProcW);
hSRM:=CreateProtoServiceFunction(PluginShort,PSR_MESSAGE ,@ReceiveMessageProcW);
-// CreateProtoServiceFunction(PluginShort,PSR_MESSAGEW,@ReceiveMessageProcW);
end;
function IconChanged(wParam:WPARAM;lParam:LPARAM):int;cdecl;