Bug#512093: kphone: add option to disable subscribe presence

david at fries.net david at fries.net
Sat Jan 17 06:09:37 UTC 2009


Package: kphone
Version: 1:4.2-6
Severity: important
Tags: patch


kphone queries with a subscribe presence event all the entries on the
contact list.  As no one on my contact list publishes their contact
information the kphone log fills up with the attempts.  It would be
nice if there was an option to disable the presence feature.  It could
be a per person address book option or a global don't use it option.

-- System Information:
Debian Release: 4.0
  APT prefers stable
  APT policy: (500, 'stable')
Architecture: i386 (i686)
Shell:  /bin/sh linked to /bin/bash
Kernel: Linux 2.6.24.4
Locale: LANG=C, LC_CTYPE=C (charmap=ANSI_X3.4-1968)

Versions of packages kphone depends on:
ii  libasound2             1.0.13-2          ALSA library
ii  libc6                  2.3.6.ds1-13etch5 GNU C Library: Shared libraries
ii  libgcc1                1:4.1.1-21        GCC support library
ii  libice6                1:1.0.1-2         X11 Inter-Client Exchange library
ii  libjack0.100.0-0       0.101.1-2         JACK Audio Connection Kit (librari
ii  libpng12-0             1.2.15~beta5-1    PNG library - runtime
ii  libqt3-mt              3:3.3.7-4etch1    Qt GUI Library (Threaded runtime v
ii  libsm6                 1:1.0.1-3         X11 Session Management library
ii  libssl0.9.8            0.9.8c-4etch1     SSL shared libraries
ii  libstdc++6             4.1.1-21          The GNU Standard C++ Library v3
ii  libx11-6               2:1.0.3-7         X11 client-side library
ii  libxext6               1:1.0.1-2         X11 miscellaneous extension librar
ii  libxt6                 1:1.0.2-2         X11 toolkit intrinsics library

kphone recommends no packages.

-- no debconf information


Index: dissipate2/siputil.cpp
===================================================================
RCS file: /data/debian/kphone/cvs_root/kphone-4.2/dissipate2/siputil.cpp,v
retrieving revision 1.1
diff -u -p -r1.1 siputil.cpp
--- dissipate2/siputil.cpp	17 Jan 2009 04:29:10 -0000	1.1
+++ dissipate2/siputil.cpp	17 Jan 2009 05:38:15 -0000
@@ -19,13 +19,13 @@
 #include <stdlib.h>
 #include <string.h>
 
+#include <vector>
+#include <string>
+
 #include "siputil.h"
 
 static char *dissipate_our_fqdn = NULL;
 
-/* max number of network interfaces*/
-#define MAX_IF 5
-
 /* Path to the route entry in proc filesystem */
 #define PROCROUTE "/proc/net/route"
 
@@ -94,41 +94,51 @@ void findFqdn( void )
 {
 	int sock, err, if_count, i, j = 0;
 	struct ifconf netconf;
-	char buffer[32*MAX_IF];
-	char if_name[10][21];
-	char if_addr[10][21];
+	std::vector<std::string> if_name, if_addr;
 	char *default_ifName;
-	netconf.ifc_len = 32 * MAX_IF;
-	netconf.ifc_buf = buffer;
+	int len=sizeof(ifreq)*2;
+	netconf.ifc_buf = NULL;
 	sock=socket( PF_INET, SOCK_DGRAM, 0 );
-	err=ioctl( sock, SIOCGIFCONF, &netconf );
-	if ( err < 0 ) printf( "Error in ioctl: %i.\n", errno );
+	do {
+		delete [] netconf.ifc_buf;
+		len = netconf.ifc_len = len*2;
+		netconf.ifc_buf = new char[len];
+
+		err=ioctl( sock, SIOCGIFCONF, &netconf );
+		if ( err < 0 ) {
+			printf( "Error in ioctl: %i.\n", errno );
+			break;
+		}
+	} while(len == netconf.ifc_len); /* Try until we get them all. */
 	close( sock );
-	if_count = netconf.ifc_len / 32;
+
+	if_count = netconf.ifc_len / sizeof(ifreq);
 	printf( "Found %i interfaces.\n", if_count );
 
 //#test
 	if ( if_count == 1 ) {
-		strncpy( if_name[j], netconf.ifc_req[0].ifr_name, 20 );
-		strncpy( if_addr[j], inet_ntoa(((struct sockaddr_in*)(&netconf.ifc_req[0].ifr_addr))->sin_addr), 20 );
+		if_name.push_back(netconf.ifc_req[0].ifr_name);
+		if_addr.push_back(inet_ntoa(((struct sockaddr_in*)(&netconf.ifc_req[0].ifr_addr))->sin_addr));
 		j++;
 	} else {
 		for ( i = 0; i < if_count; i++ ) {
 			if ( strcmp( netconf.ifc_req[i].ifr_name, "lo" ) != 0 
 					&& strncmp( netconf.ifc_req[i].ifr_name, "vmnet", 5) != 0) {
-				strncpy( if_name[j], netconf.ifc_req[i].ifr_name, 20 );
-				strncpy( if_addr[j], inet_ntoa(((struct sockaddr_in*)(&netconf.ifc_req[i].ifr_addr))->sin_addr), 20 );
+				if_name.push_back(netconf.ifc_req[i].ifr_name);
+				if_addr.push_back(inet_ntoa(((struct sockaddr_in*)(&netconf.ifc_req[i].ifr_addr))->sin_addr));
 				j++;
 			}
 		}
 	}
+	delete [] netconf.ifc_buf;
+	netconf.ifc_buf = NULL;
 	if( j == 1 ) {
-		dissipate_our_fqdn = strdup( if_addr[0] );
+		dissipate_our_fqdn = strdup( if_addr[0].c_str() );
 	} else {
 		default_ifName = getdefaultdev();
 		if( default_ifName != NULL) {
 			for( i = 0; i < j; i++ ) {
-				if( strcmp( if_name[i], default_ifName ) == 0 ) {
+				if( if_name[i] == default_ifName ) {
 					QMessageBox mb( "KPhone",
 						QObject::tr("KPhone found more than one interface.") + "\n" + 
 					        QObject::tr("Do you want to use the default interface:") + "\n\n" +
@@ -142,7 +152,7 @@ void findFqdn( void )
 					mb.setButtonText( QMessageBox::Cancel, QObject::tr("Cancel") );
 					switch( mb.exec() ) {
 						case QMessageBox::Yes:
-							dissipate_our_fqdn = strdup( if_addr[i] );
+							dissipate_our_fqdn = strdup( if_addr[i].c_str() );
 							return;
 						case QMessageBox::Cancel:
 							return;
@@ -153,7 +163,7 @@ void findFqdn( void )
 			default_ifName = "";
 		}
 		for( i = 0; i < j; i++ ) {
-			if( strcmp( if_name[i], default_ifName ) != 0 ) {
+			if( if_name[i] != default_ifName ) {
 				if( i == j-1 ) {
 					QMessageBox mb( "KPhone",
 						QObject::tr("Do you want to use") + " " + QString(if_name[i]) + "  (IP:\"" + QString(if_addr[i]) + "\")",
@@ -163,7 +173,7 @@ void findFqdn( void )
 					mb.setButtonText( QMessageBox::Yes, QObject::tr("Use") + " " + QString(if_addr[i]) );
 					switch( mb.exec() ) {
 						case QMessageBox::Yes:
-							dissipate_our_fqdn = strdup( if_addr[i] );
+							dissipate_our_fqdn = strdup( if_addr[i].c_str() );
 							return;
 						case QMessageBox::Cancel:
 							return;
@@ -180,7 +190,7 @@ void findFqdn( void )
 					mb.setButtonText( QMessageBox::Cancel, QObject::tr("Cancel") );
 					switch( mb.exec() ) {
 						case QMessageBox::Yes:
-							dissipate_our_fqdn = strdup( if_addr[i] );
+							dissipate_our_fqdn = strdup( if_addr[i].c_str() );
 							return;
 						case QMessageBox::Cancel:
 							return;





More information about the Pkg-voip-maintainers mailing list