diff --git a/clients/qt4/qt4client.cpp b/clients/qt4/qt4client.cpp index f9bfa024..d87391ce 100644 --- a/clients/qt4/qt4client.cpp +++ b/clients/qt4/qt4client.cpp @@ -1622,7 +1622,7 @@ void QtWindow::doInit() // Decode param int pos = p->toString().find('='); if (pos != -1) - params.addParam(p->toString().substr(0,pos),p->toString().substr(pos+1)); + params.addParam(p->toString().substr(0,pos),p->toString().substr(pos + 1)); } } TelEngine::destruct(list); @@ -1907,13 +1907,13 @@ bool QtClient::chooseFile(Window* parent, const NamedList& params, QWidget* p = static_cast(parent); if (files) { QStringList list = QFileDialog::getOpenFileNames((QWidget*)p,QtClient::setUtf8(caption), - QtClient::setUtf8(dir),filters?*filters:QString::null,sFilter,options); + QtClient::setUtf8(dir),filters ? *filters : QString::null,sFilter,options); for (int i = 0; i < list.size(); i++) QtClient::getUtf8(*files,"file",list[i]); } else { QString str = QFileDialog::getOpenFileName((QWidget*)p,QtClient::setUtf8(caption), - QtClient::setUtf8(dir),filters?*filters:QString::null,sFilter,options); + QtClient::setUtf8(dir),filters ? *filters : QString::null,sFilter,options); QtClient::getUtf8(*file,str); } @@ -2025,11 +2025,11 @@ bool QtClient::property(bool set, QObject* obj, const char* name, String& value) } if (ok) DDebug(ClientDriver::self(),DebugAll,"%s %s=%s for object '%s'", - set?"Set":"Got",name,value.c_str(),YQT_OBJECT_NAME(obj)); + set ? "Set" : "Got",name,value.c_str(),YQT_OBJECT_NAME(obj)); else DDebug(ClientDriver::self(),DebugNote, "Failed to %s %s=%s (type=%s) for object '%s': %s", - set?"set":"get",name,value.c_str(),var.typeName(), + set ? "set" : "get",name,value.c_str(),var.typeName(), YQT_OBJECT_NAME(obj),err); return ok; } diff --git a/engine/Client.cpp b/engine/Client.cpp index 5e97488b..29a8ed1d 100644 --- a/engine/Client.cpp +++ b/engine/Client.cpp @@ -230,7 +230,7 @@ inline bool callLogicAction(ClientLogic* logic, Window* wnd, const String& name, return false; DDebug(ClientDriver::self(),DebugAll, "Logic(%s) action='%s' in window (%p,%s) [%p]", - logic->toString().c_str(),name.c_str(),wnd,wnd?wnd->id().c_str():"",logic); + logic->toString().c_str(),name.c_str(),wnd,wnd ? wnd->id().c_str() : "",logic); return logic->action(wnd,name,params); } @@ -243,7 +243,7 @@ inline bool callLogicToggle(ClientLogic* logic, Window* wnd, const String& name, DDebug(ClientDriver::self(),DebugAll, "Logic(%s) toggle='%s' active=%s in window (%p,%s) [%p]", logic->toString().c_str(),name.c_str(),String::boolText(active), - wnd,wnd?wnd->id().c_str():"",logic); + wnd,wnd ? wnd->id().c_str() : "",logic); return logic->toggle(wnd,name,active); } @@ -257,7 +257,7 @@ inline bool callLogicSelect(ClientLogic* logic, Window* wnd, const String& name, DDebug(ClientDriver::self(),DebugAll, "Logic(%s) select='%s' item='%s' in window (%p,%s) [%p]", logic->toString().c_str(),name.c_str(),item.c_str(), - wnd,wnd?wnd->id().c_str():"",logic); + wnd,wnd ? wnd->id().c_str() : "",logic); return logic->select(wnd,name,item,text); } @@ -369,7 +369,7 @@ bool Window::setParams(const NamedList& params) // Set property: object_name:property_name=value int pos = n.find(':'); if (pos > 0) - ok = setProperty(n.substr(0,pos),n.substr(pos+1),*s) && ok; + ok = setProperty(n.substr(0,pos),n.substr(pos + 1),*s) && ok; else ok = false; } @@ -647,7 +647,7 @@ void ClientThreadProxy::process() m_rval = client->clearTable(m_name); break; case getText: - m_rval = client->getText(m_name,*m_rtext,m_rbool?*m_rbool:false,m_wnd,m_skip); + m_rval = client->getText(m_name,*m_rtext,m_rbool ? *m_rbool : false,m_wnd,m_skip); break; case getCheck: m_rval = client->getCheck(m_name,*m_rbool,m_wnd,m_skip); @@ -1693,7 +1693,7 @@ bool Client::action(Window* wnd, const String& name, NamedList* params) static String sect = "action"; XDebug(ClientDriver::self(),DebugAll,"Action '%s' in window (%p,%s)", - name.c_str(),wnd,wnd?wnd->id().c_str():""); + name.c_str(),wnd,wnd ? wnd->id().c_str() : ""); String substitute = name; String handle; @@ -1725,7 +1725,7 @@ bool Client::toggle(Window* wnd, const String& name, bool active) XDebug(ClientDriver::self(),DebugAll, "Toggle name='%s' active='%s' in window (%p,%s)", - name.c_str(),String::boolText(active),wnd,wnd?wnd->id().c_str():""); + name.c_str(),String::boolText(active),wnd,wnd ? wnd->id().c_str() : ""); String substitute = name; String handle; @@ -1759,7 +1759,7 @@ bool Client::select(Window* wnd, const String& name, const String& item, const S XDebug(ClientDriver::self(),DebugAll, "Select name='%s' item='%s' in window (%p,%s)", - name.c_str(),item.c_str(),wnd,wnd?wnd->id().c_str():""); + name.c_str(),item.c_str(),wnd,wnd ? wnd->id().c_str() : ""); String substitute = name; String handle; @@ -2142,9 +2142,9 @@ bool Client::addLogic(ClientLogic* logic) return false; bool dup = (0 != s_logics.find(logic->toString())); - Debug(ClientDriver::self(),dup?DebugGoOn:DebugInfo, + Debug(ClientDriver::self(),dup ? DebugGoOn : DebugInfo, "Adding logic%s %p name=%s prio=%d", - dup?" [DUPLICATE]":"",logic,logic->toString().c_str(),logic->priority()); + dup ? " [DUPLICATE]" : "",logic,logic->toString().c_str(),logic->priority()); for (ObjList* l = s_logics.skipNull(); l; l = l->skipNext()) { ClientLogic* obj = static_cast(l->get()); @@ -2410,7 +2410,7 @@ void ClientChannel::setConference(const String& target) if (m_transferId == target && !m_transferId) return; Debug(this,DebugCall,"%sing conference room '%s' [%p]", - target?"Enter":"Exit",target?target.c_str():m_transferId.c_str(),this); + target ? "Enter" : "Exit",target ? target.c_str() : m_transferId.c_str(),this); m_transferId = target; m_conference = (0 != m_transferId); setMedia(m_active && isAnswered()); @@ -3195,7 +3195,7 @@ bool ClientContact::appendGroup(const String& group) m_groups.append(new String(group)); DDebug(ClientDriver::self(),DebugAll, "Account(%s) contact='%s' added group '%s' [%p]", - m_owner?m_owner->uri().c_str():"",m_uri.c_str(),group.c_str(),this); + m_owner ? m_owner->uri().c_str() : "",m_uri.c_str(),group.c_str(),this); return true; } @@ -3209,7 +3209,7 @@ bool ClientContact::removeGroup(const String& group) obj->remove(); DDebug(ClientDriver::self(),DebugAll, "Account(%s) contact='%s' removed group '%s' [%p]", - m_owner?m_owner->uri().c_str():"",m_uri.c_str(),group.c_str(),this); + m_owner ? m_owner->uri().c_str() : "",m_uri.c_str(),group.c_str(),this); return true; } @@ -3248,7 +3248,7 @@ ClientResource* ClientContact::appendResource(const String& id) m_resources.append(r); DDebug(ClientDriver::self(),DebugAll, "Account(%s) contact='%s' added resource '%s' [%p]", - m_owner?m_owner->uri().c_str():"",m_uri.c_str(),id.c_str(),this); + m_owner ? m_owner->uri().c_str() : "",m_uri.c_str(),id.c_str(),this); return r; } @@ -3262,7 +3262,7 @@ bool ClientContact::removeResource(const String& id) obj->remove(); DDebug(ClientDriver::self(),DebugAll, "Account(%s) contact='%s' removed resource '%s' [%p]", - m_owner?m_owner->uri().c_str():"",m_uri.c_str(),id.c_str(),this); + m_owner ? m_owner->uri().c_str() : "",m_uri.c_str(),id.c_str(),this); return true; } diff --git a/engine/ClientLogic.cpp b/engine/ClientLogic.cpp index a53037cb..fc42f626 100644 --- a/engine/ClientLogic.cpp +++ b/engine/ClientLogic.cpp @@ -70,7 +70,7 @@ static inline void setAccParam(NamedList& params, const String& prefix, const String& param, const char* defVal) { NamedString* ns = params.getParam("acc_" + param); - params.setParam(prefix + "_" + param,ns?ns->c_str():defVal); + params.setParam(prefix + "_" + param,ns ? ns->c_str() : defVal); } // Set the image parameter of a list @@ -98,8 +98,8 @@ static void updateProtocolSpec(NamedList& p, const String& proto, const String& ObjList* obj = options.split(',',false); String prefix = "acc_proto_" + proto; // Texts - setAccParam(p,prefix,"resource",proto=="jabber"?"yate":""); - setAccParam(p,prefix,"port",proto=="jabber"?"5222":""); + setAccParam(p,prefix,"resource",proto == "jabber" ? "yate" : ""); + setAccParam(p,prefix,"port",proto == "jabber" ? "5222" : ""); setAccParam(p,prefix,"address",""); // Options prefix << "_opt_"; @@ -368,7 +368,7 @@ bool ClientLogic::action(Window* wnd, const String& name, NamedList* params) if (callOut || name == "log_in_call") { String billid; if (Client::self() && - Client::self()->getSelect(callOut?s_logOutgoing:s_logIncoming,billid) && + Client::self()->getSelect(callOut ? s_logOutgoing : s_logIncoming,billid) && billid) return callLogCall(billid); return false; @@ -378,7 +378,7 @@ bool ClientLogic::action(Window* wnd, const String& name, NamedList* params) if (callOut || name == "log_in_contact") { String billid; if (Client::self() && - Client::self()->getSelect(callOut?s_logOutgoing:s_logIncoming,billid) && + Client::self()->getSelect(callOut ? s_logOutgoing : s_logIncoming,billid) && billid) return callLogCreateContact(billid); return false; @@ -405,7 +405,7 @@ bool ClientLogic::toggle(Window* wnd, const String& name, bool active) Debug(ClientDriver::self(),DebugAll, "Logic(%s) toggle '%s'=%s in window (%p,%s)", m_name.c_str(),name.c_str(),String::boolText(active), - wnd,wnd?wnd->id().c_str():""); + wnd,wnd ? wnd->id().c_str() : ""); // Check for window params if (Client::self() && Window::isValidParamPrefix(name)) { @@ -495,7 +495,7 @@ bool ClientLogic::toggle(Window* wnd, const String& name, bool active) return true; int pos = tmp.find(':'); if (pos > 0 && Client::self()) - return Client::self()->setSelect(tmp.substr(0,pos),tmp.substr(pos+1),wnd); + return Client::self()->setSelect(tmp.substr(0,pos),tmp.substr(pos + 1),wnd); return true; } @@ -561,7 +561,7 @@ bool ClientLogic::select(Window* wnd, const String& name, const String& item, { DDebug(ClientDriver::self(),DebugAll, "Logic(%s) select name='%s' item='%s' in window (%p,%s)", - m_name.c_str(),name.c_str(),item.c_str(),wnd,wnd?wnd->id().c_str():""); + m_name.c_str(),name.c_str(),item.c_str(),wnd,wnd ? wnd->id().c_str() : ""); if (name == s_accountList) { if (!Client::self()) @@ -648,12 +648,12 @@ bool ClientLogic::select(Window* wnd, const String& name, const String& item, return false; NamedList p(""); for (const char** par = Client::s_provParams; *par; par++) - p.addParam(String("acc_")+*par,sect->getValue(*par)); + p.addParam(String("acc_") + *par,sect->getValue(*par)); NamedString* proto = sect->getParam("protocol"); if (proto) { selectProtocolSpec(p,*proto,m_accShowAdvanced); NamedString* opt = sect->getParam("options"); - updateProtocolSpec(p,*proto,opt?*opt:String::empty()); + updateProtocolSpec(p,*proto,opt ? *opt : String::empty()); } Client::self()->setParams(&p,wnd); return true; @@ -847,7 +847,7 @@ bool ClientLogic::editAccount(bool newAcc, NamedList* params, Window* wnd) if (newAcc) { proto = "--"; for (const String* par = s_accParams; !par->null(); par++) - params->setParam("acc_"+*par,""); + params->setParam("acc_" + *par,""); } else { if (!Client::self()) @@ -869,7 +869,7 @@ bool ClientLogic::editAccount(bool newAcc, NamedList* params, Window* wnd) selectProtocolSpec(*params,proto,m_accShowAdvanced); NamedString* tmp = params->getParam("acc_options"); for (int i = 0; i < Client::OtherProtocol; i++) - updateProtocolSpec(*params,Client::s_protocols[i],tmp?*tmp:String::empty()); + updateProtocolSpec(*params,Client::s_protocols[i],tmp ? *tmp : String::empty()); params->setParam("context",acc); params->setParam("acc_account",acc); params->setParam("modal",String::boolText(true)); @@ -881,7 +881,7 @@ static inline void saveAccParam(NamedList& params, const String& prefix, const String& param, Window* wnd) { String val; - if (!Client::self()->getText(prefix+param,val,false,wnd)) + if (!Client::self()->getText(prefix + param,val,false,wnd)) return; if (val) params.setParam(param,val); @@ -949,7 +949,7 @@ bool ClientLogic::acceptAccount(NamedList* params, Window* wnd) for (ObjList* o = Client::s_accOptions.skipNull(); o; o = o->skipNext()) { String* opt = static_cast(o->get()); bool checked = false; - Client::self()->getCheck(prefix+*opt,checked,wnd); + Client::self()->getCheck(prefix + *opt,checked,wnd); if (checked) options.append(*opt,","); } @@ -1115,8 +1115,8 @@ bool ClientLogic::editContact(bool newCont, NamedList* params, Window* wnd) // Make sure we reset all controls in window NamedList p(""); if (newCont) { - p.addParam("abk_name",params?params->c_str():""); - p.addParam("abk_target",params?params->getValue("target"):""); + p.addParam("abk_name",params ? params->c_str() : ""); + p.addParam("abk_target",params ? params->getValue("target") : ""); } else { if (!Client::self()) @@ -1365,8 +1365,8 @@ bool ClientLogic::callLogCreateContact(const String& billid) return false; NamedString* called = getCdrCalled(*sect,*direction); NamedList p(""); - p.setParam("abk_name",called?called->c_str():""); - p.setParam("abk_target",called?called->c_str():""); + p.setParam("abk_name",called ? called->c_str() : ""); + p.setParam("abk_target",called ? called->c_str() : ""); p.setParam("modal",String::boolText(true)); return Client::openPopup("addrbook",&p); } @@ -1815,7 +1815,7 @@ bool ClientLogic::handleClientChanUpdate(Message& msg, bool& stopLogic) updateFormats = false; buildStatus(status,"Call active",CHANUPD_ADDR,CHANUPD_ID); Client::self()->setSelect(s_channelList,CHANUPD_ID); - setImageParam(p,"party",outgoing?"down_active.png":"up_active.png"); + setImageParam(p,"party",outgoing ? "down_active.png" : "up_active.png"); if (outgoing) { if (noticed) Client::self()->ringer(true,false); @@ -1829,7 +1829,7 @@ bool ClientLogic::handleClientChanUpdate(Message& msg, bool& stopLogic) case ClientChannel::OnHold: enableActions = true; buildStatus(status,"Call on hold",CHANUPD_ADDR,CHANUPD_ID); - setImageParam(p,"party",outgoing?"down.png":"up.png"); + setImageParam(p,"party",outgoing ? "down.png" : "up.png"); if (outgoing) { if (noticed) Client::self()->ringer(true,false); @@ -1864,8 +1864,8 @@ bool ClientLogic::handleClientChanUpdate(Message& msg, bool& stopLogic) } else return false; - setImageParam(p,"party",chan?chan->party():"",outgoing?"down.png":"up.png"); - setImageParam(p,"time","",outgoing?"chan_ringing.png":"chan_idle.png"); + setImageParam(p,"party",chan ? chan->party() : "",outgoing ? "down.png" : "up.png"); + setImageParam(p,"time","",outgoing ? "chan_ringing.png" : "chan_idle.png"); // Start incoming ringer if there is no active channel if (outgoing && notConf) { ClientChannel* ch = ClientDriver::findActiveChan(); @@ -1926,7 +1926,7 @@ bool ClientLogic::handleClientChanUpdate(Message& msg, bool& stopLogic) if (chan && chan->transferId() && notConf) { setStatus = false; ClientChannel* trans = ClientDriver::findChan(chan->transferId()); - setImageParam(p,"status",trans?trans->party():"","transfer.png"); + setImageParam(p,"status",trans ? trans->party() : "","transfer.png"); TelEngine::destruct(trans); buildStatus(status,"Call transferred",CHANUPD_ADDR,CHANUPD_ID); } diff --git a/yatecbase.h b/yatecbase.h index 4142fcf0..cfa2ccb4 100644 --- a/yatecbase.h +++ b/yatecbase.h @@ -2444,7 +2444,7 @@ public: * @param dest Destination string */ inline void buildContactId(String& dest) - { buildContactId(dest,m_owner?m_owner->toString():String::empty(),m_id); } + { buildContactId(dest,m_owner ? m_owner->toString() : String::empty(),m_id); } /** * Check if a window is this contact's chat