Ejemplo n.º 1
0
SipLine* SipLineList::getLineByUserId(const UtlString& userId) const
{
   SipLine* pLine = NULL;

   if (!userId.isNull())
   {
      UtlHashMapIterator itor(m_lineMap);
      UtlContainable* pKey = NULL;

      while ((pKey = itor()) != NULL)
      {
         pLine = dynamic_cast<SipLine*>(itor.value());
         if (pLine && !pLine->getUserId().compareTo(userId))
         {
            return pLine;
         }
      }
   }

   return NULL;
}
Ejemplo n.º 2
0
//
// Priorities:
//   1. Matches first lineUri
//   2. Matches line alias
//   3. Matches first userId
//
SipLine* SipLineList::findLine(const Url& lineUri,
                               const UtlString& userId,
                               UtlBoolean bConsiderAliases) const
{
   // firt lookup by lineUri and/or alias
   SipLine* pLine = getLine(lineUri, bConsiderAliases);
   if (pLine)
   {
      return pLine;
   }
   else
   {
      // not found, try userId
      if (!userId.isNull())
      {
         // only search by userId if its not empty
         UtlHashMapIterator itor(m_lineMap);
         UtlContainable* pKey = NULL;

         while ((pKey = itor()) != NULL)
         {
            pLine = dynamic_cast<SipLine*>(itor.value());
            if (pLine)
            {
               if (pLine->getUserId().compareTo(userId, UtlString::ignoreCase) == 0)
               {
                  return pLine;
               }
            }
         }
      }
   }

   // is NULL if nothing was found
   return NULL;
}