diff options
author | George Hazan <ghazan@miranda.im> | 2019-01-18 21:13:56 +0300 |
---|---|---|
committer | George Hazan <ghazan@miranda.im> | 2019-01-18 21:14:08 +0300 |
commit | 501fd1fbff6afc11bb0368b82b4a8d9451bee5f3 (patch) | |
tree | b866920cd6602debae44b8c7834a949557482ee7 /protocols/EmLanProto/src | |
parent | 9f151b736b37b9aba43b14b39afb28563e5a3231 (diff) |
we don't need PSR_URL as well
Diffstat (limited to 'protocols/EmLanProto/src')
-rw-r--r-- | protocols/EmLanProto/src/amdproto.cpp | 5 | ||||
-rw-r--r-- | protocols/EmLanProto/src/mlan.cpp | 31 | ||||
-rw-r--r-- | protocols/EmLanProto/src/mlan.h | 1 |
3 files changed, 7 insertions, 30 deletions
diff --git a/protocols/EmLanProto/src/amdproto.cpp b/protocols/EmLanProto/src/amdproto.cpp index 99746894a0..f4e04fee8c 100644 --- a/protocols/EmLanProto/src/amdproto.cpp +++ b/protocols/EmLanProto/src/amdproto.cpp @@ -106,7 +106,7 @@ static INT_PTR __cdecl EMPSendMessage(WPARAM, LPARAM lParam) return g_lan->SendMessageUrl((CCSDATA*)lParam);
}
-static INT_PTR __cdecl EMPRecvMessageUrl(WPARAM, LPARAM lParam)
+static INT_PTR __cdecl EMPRecvMessage(WPARAM, LPARAM lParam)
{
g_lan->RecvMessageUrl((CCSDATA*)lParam);
return 0;
@@ -333,8 +333,7 @@ int CMPlugin::Load() CreateProtoServiceFunction(MODULENAME, PS_BASICSEARCH, EMPBasicSearch);
CreateProtoServiceFunction(MODULENAME, PS_ADDTOLIST, EMPAddToList);
CreateProtoServiceFunction(MODULENAME, PSS_MESSAGE, EMPSendMessage);
- CreateProtoServiceFunction(MODULENAME, PSR_MESSAGE, EMPRecvMessageUrl);
- CreateProtoServiceFunction(MODULENAME, PSR_URL, EMPRecvMessageUrl);
+ CreateProtoServiceFunction(MODULENAME, PSR_MESSAGE, EMPRecvMessage);
CreateProtoServiceFunction(MODULENAME, PSS_GETAWAYMSG, EMPGetAwayMsg);
CreateProtoServiceFunction(MODULENAME, PS_SETAWAYMSG, EMPSetAwayMsg);
CreateProtoServiceFunction(MODULENAME, PSR_AWAYMSG, EMPRecvAwayMessage);
diff --git a/protocols/EmLanProto/src/mlan.cpp b/protocols/EmLanProto/src/mlan.cpp index cf15c9f7e2..8663478667 100644 --- a/protocols/EmLanProto/src/mlan.cpp +++ b/protocols/EmLanProto/src/mlan.cpp @@ -295,13 +295,11 @@ void CMLan::OnRecvPacket(u_char *mes, int len, in_addr from) PROTORECVEVENT pre = { 0 }; pre.timestamp = get_time(); pre.szMessage = pak.strMessage; - ProtoChainRecv(FindContact(cont->m_addr, cont->m_nick, true, false, false, cont->m_status), - pak.flIsUrl ? PSR_URL : PSR_MESSAGE, 0, (LPARAM)&pre); + ProtoChainRecv(FindContact(cont->m_addr, cont->m_nick, true, false, false, cont->m_status), PSR_MESSAGE, 0, (LPARAM)&pre); TPacket npak; memset(&npak, 0, sizeof(npak)); npak.idAckMessage = pak.idMessage; - npak.flIsUrl = pak.flIsUrl; SendPacketExt(npak, from.S_un.S_addr); } } @@ -309,7 +307,7 @@ void CMLan::OnRecvPacket(u_char *mes, int len, in_addr from) if (pak.idAckMessage && cont) { MCONTACT hContact = FindContact(cont->m_addr, cont->m_nick, false, false, false); if (hContact) - ProtoBroadcastAck(MODULENAME, hContact, pak.flIsUrl ? ACKTYPE_URL : ACKTYPE_MESSAGE, ACKRESULT_SUCCESS, (HANDLE)pak.idAckMessage, 0); + ProtoBroadcastAck(MODULENAME, hContact, ACKTYPE_MESSAGE, ACKRESULT_SUCCESS, (HANDLE)pak.idAckMessage, 0); } if (pak.strAwayMessage && cont) { @@ -352,10 +350,7 @@ void CMLan::RecvMessageUrl(CCSDATA *ccs) ptrA szMessage(mir_utf8encode(pre->szMessage)); DBEVENTINFO dbei = {}; - if (!mir_strcmp(ccs->szProtoService, PSR_MESSAGE)) - dbei.eventType = EVENTTYPE_MESSAGE; - else - dbei.eventType = EVENTTYPE_URL; + dbei.eventType = EVENTTYPE_MESSAGE; dbei.szModule = MODULENAME; dbei.timestamp = pre->timestamp; dbei.flags = DBEF_UTF + ((pre->flags & PREF_CREATEREAD) ? DBEF_READ : 0); @@ -484,8 +479,6 @@ void CMLan::SendMessageExt(TDataHolder *hold) u_long addr = g_plugin.getDword(hold->hContact, "ipaddr"); pak.strMessage = mir_utf8decode(hold->msg, 0); pak.idMessage = hold->id; - if (hold->op == LEXT_SENDURL) - pak.flIsUrl = true; SendPacketExt(pak, addr); } delete hold; @@ -572,8 +565,6 @@ u_char* CMLan::CreatePacket(TPacket &pak, int *pBufLen) size_t mesLen = 0; if (pak.strMessage) { mesLen = mir_strlen(pak.strMessage); - if (pak.flIsUrl) - mesLen += 1 + mir_strlen(pak.strMessage + mesLen + 1); len += 3 + 1 + 4 + mesLen + 1; } @@ -624,10 +615,7 @@ u_char* CMLan::CreatePacket(TPacket &pak, int *pBufLen) *pb++ = 255; *((u_short*)pb) = 1 + 4 + (BYTE)mesLen + 1; pb += sizeof(u_short); - if (pak.flIsUrl) - *pb++ = MCODE_SND_URL; - else - *pb++ = MCODE_SND_MESSAGE; + *pb++ = MCODE_SND_MESSAGE; *((u_int*)pb) = pak.idMessage; pb += sizeof(u_int); if (mesLen) @@ -638,10 +626,7 @@ u_char* CMLan::CreatePacket(TPacket &pak, int *pBufLen) if (pak.idAckMessage) { *pb++ = 1 + 4; - if (pak.flIsUrl) - *pb++ = MCODE_ACK_URL; - else - *pb++ = MCODE_ACK_MESSAGE; + *pb++ = MCODE_ACK_MESSAGE; *((u_int*)pb) = pak.idAckMessage; pb += sizeof(u_int); } @@ -696,17 +681,11 @@ void CMLan::ParsePacket(TPacket& pak, u_char* buf, int len) case MCODE_REQ_STATUS: pak.flReqStatus = true; break; - case MCODE_SND_URL: - pak.flIsUrl = true; - // fall through case MCODE_SND_MESSAGE: pak.idMessage = *((u_int*)pb); pb += sizeof(u_int); pak.strMessage = (char*)pb; break; - case MCODE_ACK_URL: - pak.flIsUrl = true; - // fall through case MCODE_ACK_MESSAGE: pak.idAckMessage = *((u_int*)pb); //pb += sizeof(u_int); diff --git a/protocols/EmLanProto/src/mlan.h b/protocols/EmLanProto/src/mlan.h index 1af49fe6ce..74d2f41fe8 100644 --- a/protocols/EmLanProto/src/mlan.h +++ b/protocols/EmLanProto/src/mlan.h @@ -124,7 +124,6 @@ private: bool flReqStatus; // false means no request
char* strMessage; // NULL means no message
int idMessage;
- bool flIsUrl; // true if message is an URL
int idAckMessage; // 0 means no ack
int idReqAwayMessage; // 0 means no request
char* strAwayMessage; // NULL means no away message
|