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

* #7264: don't duplicate display name for incoming calls

parent 51e26495
No related branches found
No related tags found
No related merge requests found
......@@ -89,10 +89,8 @@ bool History::save()
void History::addEntry(const HistoryItem &item, int oldest)
{
if (item.hasPeerNumber() and item.youngerThan(oldest)) {
DEBUG("Adding history item");
if (item.hasPeerNumber() and item.youngerThan(oldest))
items_.push_back(item);
}
}
void History::ensurePath()
......
......@@ -57,14 +57,14 @@ HistoryItem::HistoryItem(const map<string, string> &args) : entryMap_(args),
HistoryItem::HistoryItem(std::istream &entry) : entryMap_(), timestampStart_(0)
{
std::string tmp;
string tmp;
while (std::getline(entry, tmp, '\n')) {
size_t pos = tmp.find('=');
if (pos == std::string::npos)
if (pos == string::npos)
break;
else if (pos < tmp.length() - 1) {
std::string key(tmp.substr(0, pos));
std::string val(tmp.substr(pos + 1, tmp.length() - pos - 1));
string key(tmp.substr(0, pos));
string val(tmp.substr(pos + 1, tmp.length() - pos - 1));
entryMap_[key] = val;
}
}
......
......@@ -1384,10 +1384,11 @@ void ManagerImpl::incomingCall(Call* call, const std::string& accountId)
// when placing new call from history (if call is IAX, do nothing)
std::string peerNumber(call->getPeerNumber());
size_t startIndex = peerNumber.find("sip:");
const char SIP_PREFIX[] = "sip:";
size_t startIndex = peerNumber.find(SIP_PREFIX);
if (startIndex != std::string::npos)
call->setPeerNumber(peerNumber.substr(startIndex + 4));
call->setPeerNumber(peerNumber.substr(startIndex + sizeof(SIP_PREFIX) - 1));
}
if (not hasCurrentCall()) {
......@@ -1397,14 +1398,9 @@ void ManagerImpl::incomingCall(Call* call, const std::string& accountId)
addWaitingCall(call->getCallId());
std::string from(call->getDisplayName());
std::string number(call->getPeerNumber());
if (not from.empty() and not number.empty())
from += " ";
from += "<" + number + ">";
std::string from("<" + number + ">");
dbus_.getCallManager()->incomingCall(accountId, call->getCallId(), call->getDisplayName() + " " + from);
}
......
......@@ -1263,7 +1263,6 @@ void SIPVoIPLink::findLocalAddressFromUri(const std::string& uri, pjsip_transpor
namespace {
std::string parseDisplayName(const char * buffer)
{
// Parse the display name from "From" header
const char* from_header = strstr(buffer, "From: ");
if (!from_header)
......
......@@ -33,7 +33,6 @@
#include "calllist.h"
#include "calltree.h"
#include <stdlib.h>
#include <glib/gprintf.h>
#include "eel-gconf-extensions.h"
#include "unused.h"
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment