diff options
-rw-r--r-- | irc_im.c | 10 | ||||
-rw-r--r-- | protocols/bee.h | 3 | ||||
-rw-r--r-- | protocols/bee_chat.c | 2 | ||||
-rw-r--r-- | protocols/bee_user.c | 7 | ||||
-rw-r--r-- | protocols/nogaim.c | 2 | ||||
-rw-r--r-- | root_commands.c | 2 |
6 files changed, 19 insertions, 7 deletions
@@ -65,6 +65,16 @@ static gboolean bee_irc_user_new( bee_t *bee, bee_user_t *bu ) if( set_getbool( &bee->set, "private" ) ) iu->flags |= IRC_USER_PRIVATE; + if( bu->flags & BEE_USER_LOCAL ) + { + char *s = set_getstr( &bee->set, "handle_unknown" ); + + if( strcmp( s, "add_private" ) == 0 ) + iu->flags |= IRC_USER_PRIVATE; + else if( strcmp( s, "add_channel" ) == 0 ) + iu->flags &= ~IRC_USER_PRIVATE; + } + iu->f = &irc_user_im_funcs; //iu->last_typing_notice = 0; diff --git a/protocols/bee.h b/protocols/bee.h index 100593f9..e421db57 100644 --- a/protocols/bee.h +++ b/protocols/bee.h @@ -53,6 +53,7 @@ typedef enum { BEE_USER_ONLINE = 1, /* Compatibility with old OPT_LOGGED_IN flag */ BEE_USER_AWAY = 4, /* Compatibility with old OPT_AWAY flag */ + BEE_USER_LOCAL = 256, /* Locally-added contacts (not in real contact list) */ } bee_user_flags_t; typedef struct bee_user @@ -106,7 +107,7 @@ bee_t *bee_new(); void bee_free( bee_t *b ); /* bee_user.c */ -bee_user_t *bee_user_new( bee_t *bee, struct im_connection *ic, const char *handle ); +bee_user_t *bee_user_new( bee_t *bee, struct im_connection *ic, const char *handle, bee_user_flags_t flags ); int bee_user_free( bee_t *bee, bee_user_t *bu ); bee_user_t *bee_user_by_handle( bee_t *bee, struct im_connection *ic, const char *handle ); int bee_user_msg( bee_t *bee, bee_user_t *bu, const char *msg, int flags ); diff --git a/protocols/bee_chat.c b/protocols/bee_chat.c index 3e17a42f..3be6f189 100644 --- a/protocols/bee_chat.c +++ b/protocols/bee_chat.c @@ -159,7 +159,7 @@ void imcb_chat_add_buddy( struct groupchat *c, const char *handle ) /* Most protocols allow people to join, even when they're not in your contact list. Try to handle that here */ if( !me && !bu ) - bu = bee_user_new( bee, ic, handle ); + bu = bee_user_new( bee, ic, handle, BEE_USER_LOCAL ); /* Add the handle to the room userlist */ /* TODO: Use bu instead of a string */ diff --git a/protocols/bee_user.c b/protocols/bee_user.c index b1dcffc8..fd2e8635 100644 --- a/protocols/bee_user.c +++ b/protocols/bee_user.c @@ -26,7 +26,7 @@ #define BITLBEE_CORE #include "bitlbee.h" -bee_user_t *bee_user_new( bee_t *bee, struct im_connection *ic, const char *handle ) +bee_user_t *bee_user_new( bee_t *bee, struct im_connection *ic, const char *handle, bee_user_flags_t flags ) { bee_user_t *bu; @@ -36,6 +36,7 @@ bee_user_t *bee_user_new( bee_t *bee, struct im_connection *ic, const char *hand bu = g_new0( bee_user_t, 1 ); bu->bee = bee; bu->ic = ic; + bu->flags = flags; bu->handle = g_strdup( handle ); bee->users = g_slist_prepend( bee->users, bu ); @@ -159,7 +160,7 @@ void imcb_buddy_status( struct im_connection *ic, const char *handle, int flags, { if( g_strcasecmp( set_getstr( &ic->bee->set, "handle_unknown" ), "add" ) == 0 ) { - bu = bee_user_new( bee, ic, handle ); + bu = bee_user_new( bee, ic, handle, BEE_USER_LOCAL ); } else { @@ -207,7 +208,7 @@ void imcb_buddy_msg( struct im_connection *ic, const char *handle, char *msg, ui } else if( g_strncasecmp( h, "add", 3 ) == 0 ) { - bu = bee_user_new( bee, ic, handle ); + bu = bee_user_new( bee, ic, handle, BEE_USER_LOCAL ); } } diff --git a/protocols/nogaim.c b/protocols/nogaim.c index 241c9833..00fe0ebf 100644 --- a/protocols/nogaim.c +++ b/protocols/nogaim.c @@ -375,7 +375,7 @@ void imcb_add_buddy( struct im_connection *ic, const char *handle, const char *g bee_t *bee = ic->bee; if( !( bu = bee_user_by_handle( bee, ic, handle ) ) ) - bu = bee_user_new( bee, ic, handle ); + bu = bee_user_new( bee, ic, handle, 0 ); bu->group = bee_group_by_name( bee, group, TRUE ); } diff --git a/root_commands.c b/root_commands.c index bbf888c1..aeb4f62a 100644 --- a/root_commands.c +++ b/root_commands.c @@ -531,7 +531,7 @@ static void cmd_add( irc_t *irc, char **cmd ) else /* Only for add -tmp. For regular adds, this callback will be called once the IM server confirms. */ - bee_user_new( irc->b, a->ic, cmd[2] ); + bee_user_new( irc->b, a->ic, cmd[2], BEE_USER_LOCAL ); irc_usermsg( irc, "Adding `%s' to your contact list", cmd[2] ); } |