Revision 1856b49720b10fe28cb4bddb5ebb5112da479e14

evands at pidgin.im evands at pidgin.im
Sat Mar 24 21:31:09 EDT 2007


o     -----------------------------------------------------------------
|\    Revision: 1856b49720b10fe28cb4bddb5ebb5112da479e14
| |   Ancestor: 07e7dc60c6d454ea53b2d205797d1d823fef5567
| |   Ancestor: b5885bece1b8de925af49d2878e6a4772913199a
| |   Author: evands at pidgin.im
| |   Date: 2007-03-25T01:30:50
| |   Branch: im.pidgin.pidgin
| |   
| |   Renamed entries:
| |           doc/gaims_funniest_home_convos.txt to doc/funniest_home_convos.txt
| |           gaim.apspec.in to pidgin.apspec.in
| |           pidgin/plugins/crazychat/cc_gaim_plugin.c to pidgin/plugins/crazychat/cc_pidgin_plugin.c
| |           pidgin/plugins/gaimrc.c to pidgin/plugins/pidginrc.c
| |   Modified files:
| |           Makefile.am configure.ac libpurple/nat-pmp.c
| |           libpurple/nat-pmp.h pidgin/plugins/Makefile.am
| |           pidgin/plugins/crazychat/Makefile.am pidgin.apspec.in
| |           po/POTFILES.in
| |   
| |   ChangeLog: 
| |   
| |   merge of '07e7dc60c6d454ea53b2d205797d1d823fef5567'
| |        and 'b5885bece1b8de925af49d2878e6a4772913199a'
| |   
| |   ============================================================
| |   --- libpurple/nat-pmp.c	f41bf331cb3878920c1effd8efbf7fb8849816b1
| |   +++ libpurple/nat-pmp.c	1ab6d4ebf220d7079bade6efd528d8a0e0d95d3c
| |   @@ -32,12 +32,13 @@
| |    #include "debug.h"
| |    
| |    #include <arpa/inet.h>
| |   -#include <net/route.h>
| |    #include <netinet/in.h>
| |   +#include <sys/types.h>
| |    #include <sys/socket.h>
| |    #include <sys/sysctl.h>
| |   -#include <sys/types.h>
| |    
| |   +#include <net/route.h>
| |   +
| |    #include <netdb.h>
| |    #include <stdio.h>
| |    #include <stdlib.h>
| |   @@ -50,8 +51,42 @@
| |    
| |    #ifdef NET_RT_DUMP2
| |    
| |   -#define PMP_DEBUG 1
| |   +#define PMP_DEBUG	1
| |    
| |   +typedef struct {
| |   +	uint8_t	version;
| |   +	uint8_t opcode;
| |   +} PurplePmpIpRequest;
| |   +
| |   +typedef struct {
| |   +	uint8_t		version;
| |   +	uint8_t		opcode; // 128 + n
| |   +	uint16_t	resultcode;
| |   +	uint32_t	epoch;
| |   +	uint32_t	address;
| |   +} PurplePmpIpResponse;
| |   +
| |   +typedef struct {
| |   +	uint8_t		version;
| |   +	uint8_t		opcode;
| |   +	char		reserved[2];
| |   +	uint16_t	privateport;
| |   +	uint16_t	publicport;
| |   +	uint32_t	lifetime;
| |   +} PurplePmpMapRequest;
| |   +
| |   +struct _PurplePmpMapResponse {
| |   +	uint8_t		version;
| |   +	uint8_t		opcode;
| |   +	uint16_t	resultcode;
| |   +	uint32_t	epoch;
| |   +	uint16_t	privateport;
| |   +	uint16_t	publicport;
| |   +	uint32_t	lifetime;
| |   +};
| |   +
| |   +typedef struct _PurplePmpMapResponse PurplePmpMapResponse;
| |   +
| |    /*
| |     *	Thanks to R. Matthew Emerson for the fixes on this
| |     */
| |   @@ -61,7 +96,7 @@
| |    
| |    #define PMP_VERSION			0
| |    #define PMP_PORT			5351
| |   -#define PMP_TIMEOUT			250000	//	250000 useconds
| |   +#define PMP_TIMEOUT			250000	/* 250000 useconds */
| |    
| |    /* alignment constraint for routing socket */
| |    #define ROUNDUP(a)			((a) > 0 ? (1 + (((a) - 1) | (sizeof(long) - 1))) : sizeof(long))
| |   @@ -197,26 +232,6 @@ default_gw()
| |    }
| |    
| |    /*!
| |   - * double_timeout(struct timeval *) will handle doubling a timeout for backoffs required by NAT-PMP
| |   - */
| |   -static void
| |   -double_timeout(struct timeval *to)
| |   -{
| |   -	int second = 1000000; // number of useconds
| |   -	
| |   -	to->tv_sec = (to->tv_sec * 2);
| |   -	to->tv_usec = (to->tv_usec * 2);
| |   -	
| |   -	// Overflow useconds if necessary
| |   -	if (to->tv_usec >= second)
| |   -	{
| |   -		int overflow = (to->tv_usec / second);
| |   -		to->tv_usec  = (to->tv_usec - (overflow * second));
| |   -		to->tv_sec = (to->tv_sec + overflow);
| |   -	}
| |   -}
| |   -
| |   -/*!
| |     *	purple_pmp_get_public_ip() will return the publicly facing IP address of the 
| |     *	default NAT gateway. The function will return NULL if:
| |     *		- The gateway doesn't support NAT-PMP
| |   @@ -227,18 +242,17 @@ purple_pmp_get_public_ip()
| |    {
| |    	struct sockaddr_in *gateway = default_gw();
| |    	
| |   -	if (gateway == NULL)
| |   +	if (!gateway)
| |    	{
| |    		purple_debug_info("nat-pmp", "Cannot request public IP from a NULL gateway!\n");
| |    		return NULL;
| |    	}
| |   +
| |   +	/* Default port for NAT-PMP is 5351 */
| |    	if (gateway->sin_port != PMP_PORT)
| |   -	{
| |   -		gateway->sin_port = htons(PMP_PORT); //	Default port for NAT-PMP is 5351
| |   -	}
| |   +		gateway->sin_port = htons(PMP_PORT);
| |    
| |    	int sendfd;
| |   -	int req_attempts = 1;	
| |    	struct timeval req_timeout;
| |    	PurplePmpIpRequest req;
| |    	PurplePmpIpResponse resp;
| |   @@ -249,70 +263,66 @@ purple_pmp_get_public_ip()
| |    
| |    	sendfd = socket(AF_INET, SOCK_DGRAM, IPPROTO_UDP);
| |    	
| |   -	//	Clean out both req and resp structures
| |   +	/* Clean out both req and resp structures */
| |    	bzero(&req, sizeof(PurplePmpIpRequest));
| |    	bzero(&resp, sizeof(PurplePmpIpResponse));
| |    	req.version = 0;
| |    	req.opcode	= 0;
| |    	
| |   -	//	Attempt to contact NAT-PMP device 9 times as per: draft-cheshire-nat-pmp-02.txt  
| |   -	while (req_attempts < 10)
| |   -	{	
| |   +	/* The NAT-PMP spec says we should attempt to contact the gateway 9 times, doubling the time we wait each time.
| |   +	 * Even starting with a timeout of 0.1 seconds, that means that we have a total waiting of 204.6 seconds.
| |   +	 * With the recommended timeout of 0.25 seconds, we're talking 511.5 seconds (8.5 minutes).
| |   +	 * 
| |   +	 * This seems really silly... if this were nonblocking, a couple retries might be in order, but it's not at present.
| |   +	 * XXX Make this nonblocking.
| |   +	 */
| |    #ifdef PMP_DEBUG
| |   -		purple_debug_info("nat-pmp", "Attempting to retrieve the public ip address for the NAT device at: %s\n", inet_ntoa(gateway->sin_addr));
| |   -		purple_debug_info("nat-pmp", "\tTimeout: %ds %dus, Request #: %d\n", req_timeout.tv_sec, req_timeout.tv_usec, req_attempts);
| |   +	purple_debug_info("nat-pmp", "Attempting to retrieve the public ip address for the NAT device at: %s\n", inet_ntoa(gateway->sin_addr));
| |   +	purple_debug_info("nat-pmp", "\tTimeout: %ds %dus\n", req_timeout.tv_sec, req_timeout.tv_usec);
| |    #endif
| |   -		struct sockaddr_in addr;
| |   -		socklen_t len = sizeof(struct sockaddr_in);
| |   +	struct sockaddr_in addr;
| |   +	socklen_t len = sizeof(struct sockaddr_in);
| |    
| |   -		/* TODO: Non-blocking! */
| |   -		if (sendto(sendfd, &req, sizeof(req), 0, (struct sockaddr *)(gateway), sizeof(struct sockaddr)) < 0)
| |   +	/* TODO: Non-blocking! */
| |   +	if (sendto(sendfd, &req, sizeof(req), 0, (struct sockaddr *)(gateway), sizeof(struct sockaddr)) < 0)
| |   +	{
| |   +		purple_debug_info("nat-pmp", "There was an error sending the NAT-PMP public IP request! (%s)\n", strerror(errno));
| |   +		g_free(gateway);
| |   +		return NULL;
| |   +	}
| |   +
| |   +	if (setsockopt(sendfd, SOL_SOCKET, SO_RCVTIMEO, &req_timeout, sizeof(req_timeout)) < 0)
| |   +	{
| |   +		purple_debug_info("nat-pmp", "There was an error setting the socket's options! (%s)\n", strerror(errno));
| |   +		g_free(gateway);
| |   +		return NULL;
| |   +	}		
| |   +
| |   +	/* TODO: Non-blocking! */
| |   +	if (recvfrom(sendfd, &resp, sizeof(PurplePmpIpResponse), 0, (struct sockaddr *)(&addr), &len) < 0)
| |   +	{			
| |   +		if (errno != EAGAIN)
| |    		{
| |   -			purple_debug_info("nat-pmp", "There was an error sending the NAT-PMP public IP request! (%s)\n", strerror(errno));
| |   +			purple_debug_info("nat-pmp", "There was an error receiving the response from the NAT-PMP device! (%s)\n", strerror(errno));
| |   +			g_free(gateway);
| |    			return NULL;
| |    		}
| |   -		
| |   -		if (setsockopt(sendfd, SOL_SOCKET, SO_RCVTIMEO, &req_timeout, sizeof(req_timeout)) < 0)
| |   -		{
| |   -			purple_debug_info("nat-pmp", "There was an error setting the socket's options! (%s)\n", strerror(errno));
| |   -			return NULL;
| |   -		}		
| |   -		
| |   -		/* TODO: Non-blocking! */
| |   -		if (recvfrom(sendfd, &resp, sizeof(PurplePmpIpResponse), 0, (struct sockaddr *)(&addr), &len) < 0)
| |   -		{			
| |   -			if ( (errno != EAGAIN) || (req_attempts == 9) )
| |   -			{
| |   -				purple_debug_info("nat-pmp", "There was an error receiving the response from the NAT-PMP device! (%s)\n", strerror(errno));
| |   -				return NULL;
| |   -			}
| |   -			else
| |   -			{
| |   -				goto iterate;
| |   -			}
| |   -		}
| |   -		
| |   -		if (addr.sin_addr.s_addr != gateway->sin_addr.s_addr)
| |   -		{
| |   -			purple_debug_info("nat-pmp", "Response was not received from our gateway! Instead from: %s\n", inet_ntoa(addr.sin_addr));
| |   -			goto iterate;
| |   -		}
| |   -		else
| |   -		{
| |   -			publicsockaddr = &addr;
| |   -			break;
| |   -		}
| |   +	}
| |    
| |   -iterate:
| |   -		++req_attempts;
| |   -		double_timeout(&req_timeout);
| |   +	if (addr.sin_addr.s_addr == gateway->sin_addr.s_addr)
| |   +		publicsockaddr = &addr;
| |   +	else
| |   +	{
| |   +		purple_debug_info("nat-pmp", "Response was not received from our gateway! Instead from: %s\n", inet_ntoa(addr.sin_addr));
| |   +		g_free(gateway);
| |   +		return NULL;
| |    	}
| |    
| |   -	if (publicsockaddr == NULL) {
| |   +	if (!publicsockaddr) {
| |    		g_free(gateway);
| |    		return NULL;
| |    	}
| |   -	
| |   +
| |    #ifdef PMP_DEBUG
| |    	purple_debug_info("nat-pmp", "Response received from NAT-PMP device:\n");
| |    	purple_debug_info("nat-pmp", "version: %d\n", resp.version);
| |   @@ -331,128 +341,122 @@ iterate:
| |    	return inet_ntoa(publicsockaddr->sin_addr);
| |    }
| |    
| |   -/*!
| |   - *	will return NULL on error, or a pointer to the PurplePmpMapResponse type
| |   - */
| |   -PurplePmpMapResponse *
| |   -purple_pmp_create_map(PurplePmpType type, uint16_t privateport, uint16_t publicport, uint32_t lifetime)
| |   +gboolean
| |   +purple_pmp_create_map(PurplePmpType type, unsigned short privateport, unsigned short publicport, int lifetime)
| |    {
| |   -	struct sockaddr_in *gateway = default_gw();
| |   +	struct sockaddr_in *gateway;
| |   +	gboolean success = TRUE;
| |   +	int sendfd;
| |   +	struct timeval req_timeout;
| |   +	PurplePmpMapRequest req;
| |   +	PurplePmpMapResponse *resp;
| |    	
| |   -	if (gateway == NULL)
| |   +	gateway = default_gw();
| |   +	
| |   +	if (!gateway)
| |    	{
| |    		purple_debug_info("nat-pmp", "Cannot create mapping on a NULL gateway!\n");
| |   -		return NULL;
| |   +		return FALSE;
| |    	}
| |   +
| |   +	/* Default port for NAT-PMP is 5351 */
| |    	if (gateway->sin_port != PMP_PORT)
| |   -	{
| |   -		gateway->sin_port = htons(PMP_PORT); //	Default port for NAT-PMP is 5351
| |   -	}
| |   -		
| |   -	int sendfd;
| |   -	int req_attempts = 1;	
| |   -	struct timeval req_timeout;
| |   -	PurplePmpMapRequest req;
| |   -	PurplePmpMapResponse *resp = (PurplePmpMapResponse *)(malloc(sizeof(PurplePmpMapResponse)));
| |   +		gateway->sin_port = htons(PMP_PORT);
| |    	
| |   +	resp = g_new0(PurplePmpMapResponse, 1);
| |   +	
| |    	req_timeout.tv_sec = 0;
| |    	req_timeout.tv_usec = PMP_TIMEOUT;
| |    	
| |    	sendfd = socket(AF_INET, SOCK_DGRAM, IPPROTO_UDP);
| |    	
| |   -	//	Clean out both req and resp structures
| |   +	/* Set up the req */
| |    	bzero(&req, sizeof(PurplePmpMapRequest));
| |   -	bzero(resp, sizeof(PurplePmpMapResponse));
| |    	req.version = 0;
| |    	req.opcode	= ((type == PURPLE_PMP_TYPE_UDP) ? PMP_MAP_OPCODE_UDP : PMP_MAP_OPCODE_TCP);	
| |    	req.privateport = htons(privateport); //	What a difference byte ordering makes...d'oh!
| |    	req.publicport = htons(publicport);
| |    	req.lifetime = htonl(lifetime);
| |    	
| |   -	//	Attempt to contact NAT-PMP device 9 times as per: draft-cheshire-nat-pmp-02.txt  
| |   -	while (req_attempts < 10)
| |   -	{	
| |   +	/* The NAT-PMP spec says we should attempt to contact the gateway 9 times, doubling the time we wait each time.
| |   +	 * Even starting with a timeout of 0.1 seconds, that means that we have a total waiting of 204.6 seconds.
| |   +	 * With the recommended timeout of 0.25 seconds, we're talking 511.5 seconds (8.5 minutes).
| |   +	 * 
| |   +	 * This seems really silly... if this were nonblocking, a couple retries might be in order, but it's not at present.
| |   +	 * XXX Make this nonblocking.
| |   +	 * XXX This code looks like the pmp_get_public_ip() code. Can it be consolidated?
| |   +	 */
| |    #ifdef PMP_DEBUG
| |   -		purple_debug_info("nat-pmp", "Attempting to create a NAT-PMP mapping the private port %d, and the public port %d\n", privateport, publicport);
| |   -		purple_debug_info("nat-pmp", "\tTimeout: %ds %dus, Request #: %d\n", req_timeout.tv_sec, req_timeout.tv_usec, req_attempts);
| |   +	purple_debug_info("nat-pmp", "Attempting to create a NAT-PMP mapping the private port %d, and the public port %d\n", privateport, publicport);
| |   +	purple_debug_info("nat-pmp", "\tTimeout: %ds %dus\n", req_timeout.tv_sec, req_timeout.tv_usec);
| |    #endif
| |    
| |   -		/* TODO: Non-blocking! */
| |   -		if (sendto(sendfd, &req, sizeof(req), 0, (struct sockaddr *)(gateway), sizeof(struct sockaddr)) < 0)
| |   -		{
| |   -			purple_debug_info("nat-pmp", "There was an error sending the NAT-PMP mapping request! (%s)\n", strerror(errno));
| |   -			return NULL;
| |   -		}
| |   -		
| |   -		if (setsockopt(sendfd, SOL_SOCKET, SO_RCVTIMEO, &req_timeout, sizeof(req_timeout)) < 0)
| |   -		{
| |   +	/* TODO: Non-blocking! */
| |   +	success = (sendto(sendfd, &req, sizeof(req), 0, (struct sockaddr *)(gateway), sizeof(struct sockaddr)) >= 0);
| |   +	if (!success)
| |   +		purple_debug_info("nat-pmp", "There was an error sending the NAT-PMP mapping request! (%s)\n", strerror(errno));
| |   +
| |   +	if (success)
| |   +	{
| |   +		success = (setsockopt(sendfd, SOL_SOCKET, SO_RCVTIMEO, &req_timeout, sizeof(req_timeout)) >= 0);
| |   +		if (!success)
| |    			purple_debug_info("nat-pmp", "There was an error setting the socket's options! (%s)\n", strerror(errno));
| |   -			return NULL;
| |   -		}		
| |   -		
| |   +	}
| |   +
| |   +	if (success)
| |   +	{
| |   +		/* The original code treats EAGAIN as a reason to iterate.. but I've removed iteration. This may be a problem */
| |    		/* TODO: Non-blocking! */
| |   -		if (recvfrom(sendfd, resp, sizeof(PurplePmpMapResponse), 0, NULL, NULL) < 0)
| |   -		{			
| |   -			if ( (errno != EAGAIN) || (req_attempts == 9) )
| |   -			{
| |   -				purple_debug_info("nat-pmp", "There was an error receiving the response from the NAT-PMP device! (%s)\n", strerror(errno));
| |   -				return NULL;
| |   -			}
| |   -			else
| |   -			{
| |   -				goto iterate;
| |   -			}
| |   -		}
| |   -		
| |   -		if (resp->opcode != (req.opcode + 128))
| |   -		{
| |   +		success = ((recvfrom(sendfd, resp, sizeof(PurplePmpMapResponse), 0, NULL, NULL) >= 0) ||
| |   +				   (errno == EAGAIN));
| |   +		if (!success)
| |   +			purple_debug_info("nat-pmp", "There was an error receiving the response from the NAT-PMP device! (%s)\n", strerror(errno));
| |   +	}
| |   +
| |   +	if (success)
| |   +	{
| |   +		success = (resp->opcode == (req.opcode + 128));
| |   +		if (!success)
| |    			purple_debug_info("nat-pmp", "The opcode for the response from the NAT device does not match the request opcode!\n");
| |   -			goto iterate;
| |   -		}
| |   -		
| |   -		break;
| |   -		
| |   -iterate:
| |   -		++req_attempts;
| |   -		double_timeout(&req_timeout);
| |    	}
| |   -	
| |   +
| |    #ifdef PMP_DEBUG
| |   -	purple_debug_info("nat-pmp", "Response received from NAT-PMP device:\n");
| |   -	purple_debug_info("nat-pmp", "version: %d\n", resp->version);
| |   -	purple_debug_info("nat-pmp", "opcode: %d\n", resp->opcode);
| |   -	purple_debug_info("nat-pmp", "resultcode: %d\n", ntohs(resp->resultcode));
| |   -	purple_debug_info("nat-pmp", "epoch: %d\n", ntohl(resp->epoch));
| |   -	purple_debug_info("nat-pmp", "privateport: %d\n", ntohs(resp->privateport));
| |   -	purple_debug_info("nat-pmp", "publicport: %d\n", ntohs(resp->publicport));
| |   -	purple_debug_info("nat-pmp", "lifetime: %d\n", ntohl(resp->lifetime));
| |   -#endif	
| |   +	if (success)
| |   +	{
| |   +		purple_debug_info("nat-pmp", "Response received from NAT-PMP device:\n");
| |   +		purple_debug_info("nat-pmp", "version: %d\n", resp->version);
| |   +		purple_debug_info("nat-pmp", "opcode: %d\n", resp->opcode);
| |   +		purple_debug_info("nat-pmp", "resultcode: %d\n", ntohs(resp->resultcode));
| |   +		purple_debug_info("nat-pmp", "epoch: %d\n", ntohl(resp->epoch));
| |   +		purple_debug_info("nat-pmp", "privateport: %d\n", ntohs(resp->privateport));
| |   +		purple_debug_info("nat-pmp", "publicport: %d\n", ntohs(resp->publicport));
| |   +		purple_debug_info("nat-pmp", "lifetime: %d\n", ntohl(resp->lifetime));
| |   +	}
| |   +#endif
| |    
| |   +	g_free(resp);
| |    	g_free(gateway);
| |    
| |   -	return resp;
| |   +	/* XXX The private port may actually differ from the one we requested, according to the spec.
| |   +	 * We don't handle that situation at present.
| |   +	 *
| |   +	 * TODO: Look at the result and verify it matches what we wanted; either return a failure if it doesn't,
| |   +	 * or change network.c to know what to do if the desired private port shifts as a result of the nat-pmp operation.
| |   +	 */
| |   +	return success;
| |    }
| |    
| |   -/*!
| |   - *	pmp_destroy_map(uint8_t,uint16_t) 
| |   - *	will return NULL on error, or a pointer to the PurplePmpMapResponse type
| |   - */
| |   -PurplePmpMapResponse *
| |   -purple_pmp_destroy_map(PurplePmpType type, uint16_t privateport)
| |   +gboolean
| |   +purple_pmp_destroy_map(PurplePmpType type, unsigned short privateport)
| |    {
| |   -	PurplePmpMapResponse *response;
| |   +	gboolean success;
| |    	
| |   -	response = purple_pmp_create_map(((type == PURPLE_PMP_TYPE_UDP) ? PMP_MAP_OPCODE_UDP : PMP_MAP_OPCODE_TCP),
| |   +	success = purple_pmp_create_map(((type == PURPLE_PMP_TYPE_UDP) ? PMP_MAP_OPCODE_UDP : PMP_MAP_OPCODE_TCP),
| |    							privateport, 0, 0);
| |   -	if (!response)
| |   -	{
| |   -		purple_debug_info("nat-pmp", "Failed to properly destroy mapping for %d!\n", privateport);
| |   -		return NULL;
| |   -	}
| |   -	else
| |   -	{
| |   -		return response;
| |   -	}
| |   +	if (!success)
| |   +		purple_debug_warning("nat-pmp", "Failed to properly destroy mapping for %d!\n", privateport);
| |   +
| |   +	return success;
| |    }
| |    #else /* #ifdef NET_RT_DUMP2 */
| |    char *
| |   @@ -461,14 +465,14 @@ purple_pmp_get_public_ip()
| |    	return NULL;
| |    }
| |    
| |   -PurplePmpMapResponse *
| |   -purple_pmp_create_map(PurplePmpType type, uint16_t privateport, uint16_t publicport, uint32_t lifetime)
| |   +gboolean
| |   +purple_pmp_create_map(PurplePmpType type, unsigned short privateport, unsigned short publicport, int lifetime)
| |    {
| |    	return NULL;
| |    }
| |    
| |   -PurplePmpMapResponse *
| |   -purple_pmp_destroy_map(PurplePmpType type, uint16_t privateport)
| |   +gboolean
| |   +purple_pmp_destroy_map(PurplePmpType type, unsigned short privateport)
| |    {
| |    	return NULL;
| |    }
| |   ============================================================
| |   --- libpurple/nat-pmp.h	bae3d58035c9f41352495b51ae69203bc489e51b
| |   +++ libpurple/nat-pmp.h	5f2cac238513429f0a46ff2bcf9374b5f61270c3
| |   @@ -32,8 +32,9 @@
| |    #define _PURPLE_NAT_PMP_H
| |    
| |    #include <stdint.h>
| |   +#include <glib.h>
| |    
| |   -#define PURPLE_PMP_LIFETIME 3600 /* seconds */
| |   +#define PURPLE_PMP_LIFETIME	3600	/* 3600 seconds */
| |    
| |    /*
| |     *	uint8_t:	version, opcodes
| |   @@ -46,41 +47,10 @@ typedef enum {
| |    	PURPLE_PMP_TYPE_TCP
| |    } PurplePmpType;
| |    
| |   -typedef struct {
| |   -	uint8_t	version;
| |   -	uint8_t opcode;
| |   -} PurplePmpIpRequest;
| |   -
| |   -typedef struct {
| |   -	uint8_t		version;
| |   -	uint8_t		opcode; // 128 + n
| |   -	uint16_t	resultcode;
| |   -	uint32_t	epoch;
| |   -	uint32_t	address;
| |   -} PurplePmpIpResponse;
| |   -
| |   -typedef struct {
| |   -	uint8_t		version;
| |   -	uint8_t		opcode;
| |   -	char		reserved[2];
| |   -	uint16_t	privateport;
| |   -	uint16_t	publicport;
| |   -	uint32_t	lifetime;
| |   -} PurplePmpMapRequest;
| |   -
| |   -typedef struct {
| |   -	uint8_t		version;
| |   -	uint8_t		opcode;
| |   -	uint16_t	resultcode;
| |   -	uint32_t	epoch;
| |   -	uint16_t	privateport;
| |   -	uint16_t	publicport;
| |   -	uint32_t	lifetime;
| |   -} PurplePmpMapResponse;
| |   -
| |    /**
| |     *
| |     */
| |   +
| |    /*
| |     * TODO: This should probably cache the result of this lookup requests
| |     *       so that subsequent calls to this function do not require a
| |   @@ -89,13 +59,25 @@ char *purple_pmp_get_public_ip();
| |    char *purple_pmp_get_public_ip();
| |    
| |    /**
| |   + * Remove the NAT-PMP mapping for a specified type on a specified port
| |     *
| |   + * @param type The PurplePmpType
| |   + * @param privateport The private port on which we are listening locally
| |   + * @param publicport The public port on which we are expecting a response
| |   + * @param lifetime The lifetime of the mapping. It is recommended that this be PURPLE_PMP_LIFETIME.
| |   + *
| |   + * @returns TRUE if succesful; FALSE if unsuccessful
| |     */
| |   -PurplePmpMapResponse *purple_pmp_create_map(PurplePmpType type, uint16_t privateport, uint16_t publicport, uint32_t lifetime);
| |   +gboolean purple_pmp_create_map(PurplePmpType type, unsigned short privateport, unsigned short publicport, int lifetime);
| |    
| |    /**
| |   + * Remove the NAT-PMP mapping for a specified type on a specified port
| |     *
| |   + * @param type The PurplePmpType
| |   + * @param privateport The private port on which the mapping was previously made
| |   + *
| |   + * @returns TRUE if succesful; FALSE if unsuccessful
| |     */
| |   +gboolean purple_pmp_destroy_map(PurplePmpType type, unsigned short privateport);
| |   +	
| |   +#endif
| |   -PurplePmpMapResponse *purple_pmp_destroy_map(PurplePmpType type, uint16_t privateport);
| |   -
| |   -#endif /* _PURPLE_NAT_PMP_H_ */
| |   ============================================================
| |   --- Makefile.am	40dc54e02a0a41b8d9199dba80cce6099ae2869d
| |   +++ Makefile.am	7646ef24953f33749ecbbe2310ee1e5667ee60e0
| |   @@ -10,16 +10,16 @@ EXTRA_DIST = \
| |    		README.SVN \
| |    		README.dbus \
| |    		README.mingw \
| |   +		config.h.mingw \
| |    		gaim.pc.in \
| |    		gaim-uninstalled.pc.in \
| |   -		gaim.apspec.in \
| |    		gaim.service.in \
| |   -		pidgin.spec.in \
| |   -		pidgin.desktop.in \
| |    		intltool-extract.in \
| |    		intltool-merge.in \
| |    		intltool-update.in \
| |   -		config.h.mingw \
| |   +		pidgin.apspec.in \
| |   +		pidgin.spec.in \
| |   +		pidgin.desktop.in \
| |    		po/Makefile.mingw
| |    
| |    noinst_HEADERS = config.h
| |   ============================================================
| |   --- configure.ac	c517e4b2580e69d4a47001ecb44a83d1cb61f25f
| |   +++ configure.ac	34f4945b51b230e5f96bfca99bc4776d05579c9e
| |   @@ -1895,12 +1895,12 @@ AC_OUTPUT([Makefile
| |    
| |    AC_OUTPUT([Makefile
| |    		   Doxyfile
| |   -		   gaim.apspec
| |    		   gaim.service
| |    		   doc/Makefile
| |    		   doc/pidgin.1
| |    		   doc/finch.1
| |    		   m4macros/Makefile
| |   +		   pidgin.apspec
| |    		   pidgin/Makefile
| |    		   pidgin/pidgin.pc
| |    		   pidgin/pidgin-uninstalled.pc
| |   ============================================================
| |   --- pidgin/plugins/Makefile.am	5efc78abe4ea4ac290464a9c594ada5fdae9667f
| |   +++ pidgin/plugins/Makefile.am	d6bb1738d28105aaf9aceacb7261bc6b7c4f4883
| |   @@ -28,11 +28,11 @@ extplacement_la_LDFLAGS     = -module -a
| |    
| |    convcolors_la_LDFLAGS       = -module -avoid-version
| |    extplacement_la_LDFLAGS     = -module -avoid-version
| |   -gaimrc_la_LDFLAGS           = -module -avoid-version
| |    history_la_LDFLAGS          = -module -avoid-version
| |    iconaway_la_LDFLAGS         = -module -avoid-version
| |    markerline_la_LDFLAGS       = -module -avoid-version
| |    notify_la_LDFLAGS           = -module -avoid-version
| |   +pidginrc_la_LDFLAGS           = -module -avoid-version
| |    relnot_la_LDFLAGS           = -module -avoid-version
| |    spellchk_la_LDFLAGS         = -module -avoid-version
| |    timestamp_la_LDFLAGS        = -module -avoid-version
| |   @@ -44,11 +44,11 @@ plugin_LTLIBRARIES = \
| |    plugin_LTLIBRARIES = \
| |    	convcolors.la       \
| |    	extplacement.la     \
| |   -	gaimrc.la           \
| |    	history.la          \
| |    	iconaway.la         \
| |    	markerline.la       \
| |    	notify.la           \
| |   +	pidginrc.la           \
| |    	relnot.la           \
| |    	spellchk.la         \
| |    	timestamp.la        \
| |   @@ -57,11 +57,11 @@ extplacement_la_SOURCES     = extplaceme
| |    
| |    convcolors_la_SOURCES       = convcolors.c
| |    extplacement_la_SOURCES     = extplacement.c
| |   -gaimrc_la_SOURCES           = gaimrc.c
| |    history_la_SOURCES          = history.c
| |    iconaway_la_SOURCES         = iconaway.c
| |    markerline_la_SOURCES       = markerline.c
| |    notify_la_SOURCES           = notify.c
| |   +pidginrc_la_SOURCES         = pidginrc.c
| |    relnot_la_SOURCES           = relnot.c
| |    spellchk_la_SOURCES         = spellchk.c
| |    timestamp_la_SOURCES        = timestamp.c
| |   @@ -70,11 +70,11 @@ extplacement_la_LIBADD      = $(GTK_LIBS
| |    
| |    convcolors_la_LIBADD        = $(GTK_LIBS)
| |    extplacement_la_LIBADD      = $(GTK_LIBS)
| |   -gaimrc_la_LIBADD            = $(GTK_LIBS)
| |    history_la_LIBADD           = $(GTK_LIBS)
| |    iconaway_la_LIBADD          = $(GTK_LIBS)
| |    markerline_la_LIBADD        = $(GTK_LIBS)
| |    notify_la_LIBADD            = $(GTK_LIBS)
| |   +pidginrc_la_LIBADD          = $(GTK_LIBS)
| |    relnot_la_LIBADD            = $(GLIB_LIBS)
| |    spellchk_la_LIBADD          = $(GTK_LIBS)
| |    timestamp_la_LIBADD         = $(GTK_LIBS)
| |   ============================================================
| |   --- pidgin/plugins/crazychat/Makefile.am	8f7c23ff9d88dc5624e584ac8137c4f7ac7a4587
| |   +++ pidgin/plugins/crazychat/Makefile.am	f8ae905cd5cb42de528ceced04c093ad456ff421
| |   @@ -1,8 +1,8 @@
| |   -plugindir = $(libdir)/gaim
| |   +plugindir = $(libdir)/pidgin
| |    
| |    if ENABLE_DEBUG
| |    DEBUG_CPPFLAGS = -g -pg
| |   -# DEBUG_CPPFLAGS = -D_DEBUG_ -g -pg 
| |   +# DEBUG_CPPFLAGS = -D_DEBUG_ -g -pg
| |    DEBUG_LFLAGS = -pg
| |    else
| |    DEBUG_CPPFLAGS = -O2
| |   @@ -18,7 +18,7 @@ crazychat_la_LDFLAGS = -module -avoid-ve
| |    endif
| |    
| |    crazychat_la_LDFLAGS = -module -avoid-version $(GTK_LIBS) $(DEBUG_LFLAGS)
| |   -crazychat_la_SOURCES = cc_gaim_plugin.c cc_gtk_gl.c cc_gtk_gl.h \
| |   +crazychat_la_SOURCES = cc_pidgin_plugin.c cc_gtk_gl.c cc_gtk_gl.h \
| |    	cc_interface.h crazychat.c crazychat.h util.h\
| |    	cc_network.c cc_network.h filter.c filter.h\
| |    	cc_output.c face.c face.h doggy.c doggy.h glm.h glm.c sharky.h sharky.c models.h models.c
| |   @@ -31,9 +31,9 @@ crazychat_la_LIBADD = $(GTKGLEXT_LIBS)
| |    #$(GTKGLEXT_CFLAGS) \
| |    #-I$(top_srcdir)/include
| |    
| |   -AM_CPPFLAGS = -DGAIM_PLUGINS \
| |   -	-I$(top_srcdir)/libgaim \
| |   -	-I$(top_srcdir)/gtk \
| |   +AM_CPPFLAGS = -DPURPLE_PLUGINS \
| |   +	-I$(top_srcdir)/libpurple \
| |   +	-I$(top_srcdir)/pidgin \
| |    	$(GTK_CFLAGS) \
| |    	$(GTKGLEXT_CFLAGS) \
| |    	$(DEBUG_CPPFLAGS) \
| |   ============================================================
| |   --- gaim.apspec.in	14d2f3d28104dd34a4298330ac436a8b105ca604
| |   +++ pidgin.apspec.in	35cc78d87b8711314097aea3cb25f0a544ced082
| |   @@ -1,11 +1,11 @@
| |    # -*-shell-script-*-
| |    
| |    [Meta]
| |   -RootName: @gaim.sourceforge.net/gaim:$SOFTWAREVERSION
| |   -DisplayName: Gaim Internet Messenger
| |   -ShortName: gaim
| |   -Maintainer: The Gaim Developers
| |   -URL: http://gaim.sourceforge.net/
| |   +RootName: @pidgin.im/pidgin:$SOFTWAREVERSION
| |   +DisplayName: Pidgin Internet Messenger
| |   +ShortName: Pidgin
| |   +Maintainer: The Pidgin Developers
| |   +URL: http://pidgin.im/
| |    Packager: Tim Ringenbach <marv_sf at users.sourceforge.net>
| |    Summary: A GTK+ based multiprotocol instant messaging client
| |    SoftwareVersion: @VERSION@
| |   @@ -13,16 +13,16 @@ PackageVersion: 1
| |    PackageVersion: 1
| |    
| |    [Description]
| |   -Gaim allows you to talk to anyone using a variety of messaging protocols,
| |   +Pidgin allows you to talk to anyone using a variety of messaging protocols,
| |    including AIM (Oscar and TOC), ICQ, IRC, Yahoo!, MSN Messenger, Jabber,
| |    Gadu-Gadu, and Zephyr. These protocols are implemented using a
| |    modular, easy to use design. To use a protocol, just add an account using the
| |    account editor.
| |    
| |   -Gaim supports many common features of other clients, as well as many unique
| |   +Pidgin supports many common features of other clients, as well as many unique
| |    features, such as perl scripting, TCL scripting and C plugins.
| |    
| |   -Gaim is NOT affiliated with or endorsed by America Online, Inc., Microsoft
| |   +Pidgin is NOT affiliated with or endorsed by America Online, Inc., Microsoft
| |    Corporation, Yahoo! Inc., or ICQ Inc.
| |    
| |    [BuildPrepare]
| |   @@ -50,19 +50,19 @@ installExe ./bin/*
| |    [Install]
| |    # Put your installation script here
| |    installExe ./bin/*
| |   -installLib ./lib/libgaim-remote.so.0.0.0
| |   +installLib ./lib/libpurple-remote.so.0.0.0
| |    # do the plugins
| |   -copyFiles ./lib/gaim "$PREFIX/lib"
| |   -installMan 1 ./man/man1/gaim.1
| |   -installDesktop "Networking/Instant Messaging" ./share/applications/gaim.desktop
| |   +copyFiles ./lib/pidgin "$PREFIX/lib"
| |   +installMan 1 ./man/man1/pidgin.1
| |   +installDesktop "Networking/Instant Messaging" ./share/applications/pidgin.desktop
| |    installLocale ./share/locale
| |    copyFiles ./share/pixmaps "$PREFIX/share"
| |    copyFiles ./share/sounds "$PREFIX/share"
| |   -installIcon ./share/pixmaps/gaim.png
| |   +installIcon ./share/pixmaps/pidgin.png
| |    # install and fix the .pc file
| |    # move this to the -devel package when I make one
| |   -# copyFile ./lib/pkgconfig/gaim.pc "$PREFIX/lib/pkgconfig/gaim.pc"
| |   -# safeSed "$PREFIX/lib/pkgconfig/gaim.pc" "s|prefix=/usr/local|prefix=$PREFIX|"
| |   +# copyFile ./lib/pkgconfig/pidgin.pc "$PREFIX/lib/pkgconfig/pidgin.pc"
| |   +# safeSed "$PREFIX/lib/pkgconfig/pidgin.pc" "s|prefix=/usr/local|prefix=$PREFIX|"
| |    
| |    [Uninstall]
| |    # Usually just the following line is enough to uninstall everything
| |   ============================================================
| |   --- po/POTFILES.in	7f4e5eb5abbfff30b594a20e6f42536fd437c9d2
| |   +++ po/POTFILES.in	31446df52ee4a9e8765995a16f09a805aa946443
| |   @@ -181,7 +181,6 @@ pidgin/plugins/gaiminc.c
| |    pidgin/plugins/convcolors.c
| |    pidgin/plugins/extplacement.c
| |    pidgin/plugins/gaiminc.c
| |   -pidgin/plugins/gaimrc.c
| |    pidgin/plugins/gestures/gestures.c
| |    pidgin/plugins/gevolution/add_buddy_dialog.c
| |    pidgin/plugins/gevolution/assoc-buddy.c
| |   @@ -196,6 +195,7 @@ pidgin/plugins/notify.c
| |    pidgin/plugins/markerline.c
| |    pidgin/plugins/musicmessaging/musicmessaging.c
| |    pidgin/plugins/notify.c
| |   +pidgin/plugins/pidginrc.c
| |    pidgin/plugins/raw.c
| |    pidgin/plugins/relnot.c
| |    pidgin/plugins/spellchk.c

To get the patch for this revision, please do this:
mtn log --last 1 --diffs --from 1856b49720b10fe28cb4bddb5ebb5112da479e14


More information about the Commits mailing list