Skip to content
Snippets Groups Projects
Commit 2714b07f authored by Tristan Matthews's avatar Tristan Matthews
Browse files

* #26825: presence: renamed ServerPresenceSub to presence_subscription

parent f225f9ff
No related branches found
No related tags found
No related merge requests found
...@@ -19,7 +19,7 @@ libsiplink_la_SOURCES = \ ...@@ -19,7 +19,7 @@ libsiplink_la_SOURCES = \
sipbuddy.h \ sipbuddy.h \
sipvoip_pres.cpp \ sipvoip_pres.cpp \
sipvoip_pres.h \ sipvoip_pres.h \
ServerPresenceSub.h presence_subscription.h
if BUILD_SDES if BUILD_SDES
libsiplink_la_SOURCES+= sdes_negotiator.cpp \ libsiplink_la_SOURCES+= sdes_negotiator.cpp \
......
/* /*
* File: ServerPresenceSub.h * File: PresenceSubscription.h
* Author: aol * Author: aol
* *
* Created on April 24, 2012, 10:13 AM * Created on April 24, 2012, 10:13 AM
...@@ -13,9 +13,9 @@ ...@@ -13,9 +13,9 @@
#include"pjsip-simple/presence.h" #include"pjsip-simple/presence.h"
class ServerPresenceSub { class PresenceSubscription {
public: public:
ServerPresenceSub(pjsip_evsub *evsub, char *r, std::string acc_Id, pjsip_dialog *d): PresenceSubscription(pjsip_evsub *evsub, char *r, std::string acc_Id, pjsip_dialog *d):
sub(evsub) sub(evsub)
, remote(r) , remote(r)
, accId(acc_Id) , accId(acc_Id)
...@@ -65,7 +65,7 @@ public: ...@@ -65,7 +65,7 @@ public:
friend pj_bool_t my_pres_on_rx_request(pjsip_rx_data *rdata); friend pj_bool_t my_pres_on_rx_request(pjsip_rx_data *rdata);
private: private:
NON_COPYABLE(ServerPresenceSub); NON_COPYABLE(PresenceSubscription);
pjsip_evsub *sub; /**< The evsub. */ pjsip_evsub *sub; /**< The evsub. */
char *remote; /**< Remote URI. */ char *remote; /**< Remote URI. */
std::string accId; /**< Account ID. */ std::string accId; /**< Account ID. */
......
...@@ -1214,25 +1214,25 @@ bool SIPAccount::isIP2IP() const ...@@ -1214,25 +1214,25 @@ bool SIPAccount::isIP2IP() const
* Presence Management for IP2IP accounts * Presence Management for IP2IP accounts
* *
* when the account receive a SUBSCRIBE from an IP account, * when the account receive a SUBSCRIBE from an IP account,
* a new ServerPresenceSub of this account is added to ServerPresenceSub list. * a new PresenceSubscription of this account is added to PresenceSubscription list.
* Then notifications can be send to each serverSubscriptions element * Then notifications can be send to each serverSubscriptions element
*/ */
/* Presence : Method used to add serverSubscription to ServerPresenceSub list in case of IP2IP accounts */ /* Presence : Method used to add serverSubscription to PresenceSubscription list in case of IP2IP accounts */
void SIPAccount::addServerSubscription(ServerPresenceSub *s) { void SIPAccount::addServerSubscription(PresenceSubscription *s) {
serverSubscriptions.push_back(s); serverSubscriptions.push_back(s);
DEBUG("server subscription added"); DEBUG("server subscription added");
} }
/* Presence : Method used to remove serverSubscription to ServerPresenceSub list in case of IP2IP accounts */ /* Presence : Method used to remove serverSubscription to PresenceSubscription list in case of IP2IP accounts */
void SIPAccount::removerServerSubscription(ServerPresenceSub *s) { void SIPAccount::removerServerSubscription(PresenceSubscription *s) {
serverSubscriptions.remove(s); serverSubscriptions.remove(s);
DEBUG("server subscription removed"); DEBUG("server subscription removed");
} }
/* Presence : Method used to notify each serverSubscription of a new presencein case of IP2IP accounts */ /* Presence : Method used to notify each serverSubscription of a new presencein case of IP2IP accounts */
void SIPAccount::notifyServers(const std::string &newPresenceStatus, const std::string &newChannelStatus) { void SIPAccount::notifyServers(const std::string &newPresenceStatus, const std::string &newChannelStatus) {
std::list< ServerPresenceSub *>::iterator serverIt; std::list< PresenceSubscription *>::iterator serverIt;
DEBUG("iterating through servers"); DEBUG("iterating through servers");
for (serverIt = serverSubscriptions.begin(); serverIt != serverSubscriptions.end(); serverIt++) for (serverIt = serverSubscriptions.begin(); serverIt != serverSubscriptions.end(); serverIt++)
(*serverIt)->notify(newPresenceStatus, newChannelStatus); (*serverIt)->notify(newPresenceStatus, newChannelStatus);
......
...@@ -43,7 +43,7 @@ ...@@ -43,7 +43,7 @@
#include "pjsip-ua/sip_regc.h" #include "pjsip-ua/sip_regc.h"
#include "noncopyable.h" #include "noncopyable.h"
#include "ServerPresenceSub.h" #include "presence_subscription.h"
typedef std::vector<pj_ssl_cipher> CipherArray; typedef std::vector<pj_ssl_cipher> CipherArray;
namespace Conf { namespace Conf {
...@@ -518,8 +518,8 @@ class SIPAccount : public Account { ...@@ -518,8 +518,8 @@ class SIPAccount : public Account {
//void addBuddy(const std::string &uri, bool subscribe); //void addBuddy(const std::string &uri, bool subscribe);
//void removeBuddy(const std::string &uri); //void removeBuddy(const std::string &uri);
void addServerSubscription(ServerPresenceSub *s); void addServerSubscription(PresenceSubscription *s);
void removerServerSubscription(ServerPresenceSub *s); void removerServerSubscription(PresenceSubscription *s);
void notifyServers(const std::string &newPresenceStatus, const std::string &newChannelStatus); void notifyServers(const std::string &newPresenceStatus, const std::string &newChannelStatus);
private: private:
NON_COPYABLE(SIPAccount); NON_COPYABLE(SIPAccount);
...@@ -772,7 +772,7 @@ class SIPAccount : public Account { ...@@ -772,7 +772,7 @@ class SIPAccount : public Account {
/** /**
* Server subscription (added by ELOI) * Server subscription (added by ELOI)
*/ */
std::list< ServerPresenceSub *> serverSubscriptions; std::list< PresenceSubscription *> serverSubscriptions;
}; };
......
...@@ -67,16 +67,16 @@ void pres_evsub_on_srv_state(pjsip_evsub *sub, pjsip_event *event) { ...@@ -67,16 +67,16 @@ void pres_evsub_on_srv_state(pjsip_evsub *sub, pjsip_event *event) {
std::string accountId = "IP2IP";/* ebail : this code is only used for IP2IP accounts */ std::string accountId = "IP2IP";/* ebail : this code is only used for IP2IP accounts */
SIPAccount *acc = Manager::instance().getSipAccount(accountId); SIPAccount *acc = Manager::instance().getSipAccount(accountId);
PJ_UNUSED_ARG(event); PJ_UNUSED_ARG(event);
ServerPresenceSub *server; PresenceSubscription *presenceSub;
// PJSUA_LOCK(); /* ebail : FIXME figure out if locking is necessary or not */ // PJSUA_LOCK(); /* ebail : FIXME figure out if locking is necessary or not */
server = (ServerPresenceSub *) pjsip_evsub_get_mod_data(sub, presenceSub = (PresenceSubscription *) pjsip_evsub_get_mod_data(sub,
((SIPVoIPLink*) (acc->getVoIPLink()))->getModId() /*my_mod_pres.id*/); ((SIPVoIPLink*) (acc->getVoIPLink()))->getModId() /*my_mod_pres.id*/);
WARN("Server subscription to %s is %s", server->remote, pjsip_evsub_get_state_name(sub)); WARN("Presence subscription to %s is %s", presenceSub->remote, pjsip_evsub_get_state_name(sub));
if (server) { if (presenceSub) {
pjsip_evsub_state state; pjsip_evsub_state state;
WARN("Server subscription to %s is %s", server->remote, pjsip_evsub_get_state_name(sub)); WARN("Server subscription to %s is %s", presenceSub->remote, pjsip_evsub_get_state_name(sub));
state = pjsip_evsub_get_state(sub); state = pjsip_evsub_get_state(sub);
...@@ -184,7 +184,7 @@ pj_bool_t my_pres_on_rx_request(pjsip_rx_data *rdata) { ...@@ -184,7 +184,7 @@ pj_bool_t my_pres_on_rx_request(pjsip_rx_data *rdata) {
status = pjsip_uri_print(PJSIP_URI_IN_REQ_URI, dlg->remote.info->uri, remote, PJSIP_MAX_URL_SIZE); status = pjsip_uri_print(PJSIP_URI_IN_REQ_URI, dlg->remote.info->uri, remote, PJSIP_MAX_URL_SIZE);
pjsip_uri_print(PJSIP_URI_IN_CONTACT_HDR, dlg->local.info->uri, contact.ptr, PJSIP_MAX_URL_SIZE); pjsip_uri_print(PJSIP_URI_IN_CONTACT_HDR, dlg->local.info->uri, contact.ptr, PJSIP_MAX_URL_SIZE);
ServerPresenceSub *serverSub = new ServerPresenceSub(sub, remote, accountId, dlg); PresenceSubscription *presenceSub = new PresenceSubscription(sub, remote, accountId, dlg);
if (status < 1) if (status < 1)
pj_ansi_strcpy(remote, "<-- url is too long-->"); pj_ansi_strcpy(remote, "<-- url is too long-->");
...@@ -193,16 +193,16 @@ pj_bool_t my_pres_on_rx_request(pjsip_rx_data *rdata) { ...@@ -193,16 +193,16 @@ pj_bool_t my_pres_on_rx_request(pjsip_rx_data *rdata) {
// pjsip_evsub_add_header(sub, &acc->cfg.sub_hdr_list); // pjsip_evsub_add_header(sub, &acc->cfg.sub_hdr_list);
int modId = ((SIPVoIPLink*) (acc->getVoIPLink()))->getModId(); int modId = ((SIPVoIPLink*) (acc->getVoIPLink()))->getModId();
pjsip_evsub_set_mod_data(sub, modId/*my_mod_pres.id*/, serverSub); pjsip_evsub_set_mod_data(sub, modId/*my_mod_pres.id*/, presenceSub);
acc->addServerSubscription(serverSub); acc->addServerSubscription(presenceSub);
/* Add server subscription to the list: */ /* Add server subscription to the list: */
// pj_list_push_back(&pjsua_var.acc[acc_id].pres_srv_list, uapres); // pj_list_push_back(&pjsua_var.acc[acc_id].pres_srv_list, uapres);
/* Capture the value of Expires header. */ /* Capture the value of Expires header. */
expires_hdr = (pjsip_expires_hdr*) pjsip_msg_find_hdr(rdata->msg_info.msg, PJSIP_H_EXPIRES, NULL); expires_hdr = (pjsip_expires_hdr*) pjsip_msg_find_hdr(rdata->msg_info.msg, PJSIP_H_EXPIRES, NULL);
if (expires_hdr) if (expires_hdr)
serverSub->setExpires(expires_hdr->ivalue); presenceSub->setExpires(expires_hdr->ivalue);
else else
serverSub->setExpires(-1); presenceSub->setExpires(-1);
st_code = (pjsip_status_code) 200; st_code = (pjsip_status_code) 200;
reason = pj_str("OK"); reason = pj_str("OK");
...@@ -250,7 +250,7 @@ pj_bool_t my_pres_on_rx_request(pjsip_rx_data *rdata) { ...@@ -250,7 +250,7 @@ pj_bool_t my_pres_on_rx_request(pjsip_rx_data *rdata) {
pjsip_pres_set_status(sub, &pres_status); pjsip_pres_set_status(sub, &pres_status);
ev_state = PJSIP_EVSUB_STATE_ACTIVE; ev_state = PJSIP_EVSUB_STATE_ACTIVE;
if (serverSub->expires == 0) if (presenceSub->expires == 0)
ev_state = PJSIP_EVSUB_STATE_TERMINATED; ev_state = PJSIP_EVSUB_STATE_TERMINATED;
/* Create and send the NOTIFY to active subscription: */ /* Create and send the NOTIFY to active subscription: */
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment