1: 2: 3: 4: 5: 6: 7: 8: 9: 10: 11: 12: 13: 14: 15: 16: 17: 18: 19: 20: 21: 22: 23: 24: 25: 26: 27: 28: 29: 30: 31: 32: 33: 34: 35: 36: 37: 38: 39: 40: 41: 42: 43: 44: 45: 46: 47: 48: 49: 50: 51: 52: 53:
| procedure TChatForm.Display_Message(Nick, Msg: string; NickStyle, MsgStyle: Byte); var i: Integer; idx: byte; sLeft: string; begin RVChat.AddFromNewLine(Nick+#32, NickStyle); Msg := Trim(Msg); sLeft := ''; i := 1; while i < Length(Msg) do begin if IsSmilie4(copy(Msg,i,4)) <> 0 then begin idx := IsSmilie4(copy(Msg,i,4)); RvChat.Add(copy(sleft,1,length(sLeft)-1), MsgStyle); sLeft := ''; RVChat.AddBullet(idx-1, SmilieImageList, false); inc(i,4); if Trim(copy(Msg,i,Length(Msg))) = '' then Break; end else if IsSmilie3(copy(Msg,i,3)) <> 0 then begin idx := IsSmilie3(copy(Msg,i,3)); RvChat.Add(copy(sleft,1,length(sLeft)-1), MsgStyle); sLeft := ''; RVChat.AddBullet(idx-1, SmilieImageList, false); inc(i,3); if Trim(copy(Msg,i,Length(Msg))) = '' then Break; end else if IsSmilie2(copy(Msg,i,2)) <> 0 then begin idx := IsSmilie2(copy(Msg,i,2)); RvChat.Add(copy(sleft,1,length(sLeft)-1), MsgStyle); sLeft := ''; RVChat.AddBullet(idx-1, SmilieImageList, false); inc(i,2); if Trim(copy(Msg,i,Length(Msg))) = '' then Break; end else begin sLeft := sLeft + copy(Msg,i,1); inc(i); end; end; RVChat.Add(sleft+copy(Msg,i,1), MsgStyle); RVChat.FormatTail; RVChat.Refresh; end; |