aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--irc.h1
-rw-r--r--irc_im.c6
-rw-r--r--irc_send.c7
-rw-r--r--protocols/bee_user.c3
4 files changed, 16 insertions, 1 deletions
diff --git a/irc.h b/irc.h
index 75342d05..86a731c5 100644
--- a/irc.h
+++ b/irc.h
@@ -90,6 +90,7 @@ typedef struct irc
typedef enum
{
IRC_USER_PRIVATE = 1,
+ IRC_USER_AWAY = 2,
} irc_user_flags_t;
typedef struct irc_user
diff --git a/irc_im.c b/irc_im.c
index 00ea3cd7..fe7287b5 100644
--- a/irc_im.c
+++ b/irc_im.c
@@ -82,6 +82,12 @@ static gboolean bee_irc_user_status( bee_t *bee, bee_user_t *bu, bee_user_t *old
irc_user_t *iu = bu->ui_data;
irc_channel_t *ic = irc->channels->data; /* For now, just pick the first channel. */
+ /* Do this outside the if below since away state can change without
+ the online state changing. */
+ iu->flags &= ~IRC_USER_AWAY;
+ if( bu->flags & BEE_USER_AWAY || !( bu->flags & BEE_USER_ONLINE ) )
+ iu->flags |= IRC_USER_AWAY;
+
if( ( bu->flags & BEE_USER_ONLINE ) != ( old->flags & BEE_USER_ONLINE ) )
{
if( bu->flags & BEE_USER_ONLINE )
diff --git a/irc_send.c b/irc_send.c
index d3485221..b3283152 100644
--- a/irc_send.c
+++ b/irc_send.c
@@ -230,6 +230,10 @@ void irc_send_whois( irc_user_t *iu )
else
irc_send_num( irc, num, "%s :%s", iu->nick, bu->status ? : bu->status_msg );
}
+ else if( !( bu->flags & BEE_USER_ONLINE ) )
+ {
+ irc_send_num( irc, 301, "%s :%s", iu->nick, "User is offline" );
+ }
}
else
{
@@ -251,7 +255,8 @@ void irc_send_who( irc_t *irc, GSList *l, const char *channel )
/* TODO(wilmer): Restore away/channel information here */
irc_send_num( irc, 352, "%s %s %s %s %s %c :0 %s",
channel ? : "*", iu->user, iu->host, irc->root->host,
- iu->nick, 'H', iu->fullname );
+ iu->nick, iu->flags & IRC_USER_AWAY ? 'G' : 'H',
+ iu->fullname );
l = l->next;
}
diff --git a/protocols/bee_user.c b/protocols/bee_user.c
index 8db2fa28..0dd40cab 100644
--- a/protocols/bee_user.c
+++ b/protocols/bee_user.c
@@ -42,6 +42,9 @@ bee_user_t *bee_user_new( bee_t *bee, struct im_connection *ic, const char *hand
if( bee->ui->user_new )
bee->ui->user_new( bee, bu );
+ /* Offline by default. This will set the right flags. */
+ imcb_buddy_status( ic, handle, 0, NULL, NULL );
+
return bu;
}