summaryrefslogtreecommitdiff
path: root/protocols
diff options
context:
space:
mode:
authorGeorge Hazan <ghazan@miranda.im>2019-01-18 21:13:56 +0300
committerGeorge Hazan <ghazan@miranda.im>2019-01-18 21:14:08 +0300
commit501fd1fbff6afc11bb0368b82b4a8d9451bee5f3 (patch)
treeb866920cd6602debae44b8c7834a949557482ee7 /protocols
parent9f151b736b37b9aba43b14b39afb28563e5a3231 (diff)
we don't need PSR_URL as well
Diffstat (limited to 'protocols')
-rw-r--r--protocols/EmLanProto/src/amdproto.cpp5
-rw-r--r--protocols/EmLanProto/src/mlan.cpp31
-rw-r--r--protocols/EmLanProto/src/mlan.h1
-rw-r--r--protocols/ICQCorp/src/protocol.cpp46
-rw-r--r--protocols/ICQCorp/src/protocol.h1
-rw-r--r--protocols/ICQCorp/src/services.cpp40
6 files changed, 7 insertions, 117 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
diff --git a/protocols/ICQCorp/src/protocol.cpp b/protocols/ICQCorp/src/protocol.cpp
index cfc2675148..6252029fad 100644
--- a/protocols/ICQCorp/src/protocol.cpp
+++ b/protocols/ICQCorp/src/protocol.cpp
@@ -857,11 +857,6 @@ void ICQ::processSystemMessage(Packet &packet, unsigned long checkUin, unsigned
addMessage(u, message, timeSent);
break;
- case ICQ_CMDxRCV_SYSxURL:
- Netlib_Logf(hNetlibUser, "url through server from %d\n", checkUin);
- addUrl(u, message, timeSent);
- break;
-
case ICQ_CMDxRCV_SYSxBROADCAST:
Netlib_Logf(hNetlibUser, "broadcast message from %d\n", checkUin);
@@ -1789,15 +1784,6 @@ void ICQ::processTcpPacket(Packet &packet, unsigned int hSocket)
>> cicqVersion;
break;
- case ICQ_CMDxTCP_URL: // url sent
- Netlib_Logf(hNetlibUser, "[tcp] url from %d.\n", checkUin);
-
- packet >> theTCPSequence;
-
- ackTCP(packet, u, newCommand, theTCPSequence);
- addUrl(u, message, time(0));
- break;
-
case ICQ_CMDxTCP_FILE:
unsigned int size;
char *fileName;
@@ -2089,38 +2075,6 @@ void ICQ::addMessage(ICQUser *u, char *m, time_t t)
///////////////////////////////////////////////////////////////////////////////
-void ICQ::addUrl(ICQUser *u, char *m, time_t t)
-{
- unsigned int i, messageLen;
- char *url;
-
- messageLen = (int)mir_strlen(m);
- for (i = 0; i < messageLen; i++)
- if (m[i] == -2) // 0xFE
- m[i] = 0;
-
- url = new char[messageLen + 1];
- lstrcpyA(url, m + mir_strlen(m) + 1);
- lstrcpyA(url + mir_strlen(url) + 1, m);
-
- PROTORECVEVENT pre;
- pre.flags = 0;
- pre.timestamp = t;
- pre.szMessage = url;
- pre.lParam = 0;
-
- CCSDATA ccs;
- ccs.hContact = u->hContact;
- ccs.szProtoService = PSR_URL;
- ccs.wParam = 0;
- ccs.lParam = (LPARAM)&pre;
- Proto_ChainRecv(0, &ccs);
-
- delete[] url;
-}
-
-///////////////////////////////////////////////////////////////////////////////
-
void ICQ::addAwayMsg(ICQUser *u, char *m, unsigned long theSequence, time_t t)
{
Netlib_Logf(hNetlibUser, "away msg: %s\n", m);
diff --git a/protocols/ICQCorp/src/protocol.h b/protocols/ICQCorp/src/protocol.h
index 9374f77d01..ba75de163b 100644
--- a/protocols/ICQCorp/src/protocol.h
+++ b/protocols/ICQCorp/src/protocol.h
@@ -185,7 +185,6 @@ public:
void recvTransferTCP(SOCKET hSocket);
void addMessage(ICQUser *u, char *m, time_t t);
- void addUrl(ICQUser *u, char *m, time_t t);
void addAwayMsg(ICQUser *u, char *m, unsigned long theSequence, time_t t);
void addFileReq(ICQUser *u, char *m, char *filename, unsigned long size, unsigned long theSequence, time_t t);
void doneUserFcn(bool ack, ICQEvent *icqEvent);
diff --git a/protocols/ICQCorp/src/services.cpp b/protocols/ICQCorp/src/services.cpp
index 850bb8173f..11f444c53b 100644
--- a/protocols/ICQCorp/src/services.cpp
+++ b/protocols/ICQCorp/src/services.cpp
@@ -209,44 +209,6 @@ static INT_PTR icqRecvMessage(WPARAM, LPARAM lParam)
///////////////////////////////////////////////////////////////////////////////
-static INT_PTR icqSendUrl(WPARAM, LPARAM lParam)
-{
- Netlib_Logf(hNetlibUser, "[ ] send url\n");
-
- CCSDATA *ccs = (CCSDATA *)lParam;
- ICQUser *u = icq.getUserByContact(ccs->hContact);
- if (u == nullptr || icq.statusVal <= ID_STATUS_OFFLINE)
- return 0;
-
- ICQEvent *icqEvent = icq.sendUrl(u, (char*)ccs->lParam);
- return icqEvent ? icqEvent->sequence : 0;
-}
-
-///////////////////////////////////////////////////////////////////////////////
-
-static INT_PTR icqRecvUrl(WPARAM, LPARAM lParam)
-{
- Netlib_Logf(hNetlibUser, "[ ] receive url\n");
-
- CCSDATA *ccs = (CCSDATA*)lParam;
- PROTORECVEVENT *pre = (PROTORECVEVENT*)ccs->lParam;
- db_unset(ccs->hContact, "CList", "Hidden");
-
- char *pszDescr = pre->szMessage + mir_strlen(pre->szMessage) + 1;
-
- DBEVENTINFO dbei = {};
- dbei.szModule = protoName;
- dbei.timestamp = pre->timestamp;
- dbei.flags = pre->flags & (PREF_CREATEREAD ? DBEF_READ : 0);
- dbei.eventType = EVENTTYPE_URL;
- dbei.cbBlob = (DWORD)(mir_strlen(pre->szMessage) + mir_strlen(pszDescr) + 2);
- dbei.pBlob = (PBYTE)pre->szMessage;
- db_event_add(ccs->hContact, &dbei);
- return 0;
-}
-
-///////////////////////////////////////////////////////////////////////////////
-
static INT_PTR icqSetAwayMsg(WPARAM, LPARAM lParam)
{
Netlib_Logf(hNetlibUser, "[ ] set away msg\n");
@@ -504,7 +466,6 @@ int LoadServices()
CreateProtoServiceFunction(protoName, PSS_GETINFO, icqGetInfo);
CreateProtoServiceFunction(protoName, PSS_MESSAGE, icqSendMessage);
- CreateProtoServiceFunction(protoName, PSS_URL, icqSendUrl);
CreateProtoServiceFunction(protoName, PSS_GETAWAYMSG, icqGetAwayMsg);
CreateProtoServiceFunction(protoName, PSS_FILE, icqSendFile);
CreateProtoServiceFunction(protoName, PSS_FILEALLOW, icqFileAllow);
@@ -513,7 +474,6 @@ int LoadServices()
CreateProtoServiceFunction(protoName, PSS_SETAPPARENTMODE, icqSetApparentMode);
CreateProtoServiceFunction(protoName, PSR_MESSAGE, icqRecvMessage);
- CreateProtoServiceFunction(protoName, PSR_URL, icqRecvUrl);
CreateProtoServiceFunction(protoName, PSR_AWAYMSG, icqRecvAwayMsg);
CreateProtoServiceFunction(protoName, PSR_FILE, icqRecvFile);
return 0;