QIP Home QIP Forum

Go Back   QIP Forum > English > Plugins and tools > Infium Plugin API

Infium Plugin API Developing your own QIP plugins.

Reply
 
Thread Tools Display Modes
Old 29.12.2010, 07:43   #1
Loftek
QIP Newcomer
 
Join Date: 12/2010
Posts: 1
Question C++ Enumerate Contactlist and get valid "Protocol Handle"

Hello there.

*little info*
I'm using the C++ port of QIP SDK version 1.9 with Visual Studio 2010 on Windows7 x64.
On this machine runs QIP 2010 v.4444 where i use my plugin.
The other machine runs QIP Infium 9032 to test with (no plugins there).


I can sucessfully log incoming messages.
I can also sucessfully "reply" after i got a message.
I do this with sending a PM_PLUGIN_SEND_IM message and use reinterpret_cast<TQipMsgPlugin*>(PlugMsg->WParam)->ProtoDll after PM_PLUGIN_MSG_RCVD msg.

I noticed, that the int value of "ProtoDll" is alawys 100001 for QIP.ru accounts
and always 100003 for ICQ accounts. (i only use those two)

When i received a message, i can reply with that "ProtoDll" from anywhere, anytime (inside code i mean).
So only one message is enough to be able to send back as many messages as i want.

This is no option for me. since i want to be able to "start" the conversation too.

So i tried to enumerate my contactlist via PM_PLUGIN_GET_CL_SNAPSHOT.
AddElement(const TProtoSnapshotElement* Contact) gets called for all of my test accounts. (2 persons with one qip+icq account each)


Here is a result of those two persons: (1st person=aaaa/1111111, 2nd person=bbbb/2222222. don't wanna post realperson data)

AddElement TProtoSnapshotElement:
ProtoName: aaaa@qip.ru
ProtoAccount: aaaa@qip.ru
ProtoHandle: 110958116
Enabled: 161

AddElement TProtoSnapshotElement:
ProtoName: bbbb@qip.ru
ProtoAccount: bbbb
ProtoHandle: 110958116
Enabled: 161

AddElement TProtoSnapshotElement:
ProtoName: 111111111
ProtoAccount: aaaa
ProtoHandle: 110956820
Enabled: 163

AddElement TProtoSnapshotElement:
ProtoName: 222222222
ProtoAccount: bbbb
ProtoHandle: 110956820
Enabled: 163

(i got the names from google-translated qip wiki)

As you can see, the ProtoHandle is totally different.
And those are always different when i send PM_PLUGIN_GET_CL_SNAPSHOT again.
But they are the same for the same accounttype (ICQ, QIP)
also notice the "Enabled". doesn't looke like a simple true/false to me like wiki says.
and also stays same accountwise (ICQ->163, QIP->161), even after PM_PLUGIN_GET_CL_SNAPSHOT send again.


so i can't use those ProtoHandles for sending messages to those contacts.



Could it be, that i don't understand the concept of PM_PLUGIN_GET_CL_SNAPSHOT?
(i also think PM_PLUGIN_GET_CL_SNAPSHOT should enumerate in AddElement(const TSnapshotElement* Contact) and not like mentioned above in AddElement(const TProtoSnapshotElement* Contact). also tried with message 81 which isnt in c++ sdk yet. delphi source says it's PM_PLUGIN_PROTOS_SNAPSHOT, which enumerates in AddElement(const TSnapshotElement* Contact), but then i only get my accounts (QIP, ICQ and "Stub" which looks something from QIP.ru too...)


Anybody out there who can help on that subject please?
Maybe it isn't possible to send like i want via plugin (yet) ?

It's a bit hard for me to explain my problem in english (i speak german), but i will try to answer better and/or more into detail if something isn't clear.

Thanks in advance.



# Edit 1 #

looks like the ICLSnapshot class got the order of the virtual functions wrong.

Code:
class ICLSnapshot : public IUnknown
{
    virtual HRESULT __stdcall AddElement(const TProtoSnapshotElement* Contact) = 0; //return S_OK if succesfull, otherwise the core will stop enumeration  		
    virtual HRESULT __stdcall AddElement(const TSnapshotElement* Contact) = 0; //return S_OK if succesfull, otherwise the core will stop enumeration  
};


using that will correctly reflect the contacts when sending PM_PLUGIN_GET_CL_SNAPSHOT:

AddElement TSnapshotElement:
AccountName: aaaa@qip.ru
ContactName: aaaa@qip.ru
GroupName: LOLK
ProtoHandle: 100001
Status: 0x01
IsChatContact: 0

AddElement TSnapshotElement:
AccountName: bbbb@qip.ru
ContactName: bbbb
GroupName: LOLK
ProtoHandle: 100001
Status: 0x0d
IsChatContact: 0

AddElement TSnapshotElement:
AccountName: 111111111
ContactName: aaaa
GroupName: LOLK
ProtoHandle: 100003
Status: 0x01
IsChatContact: 0

AddElement TSnapshotElement:
AccountName: 222222222
ContactName: bbbb
GroupName: LOLK
ProtoHandle: 100003
Status: 0x0d
IsChatContact: 0

those values now are all correct. and i can easily build a contactlist inside my plugin.

Additional note:
I noticed, if i open a chat window (without actually sending a message), i am able to send messages from my plugin. only PM_PLUGIN_CAN_ADD_BTNS gets sent from core.

While this isn't a optimum, i can use that as a temporary solution.

You are welcome to give me a hint if you know what is going wrong.
I'll keep you informed if i find more information.

Greetings

Last edited by Loftek; 29.12.2010 at 19:35. Reason: BUG? partially solved: virtual functions in class ICLSnapshot mixed up
Loftek вне форума   Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +4. The time now is 07:48.


Powered by vBulletin.
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.
©2004 - 2012 QIP.RU