diff --git a/engine/Client.cpp b/engine/Client.cpp index cb8a50a0..6e2acdce 100644 --- a/engine/Client.cpp +++ b/engine/Client.cpp @@ -206,7 +206,8 @@ String Client::s_toggles[OptCount] = { "multilines", "autoanswer", "ringincoming", "ringoutgoing", "activatelastoutcall", "activatelastincall", "activatecallonselect", "display_keypad", "openincomingurl", "addaccountonstartup", - "dockedchat", "destroychat", "notifychatstate" + "dockedchat", "destroychat", "notifychatstate", "showemptychat", + "sendemptychat" }; bool Client::s_engineStarted = false; // Engine started flag bool Client::s_idleLogicsTick = false; // Call logics' timerTick() diff --git a/engine/ClientLogic.cpp b/engine/ClientLogic.cpp index 0874ab66..eefda529 100644 --- a/engine/ClientLogic.cpp +++ b/engine/ClientLogic.cpp @@ -6558,7 +6558,8 @@ bool DefaultLogic::defaultMsgHandler(Message& msg, int id, bool& stopLogic) bool hasState = !delay && buildChatState(chatState,msg,c->m_name); const String& body = msg[YSTRING("body")]; NamedList* p = 0; - if (body || !hasState) + if (body || (!hasState && + Client::self()->getBoolOpt(Client::OptShowEmptyChat))) p = buildChatParams(body,c->m_name,time,0 != delay,ds); // Active state with no body or notification: remove last notification // if the contact has a chat @@ -6636,7 +6637,8 @@ bool DefaultLogic::defaultMsgHandler(Message& msg, int id, bool& stopLogic) String chatState; bool hasState = !delay && buildChatState(chatState,msg,member->m_name); NamedList* p = 0; - if (body || !hasState) + if (body || (!hasState && + Client::self()->getBoolOpt(Client::OptShowEmptyChat))) p = buildChatParams(body,member ? member->m_name : nick,time,0,0); const String& id = mucChat ? room->resource().toString() : member->toString(); // Active state with no body or notification: remove last notification @@ -8082,14 +8084,16 @@ bool DefaultLogic::handleChatContactAction(const String& name, Window* wnd) "DefaultLogic sending chat for contact=%s",c->toString().c_str()); String text; c->getChatInput(text); - if (text && c->sendChat(text)) { + if ((text || Client::self()->getBoolOpt(Client::OptSendEmptyChat)) && + c->sendChat(text)) { unsigned int time = Time::secNow(); NamedList* tmp = buildChatParams(text,"me",time); c->setChatProperty("history","_yate_tempitemreplace",String(false)); c->addChatHistory("chat_out",tmp); c->setChatProperty("history","_yate_tempitemreplace",String(true)); c->setChatInput(); - logChat(c,time,true,false,text); + if (text) + logChat(c,time,true,false,text); } } else if (room) { @@ -8101,11 +8105,11 @@ bool DefaultLogic::handleChatContactAction(const String& name, Window* wnd) room->uri().c_str(),m->m_name.c_str()); String text; room->getChatInput(id,text); - bool ok = false; + bool ok = text || Client::self()->getBoolOpt(Client::OptSendEmptyChat); if (room->ownMember(m)) - ok = text && room->sendChat(text,String::empty(),"groupchat"); + ok = ok && room->sendChat(text,String::empty(),"groupchat"); else - ok = text && room->sendChat(text,m->m_name); + ok = ok && room->sendChat(text,m->m_name); if (ok) { unsigned int time = Time::secNow(); NamedList* tmp = buildChatParams(text,"me",time); @@ -8113,7 +8117,8 @@ bool DefaultLogic::handleChatContactAction(const String& name, Window* wnd) room->addChatHistory(id,"chat_out",tmp); room->setChatProperty(id,"history","_yate_tempitemreplace",String(true)); room->setChatInput(id); - logChat(room,time,true,false,text,room->ownMember(m),m->m_name); + if (text) + logChat(room,time,true,false,text,room->ownMember(m),m->m_name); } } else diff --git a/share/skins/default/settings.ui b/share/skins/default/settings.ui index 4a1df29e..91150ff9 100644 --- a/share/skins/default/settings.ui +++ b/share/skins/default/settings.ui @@ -180,6 +180,26 @@ + + + + Show received chat with empty body + + + Show empty received chat + + + + + + + Send empty chat + + + Send empty chat + + + diff --git a/yatecbase.h b/yatecbase.h index 9c4e1fae..0be9c481 100644 --- a/yatecbase.h +++ b/yatecbase.h @@ -814,6 +814,8 @@ public: OptDockedChat, // Show all contacts chat in the same window OptDestroyChat, // Destroy contact chat when contact is removed/destroyed OptNotifyChatState, // Notify chat states + OptShowEmptyChat, // Display received empty chat in chat history + OptSendEmptyChat, // Send empty chat OptCount };