Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /// Struct defining a rainbow tag, [rb].
- struct rainbowtag: bbcode_tag {
- void init() { }
- string get_replacement(PurpleConversation*, PurpleAccount*, int, string content, string, string) {
- char colors[10] = { '4', '7', '8', '3', '2', '6' };
- string res = "\00304"; int color = 0;
- for (const char* uc = content.c_str(); *uc; ) {
- const char *ucf = uc; uc = g_utf8_next_char(uc);
- res += string(ucf,uc);
- gunichar c = g_utf8_get_char(ucf);
- if (!g_unichar_isspace(c)) {
- res += "\0030", res += colors[++color % 6];
- }
- }
- return res;
- }
- rainbowtag(): bbcode_tag("rb",false) {}
- };
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement