diff options
author | Piotr Piastucki <leech.miranda@gmail.com> | 2015-05-21 01:53:38 +0000 |
---|---|---|
committer | Piotr Piastucki <leech.miranda@gmail.com> | 2015-05-21 01:53:38 +0000 |
commit | fe2371ce9bc89d4673a46163715268e640d2ce31 (patch) | |
tree | 0966d1bb5d5bf706c1a2c08d54548eaa07a44b71 /protocols/MSN | |
parent | 1b673c9c170f595fdf9a0c34029451bbba3d4139 (diff) |
Fixed sending nudges.
git-svn-id: http://svn.miranda-ng.org/main/trunk@13727 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'protocols/MSN')
-rw-r--r-- | protocols/MSN/src/msn_commands.cpp | 12 | ||||
-rw-r--r-- | protocols/MSN/src/msn_global.h | 1 | ||||
-rw-r--r-- | protocols/MSN/src/msn_misc.cpp | 81 | ||||
-rw-r--r-- | protocols/MSN/src/msn_proto.cpp | 6 | ||||
-rw-r--r-- | protocols/MSN/src/msn_svcs.cpp | 10 | ||||
-rw-r--r-- | protocols/MSN/src/msn_threads.cpp | 3 |
6 files changed, 68 insertions, 45 deletions
diff --git a/protocols/MSN/src/msn_commands.cpp b/protocols/MSN/src/msn_commands.cpp index 6e12f8838a..cb0ad0a302 100644 --- a/protocols/MSN/src/msn_commands.cpp +++ b/protocols/MSN/src/msn_commands.cpp @@ -346,19 +346,22 @@ void CMsnProto::MSN_ReceiveMessage(ThreadData* info, char* cmdString, char* para }
}
else if (!_strnicmp(tContentType, "text/x-msnmsgr-datacast", 23)) {
- if (info->mJoinedContactsWLID.getCount()) {
+ //if (info->mJoinedContactsWLID.getCount()) {
MCONTACT tContact;
- if (info->mChatID[0]) {
+ if (mChatID[0]) {
GC_INFO gci = { 0 };
gci.Flags = GCF_HCONTACT;
gci.pszModule = m_szModuleName;
- gci.pszID = info->mChatID;
+ gci.pszID = mChatID;
CallServiceSync(MS_GC_GETINFO, 0, (LPARAM)&gci);
tContact = gci.hContact;
}
- else tContact = info->getContactHandle();
+ else tContact = MSN_HContactFromEmail(email, nick, true, true);
+ if (!strcmp(tHeader["Message-Type"], "Nudge"))
+ NotifyEventHooks(hMSNNudge, (WPARAM)tContact, 0);
+#ifdef OBSOLETE
MimeHeaders tFileInfo;
tFileInfo.readFromBuffer(msgBody);
@@ -377,6 +380,7 @@ void CMsnProto::MSN_ReceiveMessage(ThreadData* info, char* cmdString, char* para }
}
}
+#endif
}
else if (!_strnicmp(tContentType, "text/x-msmsgsemailnotification", 30))
sttNotificationMessage(msgBody, false);
diff --git a/protocols/MSN/src/msn_global.h b/protocols/MSN/src/msn_global.h index d60f62a1f3..59f8d78cd0 100644 --- a/protocols/MSN/src/msn_global.h +++ b/protocols/MSN/src/msn_global.h @@ -530,6 +530,7 @@ bool p2p_IsDlFileOk(filetransfer* ft); #define MSG_RTL 4
#define MSG_OFFLINE 8
#define MSG_CONTACT 16
+#define MSG_NUDGE 32
struct CMsnProto;
typedef void (__cdecl CMsnProto::*MsnThreadFunc)(void*);
diff --git a/protocols/MSN/src/msn_misc.cpp b/protocols/MSN/src/msn_misc.cpp index b34350ded7..385bd72697 100644 --- a/protocols/MSN/src/msn_misc.cpp +++ b/protocols/MSN/src/msn_misc.cpp @@ -433,44 +433,56 @@ int ThreadData::sendMessage(int msgType, const char* email, int netId, const cha CMStringA buf;
if ((parFlags & MSG_DISABLE_HDR) == 0) {
-
- char tFontName[100], tFontStyle[3];
+ char tFontName[100], tFontStyle[3], *pszMsgType, *pszContType;
DWORD tFontColor;
- strcpy(tFontName, "Arial");
+ if (parFlags & MSG_CONTACT) {
+ pszMsgType = "RichText/Contacts";
+ pszContType = "application/user+xml\r\nSkype-Age: 18";
+ *tFontName = 0;
+ } else if (parFlags & MSG_NUDGE) {
+ pszMsgType = "Nudge";
+ pszContType = "text/x-msnmsgr-datacast";
+ *tFontName = 0;
+ } else {
+ pszMsgType = "Text";
+ pszContType = "Text/plain; charset=UTF-8";
- if (proto->getByte("SendFontInfo", 1)) {
- char* p;
+ strcpy(tFontName, "Arial");
- DBVARIANT dbv;
- if (!db_get_s(NULL, "SRMsg", "Font0", &dbv)) {
- for (p = dbv.pszVal; *p; p++)
- if (BYTE(*p) >= 128 || *p < 32)
- break;
+ if (proto->getByte("SendFontInfo", 1)) {
+ char* p;
- if (*p == 0) {
- strncpy_s(tFontName, sizeof(tFontName), ptrA(mir_urlEncode(dbv.pszVal)), _TRUNCATE);
- db_free(&dbv);
+ DBVARIANT dbv;
+ if (!db_get_s(NULL, "SRMsg", "Font0", &dbv)) {
+ for (p = dbv.pszVal; *p; p++)
+ if (BYTE(*p) >= 128 || *p < 32)
+ break;
+
+ if (*p == 0) {
+ strncpy_s(tFontName, sizeof(tFontName), ptrA(mir_urlEncode(dbv.pszVal)), _TRUNCATE);
+ db_free(&dbv);
+ }
}
- }
- int tStyle = db_get_b(NULL, "SRMsg", "Font0Sty", 0);
- p = tFontStyle;
- if (tStyle & 1) *p++ = 'B';
- if (tStyle & 2) *p++ = 'I';
- *p = 0;
+ int tStyle = db_get_b(NULL, "SRMsg", "Font0Sty", 0);
+ p = tFontStyle;
+ if (tStyle & 1) *p++ = 'B';
+ if (tStyle & 2) *p++ = 'I';
+ *p = 0;
- tFontColor = db_get_dw(NULL, "SRMsg", "Font0Col", 0);
- }
- else {
- tFontColor = 0;
- tFontStyle[0] = 0;
- }
+ tFontColor = db_get_dw(NULL, "SRMsg", "Font0Col", 0);
+ }
+ else {
+ tFontColor = 0;
+ tFontStyle[0] = 0;
+ }
#ifdef OBSOLETE
- if (parFlags & MSG_OFFLINE)
- off += mir_snprintf((buf + off), (SIZEOF(buf) - off), "Dest-Agent: client\r\n");
+ if (parFlags & MSG_OFFLINE)
+ off += mir_snprintf((buf + off), (SIZEOF(buf) - off), "Dest-Agent: client\r\n");
#endif
+ }
char *pszNick=proto->MyOptions.szEmail;
DBVARIANT dbv;
@@ -490,15 +502,16 @@ int ThreadData::sendMessage(int msgType, const char* email, int netId, const cha "Message-Type: %s\r\n"
"IM-Display-Name: %s\r\n"
"Content-Type: %s\r\n"
- "Content-Length: %d\r\n"
- "X-MMS-IM-Format: FN=%s; EF=%s; CO=%x; CS=0; PF=31%s\r\n\r\n%s",
+ "Content-Length: %d\r\n",
msgid,
- (parFlags & MSG_CONTACT)?"RichText/Contacts":"Text",
+ pszMsgType,
pszNick,
- (parFlags & MSG_CONTACT)?"application/user+xml\r\nSkype-Age: 18":"Text/plain; charset=UTF-8",
- strlen(parMsg),
- tFontName, tFontStyle, tFontColor, (parFlags & MSG_RTL) ? ";RL=1" : "",
- parMsg);
+ pszContType,
+ strlen(parMsg));
+
+ if (*tFontName) buf.AppendFormat("X-MMS-IM-Format: FN=%s; EF=%s; CO=%x; CS=0; PF=31%s\r\n",
+ tFontName, tFontStyle, tFontColor, (parFlags & MSG_RTL) ? ";RL=1" : "");
+ buf.AppendFormat("\r\n%s", parMsg);
if (pszNick!=proto->MyOptions.szEmail) db_free(&dbv);
parMsg = buf;
diff --git a/protocols/MSN/src/msn_proto.cpp b/protocols/MSN/src/msn_proto.cpp index 8f63189efd..b026780ee8 100644 --- a/protocols/MSN/src/msn_proto.cpp +++ b/protocols/MSN/src/msn_proto.cpp @@ -71,12 +71,12 @@ CMsnProto::CMsnProto(const char* aProtoName, const TCHAR* aUserName) : CreateProtoService(PS_GET_LISTENINGTO, &CMsnProto::GetCurrentMedia);
CreateProtoService(PS_SET_LISTENINGTO, &CMsnProto::SetCurrentMedia);
- hMSNNudge = CreateProtoEvent("/Nudge");
- CreateProtoService(PS_SEND_NUDGE, &CMsnProto::SendNudge);
-
MsgQueue_Init();
#endif
+ hMSNNudge = CreateProtoEvent("/Nudge");
+ CreateProtoService(PS_SEND_NUDGE, &CMsnProto::SendNudge);
+
CreateProtoService(PS_GETUNREADEMAILCOUNT, &CMsnProto::GetUnreadEmailCount);
// event hooks
diff --git a/protocols/MSN/src/msn_svcs.cpp b/protocols/MSN/src/msn_svcs.cpp index 46cd62754a..1238f17b3f 100644 --- a/protocols/MSN/src/msn_svcs.cpp +++ b/protocols/MSN/src/msn_svcs.cpp @@ -240,7 +240,6 @@ INT_PTR CMsnProto::SetNickName(WPARAM wParam, LPARAM lParam) return 0;
}
-#ifdef OBSOLETE
/////////////////////////////////////////////////////////////////////////////////////////
// MsnSendNudge - Sending a nudge
@@ -251,12 +250,13 @@ INT_PTR CMsnProto::SendNudge(WPARAM hContact, LPARAM) char tEmail[MSN_MAX_EMAIL_LEN];
if (MSN_IsMeByContact(hContact, tEmail)) return 0;
+ int netId = Lists_GetNetId(tEmail);
+
+#ifdef OBSOLETE
static const char nudgemsg[] =
"Content-Type: text/x-msnmsgr-datacast\r\n\r\n"
"ID: 1\r\n\r\n";
- int netId = Lists_GetNetId(tEmail);
-
switch (netId) {
case NETID_UNKNOWN:
hContact = MSN_GetChatInernalHandle(hContact);
@@ -284,9 +284,13 @@ INT_PTR CMsnProto::SendNudge(WPARAM hContact, LPARAM) default:
break;
}
+#else
+ msnNsThread->sendMessage('3', tEmail, netId, "", MSG_NUDGE);
+#endif
return 0;
}
+#ifdef OBSOLETE
/////////////////////////////////////////////////////////////////////////////////////////
// GetCurrentMedia - get current media
diff --git a/protocols/MSN/src/msn_threads.cpp b/protocols/MSN/src/msn_threads.cpp index 3fffb806a4..beddeb94dd 100644 --- a/protocols/MSN/src/msn_threads.cpp +++ b/protocols/MSN/src/msn_threads.cpp @@ -264,6 +264,7 @@ void __cdecl CMsnProto::MSNServerThread(void* arg) LBL_Exit:
if (info->mIsMainThread) {
+ /*
if (!isConnectSuccess && !usingGateway && m_iDesiredStatus != ID_STATUS_OFFLINE) {
msnNsThread = NULL;
usingGateway = true;
@@ -274,7 +275,7 @@ LBL_Exit: newThread->startThread(&CMsnProto::MSNServerThread, this);
}
- else {
+ else*/ {
if (hKeepAliveThreadEvt) {
msnPingTimeout *= -1;
SetEvent(hKeepAliveThreadEvt);
|