IRC-Client: Chatanzeige verbessert

This commit is contained in:
Jörg Deckert 2014-01-06 20:13:42 +01:00
parent addc0f927f
commit 7f618346a9
1 changed files with 45 additions and 4 deletions

View File

@ -496,16 +496,38 @@ PRI printTime
ios.print(str.trimCharacters(str.numberToDecimal(ios.getMinutes, 2)))
ios.printchar("]")
PRI printChatStr(chanstr, nickstr, msgstr)
PRI printChatStr(chanstr, nickstr, msgstr) | channicklen, msglineend, ch, space
ios.winset(1)
ios.printnl
printTime
ios.print(nickstr)
ios.printchar(">")
ios.print(chanstr)
ios.printchar(">")
ios.print(nickstr)
ios.print(string(": "))
ios.print(msgstr)
channicklen := strsize(chanstr) + strsize(nickstr) + 10
msglineend := cols - channicklen -2
repeat
if strsize(msgstr) =< msglineend 'msgline paßt auf Zeile
ios.print(msgstr)
quit
else 'msgline muß umgebrochen werden
ch := byte[msgstr][msglineend] 'Zeichen am Zeilenende sichern
byte[msgstr][msglineend] := 0 'Messagestring am Zeilenende abschließen
if (space := findCharacterBack(msgstr, " ")) 'wenn letztes Leerzeichen in msgstr gefunden
byte[msgstr][msglineend] := ch 'Zeichen am Zeilenende wieder einfügen
byte[space] := 0 'msgstr am letzten Leerzeichen abschließen
ios.print(msgstr) 'und anzeigen
ios.printnl 'nächste Zeile
else
ios.print(msgstr) 'hier wird kein printnl gebraucht
repeat channicklen '"Tab" bis Ende Anzeige Channel + Nickname
ios.printchar(" ")
if space
msgstr := space + 1
else
ios.printchar(ch) 'am Zeilenende entferntes Zeichen hier anzeigen
msgstr += msglineend + 1
PRI strToIpPort(ipstr, ip, port) | octet
' extracts the IP and PORT from a string
@ -624,6 +646,25 @@ PRI sendStr (strSend) : error
' ios.printnl
error := ios.lan_txdata(handleidx, strSend, strsize(strSend))
PUB findCharacterBack(charactersToSearch, characterToFind) | i
'' ┌──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┐
'' │ Searches a string of characters for the last occurence of the specified character. │
'' │ │
'' │ Returns the address of that character if found and zero if not found. │
'' │ │
'' │ CharactersToSearch - A pointer to the string of characters to search. │
'' │ CharacterToFind - The character to find in the string of characters to search. │
'' └──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┘
i := strsize(charactersToSearch)
repeat i
if(byte[charactersToSearch][--i] == characterToFind)
return charactersToSearch + i
return 0
DAT
strWin1 byte "Chat",0