Exemplo n.º 1
0
/** Delete a mapping for a dialog handle.
 */
void ResourceListSet::deleteNotifyMapping(const UtlString* dialogHandle)
{
   // See comment in addNotifyMapping for why we have two entries, one for
   // the dialog handle and one for the swapped dialog handle.
   UtlString swappedDialogHandle;
   swapTags(*dialogHandle, swappedDialogHandle);

   Os::Logger::instance().log(FAC_RLS, PRI_DEBUG,
                 "ResourceListSet::deleteNotifyMapping this = %p, dialogHandle = '%s', swappedDialogHandle = '%s'",
                 this, dialogHandle->data(), swappedDialogHandle.data());

   // We have to get a pointer to the key objects, as our caller won't
   // free them.  Otherwise, we could use UtlHashMap::remove().
   // We own the key objects and have to delete them, but we don't own
   // the value objects, and so don't delete them.
   UtlContainable* value;
   UtlContainable* keyString = mNotifyMap.removeKeyAndValue(dialogHandle, value);
   if (keyString)
   {
      // Delete the key object.
      delete keyString;
   }
   keyString = mNotifyMap.removeKeyAndValue(&swappedDialogHandle, value);
   if (keyString)
   {
      // Delete the swapped key object.
      delete keyString;
   }
}
Exemplo n.º 2
0
/** Delete a mapping for a dialog handle.
 */
void AppearanceGroupSet::deleteNotifyMapping(const UtlString* dialogHandle)
{
    // See comment in addNotifyMapping for why we do this.
    UtlString swappedDialogHandle;
    swapTags(*dialogHandle, swappedDialogHandle);

    OsSysLog::add(FAC_SAA, PRI_DEBUG,
                  "AppearanceGroupSet::deleteNotifyMapping this = %p, dialogHandle = '%s', swappedDialogHandle = '%s'",
                  this, dialogHandle->data(), swappedDialogHandle.data());

    // Delete the un-swapped mapping.
    UtlContainable* value;
    UtlContainable* keyString = mNotifyMap.removeKeyAndValue(dialogHandle, value);
    if (keyString)
    {
        // Delete the key object.
        delete keyString;
    }

    // Delete the swapped mapping.
    keyString = mNotifyMap.removeKeyAndValue(&swappedDialogHandle, value);
    if (keyString)
    {
        // Delete the key object.
        delete keyString;
    }
}
Exemplo n.º 3
0
/** Add a mapping for a dialog handle to its handler for
 *  NOTIFY events.
 */
void ResourceListSet::addNotifyMapping(const UtlString& dialogHandle,
                                       UtlContainable* handler)
{
   /* The machinery surrounding dialog handles is broken in that it
    * does not keep straight which tag is local and which is remote,
    * and the order of the tags in dialogHandle is not consistent.
    * Ideally, we would fix the problem (XSL-146), but there are many
    * places in the code where it is sloppy about tracking whether a
    * message is incoming or outgoing when constructing a
    * dialogHandle.  We circumvent this by making the lookup of
    * dialogs by dialogHandle insensitive to reversing the tags.  (See
    * SipDialog::isSameDialog.)
    */

   // If we already have a different mapping, report an error, as this
   // addNotifyMapping() should be a duplicate of the mapping we
   // already have.
   UtlContainable* current_handler = mNotifyMap.find(&dialogHandle);
   if (current_handler)
   {
      if (current_handler != handler)
      {
      Os::Logger::instance().log(FAC_RLS, PRI_ERR,
                    "ResourceListSet::addNotifyMapping Adding a different handler for an existing mapping: dialogHandle = '%s', current handler = %p, new handler = %p",
                    dialogHandle.data(), current_handler, handler);
      }
      // Remove the previous mapping in preparation for the new mapping.
      deleteNotifyMapping(&dialogHandle);
   }

   // Construct our copies of the dialog handle and the swapped dialog handle.
   UtlString* dialogHandleP = new UtlString(dialogHandle);
   UtlString* swappedDialogHandleP = new UtlString;
   swapTags(dialogHandle, *swappedDialogHandleP);

   Os::Logger::instance().log(FAC_RLS, PRI_DEBUG,
                 "ResourceListSet::addNotifyMapping this = %p, dialogHandle = '%s', swappedDialogHandle = '%s', handler = %p",
                 this,
                 dialogHandleP->data(), swappedDialogHandleP->data(),
                 handler);

   // Make entries in mNotifyMap for both forms of the handle.
   mNotifyMap.insertKeyAndValue(dialogHandleP, handler);
   mNotifyMap.insertKeyAndValue(swappedDialogHandleP, handler);
}
Exemplo n.º 4
0
/** Add a mapping for a dialog handle to its handler for
 *  NOTIFY events.
 */
void AppearanceGroupSet::addNotifyMapping(const UtlString* d,
        UtlContainable* handler)
{
    /* The machinery surrounding dialog handles is broken in that it
     * does not keep straight which tag is local and which is remote,
     * and the dialogHandle for notifyEventCallback has the tags
     * reversed relative to the tags in the dialogHandle for
     * subscriptionEventCallback.  So we reverse the tags in dialogHandle
     * before inserting it into mNotifyMap, to match what
     * notifyEventCallback will receive.  Yuck.  Ideally, we would fix
     * the problem (XSL-146), but there are many places in the code
     * where it is sloppy about tracking whether a message is incoming
     * or outgoing when constructing a dialogHandle, and this is
     * circumvented by making the lookup of dialogs by dialogHandle
     * insensitive to reversing the tags.  (See SipDialog::isSameDialog.)
     */
    /* Correction:  Sometimes the NOTIFY tags are reversed, and
     * sometimes they aren't.  So we have to file both handles in
     * mNotifyMap.  Yuck.
     */
    if ( mNotifyMap.findValue(d) )
    {
        OsSysLog::add(FAC_SAA, PRI_DEBUG,
                      "AppearanceGroupSet::addNotifyMapping already exists for this = %p, dialogHandle = '%s', handler = %p",
                      this, d->data(),
                      handler);
        return;
    }
    UtlString* dialogHandle = new UtlString(*d);
    mNotifyMap.insertKeyAndValue(dialogHandle, handler);

    UtlString* swappedDialogHandleP = new UtlString;
    swapTags(*dialogHandle, *swappedDialogHandleP);

    OsSysLog::add(FAC_SAA, PRI_DEBUG,
                  "AppearanceGroupSet::addNotifyMapping this = %p, dialogHandle = '%s', swappedDialogHandle = '%s', handler = %p",
                  this, dialogHandle->data(), swappedDialogHandleP->data(),
                  handler);

    // Note that we have allocated *swappedDialogHandleP.  Our caller
    // owns *dialogHandle and will deallocate it after calling
    // deleteNotifyMapping, but deleteNotify must remember to deallocate
    // *swappedDialogHandleP, the key object in mNotifyMap.  Yuck.
    mNotifyMap.insertKeyAndValue(swappedDialogHandleP, handler);
}