📄 messagemodel.pas
字号:
unit messagemodel;
interface
uses SysUtils,windows,model;
type
tmessagemodel=class(Tmodel)
private
procedure addusertext(params:string);
procedure addusertext_ex(params:string);
procedure addbroadcast(params:string);
public
procedure process(params:string);override;
end;
implementation
uses shareunit,constunt,udpcores,structureunt,richunt;
//------------------------------------------------------------------------------
// 处理对方发来的文本消息.保存或直接弹出。
//------------------------------------------------------------------------------
procedure tmessagemodel.addusertext(params:string);
var tmp:userinfo;
firendid,msgex:string;
begin
firendid:=getparamitem(params,'firendid');
if udpcore.user.checkuser(firendid) then
begin
tmp:=udpcore.user.getuserinfoex(firendid);
if tmp.groupid='blacklist' then exit;
addusertext_ex(params);
if tmp.status=1 then //处于自动回复状态
begin
makeparamsex(msgex,'msgid',xy_message);
makeparamsex(msgex,'funid',xy_usertext_ex);
makeparamsex(msgex,'msgtext',revertmsg);
makeparamsex(msgex,'firendid',tmp.md5name);
makeparamsex(msgex,'fontname',udpcore.myfont.font.name);
makeparamsex(msgex,'fontsize',udpcore.myfont.font.size);
makeparamsex(msgex,'fontcolor',udpcore.myfont.font.color);
makeparamsex(msgex,'fontstyle',destyle(udpcore.myfont.font.style));
makeparamsex(msgex,'dt',datetimetostr(now));
udpcore.sendtouser(firendid,msgex);
end;
end;
end;
procedure Tmessagemodel.addusertext_ex(params:string);
var tmp:userinfo;
firendid,msg:string;
begin
firendid:=getparamitem(params,'firendid');
if udpcore.user.checkuser(firendid) then
begin
tmp:=udpcore.user.getuserinfoex(firendid);
if tmp.groupid='blacklist' then exit;
if newmsg_sound then udpcore.audio_dx9.playwave;
if tmp.dlghwnd>0 then
begin
expandmemo.Add(params);
postmessage(tmp.dlghwnd,refresh_status,xy_message,0);
udpcore.chat.addusertext(params,false,true);
end else begin
udpcore.chat.addusertext(params,false,false);
if newmsg_popup then
begin
msg:='';
makeparamsex(msg,'msgid',xy_createdlgform);
makeparamsex(msg,'firendid',firendid);
expandmemo.Add(msg);
postmessage(main_hwnd,refresh_status,xy_createdlgform,0);
end else expandmemo.Add(params);
end;
end;
end;
procedure tmessagemodel.addbroadcast(params:string);
var msg:string;
begin
makeparamsex(msg,'msgid',xy_showadmsgform);
makeparamsex(msg,'msgtext',getparamitem(params,'msgtext'));
makeparamsex(msg,'autoclose',false);
expandmemo.add(msg);
postmessage(main_hwnd,refresh_status,xy_showadmsgform,0);
end;
//------------------------------------------------------------------------------
// 处理所有用户有关的消息
//------------------------------------------------------------------------------
procedure tmessagemodel.process(params:string);
var funid:string;
begin
funid:=getparamitem(params,'funid');
case strtointdef(funid,xy_unknow) of
xy_usertext:addusertext(params);
xy_usertext_ex:addusertext_ex(params);
xy_broadcast:addbroadcast(params);
xy_unknow:logmemo.add('unknow:'+params);
end;
end;
end.
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -