summaryrefslogtreecommitdiff
path: root/plugins/TabSRMM/src
diff options
context:
space:
mode:
authorGeorge Hazan <george.hazan@gmail.com>2023-12-03 16:32:28 +0300
committerGeorge Hazan <george.hazan@gmail.com>2023-12-03 16:32:28 +0300
commit156262f08922cf65d9aff58257d623f7eab70f2f (patch)
treed91dcef2d51487bb32c8a218ecc816ed5115e265 /plugins/TabSRMM/src
parentdd1aac53b981fc57b3fc23ad25bdfd3ce8adc15f (diff)
SRMM: sending quoted event as PSS_MESSAGE parameter
Diffstat (limited to 'plugins/TabSRMM/src')
-rw-r--r--plugins/TabSRMM/src/generic_msghandlers.cpp2
-rw-r--r--plugins/TabSRMM/src/sendlater.cpp11
-rw-r--r--plugins/TabSRMM/src/sendlater.h2
-rw-r--r--plugins/TabSRMM/src/sendqueue.cpp9
-rw-r--r--plugins/TabSRMM/src/sendqueue.h1
5 files changed, 14 insertions, 11 deletions
diff --git a/plugins/TabSRMM/src/generic_msghandlers.cpp b/plugins/TabSRMM/src/generic_msghandlers.cpp
index f1182724f8..1fd5be9ee4 100644
--- a/plugins/TabSRMM/src/generic_msghandlers.cpp
+++ b/plugins/TabSRMM/src/generic_msghandlers.cpp
@@ -1187,7 +1187,7 @@ void CMsgDialog::DM_ErrorDetected(int type, int flag)
if (job->iSendId == 0 && job->hContact == 0)
break;
- job->iSendId = ProtoChainSend(job->hContact, PSS_MESSAGE, job->dwFlags, (LPARAM)job->szSendBuffer);
+ job->iSendId = ProtoChainSend(job->hContact, PSS_MESSAGE, job->hEvent, (LPARAM)job->szSendBuffer);
resent++;
}
diff --git a/plugins/TabSRMM/src/sendlater.cpp b/plugins/TabSRMM/src/sendlater.cpp
index 1e8614d1fd..110ec8ed24 100644
--- a/plugins/TabSRMM/src/sendlater.cpp
+++ b/plugins/TabSRMM/src/sendlater.cpp
@@ -54,6 +54,7 @@ struct CSendLaterJob : public MZeroedObject
char szId[20]; // database key name (time stamp of original send)
MCONTACT hContact; // original contact where the message has been assigned
MCONTACT hTargetContact; // *real* contact (can be different for metacontacts, e.g).
+ MEVENT hEvent;
HANDLE hProcess; // returned from the protocols sending service. needed to find it in the ACK handler
time_t created; // job was created at this time (important to kill jobs, that are too old)
time_t lastSent; // time at which the delivery was initiated. used to handle timeouts
@@ -125,7 +126,7 @@ struct CSendLaterJob : public MZeroedObject
iSendCount++;
hTargetContact = cc;
bCode = JOB_WAITACK;
- hProcess = (HANDLE)ProtoChainSend(cc, PSS_MESSAGE, 0, (LPARAM)sendBuffer);
+ hProcess = (HANDLE)ProtoChainSend(cc, PSS_MESSAGE, hEvent, (LPARAM)sendBuffer);
return 0;
}
@@ -649,10 +650,10 @@ bool SendLater::processCurrentJob()
static int _cdecl addStub(const char *szSetting, void *lParam)
{
- return(SendLater::addJob(szSetting, lParam));
+ return(SendLater::addJob(szSetting, INT_PTR(lParam), 0));
}
-static void processSingleContact(const MCONTACT hContact)
+static void processSingleContact(MCONTACT hContact)
{
int iCount = db_get_dw(hContact, "SendLater", "count", 0);
if (iCount)
@@ -680,9 +681,8 @@ void SendLater::processContacts()
// @param lParam: a contact handle for which the job should be scheduled
// @return 0 on failure, 1 otherwise
-int SendLater::addJob(const char *szSetting, void *lParam)
+int SendLater::addJob(const char *szSetting, MCONTACT hContact, MEVENT hEvent)
{
- MCONTACT hContact = (UINT_PTR)lParam;
DBVARIANT dbv = { 0 };
char *szOrig_Utf = nullptr;
@@ -716,6 +716,7 @@ int SendLater::addJob(const char *szSetting, void *lParam)
strncpy_s(job->szId, szSetting, _TRUNCATE);
job->szId[19] = 0;
job->hContact = hContact;
+ job->hEvent = hEvent;
job->created = atol(&szSetting[1]);
size_t iLen = mir_strlen(szOrig_Utf);
diff --git a/plugins/TabSRMM/src/sendlater.h b/plugins/TabSRMM/src/sendlater.h
index 5dc2a58df3..7374907bc5 100644
--- a/plugins/TabSRMM/src/sendlater.h
+++ b/plugins/TabSRMM/src/sendlater.h
@@ -55,7 +55,7 @@ namespace SendLater
bool processCurrentJob();
void processContacts();
void startJobListProcess();
- int addJob(const char *szSetting, void *lParam);
+ int addJob(const char *szSetting, MCONTACT, MEVENT);
void addContact(const MCONTACT hContact);
HANDLE processAck(const ACKDATA *ack);
diff --git a/plugins/TabSRMM/src/sendqueue.cpp b/plugins/TabSRMM/src/sendqueue.cpp
index 4f6c35a3cd..6028357c3c 100644
--- a/plugins/TabSRMM/src/sendqueue.cpp
+++ b/plugins/TabSRMM/src/sendqueue.cpp
@@ -151,7 +151,7 @@ static void DoSplitSendA(LPVOID param)
char savedChar = *szSaved;
*szSaved = 0;
- int id = ProtoChainSend(job->hContact, PSS_MESSAGE, job->dwFlags, (LPARAM)szTemp);
+ int id = ProtoChainSend(job->hContact, PSS_MESSAGE, job->hEvent, (LPARAM)szTemp);
if (!fFirstSend) {
job->iSendId = id;
fFirstSend = TRUE;
@@ -165,7 +165,7 @@ static void DoSplitSendA(LPVOID param)
}
}
else {
- int id = ProtoChainSend(job->hContact, PSS_MESSAGE, job->dwFlags, (LPARAM)szTemp);
+ int id = ProtoChainSend(job->hContact, PSS_MESSAGE, job->hEvent, (LPARAM)szTemp);
if (!fFirstSend) {
job->iSendId = id;
fFirstSend = TRUE;
@@ -244,6 +244,7 @@ int SendQueue::sendQueued(CMsgDialog *dat, const int iEntry)
goto send_unsplitted;
m_jobs[iEntry].hContact = ccActive->getActiveContact();
+ m_jobs[iEntry].hEvent = dat->m_hQuoteEvent;
m_jobs[iEntry].hOwnerWnd = hwndDlg;
m_jobs[iEntry].iStatus = SQ_INPROGRESS;
m_jobs[iEntry].iAcksNeeded = 1;
@@ -273,7 +274,7 @@ int SendQueue::sendQueued(CMsgDialog *dat, const int iEntry)
clearJob(iEntry);
return 0;
}
- m_jobs[iEntry].iSendId = ProtoChainSend(dat->m_hContact, PSS_MESSAGE, m_jobs[iEntry].dwFlags, (LPARAM)m_jobs[iEntry].szSendBuffer);
+ m_jobs[iEntry].iSendId = ProtoChainSend(dat->m_hContact, PSS_MESSAGE, m_jobs[iEntry].hEvent, (LPARAM)m_jobs[iEntry].szSendBuffer);
if (dat->m_sendMode & SMODE_NOACK) { // fake the ack if we are not interested in receiving real acks
ACKDATA ack = {};
@@ -590,7 +591,7 @@ int SendQueue::doSendLater(int iJobIndex, CMsgDialog *dat, MCONTACT hContact, bo
}
else {
mir_snprintf(tszMsg, required, "%s%s", utf_header.get(), job->szSendBuffer);
- SendLater::addJob(tszMsg, (void*)hContact);
+ SendLater::addJob(tszMsg, hContact, dat->m_hQuoteEvent);
}
mir_free(tszMsg);
diff --git a/plugins/TabSRMM/src/sendqueue.h b/plugins/TabSRMM/src/sendqueue.h
index b4dd4c5d11..ceba6c9f70 100644
--- a/plugins/TabSRMM/src/sendqueue.h
+++ b/plugins/TabSRMM/src/sendqueue.h
@@ -45,6 +45,7 @@ struct SendJob
size_t iSendLength; // length of message in utf-8 octets (used to check maxlen)
int sendCount;
MCONTACT hContact;
+ MEVENT hEvent;
HWND hOwnerWnd;
unsigned iStatus;
wchar_t* pwszErrorMsg;