On Sun, 03 Jan 2010 02:31:45 +0100, Pau Garcia i Quiles
<pgqui...@elpauer.org> wrote:
On Sat, Jan 2, 2010 at 9:02 PM, Roman Jarosz <kedge...@gmail.com> wrote:
On Sat, 02 Jan 2010 17:05:28 +0100, Pau Garcia i Quiles
<pgqui...@elpauer.org> wrote:
On Sat, Jan 2, 2010 at 3:28 PM, Roman Jarosz <kedge...@gmail.com>
wrote:
Hi,
Boiko, here is the first pile of libmsn fixes.
The 4th patch was not included intentionally.
Regarding patch
0005-Remove-ifdef-LIBMSN_INBOX_URL_ENABLED-and-make-pure-.patch, I
think you do not need to bump soname because the method is virtual.
See http://tinyurl.com/ydfphzy
Hm, I don't see anything about pure virtual functions
From http://tinyurl.com/ydfphzy :
"You cannot...
[...]
For virtual member functions:
* add a virtual function to a class that doesn't have any virtual
functions or virtual bases.
* add new virtual functions to non-leaf classes as this will break
subclasses. See below for some workarounds or ask on mailing lists.
[...]"
In this case, that's a leaf class and it already has virtual methods
(i. e. there is a virtual table already), so the change it's
binary-compatible.
, but the bump is
also because
the older version (0.2.0) could have LIBMSN_INBOX_URL_ENABLED on/off so
this
will force Kopete recompilation and will fix all the unexpected crashes.
Soversion was changed from 0.1.0 to 0.2.0 because
LIBMSN_INBOX_URL_ENABLED broke binary compatibility even when
LIBMSN_INBOX_URL_ENABLED was OFF, due to the addition of data members
(search the archives of this mailing list, I explained this in great
detail a few weeks ago).
Bump soname just to force Kopete to be rebuilt is a very bad practice
and I oppose.
Bumping soname without a need makes my life as the Debian maintainer
of libmsn more complicated because I need to submit the package and go
through the FTP-masters queue again, which may take several weeks.
Please don't.
Hi,
here are the patches without the soversion bump.
Regards,
Roman
>From 46cbbfd9fb4248575eb401220a61d49f90e7c411 Mon Sep 17 00:00:00 2001
From: kedge <ke...@kedge.(none)>
Date: Sat, 2 Jan 2010 11:42:26 +0100
Subject: [PATCH 1/5] Set isConnected to false during disconnection.
---
msn/connection.cpp | 1 +
1 files changed, 1 insertions(+), 0 deletions(-)
diff --git a/msn/connection.cpp b/msn/connection.cpp
index 48abdcd..602f0c1 100644
--- a/msn/connection.cpp
+++ b/msn/connection.cpp
@@ -114,6 +114,7 @@ namespace MSN
void Connection::disconnect()
{
+ this->connected = false;
this->myNotificationServer()->externalCallbacks.unregisterSocket(this->sock);
this->myNotificationServer()->externalCallbacks.closeSocket(this->sock);
--
1.6.5.4
>From df41cf1a67cbae6dfc78408096349aa3a2551bf3 Mon Sep 17 00:00:00 2001
From: kedge <ke...@kedge.(none)>
Date: Sat, 2 Jan 2010 11:44:01 +0100
Subject: [PATCH 2/5] Don't assert in connectionWithSocket because we need this for error handling (KDE BUG 199755).
Don't assert in disconnect if we are already disconnected.
---
msn/notificationserver.cpp | 5 ++---
msn/switchboardserver.cpp | 6 +++---
2 files changed, 5 insertions(+), 6 deletions(-)
diff --git a/msn/notificationserver.cpp b/msn/notificationserver.cpp
index 9ff8edf..963686a 100644
--- a/msn/notificationserver.cpp
+++ b/msn/notificationserver.cpp
@@ -69,8 +69,6 @@ namespace MSN
Connection *NotificationServerConnection::connectionWithSocket(void *sock)
{
- this->assertConnectionStateIsNot(NS_DISCONNECTED);
-
if (this->sock == sock)
return this;
@@ -1208,7 +1206,8 @@ public:
void NotificationServerConnection::disconnect()
{
- this->assertConnectionStateIsNot(NS_DISCONNECTED);
+ if (this->connectionState() == NS_DISCONNECTED)
+ return;
std::vector<SwitchboardServerConnection *> list = _switchboardConnections;
std::vector<SwitchboardServerConnection *>::iterator i = list.begin();
diff --git a/msn/switchboardserver.cpp b/msn/switchboardserver.cpp
index a71a46a..fa2f4c2 100644
--- a/msn/switchboardserver.cpp
+++ b/msn/switchboardserver.cpp
@@ -55,8 +55,6 @@ namespace MSN
Connection *SwitchboardServerConnection::connectionWithSocket(void * sock)
{
- this->assertConnectionStateIsAtLeast(SB_CONNECTING);
-
if (this->sock == sock)
return this;
@@ -572,7 +570,9 @@ public:
void SwitchboardServerConnection::disconnect()
{
- this->assertConnectionStateIsNot(SB_DISCONNECTED);
+ if (this->connectionState() == SB_DISCONNECTED)
+ return;
+
notificationServer.removeSwitchboardConnection(this);
this->myNotificationServer()->externalCallbacks.closingConnection(this);
--
1.6.5.4
>From 2f8f8df10d40a72aa15fb7e78997f3c53fd36a74 Mon Sep 17 00:00:00 2001
From: kedge <ke...@kedge.(none)>
Date: Sat, 2 Jan 2010 11:56:39 +0100
Subject: [PATCH 3/5] Objects created with "new" should be freed with "delete" not "free".
---
msn/p2p.cpp | 21 +++++++++++----------
msn/switchboardserver.cpp | 2 +-
2 files changed, 12 insertions(+), 11 deletions(-)
diff --git a/msn/p2p.cpp b/msn/p2p.cpp
index 0b6d106..0e826fa 100644
--- a/msn/p2p.cpp
+++ b/msn/p2p.cpp
@@ -68,7 +68,7 @@ namespace MSN {
header.read(c, packet.p2pHeader.messageLength);
std::string content(c, packet.p2pHeader.messageLength);
packet.body = content;
- free(c);
+ delete [] c;
header.read((char*)&packet.p2pFooter.appID, sizeof(packet.p2pFooter.appID));
if(packet.p2pHeader.flag==FLAG_ACK)
@@ -113,10 +113,10 @@ namespace MSN {
std::string d2(c);
std::string d3(g);
- free(a);
- free(c);
- free(d1);
- free(g);
+ delete [] a;
+ delete [] c;
+ delete [] d1;
+ delete [] g;
conn.message_ink(args, d2, d3);
return;
@@ -701,8 +701,8 @@ namespace MSN {
context.read((char*)filenameutf16, 520);
_ucs2_utf8(filenameutf8, filenameutf16, 520);
std::string filename((char*)filenameutf8);
- free(filenameutf16);
- free(filenameutf8);
+ delete [] filenameutf16;
+ delete [] filenameutf8;
unsigned long long filesize;
context.seekg(8);
@@ -715,7 +715,7 @@ namespace MSN {
char *a = new char[size2];
context.read((char*)a, size2);
preview = b64_encode(a,size2);
- free(a);
+ delete [] a;
}
fileTransferInvite ft;
ft.type = type;
@@ -1316,8 +1316,9 @@ namespace MSN {
context.write((char*)&unknown2, sizeof(unsigned int));
context.write((char*)&unknown3, 64);
- free(--filenameutf16);
- free(filenameutf8);
+ filenameutf16--;
+ delete [] filenameutf16;
+ delete [] filenameutf8;
if(ft.type == FILE_TRANSFER_WITH_PREVIEW && ft.preview.size())
context.write((char*)b64_decode(ft.preview.c_str()).c_str(), b64_decode(ft.preview.c_str()).size());
diff --git a/msn/switchboardserver.cpp b/msn/switchboardserver.cpp
index fa2f4c2..7ea1bea 100644
--- a/msn/switchboardserver.cpp
+++ b/msn/switchboardserver.cpp
@@ -474,7 +474,7 @@ public:
body_stream.read((char*)part, 1202);
std::string part1(part);
chunks.push_back(part1);
- free(part);
+ delete [] part;
}
// sending the first one
--
1.6.5.4
>From ed648911ac50d55e8b55a7994851a500a2501a09 Mon Sep 17 00:00:00 2001
From: kedge <ke...@kedge.(none)>
Date: Sat, 2 Jan 2010 12:43:55 +0100
Subject: [PATCH 5/5] Remove ifdef LIBMSN_INBOX_URL_ENABLED and make pure virtual function gotInboxUrl only virtual.
---
CMakeLists.txt | 1 -
msn/config.h.cmake | 2 --
msn/externals.h | 5 ++---
msn/notificationserver.cpp | 2 --
msntest/msntest.cpp | 4 ----
5 files changed, 2 insertions(+), 12 deletions(-)
diff --git a/CMakeLists.txt b/CMakeLists.txt
index ac93435..c71881b 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -1,7 +1,6 @@
CMAKE_MINIMUM_REQUIRED(VERSION 2.6)
project(libmsn)
-option( LIBMSN_INBOX_URL_ENABLED "Check if you want to enable the inbox feature. This will break API." TRUE )
option( ENABLE_DEBUG "Enable debug flags" FALSE)
if (ENABLE_DEBUG)
diff --git a/msn/config.h.cmake b/msn/config.h.cmake
index 5f8f59a..426ee69 100644
--- a/msn/config.h.cmake
+++ b/msn/config.h.cmake
@@ -1,6 +1,4 @@
#ifndef LIBMSN_CONFIG_H
#define LIBMSN_CONFIG_H
-#cmakedefine LIBMSN_INBOX_URL_ENABLED
-
#endif
diff --git a/msn/externals.h b/msn/externals.h
index bc4a917..f9c79a3 100644
--- a/msn/externals.h
+++ b/msn/externals.h
@@ -326,9 +326,8 @@ namespace MSN
* It must return the real size written to *sock
*/
virtual size_t writeDataToSocket (void *sock, char *data, size_t size) = 0;
-#ifdef LIBMSN_INBOX_URL_ENABLED
- virtual void gotInboxUrl (MSN::NotificationServerConnection *conn, MSN::hotmailInfo info) = 0;
-#endif
+
+ virtual void gotInboxUrl (MSN::NotificationServerConnection * /*conn*/, MSN::hotmailInfo /*info*/) {};
};
}
#endif
diff --git a/msn/notificationserver.cpp b/msn/notificationserver.cpp
index 963686a..84ec74b 100644
--- a/msn/notificationserver.cpp
+++ b/msn/notificationserver.cpp
@@ -385,9 +385,7 @@ namespace MSN
std::string creds(b);
info.creds = creds;
-#ifdef LIBMSN_INBOX_URL_ENABLED
this->myNotificationServer()->externalCallbacks.gotInboxUrl(this, info);
-#endif
}
void NotificationServerConnection::handle_MSG(std::vector<std::string> & args)
diff --git a/msntest/msntest.cpp b/msntest/msntest.cpp
index 67641c5..219947c 100644
--- a/msntest/msntest.cpp
+++ b/msntest/msntest.cpp
@@ -167,9 +167,7 @@ class Callbacks : public MSN::Callbacks
virtual size_t writeDataToSocket (void *sock, char *data, size_t size);
virtual std::string getSecureHTTPProxy();
-#ifdef LIBMSN_INBOX_URL_ENABLED
virtual void gotInboxUrl (MSN::NotificationServerConnection *conn, MSN::hotmailInfo info);
-#endif
};
struct pollfd mySockets[21];
@@ -1363,7 +1361,6 @@ void Callbacks::gotWinkFile(MSN::SwitchboardServerConnection * conn, unsigned in
printf("--- Voice Wink file '%s'\n", file.c_str());
}
-#ifdef LIBMSN_INBOX_URL_ENABLED
void Callbacks::gotInboxUrl(MSN::NotificationServerConnection *conn, MSN::hotmailInfo info)
{
std::vector<std::string>::const_iterator i;
@@ -1377,4 +1374,3 @@ void Callbacks::gotInboxUrl(MSN::NotificationServerConnection *conn, MSN::hotmai
std::cout << "auth: " << info.MSPAuth << std::endl;
std::cout << "creds: " << info.creds << std::endl;
}
-#endif
--
1.6.5.4
_______________________________________________
kopete-devel mailing list
kopete-devel@kde.org
https://mail.kde.org/mailman/listinfo/kopete-devel