本文整理汇总了C++中Url::getIdentity方法的典型用法代码示例。如果您正苦于以下问题:C++ Url::getIdentity方法的具体用法?C++ Url::getIdentity怎么用?C++ Url::getIdentity使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Url
的用法示例。
在下文中一共展示了Url::getIdentity方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: cursor
UtlBoolean
UserLocationDB::removeRow ( const Url& identityUri, const UtlString& location )
{
UtlBoolean rc = FALSE;
UtlString identityStr;
identityUri.getIdentity(identityStr);
if ( !identityStr.isNull() && (m_pFastDB != NULL) )
{
// Thread Local Storage
m_pFastDB->attach();
dbCursor< UserLocationRow > cursor(dbCursorForUpdate);
dbQuery query;
query="identity=",identityStr,"and location=",location;
if ( cursor.select( query ) > 0 )
{
cursor.removeAllSelected();
rc = TRUE;
}
// Commit rows to memory - multiprocess workaround
m_pFastDB->detach(0);
}
return rc;
}
示例2: handleNotifyMessage
/// Non-static callback to handle incoming NOTIFYs.
void SipDialogMonitor::handleNotifyMessage(const SipMessage* notifyMessage,
const char* earlyDialogHandle,
const char* dialogHandle)
{
Url fromUrl;
notifyMessage->getFromUrl(fromUrl);
UtlString contact;
fromUrl.getIdentity(contact);
OsSysLog::add(FAC_SIP, PRI_DEBUG, "SipDialogMonitor::handleNotifyMessage receiving a notify message from %s",
contact.data());
const HttpBody* notifyBody = notifyMessage->getBody();
if (notifyBody)
{
UtlString messageContent;
ssize_t bodyLength;
notifyBody->getBytes(&messageContent, &bodyLength);
// Parse the content and store it in a SipDialogEvent object
SipDialogEvent* sipDialogEvent = new SipDialogEvent(messageContent);
// Add the SipDialogEvent object to the hash table
addDialogEvent(contact, sipDialogEvent, earlyDialogHandle, dialogHandle);
}
else
{
OsSysLog::add(FAC_SIP, PRI_WARNING,
"SipDialogMonitor::handleNotifyMessage receiving an empty notify body from %s",
contact.data());
}
}
示例3:
UtlBoolean
RegistrationDB::isOutOfSequence( const Url& uri
,const UtlString& callid
,const int& cseq
) const
{
UtlBoolean isOlder;
UtlString identity;
uri.getIdentity( identity );
if ( !identity.isNull() && ( m_pFastDB != NULL) )
{
SMART_DB_ACCESS;
dbCursor< RegistrationRow > cursor;
dbQuery query;
query="np_identity=",identity,
" and callid=",callid,
" and cseq>=",cseq;
isOlder = ( cursor.select(query) > 0 );
}
else
{
OsSysLog::add( FAC_SIP, PRI_ERR,
"RegistrationDB::isOutOfSequence bad state @ %d %p"
,__LINE__, m_pFastDB
);
isOlder = TRUE; // will cause 500 Server Internal Error, which is true
}
return isOlder;
}
示例4: cursor
UtlBoolean
DialByNameDB::removeRow ( const Url& contact )
{
UtlBoolean removed = FALSE;
UtlString identity;
contact.getIdentity(identity);
if ( !identity.isNull() && (m_pFastDB != NULL) )
{
// Thread Local Storage
m_pFastDB->attach();
dbCursor< DialByNameRow > cursor(dbCursorForUpdate);
dbQuery query;
query="np_identity=",identity;
if ( cursor.select( query ) > 0 )
{
cursor.removeAllSelected();
removed = TRUE;
}
// Commit rows to memory - multiprocess workaround
m_pFastDB->detach(0);
}
return removed;
}
示例5: removeRows
void CredentialDB::removeRows (
const Url& uri,
const UtlString& realm )
{
UtlString identity;
uri.getIdentity(identity);
if ( !identity.isNull() && (m_pFastDB != NULL))
{
// Thread Local Storage
m_pFastDB->attach();
dbCursor< CredentialRow > cursor(dbCursorForUpdate);
dbQuery query;
query="np_identity=",identity,"and realm=",realm;
if (cursor.select(query) > 0)
{
cursor.removeAllSelected();
}
// Commit rows to memory - multiprocess workaround
m_pFastDB->detach(0);
// Table Data changed
SIPDBManager::getInstance()->
setDatabaseChangedFlag(mDatabaseName, TRUE);
}
}
示例6:
UtlBoolean
UserForwardDB::getCfwdTime (
const Url& identity,
UtlString& cfwdtime ) const
{
UtlString identityStr;
identity.getIdentity(identityStr);
UtlBoolean found = FALSE;
if ( !identityStr.isNull() && (m_pFastDB != NULL) )
{
// Thread Local Storage
m_pFastDB->attach();
// Match a all rows where the contact identity matches
dbQuery query;
query="identity=",identityStr;
// Search to see if we have a User Forward Row
dbCursor< UserForwardRow > cursor;
if ( cursor.select(query) > 0 )
{
cfwdtime = cursor->cfwdtime;
found = TRUE;
}
m_pFastDB->detach(0);
}
return found;
}
示例7: cursor
UtlBoolean
ExtensionDB::removeRow ( const Url& uri )
{
UtlBoolean removed = FALSE;
UtlString identity;
uri.getIdentity(identity);
if ( !identity.isNull() && (m_pFastDB != NULL) )
{
// Thread Local Storage
m_pFastDB->attach();
dbCursor< ExtensionRow > cursor(dbCursorForUpdate);
dbQuery query;
query="np_identity=",identity;
if ( cursor.select( query ) > 0 )
{
cursor.removeAllSelected();
removed = TRUE;
}
// Commit rows to memory - multiprocess workaround
m_pFastDB->detach(0);
// Table Data changed
SIPDBManager::getInstance()->
setDatabaseChangedFlag(mDatabaseName, TRUE);
}
return removed;
}
示例8: removeExtension
bool SipPresenceMonitor::removeExtension(UtlString& groupName, Url& contactUrl)
{
bool result = false;
mLock.acquire();
// Check whether the group has existed or not. If not, return false.
SipResourceList* list = dynamic_cast <SipResourceList *> (mMonitoredLists.findValue(&groupName));
if (list == NULL)
{
OsSysLog::add(FAC_SIP, PRI_DEBUG, "SipPresenceMonitor::removeExtension group %s does not exist",
groupName.data());
}
else
{
// Check whether the contact has existed or not
UtlString resourceId;
contactUrl.getIdentity(resourceId);
Resource* resource = list->getResource(resourceId);
if (resource)
{
resource = list->removeResource(resource);
delete resource;
result = true;
}
else
{
OsSysLog::add(FAC_LOG, PRI_WARNING,
"SipPresenceMonitor::removeExtension subscription for contact %s does not exists.",
resourceId.data());
}
}
mLock.release();
return result;
}
示例9:
UtlBoolean
PermissionDB::hasPermission (
const Url& identity,
const UtlString& permission ) const
{
UtlBoolean hasPermission = FALSE;
UtlString identityStr;
identity.getIdentity(identityStr);
if ( !permission.isNull() && (m_pFastDB != NULL) )
{
// Thread Local Storage
m_pFastDB->attach();
dbQuery query;
// Primary Key is the uriPermission's identity
query="identity=",identityStr,"and permission=", permission;
// Search to see if we have a Credential Row
dbCursor< PermissionRow > cursor;
if ( cursor.select(query) > 0 )
{
hasPermission = TRUE;
}
// Commit the rows to memory - multiprocess workaround
m_pFastDB->detach(0);
}
return hasPermission;
}
示例10: getDigitStrings
UtlBoolean
DialByNameDB::insertRow ( const Url& contact ) const
{
UtlBoolean result = FALSE;
if ( m_pFastDB != NULL )
{
// Fetch the display name
UtlString identity, displayName, contactString;
contact.getIdentity( identity );
contact.getDisplayName( displayName );
contact.toString( contactString );
// Make sure that the contact URL is valid and contains
// a contactIdentity and a contactDisplayName
if ( !identity.isNull() && !displayName.isNull() )
{
UtlSList dtmfStrings;
getDigitStrings ( displayName, dtmfStrings );
if ( !dtmfStrings.isEmpty() )
{
// Thread Local Storage
m_pFastDB->attach();
// Search for a matching row before deciding to update or insert
dbCursor< DialByNameRow > cursor(dbCursorForUpdate);
DialByNameRow row;
dbQuery query;
// Primary Key is identity
query="np_identity=",identity;
// Purge all existing entries associated with this identity
if ( cursor.select( query ) > 0 )
{
cursor.removeAllSelected();
}
// insert all dtmf combinations for this user
unsigned int i;
for (i=0; i<dtmfStrings.entries(); i++)
{
UtlString* digits = (UtlString*)dtmfStrings.at(i);
row.np_contact = contactString;
row.np_identity = identity;
row.np_digits = digits->data();
insert (row);
}
// Commit rows to memory - multiprocess workaround
m_pFastDB->detach(0);
}
}
}
return result;
}
示例11: telUri
RedirectPlugin::LookUpStatus
SipRedirectorPresenceRouting::doLookUp(
const Url& toUrl,
ContactList& contactList)
{
// check if we have unified presence info for this user
const UnifiedPresence* pUp;
UtlString to;
UtlString username;
toUrl.getIdentity( to );
toUrl.getUserId( username );
OsSysLog::add(FAC_SIP, PRI_INFO, "%s::LookUpStatus is looking up '%s'",
mLogName.data(),to.data() );
pUp = UnifiedPresenceContainer::getInstance()->lookup( &to );
if( pUp )
{
// unified presence data is available for the called party.
// Use it to make call routing decisions.
OsSysLog::add(FAC_SIP, PRI_INFO, "%s::LookUpStatus "
"Presence information for '%s':\r\n"
" Telephony presence: '%s'"
" XMPP presence: '%s'"
" Custom presence message: '%s'",
mLogName.data(),
to.data(), pUp->getSipState().data(),
pUp->getXmppPresence().data(),
pUp->getXmppStatusMessage().data() );
// look for tel uri in the custom presence message
RegEx telUri( TelUri );
telUri.Search( pUp->getXmppStatusMessage().data() );
UtlString targetUri;
if( telUri.MatchString( &targetUri, 1 ) )
{
// prepend 'sip:' and add target as contact
targetUri.insert( 0, "sip:" );
contactList.add( targetUri, *this );
}
else
{
// If user is busy then call goes directly to voicemail.
if( ( pUp->getSipState().compareTo("BUSY", UtlString::ignoreCase ) == 0 && mbForwardToVmOnBusy ) ||
( pUp->getXmppPresence().compareTo("BUSY", UtlString::ignoreCase ) == 0 && mUserPrefs.forwardToVoicemailOnDnd( username ) ) )
{
// prune all non-voicemail contacts from the list
removeNonVoicemailContacts( contactList );
}
}
}
return RedirectPlugin::SUCCESS;
}
示例12: UtlString
void
AliasDB::getAliases (
const Url& contactIdentity,
ResultSet& rResultSet ) const
{
UtlString contactIdentityStr;
contactIdentity.getIdentity(contactIdentityStr);
// This should erase the contents of the existing resultset
rResultSet.clear();
if ( !contactIdentityStr.isNull() && (m_pFastDB != NULL) )
{
// Thread Local Storage
m_pFastDB->attach();
// Match a all rows where the contact identity matches
UtlString queryString = "contact like '%" + contactIdentityStr + "%'";
dbQuery query;
query=queryString;
// Search to see if we have a Credential Row
dbCursor< AliasRow > cursor;
if ( cursor.select(query) > 0 )
{
do {
UtlHashMap record;
UtlString* identityValue =
new UtlString ( cursor->identity );
UtlString* contactValue =
new UtlString ( cursor->contact );
// Memory Leak fixes, make shallow copies of static keys
UtlString* identityKey = new UtlString( gIdentityKey );
UtlString* contactKey = new UtlString( gContactKey );
record.insertKeyAndValue (
identityKey, identityValue );
record.insertKeyAndValue (
contactKey, contactValue );
rResultSet.addValue(record);
} while ( cursor.next() );
}
// Commit the rows to memory - multiprocess workaround
m_pFastDB->detach(0);
}
}
示例13: addExtension
bool SipPresenceMonitor::addExtension(UtlString& groupName, Url& contactUrl)
{
bool result = false;
mLock.acquire();
// Check whether the group has already existed. If not, create one.
SipResourceList* list = dynamic_cast <SipResourceList *> (mMonitoredLists.findValue(&groupName));
if (list == NULL)
{
UtlString* listName = new UtlString(groupName);
list = new SipResourceList((UtlBoolean)TRUE, listName->data(), PRESENCE_EVENT_TYPE);
mMonitoredLists.insertKeyAndValue(listName, list);
OsSysLog::add(FAC_SIP, PRI_DEBUG, "SipPresenceMonitor::addExtension insert listName %s and object %p to the resource list",
groupName.data(), list);
}
// Check whether the contact has already been added to the group
UtlString resourceId;
contactUrl.getIdentity(resourceId);
Resource* resource = list->getResource(resourceId);
if (resource == NULL)
{
resource = new Resource(resourceId);
UtlString userName;
contactUrl.getDisplayName(userName);
resource->setName(userName);
UtlString id;
makeId(id, resourceId);
resource->setInstance(id, STATE_PENDING);
list->insertResource(resource);
result = true;
}
else
{
OsSysLog::add(FAC_LOG, PRI_WARNING,
"SipPresenceMonitor::addExtension contact %s already exists.",
resourceId.data());
}
int dummy;
list->buildBody(&dummy);
mLock.release();
return result;
}
示例14: removeExtension
bool SipDialogMonitor::removeExtension(UtlString& groupName, Url& contactUrl)
{
bool result = false;
mLock.acquire();
// Check whether the group has existed or not. If not, return false.
SipResourceList* list = dynamic_cast <SipResourceList *> (mMonitoredLists.findValue(&groupName));
if (list == NULL)
{
OsSysLog::add(FAC_SIP, PRI_DEBUG, "SipDialogMonitor::removeExtension group %s does not exist",
groupName.data());
}
else
{
// Check whether the contact has existed or not
UtlString resourceId;
contactUrl.getIdentity(resourceId);
Resource* resource = list->getResource(resourceId);
if (resource)
{
UtlString* dialogHandle = dynamic_cast <UtlString *> (mDialogHandleList.findValue(&resourceId));
OsSysLog::add(FAC_SIP, PRI_DEBUG,
"SipDialogMonitor::removeExtension Calling endSubscription(%s)",
dialogHandle->data());
UtlBoolean status = mpSipSubscribeClient->endSubscription(dialogHandle->data());
if (!status)
{
OsSysLog::add(FAC_SIP, PRI_ERR,
"SipDialogMonitor::removeExtension Unsubscription failed for %s.",
resourceId.data());
}
mDialogHandleList.destroy(&resourceId);
resource = list->removeResource(resource);
delete resource;
result = true;
}
else
{
OsSysLog::add(FAC_LOG, PRI_WARNING,
"SipDialogMonitor::removeExtension subscription for contact %s does not exists.",
resourceId.data());
}
}
mLock.release();
return result;
}
示例15: cursor
/// clean out any bindings for this callid and older cseq values.
void
RegistrationDB::expireOldBindings( const Url& uri
,const UtlString& callid
,const int& cseq
,const int& timeNow
,const UtlString& primary
,const Int64& update_number
)
{
UtlString identity;
uri.getIdentity(identity);
int expirationTime = timeNow-1;
if ( !identity.isNull() && ( m_pFastDB != NULL ) )
{
SMART_DB_ACCESS;
dbCursor< RegistrationRow > cursor(dbCursorForUpdate);
dbQuery query;
query="np_identity=",identity,
"and callid=",callid,
"and cseq<",cseq,
"and expires>=",expirationTime
;
if (cursor.select(query) > 0)
{
do
{
cursor->expires = expirationTime;
cursor->cseq = cseq;
cursor->primary = primary;
cursor->update_number = update_number;
cursor.update();
} while ( cursor.next() );
}
}
else
{
OsSysLog::add(FAC_DB, PRI_CRIT, "RegistrationDB::expireOldBindings failed - no DB");
}
}