# SkypeKit Class Events

Events are represented as virtual methods of the SkypeKit classes. To get events, you will need to derive a child class and override corresponding OnXXX event callbacks.

    void MySkype::OnConversationListChange (
      const ConversationRef & conversation,
      const Conversation::LIST_TYPE & type,
      const bool & added)
    {
        if ((added) && (type == Conversation::ALL_CONVERSATIONS))
        {
            // new conversation has been created
        };
    };

Aside from events, you can monitor value changes of class properties. For this you need to override the OnChange(int prop) method. Note that the callback is per-class, not per-property, i.e. all property updates will land in this single callback.

    void MyAccount::OnChange(int prop)
    {
        if (prop == Account::P_STATUS)
        {
            Account::STATUS loginStatus;
            this->GetPropStatus(loginStatus);
            if (loginStatus == Account::LOGGED_IN)
            {
                // Success!
            };
        };
    };

It is important to know that not everything that happens in the SkypeKit runtime gets propagated to the wrapper, as events. To minimize IPC traffic between runtime and wrapper, individual objects need to be "subscribed" to events (and property updates). To subscribe an object, you will need to either call a method of that particular object instance or access one of its properties. After that, you should start receiving events to that object.

Alternatively you can call SEObject::fetch() method, to make sure the object is subscribed.

For lists of objects, you can use the global fetch(SEObject::Refs) function to subscribe an entire list of references.

    Conversation::Refs inbox;
    skype->GetConversationList(inbox, Conversation::INBOX_CONVERSATIONS);
    fetch(inbox);

NB! Because of wrapper memory management, you will need to keep alive at least one xxxRef reference, to every object that you wish to keep getting events for. Otherwise, garbage collection is likely to remove that object from the object cache and no more events will fire for that object.

All Classes Files Functions Variables Typedefs Enumerations Enumerator Friends Defines

(c) Skype Technologies S.A. Confidential/Proprietary

Last updated: Fri Mar 16 2012