diff options
Diffstat (limited to 'MySpace/formatting.cpp')
-rw-r--r-- | MySpace/formatting.cpp | 37 |
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, "'", 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, "'", 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]) {
|