Messages colors manipulation


Functions

char * irc_color_strip_from_mirc (const char *message)
 Removes all the color codes and format options.
char * irc_color_convert_from_mirc (const char *message)
 Converts all the color codes and format options to libircclient colors.
char * irc_color_convert_to_mirc (const char *message)
 Converts all the color codes from libircclient format to mIRC.

Function Documentation

char * irc_color_convert_from_mirc ( const char *  message  ) 

Converts all the color codes and format options to libircclient colors.

Parameters:
message A message from IRC
Returns:
Returns a new message with converted mIRC color codes and format options. See the irc_color_convert_to_mirc() help to see how the colors are converted.
Note that the memory for the new message is allocated using malloc(), so you should free it using free() when it is not used anymore. If memory allocation failed, returns 0.
See also:
irc_color_strip_from_mirc irc_color_convert_to_mirc

char * irc_color_convert_to_mirc ( const char *  message  ) 

Converts all the color codes from libircclient format to mIRC.

Parameters:
message A message with color codes
Returns:
Returns a new message with converted color codes and format options, or 0 if memory could not be allocated. Note that the memory for the new message is allocated using malloc(), so you should free it using free() when it is not used anymore.
The color system of libircclient is designed to be easy to use, and portable between different IRC clients. Every color or format option is described using plain text commands written between square brackets. The possible codes are:
  • [B] ... [/B] - bold format mode. Everything between [B] and [/B] is written in bold.
  • [I] ... [/I] - italic/reverse format mode. Everything between [I] and [/I] is written in italic, or reversed (however, because some clients are incapable of rendering italic text, most clients display this as normal text with the background and foreground colors swapped).
  • [U] ... [/U] - underline format mode. Everything between [U] and [/U] is written underlined.
  • [COLOR=RED] ... [/COLOR] - write the text using specified foreground color. The color is set by using the COLOR keyword, and equal sign followed by text color code (see below).
  • [COLOR=RED/BLUE] ... [/COLOR] - write the text using specified foreground and background color. The color is set by using the COLOR keyword, an equal sign followed by text foreground color code, a dash and a text background color code.

The supported text colors are:

  • WHITE
  • BLACK
  • DARKBLUE
  • DARKGREEN
  • RED
  • BROWN
  • PURPLE
  • OLIVE
  • YELLOW
  • GREEN
  • TEAL
  • CYAN
  • BLUE
  • MAGENTA
  • DARKGRAY
  • LIGHTGRAY

Examples of color sequences:

 Hello, [B]Tim[/B]. 
 [U]Arsenal[/U] got a [COLOR=RED]red card[/COLOR]
 The tree[U]s[/U] are [COLOR=GREEN/BLACK]green[/COLOR]

See also:
irc_color_strip_from_mirc irc_color_convert_from_mirc

char * irc_color_strip_from_mirc ( const char *  message  ) 

Removes all the color codes and format options.

Parameters:
message A message from IRC
Returns:
Returns a new plain text message with stripped mIRC color codes. Note that the memory for the new message is allocated using malloc(), so you should free it using free() when it is not used anymore. If memory allocation failed, returns 0.
See also:
irc_color_convert_from_mirc irc_color_convert_to_mirc


Generated on Sat Jan 10 18:19:35 2009 for libircclient by  doxygen 1.5.7.1