aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorWilmer van der Gaast <wilmer@gaast.net>2010-03-14 17:49:24 +0000
committerWilmer van der Gaast <wilmer@gaast.net>2010-03-14 17:49:24 +0000
commitc6ca3ee33e27feefb8cae0dc1d55a7239baf43cb (patch)
tree664f9f4385637f6d79802a63f5da1dfd55741370
parent6a78c0eed44820a2fefe1e96516e335eddc9c70b (diff)
Some const/etc cleanups submitted by domen@coderock.org back in bug #431.
-rw-r--r--bitlbee.h2
-rwxr-xr-xconfigure2
-rw-r--r--lib/misc.c3
-rw-r--r--lib/misc.h2
-rw-r--r--protocols/jabber/jabber.h1
-rw-r--r--protocols/msn/msn.c4
-rw-r--r--protocols/msn/msn.h6
-rw-r--r--protocols/nogaim.c16
-rw-r--r--protocols/nogaim.h17
-rw-r--r--user.c2
-rw-r--r--user.h2
11 files changed, 32 insertions, 25 deletions
diff --git a/bitlbee.h b/bitlbee.h
index 7c8b8a36..a09ebc5f 100644
--- a/bitlbee.h
+++ b/bitlbee.h
@@ -26,7 +26,9 @@
#ifndef _BITLBEE_H
#define _BITLBEE_H
+#ifndef _GNU_SOURCE
#define _GNU_SOURCE /* Stupid GNU :-P */
+#endif
/* Depend on Windows 2000 for now since we need getaddrinfo() */
#define _WIN32_WINNT 0x0501
diff --git a/configure b/configure
index b3a98086..5be64a84 100755
--- a/configure
+++ b/configure
@@ -155,7 +155,7 @@ else
fi
echo CFLAGS=$CFLAGS >> Makefile.settings
-echo CFLAGS+=-I`pwd` -I`pwd`/lib -I`pwd`/protocols -I. >> Makefile.settings
+echo CFLAGS+=-I`pwd` -iquote`pwd`/lib -iquote`pwd`/protocols -I. >> Makefile.settings
echo CFLAGS+=-DHAVE_CONFIG_H >> Makefile.settings
diff --git a/lib/misc.c b/lib/misc.c
index 9d504b75..c5087f75 100644
--- a/lib/misc.c
+++ b/lib/misc.c
@@ -33,6 +33,7 @@
#define BITLBEE_CORE
#include "nogaim.h"
#include "base64.h"
+#include "md5.h"
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
@@ -520,7 +521,7 @@ struct ns_srv_reply *srv_lookup( char *service, char *protocol, char *domain )
}
/* Word wrapping. Yes, I know this isn't UTF-8 clean. I'm willing to take the risk. */
-char *word_wrap( char *msg, int line_len )
+char *word_wrap( const char *msg, int line_len )
{
GString *ret = g_string_sized_new( strlen( msg ) + 16 );
diff --git a/lib/misc.h b/lib/misc.h
index 5376cd22..ce36caf5 100644
--- a/lib/misc.h
+++ b/lib/misc.h
@@ -61,7 +61,7 @@ G_MODULE_EXPORT int bool2int( char *value );
G_MODULE_EXPORT struct ns_srv_reply *srv_lookup( char *service, char *protocol, char *domain );
-G_MODULE_EXPORT char *word_wrap( char *msg, int line_len );
+G_MODULE_EXPORT char *word_wrap( const char *msg, int line_len );
G_MODULE_EXPORT gboolean ssl_sockerr_again( void *ssl );
diff --git a/protocols/jabber/jabber.h b/protocols/jabber/jabber.h
index 904bf0c4..61238a30 100644
--- a/protocols/jabber/jabber.h
+++ b/protocols/jabber/jabber.h
@@ -28,6 +28,7 @@
#include "xmltree.h"
#include "bitlbee.h"
+#include "md5.h"
extern GSList *jabber_connections;
diff --git a/protocols/msn/msn.c b/protocols/msn/msn.c
index a2e8519a..09670dfa 100644
--- a/protocols/msn/msn.c
+++ b/protocols/msn/msn.c
@@ -26,6 +26,10 @@
#include "nogaim.h"
#include "msn.h"
+int msn_chat_id;
+GSList *msn_connections;
+GSList *msn_switchboards;
+
static char *msn_set_display_name( set_t *set, char *value );
static void msn_init( account_t *acc )
diff --git a/protocols/msn/msn.h b/protocols/msn/msn.h
index 63759303..16e5ab52 100644
--- a/protocols/msn/msn.h
+++ b/protocols/msn/msn.h
@@ -132,7 +132,7 @@ struct msn_handler_data
#define STATUS_SB_IM_SPARE 4 /* Make one-to-one conversation switchboard available again, invite failed. */
#define STATUS_SB_CHAT_SPARE 8 /* Same, but also for groupchats (not used yet). */
-int msn_chat_id;
+extern int msn_chat_id;
extern const struct msn_away_state msn_away_state_list[];
extern const struct msn_status_code msn_status_code_list[];
@@ -141,8 +141,8 @@ extern const struct msn_status_code msn_status_code_list[];
is down already (for example, when an impatient user disabled the
connection), the callback should check whether it's still listed here
before doing *anything* else. */
-GSList *msn_connections;
-GSList *msn_switchboards;
+extern GSList *msn_connections;
+extern GSList *msn_switchboards;
/* ns.c */
gboolean msn_ns_connected( gpointer data, gint source, b_input_condition cond );
diff --git a/protocols/nogaim.c b/protocols/nogaim.c
index 7466e93a..62669aaf 100644
--- a/protocols/nogaim.c
+++ b/protocols/nogaim.c
@@ -351,7 +351,7 @@ void imcb_ask( struct im_connection *ic, char *msg, void *data,
/* list.c */
-void imcb_add_buddy( struct im_connection *ic, char *handle, char *group )
+void imcb_add_buddy( struct im_connection *ic, const char *handle, const char *group )
{
user_t *u;
char nick[MAX_NICK_LENGTH+1], *s;
@@ -425,7 +425,7 @@ struct buddy *imcb_find_buddy( struct im_connection *ic, char *handle )
return( b );
}
-void imcb_rename_buddy( struct im_connection *ic, char *handle, char *realname )
+void imcb_rename_buddy( struct im_connection *ic, const char *handle, const char *realname )
{
user_t *u = user_findhandle( ic, handle );
@@ -442,7 +442,7 @@ void imcb_rename_buddy( struct im_connection *ic, char *handle, char *realname )
}
}
-void imcb_remove_buddy( struct im_connection *ic, char *handle, char *group )
+void imcb_remove_buddy( struct im_connection *ic, const char *handle, char *group )
{
user_t *u;
@@ -627,7 +627,7 @@ void imcb_buddy_status( struct im_connection *ic, const char *handle, int flags,
}
}
-void imcb_buddy_msg( struct im_connection *ic, char *handle, char *msg, uint32_t flags, time_t sent_at )
+void imcb_buddy_msg( struct im_connection *ic, const char *handle, char *msg, uint32_t flags, time_t sent_at )
{
irc_t *irc = ic->irc;
char *wrapped;
@@ -694,7 +694,7 @@ void imcb_buddy_typing( struct im_connection *ic, char *handle, uint32_t flags )
}
}
-struct groupchat *imcb_chat_new( struct im_connection *ic, char *handle )
+struct groupchat *imcb_chat_new( struct im_connection *ic, const char *handle )
{
struct groupchat *c;
@@ -760,7 +760,7 @@ void imcb_chat_free( struct groupchat *c )
}
}
-void imcb_chat_msg( struct groupchat *c, char *who, char *msg, uint32_t flags, time_t sent_at )
+void imcb_chat_msg( struct groupchat *c, const char *who, char *msg, uint32_t flags, time_t sent_at )
{
struct im_connection *ic = c->ic;
char *wrapped;
@@ -832,7 +832,7 @@ void imcb_chat_topic( struct groupchat *c, char *who, char *topic, time_t set_at
/* buddy_chat.c */
-void imcb_chat_add_buddy( struct groupchat *b, char *handle )
+void imcb_chat_add_buddy( struct groupchat *b, const char *handle )
{
user_t *u = user_findhandle( b->ic, handle );
int me = 0;
@@ -867,7 +867,7 @@ void imcb_chat_add_buddy( struct groupchat *b, char *handle )
}
/* This function is one BIG hack... :-( EREWRITE */
-void imcb_chat_remove_buddy( struct groupchat *b, char *handle, char *reason )
+void imcb_chat_remove_buddy( struct groupchat *b, const char *handle, const char *reason )
{
user_t *u;
int me = 0;
diff --git a/protocols/nogaim.h b/protocols/nogaim.h
index 9fe843b5..ee5d7a30 100644
--- a/protocols/nogaim.h
+++ b/protocols/nogaim.h
@@ -42,7 +42,6 @@
#include "account.h"
#include "proxy.h"
#include "query.h"
-#include "md5.h"
#define BUDDY_ALIAS_MAXLEN 388 /* because MSN names can be 387 characters */
@@ -263,10 +262,10 @@ G_MODULE_EXPORT void imcb_ask_add( struct im_connection *ic, char *handle, const
/* This function should be called for each handle which are visible to the
* user, usually after a login, or if the user added a buddy and the IM
* server confirms that the add was successful. Don't forget to do this! */
-G_MODULE_EXPORT void imcb_add_buddy( struct im_connection *ic, char *handle, char *group );
-G_MODULE_EXPORT void imcb_remove_buddy( struct im_connection *ic, char *handle, char *group );
+G_MODULE_EXPORT void imcb_add_buddy( struct im_connection *ic, const char *handle, const char *group );
+G_MODULE_EXPORT void imcb_remove_buddy( struct im_connection *ic, const char *handle, char *group );
G_MODULE_EXPORT struct buddy *imcb_find_buddy( struct im_connection *ic, char *handle );
-G_MODULE_EXPORT void imcb_rename_buddy( struct im_connection *ic, char *handle, char *realname );
+G_MODULE_EXPORT void imcb_rename_buddy( struct im_connection *ic, const char *handle, const char *realname );
G_MODULE_EXPORT void imcb_buddy_nick_hint( struct im_connection *ic, char *handle, char *nick );
/* Buddy activity */
@@ -277,7 +276,7 @@ G_MODULE_EXPORT void imcb_buddy_nick_hint( struct im_connection *ic, char *handl
G_MODULE_EXPORT void imcb_buddy_status( struct im_connection *ic, const char *handle, int flags, const char *state, const char *message );
/* Not implemented yet! */ G_MODULE_EXPORT void imcb_buddy_times( struct im_connection *ic, const char *handle, time_t login, time_t idle );
/* Call when a handle says something. 'flags' and 'sent_at may be just 0. */
-G_MODULE_EXPORT void imcb_buddy_msg( struct im_connection *ic, char *handle, char *msg, uint32_t flags, time_t sent_at );
+G_MODULE_EXPORT void imcb_buddy_msg( struct im_connection *ic, const char *handle, char *msg, uint32_t flags, time_t sent_at );
G_MODULE_EXPORT void imcb_buddy_typing( struct im_connection *ic, char *handle, uint32_t flags );
G_MODULE_EXPORT void imcb_clean_handle( struct im_connection *ic, char *handle );
@@ -289,12 +288,12 @@ G_MODULE_EXPORT void imcb_chat_invited( struct im_connection *ic, char *handle,
* - After you have a groupchat pointer, you should add the handles, finally
* the user her/himself. At that point the group chat will be visible to the
* user, too. */
-G_MODULE_EXPORT struct groupchat *imcb_chat_new( struct im_connection *ic, char *handle );
-G_MODULE_EXPORT void imcb_chat_add_buddy( struct groupchat *b, char *handle );
+G_MODULE_EXPORT struct groupchat *imcb_chat_new( struct im_connection *ic, const char *handle );
+G_MODULE_EXPORT void imcb_chat_add_buddy( struct groupchat *b, const char *handle );
/* To remove a handle from a group chat. Reason can be NULL. */
-G_MODULE_EXPORT void imcb_chat_remove_buddy( struct groupchat *b, char *handle, char *reason );
+G_MODULE_EXPORT void imcb_chat_remove_buddy( struct groupchat *b, const char *handle, const char *reason );
/* To tell BitlBee 'who' said 'msg' in 'c'. 'flags' and 'sent_at' can be 0. */
-G_MODULE_EXPORT void imcb_chat_msg( struct groupchat *c, char *who, char *msg, uint32_t flags, time_t sent_at );
+G_MODULE_EXPORT void imcb_chat_msg( struct groupchat *c, const char *who, char *msg, uint32_t flags, time_t sent_at );
/* System messages specific to a groupchat, so they can be displayed in the right context. */
G_MODULE_EXPORT void imcb_chat_log( struct groupchat *c, char *format, ... ) G_GNUC_PRINTF( 2, 3 );
/* To tell BitlBee 'who' changed the topic of 'c' to 'topic'. */
diff --git a/user.c b/user.c
index 26676dd4..4d58f56b 100644
--- a/user.c
+++ b/user.c
@@ -140,7 +140,7 @@ user_t *user_find( irc_t *irc, char *nick )
return( NULL );
}
-user_t *user_findhandle( struct im_connection *ic, char *handle )
+user_t *user_findhandle( struct im_connection *ic, const char *handle )
{
user_t *u;
char *nick;
diff --git a/user.h b/user.h
index c6b933bc..9d8a41a0 100644
--- a/user.h
+++ b/user.h
@@ -55,7 +55,7 @@ typedef struct __USER
user_t *user_add( struct irc *irc, char *nick );
int user_del( irc_t *irc, char *nick );
G_MODULE_EXPORT user_t *user_find( irc_t *irc, char *nick );
-G_MODULE_EXPORT user_t *user_findhandle( struct im_connection *ic, char *handle );
+G_MODULE_EXPORT user_t *user_findhandle( struct im_connection *ic, const char *handle );
void user_rename( irc_t *irc, char *oldnick, char *newnick );
#endif /* __USER_H__ */