diff options
-rw-r--r-- | include/delphi/m_protosvc.inc | 18 | ||||
-rw-r--r-- | include/m_protosvc.h | 5 | ||||
-rw-r--r-- | plugins/NewsAggregator/Src/CheckFeed.cpp | 4 | ||||
-rw-r--r-- | protocols/AimOscar/src/server.cpp | 3 | ||||
-rw-r--r-- | protocols/EmLanProto/src/mlan.cpp | 7 | ||||
-rw-r--r-- | protocols/IRCG/src/commandmonitor.cpp | 2 | ||||
-rw-r--r-- | protocols/IcqOscarJ/src/fam_02location.cpp | 3 | ||||
-rw-r--r-- | protocols/IcqOscarJ/src/fam_13servclist.cpp | 3 | ||||
-rw-r--r-- | protocols/MSN/src/msn_commands.cpp | 2 | ||||
-rw-r--r-- | protocols/Skype/src/skype_contacts.cpp | 2 | ||||
-rw-r--r-- | protocols/Skype/src/skype_messages.cpp | 2 | ||||
-rw-r--r-- | protocols/Tlen/src/tlen_thread.cpp | 12 | ||||
-rw-r--r-- | protocols/Twitter/src/connection.cpp | 2 | ||||
-rw-r--r-- | protocols/Yahoo/src/im.cpp | 2 | ||||
-rw-r--r-- | src/modules/protocols/protocols.cpp | 11 |
15 files changed, 41 insertions, 37 deletions
diff --git a/include/delphi/m_protosvc.inc b/include/delphi/m_protosvc.inc index 549a10f08e..bb085ad00c 100644 --- a/include/delphi/m_protosvc.inc +++ b/include/delphi/m_protosvc.inc @@ -27,9 +27,9 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. ******************************************
Only new style protocols (Miranda 0.9+) with m_iVersion set to 2 or higher
-support Unicode services documented below, all other support only ANSI.
+support Unicode services documented below, all other support only ANSI.
-For all other that do not support Unicode services, Miranda core will
+For all other that do not support Unicode services, Miranda core will
convert Unicode to ANSI and call the appropriate service.
}
@@ -223,10 +223,12 @@ type PPROTORECVEVENT = ^TPROTORECVEVENT;
TPROTORECVEVENT = record
- flags : DWORD;
- timestamp: DWORD;
- szMessage: TChar;
- lParam : LPARAM;
+ flags : DWORD;
+ timestamp : DWORD;
+ szMessage : TChar;
+ lParam : LPARAM;
+ customInfo: Pointer;
+ customSize: DWORD;
end;
PPROTORECVFILE = ^TPROTORECVFILE;
@@ -594,7 +596,7 @@ const Asks protocol for the status message for a status
wParam=(WORD) 0 for current status or a status id
lParam=SGMA_xxx
- Returns status msg or NULL if there is none. The protocol have to handle only the current
+ Returns status msg or NULL if there is none. The protocol have to handle only the current
status. Handling messages for other statuses is optional.
Remember to mir_free the return value
}
@@ -968,7 +970,7 @@ const userNick should be a human-readable description of the user. It need not
be the nick, or even confined to displaying just one type of
information. The dbe.flags can contain DBEF_UTF defining userNick as
- utf-8 encoded.
+ utf-8 encoded.
userId should be a machine-readable representation of the unique
protocol identifying field of the user. Because of the need to be
zero-terminated, binary data should be converted to text.
diff --git a/include/m_protosvc.h b/include/m_protosvc.h index beb469a83c..304d9e4f9f 100644 --- a/include/m_protosvc.h +++ b/include/m_protosvc.h @@ -720,9 +720,12 @@ typedef struct { TCHAR *tszMessage;
};
LPARAM lParam; //extra space for the network level protocol module
+ void *pCustomData;
+ DWORD cbCustomDataSize;
} PROTORECVEVENT;
+
#define PREF_CREATEREAD 1 //create the database event with the 'read' flag set
-#define PREF_UNICODE 2
+#define PREF_UNICODE 2
#define PREF_RTL 4 // 0.5+ addition: support for right-to-left messages
#define PREF_UTF 8 // message is in utf-8 (0.7.0+)
diff --git a/plugins/NewsAggregator/Src/CheckFeed.cpp b/plugins/NewsAggregator/Src/CheckFeed.cpp index b0286357ce..eef9ba2b79 100644 --- a/plugins/NewsAggregator/Src/CheckFeed.cpp +++ b/plugins/NewsAggregator/Src/CheckFeed.cpp @@ -334,7 +334,7 @@ VOID CheckCurrentFeed(HANDLE hContact) }
if (!MesExist) {
- PROTORECVEVENT recv;
+ PROTORECVEVENT recv = { 0 };
recv.flags = PREF_TCHAR;
recv.timestamp = stamp;
recv.tszMessage = message;
@@ -579,7 +579,7 @@ VOID CheckCurrentFeed(HANDLE hContact) }
if (!MesExist) {
- PROTORECVEVENT recv;
+ PROTORECVEVENT recv = { 0 };
recv.flags = PREF_TCHAR;
recv.timestamp = stamp;
recv.tszMessage = message;
diff --git a/protocols/AimOscar/src/server.cpp b/protocols/AimOscar/src/server.cpp index 9359813aba..3988e342fa 100644 --- a/protocols/AimOscar/src/server.cpp +++ b/protocols/AimOscar/src/server.cpp @@ -1315,11 +1315,10 @@ void CAimProto::snac_received_message(SNAC &snac,HANDLE hServerConn,unsigned sho // Okay we are setting up the structure to give the message back to miranda's core
CallService(MS_PROTO_CONTACTISTYPING, (WPARAM)hMsgContact, 0);
{
- PROTORECVEVENT pre;
+ PROTORECVEVENT pre = { 0 };
pre.flags = PREF_UTF;
pre.timestamp = (is_offline) ? offline_timestamp : (DWORD)time(0);
pre.szMessage = msg_buf;
- pre.lParam = 0;
ProtoChainRecvMsg(hMsgContact, &pre);
}
diff --git a/protocols/EmLanProto/src/mlan.cpp b/protocols/EmLanProto/src/mlan.cpp index 01fe5a9c49..c899fd4121 100644 --- a/protocols/EmLanProto/src/mlan.cpp +++ b/protocols/EmLanProto/src/mlan.cpp @@ -342,11 +342,9 @@ void CMLan::OnRecvPacket(u_char* mes, int len, in_addr from) RequestStatus(true, cont->m_addr.S_un.S_addr);
else
{
- PROTORECVEVENT pre;
- pre.flags = 0;
+ PROTORECVEVENT pre = { 0 };
pre.timestamp = get_time();
pre.szMessage = pak.strMessage;
- pre.lParam = 0;
ProtoChainRecv( FindContact(cont->m_addr, cont->m_nick, true, false, false, cont->m_status),
pak.flIsUrl ? PSR_URL : PSR_MESSAGE, 0, (LPARAM)&pre );
@@ -367,8 +365,7 @@ void CMLan::OnRecvPacket(u_char* mes, int len, in_addr from) if (pak.strAwayMessage && cont)
{
- PROTORECVEVENT pre;
- pre.flags = 0;
+ PROTORECVEVENT pre = { 0 };
pre.timestamp = get_time();
pre.szMessage = pak.strAwayMessage;
pre.lParam = pak.idAckAwayMessage;
diff --git a/protocols/IRCG/src/commandmonitor.cpp b/protocols/IRCG/src/commandmonitor.cpp index 6873bc918c..a280009923 100644 --- a/protocols/IRCG/src/commandmonitor.cpp +++ b/protocols/IRCG/src/commandmonitor.cpp @@ -718,7 +718,7 @@ bool CIrcProto::OnIrc_PRIVMSG(const CIrcMessage* pmsg) HANDLE hContact = CList_AddContact(&user, false, true);
- PROTORECVEVENT pre;
+ PROTORECVEVENT pre = { 0 };
pre.timestamp = (DWORD)time(NULL);
pre.flags = PREF_UTF;
pre.szMessage = mir_utf8encodeW( mess.c_str());
diff --git a/protocols/IcqOscarJ/src/fam_02location.cpp b/protocols/IcqOscarJ/src/fam_02location.cpp index 5b3fcf07a2..1913681070 100644 --- a/protocols/IcqOscarJ/src/fam_02location.cpp +++ b/protocols/IcqOscarJ/src/fam_02location.cpp @@ -278,8 +278,7 @@ void CIcqProto::handleLocationUserInfoReply(BYTE* buf, WORD wLen, DWORD dwCookie disposeChain(&pChain);
}
- PROTORECVEVENT pre;
- pre.flags = 0;
+ PROTORECVEVENT pre = { 0 };
pre.szMessage = szMsg ? szMsg : (char *)"";
pre.timestamp = time(NULL);
pre.lParam = dwCookie;
diff --git a/protocols/IcqOscarJ/src/fam_13servclist.cpp b/protocols/IcqOscarJ/src/fam_13servclist.cpp index e451e63ffc..ee848c5e0f 100644 --- a/protocols/IcqOscarJ/src/fam_13servclist.cpp +++ b/protocols/IcqOscarJ/src/fam_13servclist.cpp @@ -1634,8 +1634,7 @@ void CIcqProto::handleRecvAuthRequest(unsigned char *buf, WORD wLen) HANDLE hContact = HContactFromUID(dwUin, szUid, &bAdded);
- PROTORECVEVENT pre;
- pre.flags = 0;
+ PROTORECVEVENT pre = { 0 };
pre.timestamp = time(NULL);
pre.lParam = sizeof(DWORD) + sizeof(HANDLE) + 5;
// Prepare reason
diff --git a/protocols/MSN/src/msn_commands.cpp b/protocols/MSN/src/msn_commands.cpp index 41d622b965..43d413a206 100644 --- a/protocols/MSN/src/msn_commands.cpp +++ b/protocols/MSN/src/msn_commands.cpp @@ -500,7 +500,7 @@ void CMsnProto::MSN_ReceiveMessage(ThreadData* info, char* cmdString, char* para {
CallService(MS_PROTO_CONTACTISTYPING, WPARAM(hContact), 0);
- PROTORECVEVENT pre;
+ PROTORECVEVENT pre = { 0 };
pre.szMessage = (char*)msgBody;
pre.flags = PREF_UTF + (isRtl ? PREF_RTL : 0);
pre.timestamp = (DWORD)time(NULL);
diff --git a/protocols/Skype/src/skype_contacts.cpp b/protocols/Skype/src/skype_contacts.cpp index 0f848d522f..72a518a80f 100644 --- a/protocols/Skype/src/skype_contacts.cpp +++ b/protocols/Skype/src/skype_contacts.cpp @@ -469,7 +469,7 @@ void CSkypeProto::OnContactsReceived(const ConversationRef &conversation, const message->GetPropGuid(guid);
ReadMessageParam param = { guid, messageType };
- PROTORECVEVENT pre;
+ PROTORECVEVENT pre = { 0 };
pre.flags = PREF_UTF;
pre.lParam = (LPARAM)¶m;
pre.timestamp = timestamp;
diff --git a/protocols/Skype/src/skype_messages.cpp b/protocols/Skype/src/skype_messages.cpp index 93d8f71f49..d0e4ea81da 100644 --- a/protocols/Skype/src/skype_messages.cpp +++ b/protocols/Skype/src/skype_messages.cpp @@ -68,7 +68,7 @@ void CSkypeProto::OnMessageReceived(const ConversationRef &conversation, const M if (status != CMessage::UNCONSUMED_NORMAL)
flags |= PREF_CREATEREAD;
- PROTORECVEVENT recv;
+ PROTORECVEVENT recv = { 0 };
recv.flags = flags;
recv.lParam = (LPARAM)¶m;
recv.timestamp = timestamp;
diff --git a/protocols/Tlen/src/tlen_thread.cpp b/protocols/Tlen/src/tlen_thread.cpp index f9fe2ef01e..a08f3763a8 100644 --- a/protocols/Tlen/src/tlen_thread.cpp +++ b/protocols/Tlen/src/tlen_thread.cpp @@ -586,7 +586,6 @@ static void TlenProcessAvatar(XmlNode* node, ThreadData *info) static void TlenProcessMessage(XmlNode *node, ThreadData *info)
{
HANDLE hContact;
- PROTORECVEVENT recv;
XmlNode *bodyNode, *subjectNode, *xNode, *n;
char *from, *type, *nick, *p, *localMessage, *idStr;
DWORD msgTime;
@@ -703,7 +702,7 @@ static void TlenProcessMessage(XmlNode *node, ThreadData *info) msgTime = time(NULL);
}
}
- recv.flags = 0;
+ PROTORECVEVENT recv = { 0 };
recv.timestamp = (DWORD) msgTime;
recv.szMessage = localMessage;
recv.lParam = 0;
@@ -952,7 +951,6 @@ static void TlenProcessIq(XmlNode *node, ThreadData *info) static void TlenProcessW(XmlNode *node, ThreadData *info)
{
HANDLE hContact;
- PROTORECVEVENT recv;
char *f, *e, *s, *body;
char *str, *localMessage;
int strSize;
@@ -984,10 +982,9 @@ static void TlenProcessW(XmlNode *node, ThreadData *info) localMessage = TlenTextDecode(str);
- recv.flags = 0;
+ PROTORECVEVENT recv = { 0 };
recv.timestamp = (DWORD) time(NULL);
recv.szMessage = localMessage;
- recv.lParam = 0;
ProtoChainRecvMsg(hContact, &recv);
mir_free(localMessage);
@@ -1001,7 +998,6 @@ static void TlenProcessW(XmlNode *node, ThreadData *info) static void TlenProcessM(XmlNode *node, ThreadData *info)
{
HANDLE hContact;
- PROTORECVEVENT recv;
char *f;//, *from;//username
char *tp;//typing start/stop
char *p, *n, *r, *s, *str, *localMessage;
@@ -1071,10 +1067,10 @@ static void TlenProcessM(XmlNode *node, ThreadData *info) db_set_b(hContact, info->proto->m_szModuleName, "bChat", TRUE);
mir_free(str);
localMessage = TlenTextDecode(bNode->text);
- recv.flags = 0;
+
+ PROTORECVEVENT recv = { 0 };
recv.timestamp = (DWORD) timestamp;
recv.szMessage = localMessage;
- recv.lParam = 0;
ProtoChainRecvMsg(hContact, &recv);
mir_free(localMessage);
} else {
diff --git a/protocols/Twitter/src/connection.cpp b/protocols/Twitter/src/connection.cpp index 623975696d..bad727f993 100644 --- a/protocols/Twitter/src/connection.cpp +++ b/protocols/Twitter/src/connection.cpp @@ -622,7 +622,7 @@ void TwitterProto::UpdateMessages(bool pre_read) {
HANDLE hContact = AddToClientList(i->username.c_str(),"");
- PROTORECVEVENT recv = {};
+ PROTORECVEVENT recv = { 0 };
recv.flags = PREF_UTF;
if(pre_read)
recv.flags |= PREF_CREATEREAD;
diff --git a/protocols/Yahoo/src/im.cpp b/protocols/Yahoo/src/im.cpp index 5fc8f536e0..08ab726172 100644 --- a/protocols/Yahoo/src/im.cpp +++ b/protocols/Yahoo/src/im.cpp @@ -104,7 +104,7 @@ void CYahooProto::ext_got_im(const char *me, const char *who, int protocol, cons //setWord(hContact, "yprotoid", protocol);
Set_Protocol(hContact, protocol);
- PROTORECVEVENT pre;
+ PROTORECVEVENT pre = { 0 };
pre.flags = (utf8) ? PREF_UTF : 0;
if (tm) {
diff --git a/src/modules/protocols/protocols.cpp b/src/modules/protocols/protocols.cpp index da68984d7c..efcd69ffba 100644 --- a/src/modules/protocols/protocols.cpp +++ b/src/modules/protocols/protocols.cpp @@ -149,6 +149,7 @@ static INT_PTR Proto_RecvMessage(WPARAM, LPARAM lParam) return NULL;
ptrA pszTemp;
+ mir_ptr<BYTE> pszBlob;
DBEVENTINFO dbei = { 0 };
dbei.cbSize = sizeof(dbei);
@@ -163,7 +164,15 @@ static INT_PTR Proto_RecvMessage(WPARAM, LPARAM lParam) }
else {
dbei.cbBlob = (DWORD)strlen(pre->szMessage) + 1;
- dbei.pBlob = (PBYTE) pre->szMessage;
+ dbei.pBlob = (PBYTE)pre->szMessage;
+ }
+
+ if (pre->cbCustomDataSize != 0) {
+ pszBlob = (PBYTE)mir_alloc(dbei.cbBlob + pre->cbCustomDataSize);
+ memcpy(pszBlob, dbei.pBlob, dbei.cbBlob);
+ memcpy((PBYTE)pszBlob + dbei.cbBlob, pre->pCustomData, pre->cbCustomDataSize);
+ dbei.pBlob = pszBlob;
+ dbei.cbBlob += pre->cbCustomDataSize;
}
if (pre->flags & PREF_CREATEREAD)
|