forked from mirrors/linphone-iphone
fix(core): clean some pieces of code
This commit is contained in:
parent
4f40f34a16
commit
2b8e1cca64
6 changed files with 65 additions and 67 deletions
|
|
@ -20,9 +20,9 @@
|
|||
#include "linphone/utils/utils.h"
|
||||
|
||||
#include "address-p.h"
|
||||
#include "address/identity-address.h"
|
||||
#include "c-wrapper/c-wrapper.h"
|
||||
#include "logger/logger.h"
|
||||
#include "address/identity-address.h"
|
||||
|
||||
// =============================================================================
|
||||
|
||||
|
|
@ -403,7 +403,7 @@ bool Address::setUriParams (const string &uriParams) {
|
|||
return true;
|
||||
}
|
||||
|
||||
bool Address::removeUriParam(const string &uriParamName) {
|
||||
bool Address::removeUriParam (const string &uriParamName) {
|
||||
L_D();
|
||||
|
||||
if (!d->internalAddress)
|
||||
|
|
|
|||
|
|
@ -101,7 +101,7 @@ public:
|
|||
const std::string &getUriParamValue (const std::string &uriParamName) const;
|
||||
bool setUriParam (const std::string &uriParamName, const std::string &uriParamValue = "");
|
||||
bool setUriParams (const std::string &uriParams);
|
||||
bool removeUriParam(const std::string &uriParamName);
|
||||
bool removeUriParam (const std::string &uriParamName);
|
||||
|
||||
private:
|
||||
L_DECLARE_PRIVATE(Address);
|
||||
|
|
|
|||
|
|
@ -17,10 +17,8 @@
|
|||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
*/
|
||||
|
||||
#include "linphone/utils/utils.h"
|
||||
|
||||
#include "identity-address-p.h"
|
||||
#include "c-wrapper/c-wrapper.h"
|
||||
#include "identity-address-p.h"
|
||||
#include "logger/logger.h"
|
||||
|
||||
// =============================================================================
|
||||
|
|
|
|||
|
|
@ -217,7 +217,7 @@ bctbx_list_t *linphone_chat_room_get_history_range_events (LinphoneChatRoom *cr,
|
|||
}
|
||||
|
||||
LinphoneChatMessage *linphone_chat_room_get_last_message_in_history(LinphoneChatRoom *cr) {
|
||||
shared_ptr<LinphonePrivate::ChatMessage> cppPtr = L_GET_CPP_PTR_FROM_C_OBJECT(cr)->getLastMessageInHistory();
|
||||
shared_ptr<LinphonePrivate::ChatMessage> cppPtr = L_GET_CPP_PTR_FROM_C_OBJECT(cr)->getLastChatMessageInHistory();
|
||||
if (!cppPtr)
|
||||
return nullptr;
|
||||
|
||||
|
|
|
|||
|
|
@ -92,37 +92,6 @@ shared_ptr<ChatMessage> ChatRoomPrivate::createChatMessage (ChatMessage::Directi
|
|||
return shared_ptr<ChatMessage>(new ChatMessage(q->getSharedFromThis(), direction));
|
||||
}
|
||||
|
||||
// -----------------------------------------------------------------------------
|
||||
|
||||
const ChatRoomId &ChatRoom::getChatRoomId () const {
|
||||
L_D();
|
||||
return d->chatRoomId;
|
||||
}
|
||||
|
||||
const IdentityAddress &ChatRoom::getPeerAddress () const {
|
||||
L_D();
|
||||
return d->chatRoomId.getPeerAddress();
|
||||
}
|
||||
|
||||
const IdentityAddress &ChatRoom::getLocalAddress () const {
|
||||
L_D();
|
||||
return d->chatRoomId.getLocalAddress();
|
||||
}
|
||||
|
||||
// -----------------------------------------------------------------------------
|
||||
|
||||
time_t ChatRoom::getCreationTime () const {
|
||||
L_D();
|
||||
return d->creationTime;
|
||||
}
|
||||
|
||||
time_t ChatRoom::getLastUpdateTime () const {
|
||||
L_D();
|
||||
return d->lastUpdateTime;
|
||||
}
|
||||
|
||||
// -----------------------------------------------------------------------------
|
||||
|
||||
list<shared_ptr<ChatMessage> > ChatRoomPrivate::findMessages (const string &messageId) const {
|
||||
L_Q();
|
||||
return q->getCore()->getPrivate()->mainDb->findChatMessages(q->getChatRoomId(), messageId);
|
||||
|
|
@ -167,8 +136,6 @@ LinphoneReason ChatRoomPrivate::messageReceived (SalOp *op, const SalMessage *sa
|
|||
shared_ptr<ChatMessage> msg;
|
||||
|
||||
shared_ptr<Core> core = q->getCore();
|
||||
if (!core)
|
||||
return reason;
|
||||
LinphoneCore *cCore = core->getCCore();
|
||||
|
||||
msg = createChatMessage(
|
||||
|
|
@ -349,6 +316,61 @@ ChatRoom::ChatRoom (ChatRoomPrivate &p, const shared_ptr<Core> &core, const Chat
|
|||
|
||||
// -----------------------------------------------------------------------------
|
||||
|
||||
const ChatRoomId &ChatRoom::getChatRoomId () const {
|
||||
L_D();
|
||||
return d->chatRoomId;
|
||||
}
|
||||
|
||||
const IdentityAddress &ChatRoom::getPeerAddress () const {
|
||||
L_D();
|
||||
return d->chatRoomId.getPeerAddress();
|
||||
}
|
||||
|
||||
const IdentityAddress &ChatRoom::getLocalAddress () const {
|
||||
L_D();
|
||||
return d->chatRoomId.getLocalAddress();
|
||||
}
|
||||
|
||||
// -----------------------------------------------------------------------------
|
||||
|
||||
time_t ChatRoom::getCreationTime () const {
|
||||
L_D();
|
||||
return d->creationTime;
|
||||
}
|
||||
|
||||
time_t ChatRoom::getLastUpdateTime () const {
|
||||
L_D();
|
||||
return d->lastUpdateTime;
|
||||
}
|
||||
|
||||
// -----------------------------------------------------------------------------
|
||||
|
||||
list<shared_ptr<EventLog>> ChatRoom::getHistory (int nLast) {
|
||||
return getCore()->getPrivate()->mainDb->getHistory(getChatRoomId(), nLast);
|
||||
}
|
||||
|
||||
list<shared_ptr<EventLog>> ChatRoom::getHistoryRange (int begin, int end) {
|
||||
return getCore()->getPrivate()->mainDb->getHistoryRange(getChatRoomId(), begin, end);
|
||||
}
|
||||
|
||||
int ChatRoom::getHistorySize () {
|
||||
return getCore()->getPrivate()->mainDb->getChatMessagesCount(getChatRoomId());
|
||||
}
|
||||
|
||||
shared_ptr<ChatMessage> ChatRoom::getLastChatMessageInHistory() const {
|
||||
return getCore()->getPrivate()->mainDb->getLastChatMessage(getChatRoomId());
|
||||
}
|
||||
|
||||
void ChatRoom::deleteHistory () {
|
||||
getCore()->getPrivate()->mainDb->cleanHistory(getChatRoomId());
|
||||
}
|
||||
|
||||
int ChatRoom::getUnreadChatMessagesCount () {
|
||||
return getCore()->getPrivate()->mainDb->getUnreadChatMessagesCount(getChatRoomId());
|
||||
}
|
||||
|
||||
// -----------------------------------------------------------------------------
|
||||
|
||||
void ChatRoom::compose () {
|
||||
L_D();
|
||||
if (!d->isComposing) {
|
||||
|
|
@ -379,10 +401,6 @@ shared_ptr<ChatMessage> ChatRoom::createMessage () {
|
|||
return d->createChatMessage(ChatMessage::Direction::Outgoing);
|
||||
}
|
||||
|
||||
void ChatRoom::deleteHistory () {
|
||||
getCore()->getPrivate()->mainDb->cleanHistory(getChatRoomId());
|
||||
}
|
||||
|
||||
shared_ptr<ChatMessage> ChatRoom::findMessage (const string &messageId) {
|
||||
L_D();
|
||||
shared_ptr<ChatMessage> cm = nullptr;
|
||||
|
|
@ -406,26 +424,6 @@ shared_ptr<ChatMessage> ChatRoom::findMessageWithDirection (const string &messag
|
|||
return ret;
|
||||
}
|
||||
|
||||
list<shared_ptr<EventLog>> ChatRoom::getHistory (int nLast) {
|
||||
return getCore()->getPrivate()->mainDb->getHistory(getChatRoomId(), nLast);
|
||||
}
|
||||
|
||||
list<shared_ptr<EventLog>> ChatRoom::getHistoryRange (int begin, int end) {
|
||||
return getCore()->getPrivate()->mainDb->getHistoryRange(getChatRoomId(), begin, end);
|
||||
}
|
||||
|
||||
int ChatRoom::getHistorySize () {
|
||||
return getCore()->getPrivate()->mainDb->getChatMessagesCount(getChatRoomId());
|
||||
}
|
||||
|
||||
shared_ptr<ChatMessage> ChatRoom::getLastMessageInHistory() const {
|
||||
return getCore()->getPrivate()->mainDb->getLastChatMessage(getChatRoomId());
|
||||
}
|
||||
|
||||
int ChatRoom::getUnreadChatMessagesCount () {
|
||||
return getCore()->getPrivate()->mainDb->getUnreadChatMessagesCount(getChatRoomId());
|
||||
}
|
||||
|
||||
bool ChatRoom::isRemoteComposing () const {
|
||||
L_D();
|
||||
return d->remoteIsComposing.size() > 0;
|
||||
|
|
|
|||
|
|
@ -64,17 +64,19 @@ public:
|
|||
std::list<std::shared_ptr<EventLog>> getHistoryRange (int begin, int end);
|
||||
int getHistorySize ();
|
||||
|
||||
std::shared_ptr<ChatMessage> getLastMessageInHistory () const;
|
||||
std::shared_ptr<ChatMessage> getLastChatMessageInHistory () const;
|
||||
|
||||
void deleteHistory ();
|
||||
|
||||
int getUnreadChatMessagesCount ();
|
||||
|
||||
// TODO: Remove useless functions.
|
||||
void compose ();
|
||||
std::shared_ptr<ChatMessage> createFileTransferMessage (const LinphoneContent *initialContent);
|
||||
std::shared_ptr<ChatMessage> createMessage (const std::string &msg);
|
||||
std::shared_ptr<ChatMessage> createMessage ();
|
||||
void deleteHistory ();
|
||||
std::shared_ptr<ChatMessage> findMessage (const std::string &messageId);
|
||||
std::shared_ptr<ChatMessage> findMessageWithDirection (const std::string &messageId, ChatMessage::Direction direction);
|
||||
int getUnreadChatMessagesCount ();
|
||||
bool isRemoteComposing () const;
|
||||
std::list<Address> getComposingAddresses () const;
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue