aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorWilmer van der Gaast <wilmer@gaast.net>2010-05-08 15:48:38 +0100
committerWilmer van der Gaast <wilmer@gaast.net>2010-05-08 15:48:38 +0100
commiteaaa9862451175392d6df48c4795b188518bed4b (patch)
treebaf01847709f54d56fc009b261484120e90e5be4
parent4a9fd5f7a980831ee2c96a728f4f83137cfc73fe (diff)
Misc. cleanup. Also updated the Yahoo! module to deal with struct groupchat
in a GSList so that a default config fully compiles again.
-rw-r--r--irc.c1
-rw-r--r--irc_commands.c2
-rw-r--r--protocols/bee.h1
-rw-r--r--protocols/bee_chat.c15
-rw-r--r--protocols/jabber/presence.c1
-rw-r--r--protocols/yahoo/yahoo.c20
6 files changed, 26 insertions, 14 deletions
diff --git a/irc.c b/irc.c
index 39943877..13a77a72 100644
--- a/irc.c
+++ b/irc.c
@@ -241,6 +241,7 @@ void irc_free( irc_t * irc )
g_free( irc->sendbuffer );
g_free( irc->readbuffer );
g_free( irc->password );
+ g_free( irc->last_root_cmd );
g_free( irc );
diff --git a/irc_commands.c b/irc_commands.c
index b41c1a42..f43ef583 100644
--- a/irc_commands.c
+++ b/irc_commands.c
@@ -535,8 +535,6 @@ static void irc_cmd_topic( irc_t *irc, char **cmd )
static void irc_cmd_away( irc_t *irc, char **cmd )
{
- char *set;
-
if( cmd[1] && *cmd[1] )
{
char away[strlen(cmd[1])+1];
diff --git a/protocols/bee.h b/protocols/bee.h
index e0ab0030..b8fee2ae 100644
--- a/protocols/bee.h
+++ b/protocols/bee.h
@@ -128,5 +128,6 @@ void imcb_chat_remove_buddy( struct groupchat *b, const char *handle, const char
static int remove_chat_buddy_silent( struct groupchat *b, const char *handle );
#endif
int bee_chat_msg( bee_t *bee, struct groupchat *c, const char *msg, int flags );
+struct groupchat *bee_chat_by_title( bee_t *bee, struct im_connection *ic, const char *title );
#endif /* __BEE_H__ */
diff --git a/protocols/bee_chat.c b/protocols/bee_chat.c
index e565b616..3e17a42f 100644
--- a/protocols/bee_chat.c
+++ b/protocols/bee_chat.c
@@ -217,3 +217,18 @@ int bee_chat_msg( bee_t *bee, struct groupchat *c, const char *msg, int flags )
return 1;
}
+
+struct groupchat *bee_chat_by_title( bee_t *bee, struct im_connection *ic, const char *title )
+{
+ struct groupchat *c;
+ GSList *l;
+
+ for( l = ic->groupchats; l; l = l->next )
+ {
+ c = l->data;
+ if( strcmp( c->title, title ) == 0 )
+ return c;
+ }
+
+ return NULL;
+}
diff --git a/protocols/jabber/presence.c b/protocols/jabber/presence.c
index dadccfb9..2875d23e 100644
--- a/protocols/jabber/presence.c
+++ b/protocols/jabber/presence.c
@@ -204,7 +204,6 @@ int presence_send_update( struct im_connection *ic )
{
struct jabber_data *jd = ic->proto_data;
struct xt_node *node, *cap;
- struct groupchat *c;
GSList *l;
int st;
diff --git a/protocols/yahoo/yahoo.c b/protocols/yahoo/yahoo.c
index b61f6ff9..4fd7bee5 100644
--- a/protocols/yahoo/yahoo.c
+++ b/protocols/yahoo/yahoo.c
@@ -152,7 +152,7 @@ static void byahoo_logout( struct im_connection *ic )
GSList *l;
while( ic->groupchats )
- imcb_chat_free( ic->groupchats );
+ imcb_chat_free( ic->groupchats->data );
for( l = yd->buddygroups; l; l = l->next )
{
@@ -790,10 +790,14 @@ static void byahoo_accept_conf( void *data )
{
struct byahoo_conf_invitation *inv = data;
struct groupchat *b;
+ GSList *l;
- for( b = inv->ic->groupchats; b; b = b->next )
+ for( l = inv->ic->groupchats; l; l = l->next )
+ {
+ b = l->data;
if( b == inv->c )
break;
+ }
if( b != NULL )
{
@@ -855,9 +859,7 @@ void ext_yahoo_conf_userdecline( int id, const char *ignored, const char *who, c
void ext_yahoo_conf_userjoin( int id, const char *ignored, const char *who, const char *room )
{
struct im_connection *ic = byahoo_get_ic_by_id( id );
- struct groupchat *c;
-
- for( c = ic->groupchats; c && strcmp( c->title, room ) != 0; c = c->next );
+ struct groupchat *c = bee_chat_by_title( ic->bee, ic, room );
if( c )
imcb_chat_add_buddy( c, (char*) who );
@@ -867,9 +869,7 @@ void ext_yahoo_conf_userleave( int id, const char *ignored, const char *who, con
{
struct im_connection *ic = byahoo_get_ic_by_id( id );
- struct groupchat *c;
-
- for( c = ic->groupchats; c && strcmp( c->title, room ) != 0; c = c->next );
+ struct groupchat *c = bee_chat_by_title( ic->bee, ic, room );
if( c )
imcb_chat_remove_buddy( c, (char*) who, "" );
@@ -879,9 +879,7 @@ void ext_yahoo_conf_message( int id, const char *ignored, const char *who, const
{
struct im_connection *ic = byahoo_get_ic_by_id( id );
char *m = byahoo_strip( msg );
- struct groupchat *c;
-
- for( c = ic->groupchats; c && strcmp( c->title, room ) != 0; c = c->next );
+ struct groupchat *c = bee_chat_by_title( ic->bee, ic, room );
if( c )
imcb_chat_msg( c, (char*) who, (char*) m, 0, 0 );