From a58acea009e563d5682feb703e92f6f42d88e495 Mon Sep 17 00:00:00 2001
From: Stepan Salenikovich <stepan.salenikovich@savoirfairelinux.com>
Date: Wed, 2 Sep 2015 14:46:08 -0400
Subject: [PATCH] im: remove message saving

This is not used by the daemon and the clients save IMs via LRC.
There is no need for this function and it only pollutes the daemon
dir with im files.

Issue: #79618
Change-Id: Ibab3f83a3c6a966f0d602017c50aeb7cd7a4567f
---
 src/im/instant_messaging.cpp | 19 -------------------
 src/im/instant_messaging.h   | 13 -------------
 2 files changed, 32 deletions(-)

diff --git a/src/im/instant_messaging.cpp b/src/im/instant_messaging.cpp
index 30ef953ecd..c99a335256 100644
--- a/src/im/instant_messaging.cpp
+++ b/src/im/instant_messaging.cpp
@@ -56,23 +56,6 @@ static void XMLCALL
 endElementCallback(void * /*userData*/, const char* /*name*/)
 {}
 
-bool
-InstantMessaging::saveMessage(const std::string& message, const std::string& author,
-                              const std::string& id, int mode)
-{
-    std::ofstream File;
-    std::string filename = "im_" + id;
-    File.open(filename.c_str(), static_cast<std::ios_base::openmode>(mode));
-
-    if (!File.good() || !File.is_open())
-        return false;
-
-    File << "[" << author << "] " << message << '\n';
-    File.close();
-
-    return true;
-}
-
 void
 InstantMessaging::sendSipMessage(pjsip_inv_session* session, const std::string& id,
                                  const std::vector<std::string>& chunks)
@@ -102,8 +85,6 @@ InstantMessaging::sendSipMessage(pjsip_inv_session* session, const std::string&
         if (ret != PJ_SUCCESS)
             RING_WARN("SIP send message failed: %s", sip_utils::sip_strerror(ret).c_str());
         pjsip_dlg_dec_lock(dialog);
-
-        saveMessage(text, "Me", id);
     }
 }
 
diff --git a/src/im/instant_messaging.h b/src/im/instant_messaging.h
index 8d0c2a2298..151771058e 100644
--- a/src/im/instant_messaging.h
+++ b/src/im/instant_messaging.h
@@ -33,9 +33,7 @@
 #define __INSTANT_MESSAGING_H__
 
 #include <string>
-#include <iostream>
 #include <vector>
-#include <fstream>
 #include <pjsip.h>
 #include <pjlib.h>
 #include <pjsip_ua.h>
@@ -79,17 +77,6 @@ struct InstantMessageException : std::runtime_error
 using UriEntry = std::map<std::string, std::string>;
 using UriList = std::list<UriEntry>;
 
-/*
- * Write the text message to the right file
- * The call ID is associated to a file descriptor, so it is easy then to retrieve the right file
- *
- * @param message	The text message
- * @param id	The current call
- * @return True if the message could have been successfully saved, False otherwise
- */
-bool saveMessage(const std::string& message, const std::string& author, const std::string& id,
-                 int mode = MODE_APPEND);
-
 void sendSipMessage(pjsip_inv_session* session, const std::string& id,
                     const std::vector<std::string>& chunks);
 #if HAVE_IAX
-- 
GitLab