summaryrefslogtreecommitdiff
path: root/MySpace/formatting.cpp
diff options
context:
space:
mode:
authorsje <sje@4f64403b-2f21-0410-a795-97e2b3489a10>2007-07-02 04:28:46 +0000
committersje <sje@4f64403b-2f21-0410-a795-97e2b3489a10>2007-07-02 04:28:46 +0000
commit5be409c981e54efd335f311f082bc6a3dc18fadf (patch)
tree609b43d713ac62eab883acd5521b761c9ed1955c /MySpace/formatting.cpp
parent3413f527f0945d08dc9102e75b2d9630d6855ed1 (diff)
fix for nick formatting
git-svn-id: https://server.scottellis.com.au/svn/mim_plugs@238 4f64403b-2f21-0410-a795-97e2b3489a10
Diffstat (limited to 'MySpace/formatting.cpp')
-rw-r--r--MySpace/formatting.cpp37
1 files changed, 35 insertions, 2 deletions
diff --git a/MySpace/formatting.cpp b/MySpace/formatting.cpp
index 891f75e..e66d0f6 100644
--- a/MySpace/formatting.cpp
+++ b/MySpace/formatting.cpp
@@ -1,7 +1,7 @@
#include "common.h"
#include "formatting.h"
-void entitize(char *buff, int size) {
+void entitize_msg(char *buff, int size) {
char *tmp = new char[size];
int in = 0, out = 0;
@@ -23,7 +23,7 @@ void entitize(char *buff, int size) {
buff[size - 1] = 0;
}
-void unentitize(char *buff) {
+void unentitize_msg(char *buff) {
int in = 0, out = 0;
while(buff[in]) {
if(buff[in] == '&') {
@@ -45,6 +45,39 @@ void unentitize(char *buff) {
buff[out] = 0;
}
+void entitize_nick(char *buff, int size) {
+ char *tmp = new char[size];
+
+ int in = 0, out = 0;
+ while(buff[in] && out < size) {
+ switch(buff[in]) {
+ case '\'': in++; strncpy(tmp + out, "&#39;", size - out); out += 5; break;
+ default:
+ tmp[out++] = buff[in++];
+ }
+ }
+ tmp[out] = 0;
+
+ strncpy(buff, tmp, size);
+ delete tmp;
+ buff[size - 1] = 0;
+}
+
+void unentitize_nick(char *buff) {
+ int in = 0, out = 0;
+ while(buff[in]) {
+ if(buff[in] == '&') {
+ if(strncmp(buff + in, "&#39;", 5) == 0) {
+ buff[out++] = '\''; in += 5;
+ } else
+ buff[out++] = buff[in++];
+ } else
+ buff[out++] = buff[in++];
+ }
+ buff[out] = 0;
+}
+
+
void strip_tags(char *buff) {
int in = 0, out = 0;
while(buff[in]) {