diff options
Diffstat (limited to 'MySpace/formatting.cpp')
-rw-r--r-- | MySpace/formatting.cpp | 13 |
1 files changed, 12 insertions, 1 deletions
diff --git a/MySpace/formatting.cpp b/MySpace/formatting.cpp index e66d0f6..130e703 100644 --- a/MySpace/formatting.cpp +++ b/MySpace/formatting.cpp @@ -81,9 +81,20 @@ void unentitize_nick(char *buff) { void strip_tags(char *buff) {
int in = 0, out = 0;
while(buff[in]) {
- if(buff[in] == '<' && buff[in + 1] != 'i') {
+ if(buff[in] == '<' && buff[in + 1] != 'i' && buff[in + 1] != 'a') {
while(buff[in] && buff[in] != '>') in++;
in++;
+ } else if(buff[in] == '<' && buff[in + 1] == 'a') {
+ // link
+ while(buff[in] && buff[in] != '\'' && buff[in] != '\"') in++;
+ in++;
+ while(buff[in] && buff[in] != '\'' && buff[in] != '\"')
+ buff[out++] = buff[in++];
+ while(buff[in] && buff[in] != '>') in++;
+ in++;
+ // add a space after a link in case there's something inside the <a></a> tags
+ if(buff[in] && buff[in] != ' ' && buff[in] != '\r' && buff[in] != '\n' && buff[in] != '\t')
+ buff[out++] = ' ';
} else
buff[out++] = buff[in++];
}
|