summaryrefslogtreecommitdiff
path: root/MySpace/formatting.cpp
diff options
context:
space:
mode:
authorsje <sje@4f64403b-2f21-0410-a795-97e2b3489a10>2007-07-03 06:26:19 +0000
committersje <sje@4f64403b-2f21-0410-a795-97e2b3489a10>2007-07-03 06:26:19 +0000
commit6ad2fdede0ae25dc0d56b5e45f6b9aa876e93b68 (patch)
tree338cd3a33a281b5f8372908f9b2ffb280dd611f2 /MySpace/formatting.cpp
parent3211838af8942e88c53fb775ccd1a2524049592e (diff)
don't strip links in <a> tags
get avatars! woohoo :) git-svn-id: https://server.scottellis.com.au/svn/mim_plugs@248 4f64403b-2f21-0410-a795-97e2b3489a10
Diffstat (limited to 'MySpace/formatting.cpp')
-rw-r--r--MySpace/formatting.cpp13
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++];
}