Crise

Plugin API

34 posts in this topic

Perhaps make a plugin that gives stats to a vista gadget is that a good or bad idea ?

Vista Gadget API

Well I haven't looked into it much, but as the gadget api is markup language and jscript only it would need a way to access the plugin to get the information required and after quick look up I see no gadget access to stuff such as SendMessage or FindWindow etc. that would allow direct communication with application components...

Share this post


Link to post
Share on other sites

Well hubsofts seldom do anything for one single client :)

Besides before I start to do anything extreme, I want to know if there is any need fir this.

Oh and just for the fun of it, here is something for you guys to look at...

Share this post


Link to post
Share on other sites

Hello all!

I like to use ApexDC++, because it's very light, simply and easy to use!

And want to thank all of the developers!

I have a question about plugin API.

I'm trying to write a plugin which send private message to user when he/she start to Upload something from me.

So, I have question: is there something like QUEUE_ADD for HOOK_QUEUE, but for Upload, not Download?

For example:


Bool DCAPI pluginProc(uint32_t eventId, dcptr_t pData) {

  switch(eventId) {

    /* default actions */

    case ON_INSTALL:

    case ON_LOAD:

      return onLoad(eventId, (DCCorePtr)pData);

    case ON_UNINSTALL:

    case ON_UNLOAD:

      return onUnload(eventId);


    case QUEUE_ADD_UPLOAD: /* <-- I need this action to hook! */

      BASE_HUB_SEND_PM(dcpp, ((UserDataPtr)pData)->object, "Hello world!", TRUE);

      return True;


    default: return False;

  }

}

Thanks in advance.

Share this post


Link to post
Share on other sites

No there isn't... but if there was it would be very unlikely that what you'd work with was UserData.

What would you want it for exactly anyways? And if it is for blocking uploads, that is a) not really something we want to encourage and B) already possible for a plugin to do, although it's a rather roundabout way.

Share this post


Link to post
Share on other sites

Thank you for your answer!

No there isn't... but if there was it would be very unlikely that what you'd work with was UserData.
Oh, I see. Is there any chance that something like this would be added in future releases?

What would you want it for exactly anyways? And if it is for blocking uploads, that is a) not really something we want to encourage and B) already possible for a plugin to do, although it's a rather roundabout way.
No-no-no. It's not for blocking uploads.

The basic idea behind all of this: if someone trying to download something from me he / she recieve message about HTTP site where you can find description, screenshots and other infromation related to this files.

Algorithm (what I'm try to achieve):

1) Send message to user when he / she start uploading something.

2) Add user and current datetime to list.

3) If user not in list or time difference between now and datetime from list for current user more than 24 hours - user recieve this message again and list updated with current datetime.

4) Optionally user can send private command and this message won't be shown anymore.

Share this post


Link to post
Share on other sites

No there isn't... but if there was it would be very unlikely that what you'd work with was UserData.
Okey, I got it and download latest source code for plugins.

From old source:

BASE_HUB_SEND_PM(dcpp, user->object, result.c_str(), thirdPerson);
From latest (1.3.6):
BASE_HUB_SEND_PM(dcpp, ((UserDataPtr)cmd->object)->object, result.c_str(), thirdPerson)
1) What is structure of UserData->object? From "PluginDefs.h" - it's just a pointer:
dcptr_t object;
dcptr_t declared as:
typedef void *hookHandle, *dcptr_t, *subsHandle;

2) Can I fill this structure manually and what I need if can?

If there is no API for algorithm from my post above - I can try to get current userlist with WinAPI, but only username and it's hard as hell to use EnumWindows() / SendMessage() to do that...

Any suggestions?

Thanks in advance.

Share this post


Link to post
Share on other sites

The object members of various structs the plugins use have no meaning to the plugin itself, they are just something the node that implements a certain callback function uses.

In other words they can be thought of as handles of sorts that the underlying implementation uses. The only exception being the object member of CommandData which is (as noted in PluginDefs.h) is either UserData or ClientData.

So to answer your question, to fill f.ex. UserData on your own is impossible.

So right now what you want to do is, while not impossible, extremely hard... because there is no API for querying users (mainly because a user cam go offline at any time yet and the plugin would not know about it).

I am very much aware that there is much room for improvement with the API still but there are number of factors that make making certain additions to the API difficult.

Share this post


Link to post
Share on other sites

So right now what you want to do is, while not impossible, extremely hard...

Thank you for answering!

So, I think, there is only one way to do it now: full emulation through WinAPI user's action, like selecting user, "Send private command" and etc.

Share this post


Link to post
Share on other sites