(jabber) Add debug output

This commit is contained in:
Jaidyn Ann 2021-07-18 20:03:42 -05:00
parent 4905dbbe6c
commit 23e6f4ba5a
2 changed files with 30 additions and 4 deletions

View File

@ -8,6 +8,8 @@
* Jaidyn Levesque, jadedctrl@teknik.io
*/
#include <iostream>
#include <Directory.h>
#include <Entry.h>
#include <File.h>
@ -401,7 +403,7 @@ JabberHandler::UpdateSettings(BMessage* msg)
fJid.setJID(jid.String());
// Register our client
fClient = new gloox::Client(fJid, fPassword.String());
fClient = new OurClient(fJid, fPassword.String());
fClient->setServer(fServer.String());
if (fPort > 0)
fClient->setPort(fPort);
@ -1471,7 +1473,6 @@ JabberHandler::handleMessageEvent(const gloox::JID& from, gloox::MessageEventTyp
void
JabberHandler::handleChatState(const gloox::JID& from, gloox::ChatStateType state)
{
printf("------ %d\n", state);
// We're interested only in some states
if (state == gloox::ChatStateActive || state == gloox::ChatStateInvalid)
return;
@ -1819,7 +1820,7 @@ JabberHandler::handleLog(gloox::LogLevel level, gloox::LogArea,
const std::string& msg)
{
if (level >= gloox::LogLevelWarning)
printf("%s\n", msg.c_str());
std::cout << msg << std::endl;
}
@ -1872,6 +1873,22 @@ JabberHandler::handleVCardResult(gloox::VCardHandler::VCardContext context,
}
OurClient::OurClient(const gloox::JID jid, const char* password)
:
gloox::Client(jid, password)
{
}
void
OurClient::handleTag(gloox::Tag* tag)
{
if (DEBUG_ENABLED)
std::cerr << "Tag\t" << tag->xml() << std::endl;
gloox::Client::handleTag(tag);
}
InviteHandler::InviteHandler(gloox::ClientBase* client, JabberHandler* handler)
:
gloox::MUCInvitationHandler(client),

View File

@ -38,6 +38,7 @@
class BList;
class InviteHandler;
class OurClient;
typedef KeyMap<BString, gloox::MUCRoom*> RoomMap;
@ -108,7 +109,7 @@ private:
ChatProtocolMessengerInterface*
fServerMessenger;
gloox::Client* fClient;
OurClient* fClient;
gloox::ConnectionTCPClient*
fConnection;
gloox::VCardManager* fVCardManager;
@ -211,6 +212,14 @@ private:
};
class OurClient : public gloox::Client {
public:
OurClient(const gloox::JID jid, const char* password);
virtual void handleTag(gloox::Tag* tag);
};
class InviteHandler : public gloox::MUCInvitationHandler {
public:
InviteHandler(gloox::ClientBase* parent, JabberHandler* handler);