1
#ifndef _KVI_CONTROLCODES_H_
2
#define _KVI_CONTROLCODES_H_
4
//=============================================================================
6
// File : KviControlCodes.h
7
// Creation date : Thu Jun 29 2000 21:06:55 CEST by Szymon Stefanek
9
// This file is part of the KVIrc irc client distribution
10
// Copyright (C) 2000-2010 Szymon Stefanek (pragma at kvirc dot net)
11
// Copyright (C) 2011 Elvio Basello (hellvis69 at gmail dot com)
13
// This program is FREE software. You can redistribute it and/or
14
// modify it under the terms of the GNU General Public License
15
// as published by the Free Software Foundation; either version 2
16
// of the License, or (at your opinion) any later version.
18
// This program is distributed in the HOPE that it will be USEFUL,
19
// but WITHOUT ANY WARRANTY; without even the implied warranty of
20
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
21
// See the GNU General Public License for more details.
23
// You should have received a copy of the GNU General Public License
24
// along with this program. If not, write to the Free Software Foundation,
25
// Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
27
//=============================================================================
29
//=============================================================================
30
// This file contains non-customizable standards
32
// Better do not touch this :)
33
//=============================================================================
36
* \file KviControlCodes.h
37
* \author Szymon Stefanek
38
* \brief This file holds the text control codes
40
* It was originally named KviMircCntrl
43
#include "kvi_settings.h"
44
#include "KviCString.h"
46
#define KVI_MIRCCOLOR_MAX_FOREGROUND 15
47
#define KVI_MIRCCOLOR_MAX_BACKGROUND 15
51
// ASCII Stuff: the following defines are meant to be escape sequences
52
// that can go thru an IRC connection
54
// The following table is a 30-minute analysis of the escape characters commonly used over the IRC protocol...
55
// created when looking for a good placement for the CRYPT escape char in KVirc.
56
// I guess that the best chars to be used were FS,GS,RS,US,DC1,DC2,DC3,DC4...they have the "less defined"
57
// meaning as ASCII control chars.
61
// 000 NUL Null (Cannot be assigned)
62
// 001 SOH Start of heading ( CTCP Escape: only beginning of the message )
63
// 002 STX Start of text ( Bold text )
64
// 003 ETX End of text ( Color text escape sequence )
65
// 004 EOT End of transmission ( Assigned internally (escape) )
66
// 005 ENQ Enquiry (WRU: Who are you) ( Assigned internally (unescape) )
67
// 006 ACK Acknowledge (Not so good, but can be used as last resource)
68
// 007 BEL Bell ( Recognized as bell by terminals and IRCII ) (Used also by some IRC servers)
69
// 008 BS Backspace (Should not be assigned: terminal control)
70
// 009 HT Horizontal tabulation (Should not be assigned: terminal control)
71
// 010 LF Line feed (Should not be assigned: terminal control)
72
// 011 VT Vertical tabulation (Should not be assigned: terminal control)
73
// 012 FF Form feed (Should not be assigned: terminal control)
74
// 013 CR Carriage return (Should not be assigned: terminal control)
75
// 014 SO Shift out (Should not be assigned: terminal control)
76
// 015 SI Shift in ( Resets Bold,Color,Underline and Reverse ) (Conflicting with terminal control)
77
// 016 DLE Data link escape (Decent, can be assigned)
78
// 017 DC1 Device control 1 (Good to be assigned)
79
// 018 DC2 Device control 2 (Good to be assigned)
80
// 019 DC3 Device control 3 (Good to be assigned)
81
// 020 DC4 Device control 4 (Good to be assigned)
82
// 021 NAK Negative acknowledge (Not so good, but could be used as last resource)
83
// 022 SYN Synchronous idle ( Reverse text )
84
// 023 ETB End of transmission block (Decent, can be assigned)
85
// 024 CAN Cancel (Should not be assigned: terminal control)
86
// 025 EM End of medium (Decent, can be assigned)
87
// 026 SUB Substitute (Should not be assigned: terminal control)
88
// 027 ESC Escape (Should not be assigned: terminal control)
89
// 028 FS File separator (Excellent, should be used as first candidate)
90
// 029 GS Group separator ( ICONS Escape: beginning of a word )
91
// 030 RS Record separator ( CRYPT Escape: only beginning of the message )
92
// 031 US Unit separator ( Underline text )
98
//31 (0001 1111) US (Unit separator)
99
//2 (0000 0010) STX (Start of text)
100
//15 (0000 1111) SI (Shift in)
101
//22 (0001 0110) SYN (Synchronous idle)
102
//3 (0000 0011) ETX (End of text)
107
//1 (0000 0001) SOH (Start of heading)
110
// KVirc added control codes
112
//30 (0001 1110) RS (Record separator)
113
//29 (0001 1101) GS (Group separator)
117
* \namespace KviControlCodes
118
* \brief Holds all text control code KVIrc uses
120
namespace KviControlCodes
124
* \brief Contains mIRC color codes
127
White = 0, /**< White */
128
Black = 1, /**< Black */
129
DarkBlue = 2, /**< Dark blue */
130
DarkGreen = 3, /**< Dark green */
132
DarkRed = 5, /**< Dark red */
133
DarkViolet = 6, /**< Dark violet */
134
Orange = 7, /**< Orange */
135
Yellow = 8, /**< Yellow */
136
LightGreen = 9, /**< Light green */
137
BlueMarine = 10, /**< Blue marine */
138
LightBlue = 11, /**< Light blue */
139
Blue = 12, /**< Blue */
140
LightViolet = 13, /**< Light violet */
141
DarkGray = 14, /**< Dark gray */
142
LightGray = 15, /**< Light gray */
143
Transparent = 100, /**< Transparent, non standard color code for KviIrcView */
144
NoChange = 101 /**< No change, non standard color code for KviIrcView */
149
* \brief Contains mIRC control codes
152
CTCP = 0x01, /**< CTCP, IRC control code */
153
Bold = 0x02, /**< Bold */
154
Color = 0x03, /**< Color */
155
Escape = 0x04, /**< Escape, totally artificial and internal to KviIrcView */
156
UnEscape = 0x05, /**< Unescape, totally artificial and internal to KviIrcView */
157
UnIcon = 0x06, /**< Unicon, totally artificial and internal to KviIrcView */
158
Reset = 0x0f, /**< Reset */
159
Reverse = 0x16, /**< Reverse */
160
Icon = 0x1d, /**< Icon, KVIrc control code */
161
CryptEscape = 0x1e, /**< Crypt escape, KVIrc control code */
162
Underline = 0x1f /**< Underline */
166
* \brief Removes control bytes from the given string
167
* \param szData The string to clean
170
KVILIB_API QString stripControlBytes(const QString & szData);
173
KVILIB_API const kvi_wchar_t * getColorBytesW(const kvi_wchar_t * pwData, unsigned char * pcByte1, unsigned char * pcByte2);
175
KVILIB_API unsigned int getUnicodeColorBytes(const QString & szData, unsigned int iChar, unsigned char * pcByte1, unsigned char * pcByte2);
177
extern KVILIB_API const char * getColorBytes(const char * pcData, unsigned char * pcByte1, unsigned char * pcByte2);
178
inline const QChar * getUnicodeColorBytes(const QChar * pData, unsigned char * pcByte1, unsigned char * pcByte2)
179
{ return (QChar *)getColorBytesW((const kvi_wchar_t *)pData,pcByte1,pcByte2); }
183
#endif //_KVI_CONTROLCODES_H_