summaryrefslogtreecommitdiffstats
path: root/kopete/protocols/oscar/liboscar/client.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'kopete/protocols/oscar/liboscar/client.cpp')
-rw-r--r--kopete/protocols/oscar/liboscar/client.cpp81
1 files changed, 71 insertions, 10 deletions
diff --git a/kopete/protocols/oscar/liboscar/client.cpp b/kopete/protocols/oscar/liboscar/client.cpp
index 2bae2155..7ed6c0d6 100644
--- a/kopete/protocols/oscar/liboscar/client.cpp
+++ b/kopete/protocols/oscar/liboscar/client.cpp
@@ -93,6 +93,7 @@ public:
int stage;
//Protocol specific data
+ bool isIcq;
bool redirectRequested;
TQValueList<WORD> redirectionServices;
WORD currentRedirect;
@@ -145,6 +146,7 @@ Client::Client( TQObject* parent )
d = new ClientPrivate;
d->tzoffset = 0;
d->active = false;
+ d->isIcq = false; //default to AIM
d->redirectRequested = false;
d->currentRedirect = 0;
d->connectAsStatus = 0x0; // default to online
@@ -231,6 +233,30 @@ void Client::close()
d->ssiManager->clear();
}
+void Client::setStatus( AIMStatus status, const TQString &_message )
+{
+ // AIM: you're away exactly when your away message isn't empty.
+ // can't use TQString() as a message either; ProfileTask
+ // interprets null as "don't change".
+ TQString message;
+ if ( status == Online )
+ message = TQString::fromAscii("");
+ else
+ {
+ if ( _message.isEmpty() )
+ message = TQString::fromAscii(" ");
+ else
+ message = _message;
+ }
+
+ Connection* c = d->connections.connectionForFamily( 0x0002 );
+ if ( !c )
+ return;
+ ProfileTask* pt = new ProfileTask( c->rootTask() );
+ pt->setAwayMessage( message );
+ pt->go( true );
+}
+
void Client::setStatus( DWORD status, const TQString &message )
{
// remember the message to reply with, when requested
@@ -372,20 +398,24 @@ void Client::serviceSetupFinished()
{
d->active = true;
- setStatus( d->connectAsStatus, d->connectWithMessage );
+ if ( isIcq() )
+ setStatus( d->connectAsStatus, d->connectWithMessage );
d->ownStatusTask->go();
- //retrieve offline messages
- Connection* c = d->connections.connectionForFamily( 0x0015 );
- if ( !c ) {
- return;
- }
+ if ( isIcq() )
+ {
+ //retrieve offline messages
+ Connection* c = d->connections.connectionForFamily( 0x0015 );
+ if ( !c ) {
+ return;
+ }
- OfflineMessagesTask *offlineMsgTask = new OfflineMessagesTask( c->rootTask() );
- connect( offlineMsgTask, TQT_SIGNAL( receivedOfflineMessage(const Oscar::Message& ) ),
- this, TQT_SIGNAL( messageReceived(const Oscar::Message& ) ) );
- offlineMsgTask->go( true );
+ OfflineMessagesTask *offlineMsgTask = new OfflineMessagesTask( c->rootTask() );
+ connect( offlineMsgTask, TQT_SIGNAL( receivedOfflineMessage(const Oscar::Message& ) ),
+ this, TQT_SIGNAL( messageReceived(const Oscar::Message& ) ) );
+ offlineMsgTask->go( true );
+ }
emit haveSSIList();
emit loggedIn();
@@ -566,6 +596,16 @@ bool Client::isActive() const
return d->active;
}
+bool Client::isIcq() const
+{
+ return d->isIcq;
+}
+
+void Client::setIsIcq( bool isIcq )
+{
+ d->isIcq = isIcq;
+}
+
void Client::debug( const TQString& str )
{
Q_UNUSED(str);
@@ -813,6 +853,16 @@ void Client::setChatExchangeList( const TQValueList<int>& exchanges )
d->exchanges = exchanges;
}
+void Client::requestAIMProfile( const TQString& contact )
+{
+ d->userInfoTask->requestInfoFor( contact, UserInfoTask::Profile );
+}
+
+void Client::requestAIMAwayMessage( const TQString& contact )
+{
+ d->userInfoTask->requestInfoFor( contact, UserInfoTask::AwayMessage );
+}
+
void Client::requestICQAwayMessage( const TQString& contact, ICQStatus contactStatus )
{
kdDebug(OSCAR_RAW_DEBUG) << k_funcinfo << "requesting away message for " << contact << endl;
@@ -944,6 +994,17 @@ void Client::uinSearch( const TQString& uin )
ust->searchUserByUIN( uin );
}
+void Client::updateProfile( const TQString& profile )
+{
+ Connection* c = d->connections.connectionForFamily( 0x0002 );
+ if ( !c ) {
+ return;
+ }
+ ProfileTask* pt = new ProfileTask( c->rootTask() );
+ pt->setProfileText( profile );
+ pt->go(true);
+}
+
void Client::sendTyping( const TQString & contact, bool typing )
{
Connection* c = d->connections.connectionForFamily( 0x0004 );