[prev in list] [next in list] [prev in thread] [next in thread]
List: kopete-devel
Subject: [kopete-devel] [Bug 96295] removing contacts in GG is not permanent
From: Grzegorz Jaskiewicz <gj () pointblue ! com ! pl>
Date: 2005-06-11 0:37:37
Message-ID: 20050611003737.8969.qmail () ktown ! kde ! org
[Download RAW message or body]
------- You are receiving this mail because: -------
You are on the CC list for the bug, or are watching someone who is.
http://bugs.kde.org/show_bug.cgi?id=96295
gj pointblue com pl changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|ASSIGNED |RESOLVED
Resolution| |FIXED
------- Additional Comments From gj pointblue com pl 2005-06-11 02:37 -------
SVN commit 424180 by gj:
CCMAIL: 96295-done bugs kde org
contact list is exported automatical ~2 mins after last change. This should keep list in sync.
If 2 mins is too long, well, tell me now. I think it should be enough.
If user disconnects in between, list won't be exported.
Need better synchronization ? use jabber, or tell sms express to make protocol saner :-)
M +46 -4 gaduaccount.cpp
M +3 -1 gaduaccount.h
M +10 -2 gaducontact.cpp
--- trunk/KDE/kdenetwork/kopete/protocols/gadu/gaduaccount.cpp #424179:424180
@ -65,7 +65,7 @
GaduDCC* gaduDcc_;
QTimer* pingTimer_;
-
+
QTextCodec* textcodec_;
KFileDialog* saveListDialog;
KFileDialog* loadListDialog;
@ -83,13 +83,19 @
QString lastDescription;
bool forFriends;
-
- KConfigGroup* config;
+
+ QTimer* exportTimer_;
+ bool exportUserlist;
+
+ KConfigGroup* config;
Kopete::OnlineStatus status;
QValueList<unsigned int> servers;
KGaduLoginParams loginInfo;
};
+// two minutes
+#define USERLISTEXPORT_TIMEOUT (2*60*1000)
+
// FIXME: use dynamic cache please, i consider this as broken resolution of this problem
static const char* const servers_ip[] = {
"217.17.41.88",
@ -144,7 +150,9 @
p->loginInfo.client_addr = 0;
p->pingTimer_ = new QTimer( this );
+ p->exportTimer_ = new QTimer( this );
+ p->exportUserlist = false;
p->gaduDcc_ = NULL;
p->config = configGroup();
@ -211,6 +219,9 @
QObject::connect( p->pingTimer_, SIGNAL( timeout() ),
SLOT( pingServer() ) );
+
+ QObject::connect( p->exportTimer_, SIGNAL( timeout() ),
+ SLOT( slotUserlistSynch() ) );
}
void
@ -338,6 +349,24 @
changeStatus( status, reason);
}
+void
+GaduAccount::slotUserlistSynch()
+{
+ if ( !p->exportUserlist ) {
+ return;
+ }
+ p->exportUserlist = false;
+ kdDebug(14100) << "userlist changed, exporting" << endl;
+ slotExportContactsList();
+}
+
+void
+GaduAccount::userlistChanged()
+{
+ p->exportUserlist = true;
+ p->exportTimer_->changeInterval( USERLISTEXPORT_TIMEOUT );
+}
+
bool
GaduAccount::createContact( const QString& contactId, Kopete::MetaContact* parentContact )
{
@ -348,6 +377,8 @
newContact->setParentIdentity( accountId() );
addNotify( uinNumber );
+ userlistChanged();
+
return true;
}
@ -495,6 +526,7 @
if ( isConnected() ) {
const uin_t u = c->uin();
p->session_->removeNotify( u );
+ userlistChanged();
}
}
@ -722,7 +754,11 @
startNotify();
p->session_->requestContacts();
- p->pingTimer_->start( 180000 );//3 minute timeout
+ p->pingTimer_->start( 3*60*1000 );//3 minute timeout
+ pingServer();
+
+ // check if we need to export userlist every USERLISTEXPORT_TIMEOUT ms
+ p->exportTimer_->start( USERLISTEXPORT_TIMEOUT );
}
void
@ -778,6 +814,9 @
Kopete::MetaContact* metaContact;
unsigned int i;
+ // don't export any new changes that were just imported :-)
+ p->exportTimer_->stop();
+
for ( i = 0; i != contactsList.size() ; i++ ) {
kdDebug(14100) << "uin " << contactsList[i].uin << endl;
@ -818,6 +857,9 @
}
}
}
+ // start to check if we need to export userlist
+ p->exportUserlist = false;
+ p->exportTimer_->start( USERLISTEXPORT_TIMEOUT );
}
void
--- trunk/KDE/kdenetwork/kopete/protocols/gadu/gaduaccount.h #424179:424180
@ -137,7 +137,8 @
void userlist( const QString& contacts );
GaduContactsList* userlist();
-
+ void slotUserlistSynch();
+
void connectionFailed( gg_failure_t failure );
void connectionSucceed( );
@ -156,6 +157,7 @
void initActions();
void dccOn();
void dccOff();
+ void userlistChanged();
GaduAccountPrivate* p;
};
--- trunk/KDE/kdenetwork/kopete/protocols/gadu/gaducontact.cpp #424179:424180
@ -24,6 +24,7 @
#include <kaction.h>
#include <kdebug.h>
#include <kfiledialog.h>
+#include <kmessagebox.h>
#include "gaduaccount.h"
#include "gaduprotocol.h"
@ -224,8 +225,15 @
void
GaduContact::deleteContact()
{
- account_->removeContact( this );
- deleteLater();
+ if ( account_->isConnected() ) {
+ account_->removeContact( this );
+ deleteLater();
+ }
+ else {
+ KMessageBox::error( Kopete::UI::Global::mainWidget(),
+ i18n( "<qt>Please go online to remove a contact from your contact list.</qt>" ),
+ i18n( "Gadu-Gadu Plugin" ));
+ }
}
void
_______________________________________________
kopete-devel mailing list
kopete-devel@kde.org
https://mail.kde.org/mailman/listinfo/kopete-devel
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic