diff options
| -rw-r--r-- | conf.c | 2 | ||||
| -rw-r--r-- | ipc.c | 3 | ||||
| -rw-r--r-- | irc.c | 2 | ||||
| -rw-r--r-- | protocols/http_client.c | 52 | ||||
| -rw-r--r-- | protocols/http_client.h | 2 | ||||
| -rw-r--r-- | protocols/jabber/jabber.c | 2 | ||||
| -rw-r--r-- | protocols/jabber/xmlparse.c | 25 | ||||
| -rw-r--r-- | protocols/nogaim.c | 3 | ||||
| -rw-r--r-- | protocols/oscar/oscar_util.c | 4 | ||||
| -rw-r--r-- | protocols/oscar/service.c | 3 | ||||
| -rw-r--r-- | protocols/yahoo/yahoo.c | 3 | ||||
| -rw-r--r-- | set.c | 6 | 
12 files changed, 82 insertions, 25 deletions
| @@ -94,7 +94,7 @@ conf_t *conf_load( int argc, char *argv[] )  			}  			conf->port = i;  		} -		else if( opt == 'p' ) +		else if( opt == 'P' )  		{  			g_free( conf->pidfile );  			conf->pidfile = g_strdup( optarg ); @@ -507,7 +507,7 @@ int ipc_master_listen_socket()  		return 0;  	} -	if (bind(serversock, &un_addr, sizeof(un_addr)) == -1) { +	if (bind(serversock, (struct sockaddr *)&un_addr, sizeof(un_addr)) == -1) {  		log_message( LOGLVL_WARNING, "Unable to bind UNIX socket to %s: %s", IPCSOCKET, strerror(errno) );  		return 0;  	} @@ -565,5 +565,6 @@ int ipc_master_load_state()  	ipc_to_children_str( "HELLO\r\n" );  	ipc_to_children_str( "OPERMSG :New BitlBee master process started (version " BITLBEE_VERSION ")\r\n" ); +	fclose( fp );  	return 1;  } @@ -549,7 +549,7 @@ int irc_usermsg( irc_t *irc, char *format, ... )  	user_t *u;  	u = user_find( irc, irc->mynick ); -	if( u ) is_private = u->is_private; +	is_private = u->is_private;  	va_start( params, format );  	g_vsnprintf( text, sizeof( text ), format, params ); diff --git a/protocols/http_client.c b/protocols/http_client.c index 0142bb2e..d686cfb8 100644 --- a/protocols/http_client.c +++ b/protocols/http_client.c @@ -70,6 +70,37 @@ void *http_dorequest( char *host, int port, int ssl, char *request, http_input_f  	return( req );  } +void *http_dorequest_url( char *url_string, http_input_function func, gpointer data ) +{ +	url_t *url = g_new0( url_t, 1 ); +	char *request; +	void *ret; +	 +	if( !url_set( url, url_string ) ) +	{ +		g_free( url ); +		return NULL; +	} +	 +	if( url->proto != PROTO_HTTP && url->proto != PROTO_HTTPS ) +	{ +		g_free( url ); +		return NULL; +	} +	 +	request = g_strdup_printf( "GET %s HTTP/1.0\r\n" +	                           "Host: %s\r\n" +	                           "User-Agent: BitlBee " BITLBEE_VERSION " " ARCH "/" CPU "\r\n" +	                           "\r\n", url->file, url->host ); +	 +	ret = http_dorequest( url->host, url->port, +	                      url->proto == PROTO_HTTPS, request, func, data ); +	 +	g_free( url ); +	g_free( request ); +	return ret; +} +  /* This one is actually pretty simple... Might get more calls if we can't write      the whole request at once. */  static gboolean http_connected( gpointer data, int source, b_input_condition cond ) @@ -221,21 +252,24 @@ got_reply:  		end1 = end2 + 1;  		evil_server = 1;  	} -	else +	else if( end1 )  	{  		end1 += 2;  	} -	 -	if( end1 ) +	else  	{ -		*end1 = 0; -		 -		if( evil_server ) -			req->reply_body = end1 + 1; -		else -			req->reply_body = end1 + 2; +		goto cleanup;  	} +	*end1 = 0; +	 +	if( evil_server ) +		req->reply_body = end1 + 1; +	else +		req->reply_body = end1 + 2; +	 +	req->body_size = req->reply_headers + req->bytes_read - req->reply_body; +	  	if( ( end1 = strchr( req->reply_headers, ' ' ) ) != NULL )  	{  		if( sscanf( end1 + 1, "%d", &req->status_code ) != 1 ) diff --git a/protocols/http_client.h b/protocols/http_client.h index 53c6fcd6..860cdd86 100644 --- a/protocols/http_client.h +++ b/protocols/http_client.h @@ -38,6 +38,7 @@ struct http_request  	int status_code;  	char *reply_headers;  	char *reply_body; +	int body_size;  	int finished;  	void *ssl; @@ -52,3 +53,4 @@ struct http_request  };  void *http_dorequest( char *host, int port, int ssl, char *request, http_input_function func, gpointer data ); +void *http_dorequest_url( char *url_string, http_input_function func, gpointer data ); diff --git a/protocols/jabber/jabber.c b/protocols/jabber/jabber.c index c9b7bc6e..029473fd 100644 --- a/protocols/jabber/jabber.c +++ b/protocols/jabber/jabber.c @@ -1552,7 +1552,9 @@ static gboolean jabber_free(gpointer data, gint fd, b_input_condition cond)  	if(jd->gjc != NULL) {  		gjab_delete(jd->gjc); +		/* YAY for modules with their own memory pool managers!...  		g_free(jd->gjc->sid); +		And a less sarcastic yay for valgrind. :-) */  		jd->gjc = NULL;  	}  	g_free(jd); diff --git a/protocols/jabber/xmlparse.c b/protocols/jabber/xmlparse.c index 492da948..bbef7d59 100644 --- a/protocols/jabber/xmlparse.c +++ b/protocols/jabber/xmlparse.c @@ -1460,7 +1460,7 @@ initializeEncoding(XML_Parser parser)  #else  s = protocolEncodingName;  #endif -    if ((ns ? XmlInitEncodingNS : XmlInitEncoding)(&initEncoding, &encoding, s)) +    if (ns ? XmlInitEncodingNS(&initEncoding, &encoding, s) : XmlInitEncoding(&initEncoding, &encoding, s))          return XML_ERROR_NONE;      return handleUnknownEncoding(parser, protocolEncodingName);  } @@ -1474,8 +1474,7 @@ processXmlDecl(XML_Parser parser, int isGeneralTextEntity,      const char *version;      int standalone = -1;      if (!(ns -            ? XmlParseXmlDeclNS -            : XmlParseXmlDecl)(isGeneralTextEntity, +            ? XmlParseXmlDeclNS(isGeneralTextEntity,                                 encoding,                                 s,                                 next, @@ -1483,7 +1482,16 @@ processXmlDecl(XML_Parser parser, int isGeneralTextEntity,                                 &version,                                 &encodingName,                                 &newEncoding, -                               &standalone)) +                               &standalone) +            : XmlParseXmlDecl(isGeneralTextEntity, +                               encoding, +                               s, +                               next, +                               &eventPtr, +                               &version, +                               &encodingName, +                               &newEncoding, +                               &standalone)))          return XML_ERROR_SYNTAX;      if (!isGeneralTextEntity && standalone == 1)          dtd.standalone = 1; @@ -1536,11 +1544,14 @@ handleUnknownEncoding(XML_Parser parser, const XML_Char *encodingName)                  return XML_ERROR_NO_MEMORY;              }              enc = (ns -                   ? XmlInitUnknownEncodingNS -                   : XmlInitUnknownEncoding)(unknownEncodingMem, +                   ? XmlInitUnknownEncodingNS(unknownEncodingMem, +                                             info.map, +                                             info.convert, +                                             info.data) +                   : XmlInitUnknownEncoding(unknownEncodingMem,                                               info.map,                                               info.convert, -                                             info.data); +                                             info.data));              if (enc) {                  unknownEncodingData = info.data;                  unknownEncodingRelease = info.release; diff --git a/protocols/nogaim.c b/protocols/nogaim.c index 06b629a5..4c32cd40 100644 --- a/protocols/nogaim.c +++ b/protocols/nogaim.c @@ -609,7 +609,8 @@ void serv_got_update( struct gaim_connection *gc, char *handle, int loggedin, in  			return;  		} -		return; +		/* Why did we have this here.... +		return; */  	}  	oa = u->away != NULL; diff --git a/protocols/oscar/oscar_util.c b/protocols/oscar/oscar_util.c index 1bb27559..0ce06bd9 100644 --- a/protocols/oscar/oscar_util.c +++ b/protocols/oscar/oscar_util.c @@ -108,7 +108,7 @@ static int aim_snlen(const char *sn)  		return 0;  	curPtr = sn; -	while ( (*curPtr) != (char) NULL) { +	while ( (*curPtr) != (char) '\0') {  		if ((*curPtr) != ' ')  		i++;  		curPtr++; @@ -139,7 +139,7 @@ int aim_sncmp(const char *sn1, const char *sn2)  	curPtr1 = sn1;  	curPtr2 = sn2; -	while ( (*curPtr1 != (char) NULL) && (*curPtr2 != (char) NULL) ) { +	while ( (*curPtr1 != (char) '\0') && (*curPtr2 != (char) '\0') ) {  		if ( (*curPtr1 == ' ') || (*curPtr2 == ' ') ) {  			if (*curPtr1 == ' ')  				curPtr1++; diff --git a/protocols/oscar/service.c b/protocols/oscar/service.c index 4519ce14..4596974f 100644 --- a/protocols/oscar/service.c +++ b/protocols/oscar/service.c @@ -880,13 +880,14 @@ int aim_sendmemblock(aim_session_t *sess, aim_conn_t *conn, guint32 offset, guin  			aimbs_put32(&fr->data, 0xa46d3b39);  #endif +/* len can't be 0 here anyway...  		} else if ((offset == 0x00001000) && (len == 0x00000000)) {  			aimbs_put32(&fr->data, 0xd41d8cd9);  			aimbs_put32(&fr->data, 0x8f00b204);  			aimbs_put32(&fr->data, 0xe9800998);  			aimbs_put32(&fr->data, 0xecf8427e); - +*/  		} else  			do_error_dialog(sess->aux_data, "WARNING: unknown hash request", "Gaim"); diff --git a/protocols/yahoo/yahoo.c b/protocols/yahoo/yahoo.c index fba5dfb8..79c0febb 100644 --- a/protocols/yahoo/yahoo.c +++ b/protocols/yahoo/yahoo.c @@ -607,7 +607,8 @@ void ext_yahoo_status_changed( int id, char *who, int stat, char *msg, int away  {  	struct gaim_connection *gc = byahoo_get_gc_by_id( id ); -	serv_got_update( gc, who, stat != YAHOO_STATUS_OFFLINE, 0, 0, 0, +	serv_got_update( gc, who, stat != YAHOO_STATUS_OFFLINE, 0, 0, +	                 ( stat == YAHOO_STATUS_IDLE ) ? away : 0,  	                 ( stat != YAHOO_STATUS_AVAILABLE ) | ( stat << 1 ), 0 );  } @@ -149,7 +149,11 @@ void set_del( irc_t *irc, char *key )  	}  	if( s )  	{ -		t->next = s->next; +		if( t ) +			t->next = s->next; +		else +			irc->set = s->next; +		  		g_free( s->key );  		if( s->value ) g_free( s->value );  		if( s->def ) g_free( s->def ); | 
