Ring Daemon 16.0.0
Loading...
Searching...
No Matches
pres_sub_server.h
Go to the documentation of this file.
1/*
2 * Copyright (C) 2004-2025 Savoir-faire Linux Inc.
3 *
4 * This program is free software: you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation, either version 3 of the License, or
7 * (at your option) any later version.
8 *
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
13 *
14 * You should have received a copy of the GNU General Public License
15 * along with this program. If not, see <https://www.gnu.org/licenses/>.
16 */
17
18#ifndef SERVERPRESENCESUB_H
19#define SERVERPRESENCESUB_H
20
21#include <pj/string.h>
22#include <pjsip/sip_types.h>
23#include <pjsip-simple/evsub.h>
24#include <pjsip-simple/presence.h>
25#include <pjsip/sip_module.h>
26
27#include "noncopyable.h"
28
29namespace jami {
30
32
33class SIPPresence;
34
36{
37public:
40 /*
41 * Access to the evsub expire variable.
42 * It was received in the SUBSCRIBE request.
43 */
44 void setExpires(int ms);
45 int getExpires() const;
46 /*
47 * Match method
48 * s is the URI (remote)
49 */
50 bool matches(const char* s) const;
51 /*
52 * Allow the subscriber for being notified.
53 */
54 void approve(bool flag);
55 /*
56 * Notify subscriber with the pres_status_date of the account
57 */
58 void notify();
59
61
62private:
63 static pj_bool_t pres_on_rx_subscribe_request(pjsip_rx_data* rdata);
64 static void pres_evsub_on_srv_state(pjsip_evsub* sub, pjsip_event* event);
65
67 /* TODO: add '< >' to URI for consistency */
68 const char* remote_;
69 SIPPresence* pres_;
70 pjsip_evsub* sub_;
71 pjsip_dialog* dlg_;
72 int expires_;
73 bool approved_;
74};
75
76} // namespace jami
77
78#endif /* SERVERPRESENCESUB_H */
void approve(bool flag)
static pjsip_module mod_presence_server
bool matches(const char *s) const
void emitSignal(Args... args)
Definition ring_signal.h:64
pj_bool_t pres_on_rx_subscribe_request(pjsip_rx_data *rdata)
Simple macro to hide class' copy constructor and assignment operator.
#define NON_COPYABLE(ClassName)
Definition noncopyable.h:30