summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--MySpace/MySpace.cpp1
-rw-r--r--MySpace/NetMessage.cpp369
-rw-r--r--MySpace/NetMessage.h37
-rw-r--r--MySpace/formatting.cpp37
-rw-r--r--MySpace/formatting.h7
-rw-r--r--MySpace/nick_dialog.cpp14
-rw-r--r--MySpace/proto.cpp2
-rw-r--r--MySpace/server_con.cpp40
-rw-r--r--MySpace/version.h2
9 files changed, 359 insertions, 150 deletions
diff --git a/MySpace/MySpace.cpp b/MySpace/MySpace.cpp
index 741ae3f..1785be4 100644
--- a/MySpace/MySpace.cpp
+++ b/MySpace/MySpace.cpp
@@ -99,6 +99,7 @@ void SetAllOffline() {
proto = ( char* )CallService( MS_PROTO_GETCONTACTBASEPROTO, ( WPARAM )hContact,0 );
if ( proto && !strcmp( MODULE, proto)) {
DBWriteContactSettingWord(hContact, MODULE, "Status", ID_STATUS_OFFLINE);
+ DBWriteContactSettingDword(hContact, MODULE, "IdleTS", 0);
}
hContact = ( HANDLE )CallService( MS_DB_CONTACT_FINDNEXT,( WPARAM )hContact, 0 );
}
diff --git a/MySpace/NetMessage.cpp b/MySpace/NetMessage.cpp
index a43ce85..b158654 100644
--- a/MySpace/NetMessage.cpp
+++ b/MySpace/NetMessage.cpp
@@ -2,19 +2,19 @@
#include "NetMessage.h"
#include <cstdlib>
-NMString::NMString(): text(0) {
+NMString::NMString(): text(0), len(0) {
}
NMString::NMString(const NMString &other) {
- int len = strlen(other.text) + 1;
+ len = strlen(other.text);
text = new char[len + 1];
- mir_snprintf(text, len, "%s", other.text);
+ mir_snprintf(text, len + 1, "%s", other.text);
}
NMString::NMString(char *t) {
- int len = strlen(t) + 1;
+ len = strlen(t);
text = new char[len + 1];
- mir_snprintf(text, len, "%s", t);
+ mir_snprintf(text, len + 1, "%s", t);
}
const bool NMString::operator<(const NMString &other) const {
@@ -25,12 +25,18 @@ const bool NMString::operator==(const NMString &other) const {
return strcmp(text, other.text) == 0;
}
-NMString &NMString::operator=(const NMString &other) {
- if(text) delete[] text;
+const bool NMString::operator==(const char *str) const {
+ return strcmp(text, str) == 0;
+}
- int len = strlen(other.text) + 1;
- text = new char[len + 1];
- mir_snprintf(text, len, "%s", other.text);
+NMString &NMString::operator=(const NMString &other) {
+ int olen = strlen(other.text);
+ if(olen > len) {
+ if(text) delete[] text;
+ len = olen;
+ text = new char[len + 1];
+ }
+ mir_snprintf(text, len + 1, "%s", other.text);
return *this;
}
@@ -39,6 +45,147 @@ NMString::~NMString() {
delete[] text;
}
+StringList::StringList(char *sep): LinkedList<NMString>(), seperators(sep) {
+}
+
+StringList::~StringList() {
+}
+
+int StringList::parse(char *data, int size) {
+ int i = 0, tl, pos = 0;
+ bool first = true;
+ while(pos < size) {
+ tl = strcspn(data + pos, seperators);
+ if(first && tl == 0) {
+ first = false;
+ pos += 1;
+ } else {
+ if(pos + tl < size) {
+ *(data + pos + tl) = 0;
+ add(NMString(unescape_inplace(data + pos)));
+ i++;
+ }
+ pos += tl + 1;
+ }
+ }
+ return i;
+}
+
+bool StringList::get_string(int index, char *buff, int buffsize) {
+ int i = 0;
+ ListNode<NMString> *n = head;
+ while(n && i < index) {
+ if(i == index) break;
+ n = n->next;
+ i++;
+ }
+ if(n) {
+ strncpy(buff, n->val.text, buffsize);
+ return true;
+ }
+ return false;
+}
+
+int StringList::get_int(int index) {
+ int i = 0;
+ ListNode<NMString> *n = head;
+ while(n && i < index) {
+ if(i == index) break;
+ n = n->next;
+ i++;
+ }
+ if(n) {
+ return atoi(n->val.text);
+ }
+ return 0;
+}
+
+void StringList::add_string(char *buff) {
+ add(NMString(buff));
+}
+
+void StringList::add_int(int i) {
+ char buff[128];
+ _itoa(i, buff, 10);
+ add(NMString(buff));
+}
+
+int StringList::make_body(char *buff, int size, bool sep_at_start) {
+ int len = 0;
+ bool first = true;
+ char *val;
+ for(LinkedList<NMString>::Iterator i = start(); i.has_val() && len < size; i.next()) {
+ NMString &val = i.val();
+ if(first && sep_at_start == false) {
+ first = false;
+ } else {
+ if(len < size) buff[len++] = seperators[0];
+ if(len < size) buff[len] = 0;
+ }
+ char *temp = escape(val.text);
+ strncat(buff, temp, size - len);
+ len += strlen(temp);
+ delete[] temp;
+ }
+ if(len < size) buff[len] = 0;
+ return len;
+}
+
+char *StringList::escape(char *val) {
+ int len = strlen(val);
+ char *buff = new char[len + 1];
+ strncpy(buff, val, strlen(val));
+ return buff;
+}
+
+char *StringList::unescape_inplace(char *val) {
+ return val;
+}
+
+PipedStringList::PipedStringList(): StringList() {
+}
+
+PipedStringList::~PipedStringList() {
+}
+
+char *PipedStringList::escape(char *val) {
+ int len = strlen(val);
+ char *buff = new char[len * 2 + 1];
+ int read_pos = 0, write_pos = 0;
+ while(read_pos < len) {
+ if(val[read_pos] == '|') {
+ buff[write_pos++] = '/';
+ buff[write_pos++] = '3';
+ read_pos++;
+ } else {
+ buff[write_pos++] = val[read_pos++];
+ }
+ }
+ buff[write_pos] = 0;
+ return buff;
+}
+
+char *PipedStringList::unescape_inplace(char *val) {
+ int read_pos = 0, write_pos = 0, len = strlen(val);
+ while(read_pos < len) {
+ if(val[read_pos] == '/' && read_pos + 1 < len) {
+ if(val[read_pos + 1] == '3') {
+ read_pos += 2;
+ val[write_pos++] = '|';
+ } else {
+ val[write_pos++] = val[read_pos++];
+ val[write_pos++] = val[read_pos++];
+ }
+ } else {
+ val[write_pos++] = val[read_pos++];
+ }
+ }
+ val[write_pos] = 0;
+
+ return val;
+}
+
+
Dictionary::Dictionary(): LinkedList< KeyValue >() {
}
@@ -46,36 +193,28 @@ Dictionary::~Dictionary() {
}
int Dictionary::parse(char *data, int size) {
- int pos = 0;
+ int i = 0, tl, il, pos = 0;
+ bool first = true;
char *key, *value;
- int start, end = 0;
- while(end < size) {
- start = end;
- end = start;
- while(end < size && data[end] != '=') end++;
- if(end < size) {
- data[end] = 0;
- key = &data[start];
-
- start = end + 1;
- end = start;
- while(end < size && data[end] != '\x1c' && data[end] != 0) end++;
- if(end <= size) {
- data[end] = 0;
- value = &data[start];
- end++;
- } else
- value = 0;
+ while(pos < size) {
+ tl = strcspn(data + pos, "\x1c");
+ if(first && tl == 0) {
+ first = false;
+ pos += 1;
} else {
- key = value = 0;
- }
+ *(data + pos + tl) = 0;
- if(key && value) {
+ il = strcspn(data + pos, "=");
+ *(data + pos + il) = 0;
+ key = unescape_inplace(data + pos);
+ value = unescape_inplace(data + pos + il + 1);
KeyValue kv = KeyValue(NMString(key), NMString(value));
add(kv);
+ pos += tl + 1;
+
}
}
- return pos;
+ return i;
}
bool Dictionary::get_string(char *key, char *buff, int buffsize) {
@@ -114,27 +253,96 @@ void Dictionary::add_int(char *key, int i) {
int Dictionary::make_body(char *buff, int size) {
int pos = 0, key_len, val_len, len;
+ char *ekey, *eval;
bool first = true;
for(Iterator i = start(); i.has_val() && pos < size; i.next()) {
- KeyValue v = i.val();
+ KeyValue &v = i.val();
- key_len = strlen(v.first.text);
- val_len = strlen(v.second.text);
+ ekey = escape(v.first.text);
+ eval = escape(v.second.text);
+ key_len = strlen(ekey);
+ val_len = strlen(eval);
len = key_len + val_len + 2;
if(size - pos - len > 0) {
if(first) {
- mir_snprintf(buff + pos, size - pos, "%s=%s", v.first.text, v.second.text);
+ mir_snprintf(buff + pos, size - pos, "%s=%s", ekey, eval);
first = false;
} else
- mir_snprintf(buff + pos, size - pos, "\x1c%s=%s", v.first.text, v.second.text);
+ mir_snprintf(buff + pos, size - pos, "\x1c%s=%s", ekey, eval);
+ pos += len;
}
- pos += len;
+ delete[] ekey;
+ delete[] eval;
}
return pos;
}
+char *Dictionary::escape(char *val) {
+ int len = strlen(val);
+ char *buff = new char[len * 6 + 1];
+ int read_pos = 0, write_pos = 0;
+ while(read_pos < len) {
+ if(val[read_pos] == '\'') {
+ buff[write_pos++] = '&';
+ buff[write_pos++] = '#';
+ buff[write_pos++] = '3';
+ buff[write_pos++] = '9';
+ buff[write_pos++] = ';';
+ read_pos++;
+ } else if(val[read_pos] == '`') {
+ buff[write_pos++] = '&';
+ buff[write_pos++] = '#';
+ buff[write_pos++] = '3';
+ buff[write_pos++] = '9';
+ buff[write_pos++] = ';';
+ read_pos++;
+ } else if(val[read_pos] == '#') {
+ buff[write_pos++] = '&';
+ buff[write_pos++] = '#';
+ buff[write_pos++] = '0';
+ buff[write_pos++] = '3';
+ buff[write_pos++] = '5';
+ buff[write_pos++] = ';';
+ read_pos++;
+ } else if(val[read_pos] == '\"') {
+ buff[write_pos++] = '&';
+ buff[write_pos++] = 'q';
+ buff[write_pos++] = 'u';
+ buff[write_pos++] = 'o';
+ buff[write_pos++] = 't';
+ buff[write_pos++] = ';';
+ read_pos++;
+ } else {
+ buff[write_pos++] = val[read_pos++];
+ }
+ }
+ buff[write_pos] = 0;
+ return buff;
+}
+
+char *Dictionary::unescape_inplace(char *val) {
+ int read_pos = 0, write_pos = 0, len = strlen(val);
+ while(read_pos < len) {
+ if(read_pos + 5 < len && strncmp(&val[read_pos], "&#39;", 5) == 0) {
+ read_pos += 5;
+ val[write_pos++] = '\'';
+ } else if(read_pos + 6 < len && strncmp(&val[read_pos], "&#035;", 6) == 0) {
+ read_pos += 6;
+ val[write_pos++] = '#';
+ } else if(read_pos + 6 < len && strncmp(&val[read_pos], "&quot;", 6) == 0) {
+ read_pos += 6;
+ val[write_pos++] = '\"';
+ } else {
+ val[write_pos++] = val[read_pos++];
+ }
+ }
+ val[write_pos] = 0;
+
+ return val;
+}
+
NetMessage::NetMessage(): Map<NMString, NMString>() {
}
@@ -147,11 +355,13 @@ char *NetMessage::unescape_inplace(char *val) {
int read_pos = 0, write_pos = 0, len = strlen(val);
while(read_pos < len) {
if(val[read_pos] == '/' && read_pos + 1 < len) {
- read_pos++;
- if(val[read_pos] == '1') val[write_pos++] = '/';
- else if(val[read_pos] == '2') val[write_pos++] = '\\';
- else val[write_pos++] = '?';
- read_pos++;
+ if(val[read_pos + 1] == '1') val[write_pos++] = '/';
+ else if(val[read_pos + 1] == '2') val[write_pos++] = '\\';
+ else {
+ val[write_pos++] = val[read_pos];
+ val[write_pos++] = val[read_pos + 1];
+ }
+ read_pos+= 2;
} else {
val[write_pos++] = val[read_pos++];
}
@@ -162,39 +372,17 @@ char *NetMessage::unescape_inplace(char *val) {
}
int NetMessage::parse(char *data, int size) {
- int pos = 0;
- bool finished = false;
- char *key, *value;
- int start, end = 0;
- while(end < size && !finished) {
- start = end + 1;
- end = start;
- while(end < size && data[end] != '\\') end++;
- if(end < size) {
- data[end] = 0;
- key = &data[start];
-
- start = end + 1;
- if(strcmp(key, "final") != 0) {
- end = start;
- while(end < size && data[end] != '\\') end++;
- if(end < size) {
- data[end] = 0;
- value = &data[start];
- } else
- value = 0;
- } else
- value = 0;
- } else {
- key = value = 0;
+ StringList sl("\\");
+ sl.parse(data, size);
+ for(StringList::Iterator i = sl.start(); i.has_val(); i.next()) {
+ NMString &key = i.val();
+ i.next();
+ if(i.has_val()) {
+ NMString &val = i.val();
+ put(key, val);
}
-
- if(key && strcmp(key, "final") == 0)
- finished = true;
- else if(key && value)
- put(NMString(key), NMString(value));
}
- return pos;
+ return this->size();
}
bool NetMessage::get_string(char *key, char *buff, int buffsize) {
@@ -242,6 +430,14 @@ Dictionary NetMessage::get_dict(char *key) {
return d;
}
+PipedStringList NetMessage::get_list(char *key) {
+ PipedStringList l;
+ char t[4096];
+ if(get_string(key, t, 4096)) {
+ l.parse(t, strlen(t));
+ }
+ return l;
+}
ClientNetMessage::ClientNetMessage(): Dictionary() {
}
@@ -259,7 +455,6 @@ bool ClientNetMessage::add_data(char *key, char *data, int size) {
nbd.pbDecoded = (BYTE *)data;
nbd.cbDecoded = size;
- //*size = Netlib_GetBase64DecodedBufferSize(nbd.cchEncoded);
if(CallService(MS_NETLIB_BASE64ENCODE, 0, (LPARAM)&nbd)) {
KeyValue dat = KeyValue(NMString(key), NMString(buff));
add(dat);
@@ -274,14 +469,23 @@ bool ClientNetMessage::add_data(char *key, char *data, int size) {
void ClientNetMessage::add_string(char *key, char *buff) {
char *temp = escape(buff);
KeyValue dat = KeyValue(NMString(key), NMString(temp));
- delete temp;
+ delete[] temp;
add(dat);
}
void ClientNetMessage::add_dict(char *key, Dictionary &d) {
char t[4096];
if(d.make_body(t, 4096)) {
- add_string(key, t);
+ KeyValue dat = KeyValue(NMString(key), NMString(t));
+ add(dat);
+ }
+}
+
+void ClientNetMessage::add_list(char *key, PipedStringList &list) {
+ char t[4096];
+ if(list.make_body(t, 4096)) {
+ KeyValue dat = KeyValue(NMString(key), NMString(t));
+ add(dat);
}
}
@@ -316,14 +520,17 @@ int ClientNetMessage::make_packet(char *buff, int size) {
val_len = strlen(v.second.text);
len = key_len + val_len + 2;
- if(size - pos - len > 0)
+ if(size - pos - len > 0) {
mir_snprintf(buff + pos, size - pos, "\\%s\\%s", v.first.text, v.second.text);
- pos += len;
+ pos += len;
+ } else
+ return -1;
}
if(size - pos > 7) {
mir_snprintf(buff + pos, size - pos, "\\final\\");
pos += 7;
+ return pos;
}
- return pos;
+ return -1;
}
diff --git a/MySpace/NetMessage.h b/MySpace/NetMessage.h
index 4989f55..fb4e73b 100644
--- a/MySpace/NetMessage.h
+++ b/MySpace/NetMessage.h
@@ -12,9 +12,41 @@ public:
const bool operator<(const NMString &other) const;
const bool operator==(const NMString &other) const;
+ const bool operator==(const char *str) const;
NMString &operator=(const NMString &other);
char *text;
+ int len;
+};
+
+class StringList: public LinkedList<NMString> {
+public:
+ StringList(char *sep = "|");
+ virtual ~StringList();
+
+ int parse(char *data, int size);
+
+ bool get_string(int index, char *buff, int buffsize);
+ int get_int(int index);
+
+ void add_string(char *buff);
+ void add_int(int i);
+
+ int make_body(char *buff, int size, bool sep_at_start = false);
+protected:
+ virtual char *escape(char *val);
+ virtual char *unescape_inplace(char *val);
+
+ char* seperators;
+};
+
+class PipedStringList: public StringList {
+public:
+ PipedStringList();
+ virtual ~PipedStringList();
+protected:
+ char *escape(char *val);
+ char *unescape_inplace(char *val);
};
class KeyValue: public Pair<NMString, NMString> {
@@ -41,6 +73,9 @@ public:
void add_int(char *key, int i);
int make_body(char *buff, int size);
+
+ static char *escape(char *val);
+ static char *unescape_inplace(char *val);
};
class NetMessage: public Map<NMString, NMString> {
@@ -54,6 +89,7 @@ public:
int get_int(char *key);
bool get_data(char *key, char *buff, int *size);
Dictionary get_dict(char *key);
+ PipedStringList get_list(char *key);
static char *unescape_inplace(char *val);
};
@@ -68,6 +104,7 @@ public:
void add_string(char *key, char *buff);
bool add_data(char *key, char *buff, int size);
void add_dict(char *key, Dictionary &d);
+ void add_list(char *key, PipedStringList &list);
static char *escape(char *val);
};
diff --git a/MySpace/formatting.cpp b/MySpace/formatting.cpp
index 130e703..e3a2336 100644
--- a/MySpace/formatting.cpp
+++ b/MySpace/formatting.cpp
@@ -1,7 +1,7 @@
#include "common.h"
#include "formatting.h"
-void entitize_msg(char *buff, int size) {
+void entitize_xml(char *buff, int size) {
char *tmp = new char[size];
int in = 0, out = 0;
@@ -23,7 +23,7 @@ void entitize_msg(char *buff, int size) {
buff[size - 1] = 0;
}
-void unentitize_msg(char *buff) {
+void unentitize_xml(char *buff) {
int in = 0, out = 0;
while(buff[in]) {
if(buff[in] == '&') {
@@ -45,39 +45,6 @@ void unentitize_msg(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]) {
diff --git a/MySpace/formatting.h b/MySpace/formatting.h
index 02b2dec..18db37a 100644
--- a/MySpace/formatting.h
+++ b/MySpace/formatting.h
@@ -1,11 +1,8 @@
#ifndef _FORMATTING_INC
#define _FORMATTING_INC
-void entitize_msg(char *buff, int size);
-void unentitize_msg(char *buff);
-
-void entitize_nick(char *buff, int size);
-void unentitize_nick(char *buff);
+void entitize_xml(char *buff, int size);
+void unentitize_xml(char *buff);
void strip_tags(char *buff);
diff --git a/MySpace/nick_dialog.cpp b/MySpace/nick_dialog.cpp
index 83d7402..b60bdb3 100644
--- a/MySpace/nick_dialog.cpp
+++ b/MySpace/nick_dialog.cpp
@@ -26,10 +26,9 @@ void CheckAvailable(HWND hwndDlg, TCHAR *nick) {
#else
strncpy(an, nick, 256);
#endif
- char body[512];
- entitize_nick(an, 256);
- mir_snprintf(body, 512, "UserName=%s", an);
- msg.add_string("body", body);
+ Dictionary d;
+ d.add_string("UserName", an);
+ msg.add_dict("body", d);
SendMessage(msg);
}
@@ -50,10 +49,9 @@ void SetNick(HWND hwndDlg, TCHAR *nick) {
#else
strncpy(an, nick, 256);
#endif
- char body[512];
- entitize_nick(an, 256);
- mir_snprintf(body, 512, "UserName=%s", an);
- msg.add_string("body", body);
+ Dictionary d;
+ d.add_string("UserName", an);
+ msg.add_dict("body", d);
SendMessage(msg);
}
diff --git a/MySpace/proto.cpp b/MySpace/proto.cpp
index 989424a..31517e2 100644
--- a/MySpace/proto.cpp
+++ b/MySpace/proto.cpp
@@ -127,7 +127,7 @@ int ProtoSendMessage(WPARAM wParam, LPARAM lParam) {
}
msg_utf[MAX_MESSAGE_SIZE-1] = 0;
- entitize_msg(msg_utf, MAX_MESSAGE_SIZE);
+ entitize_xml(msg_utf, MAX_MESSAGE_SIZE);
encode_smileys(msg_utf, MAX_MESSAGE_SIZE);
mir_snprintf(msg_fmt, MAX_MESSAGE_SIZE, "<p><f f='Times' h='16'><c v='black'><b v='white'>%s</b></c></f></p>", msg_utf);
diff --git a/MySpace/server_con.cpp b/MySpace/server_con.cpp
index e5f9ccd..e81db37 100644
--- a/MySpace/server_con.cpp
+++ b/MySpace/server_con.cpp
@@ -219,6 +219,8 @@ void try_login(NetMessage &msg, HANDLE connection) {
strcpy(email, options.email);
MultiByteToWideChar(code_page, 0, options.pw, -1, wpw, 10);
#endif
+ // and make it lower case!?!?
+ _wcslwr(wpw);
sha1.sha1_hash((mir_sha1_byte_t*)wpw, wcslen(wpw) * sizeof(wchar_t), pw_hash);
@@ -254,16 +256,16 @@ void try_login(NetMessage &msg, HANDLE connection) {
}
}
-void ParseStatusMessage(HANDLE hContact, char *smsg) {
- int stat = stat_myspace_to_mir(smsg[3] - '0');
+void ParseStatusMessage(HANDLE hContact, PipedStringList &l) {
+ int stat = stat_myspace_to_mir(l.get_int(1));
if(stat == ID_STATUS_IDLE) {
- DBWriteContactSettingWord(hContact, MODULE, "IdleTS", (DWORD)time(0));
+ DBWriteContactSettingDword(hContact, MODULE, "IdleTS", (DWORD)time(0));
} else {
DBWriteContactSettingWord(hContact, MODULE, "Status", stat);
+ DBWriteContactSettingDword(hContact, MODULE, "IdleTS", 0);
}
- smsg += 8;
- char *end = strstr(smsg, "|");
- if(end) *end = 0;
+ char smsg[512];
+ l.get_string(3, smsg, 512);
DBWriteContactSettingStringUtf(hContact, MODULE, "StatusMsg", smsg);
}
@@ -347,7 +349,7 @@ void __cdecl ServerThreadFunc(void*) {
}
NetMessage msg;
- msg.parse(pbuff, bytes);
+ msg.parse(pbuff, end - pbuff);
if(msg.exists(NMString("error"))) {
char errmsg[256];
if(msg.get_string("errmsg", errmsg, 256)) {
@@ -429,13 +431,11 @@ void __cdecl ServerThreadFunc(void*) {
if(uid) {
HANDLE hContact = FindContact(uid);
if(!hContact) {
- hContact = CreateContact(uid, 0, 0, true);
+ hContact = CreateContact(uid, 0, 0, false);
LookupUID(uid);
}
- char smsg[1024];
- if(msg.get_string("msg", smsg, 1024)) {
- ParseStatusMessage(hContact, smsg);
- }
+ PipedStringList l = msg.get_list("msg");
+ ParseStatusMessage(hContact, l);
}
} else if(msg.get_int("bm") == 121) { // action message
int uid = msg.get_int("f");
@@ -472,7 +472,7 @@ void __cdecl ServerThreadFunc(void*) {
strip_tags(text);
decode_smileys(text);
- unentitize_msg(text);
+ unentitize_xml(text);
PROTORECVEVENT pre = {0};
pre.flags = PREF_UTF;
@@ -505,10 +505,8 @@ void __cdecl ServerThreadFunc(void*) {
MYPROTOSEARCHRESULT mpsr = {sizeof(mpsr)};
if(body.get_string("UserName", nick, 256)) {
- unentitize_nick(nick);
mpsr.psr.nick = nick;
} else if(body.get_string("DisplayName", nick, 256)) {
- unentitize_nick(nick);
mpsr.psr.nick = nick;
}
if(body.get_string("Email", email, 256))
@@ -533,10 +531,8 @@ void __cdecl ServerThreadFunc(void*) {
MYPROTOSEARCHRESULT mpsr = {sizeof(mpsr)};
if(body.get_string("DisplayName", nick, 256)) {
- unentitize_nick(nick);
mpsr.psr.nick = nick;
} else if(body.get_string("UserName", nick, 256)) {
- unentitize_nick(nick);
mpsr.psr.nick = nick;
}
@@ -633,7 +629,6 @@ void __cdecl ServerThreadFunc(void*) {
int uid = body.get_int("ContactID");
if(uid != 0) {
if(body.get_string("NickName", nick, 256)) {
- unentitize_nick(nick);
DBWriteContactSettingStringUtf(0, MODULE, "Nick", nick);
}
}
@@ -721,10 +716,17 @@ void CALLBACK sttMainThreadStatusMessageCallback( ULONG dwParam ) {
if(status != ID_STATUS_OFFLINE) {
if(myspace_server_running && sesskey) {
// set status
+
ClientNetMessage msg_status;
msg_status.add_int("status", stat_mir_to_myspace(status));
msg_status.add_int("sesskey", sesskey);
- msg_status.add_string("statstring", msg ? msg : "");
+ if(msg && msg[0]) {
+ char buff[512];
+ strncpy(buff, msg, 512);
+ msg_status.add_string("statstring", buff);
+ } else {
+ msg_status.add_string("statstring", "");
+ }
msg_status.add_string("locstring", "");
SendMessage(msg_status);
} else {
diff --git a/MySpace/version.h b/MySpace/version.h
index c0a90b5..208e491 100644
--- a/MySpace/version.h
+++ b/MySpace/version.h
@@ -5,7 +5,7 @@
#define __MAJOR_VERSION 0
#define __MINOR_VERSION 0
#define __RELEASE_NUM 2
-#define __BUILD_NUM 0
+#define __BUILD_NUM 3
#define __FILEVERSION_STRING __MAJOR_VERSION,__MINOR_VERSION,__RELEASE_NUM,__BUILD_NUM
#define __FILEVERSION_STRING_DOTS __MAJOR_VERSION.__MINOR_VERSION.__RELEASE_NUM.__BUILD_NUM