diff options
-rw-r--r-- | irc_send.c | 8 | ||||
-rw-r--r-- | protocols/bee.h | 4 | ||||
-rw-r--r-- | protocols/bee_user.c | 12 | ||||
-rw-r--r-- | protocols/oscar/oscar.c | 2 | ||||
-rw-r--r-- | protocols/purple/purple.c | 4 | ||||
-rw-r--r-- | protocols/yahoo/yahoo.c | 4 |
6 files changed, 29 insertions, 5 deletions
@@ -239,6 +239,14 @@ void irc_send_whois( irc_user_t *iu ) { irc_send_num( irc, 301, "%s :%s", iu->nick, "User is offline" ); } + + if( bu->idle_time || bu->login_time ) + { + irc_send_num( irc, 317, "%s %d %d :seconds idle, signon time", + iu->nick, + bu->idle_time ? (int) ( time( NULL ) - bu->idle_time ) : 0, + (int) bu->login_time ); + } } else { diff --git a/protocols/bee.h b/protocols/bee.h index 5701ea60..c57b4ab5 100644 --- a/protocols/bee.h +++ b/protocols/bee.h @@ -67,6 +67,8 @@ typedef struct bee_user char *status; char *status_msg; + time_t login_time, idle_time; + bee_t *bee; void *ui_data; } bee_user_t; @@ -122,7 +124,7 @@ void bee_group_free( bee_t *bee ); * OPT_LOGGED_IN and OPT_AWAY. * - 'state' and 'message' can be NULL */ 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 ); +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, const char *handle, char *msg, guint32 flags, time_t sent_at ); diff --git a/protocols/bee_user.c b/protocols/bee_user.c index fd2e8635..28235a6d 100644 --- a/protocols/bee_user.c +++ b/protocols/bee_user.c @@ -191,6 +191,18 @@ void imcb_buddy_status( struct im_connection *ic, const char *handle, int flags, g_free( old ); } +void imcb_buddy_times( struct im_connection *ic, const char *handle, time_t login, time_t idle ) +{ + bee_t *bee = ic->bee; + bee_user_t *bu; + + if( !( bu = bee_user_by_handle( bee, ic, handle ) ) ) + return; + + bu->login_time = login; + bu->idle_time = idle; +} + void imcb_buddy_msg( struct im_connection *ic, const char *handle, char *msg, uint32_t flags, time_t sent_at ) { bee_t *bee = ic->bee; diff --git a/protocols/oscar/oscar.c b/protocols/oscar/oscar.c index f5b5c114..acae6433 100644 --- a/protocols/oscar/oscar.c +++ b/protocols/oscar/oscar.c @@ -937,7 +937,7 @@ static int gaim_parse_oncoming(aim_session_t *sess, aim_frame_t *fr, ...) { tmp = normalize(info->sn); imcb_buddy_status(ic, tmp, flags, state_string, NULL); - /* imcb_buddy_times(ic, tmp, signon, time_idle); */ + imcb_buddy_times(ic, tmp, signon, time_idle); return 1; diff --git a/protocols/purple/purple.c b/protocols/purple/purple.c index 16ca01de..2804fdf3 100644 --- a/protocols/purple/purple.c +++ b/protocols/purple/purple.c @@ -686,6 +686,10 @@ static void prplcb_blist_update( PurpleBuddyList *list, PurpleBlistNode *node ) imcb_buddy_status( ic, bud->name, flags, purple_status_get_name( as ), purple_status_get_attr_string( as, "message" ) ); + + imcb_buddy_times( ic, bud->name, + purple_presence_get_login_time( bud->presence ), + purple_presence_get_idle_time( bud->presence ) ); } } diff --git a/protocols/yahoo/yahoo.c b/protocols/yahoo/yahoo.c index d9f90fe0..bf577496 100644 --- a/protocols/yahoo/yahoo.c +++ b/protocols/yahoo/yahoo.c @@ -612,10 +612,8 @@ void ext_yahoo_status_changed( int id, const char *who, int stat, const char *ms imcb_buddy_status( ic, who, flags, state_string, msg ); - /* Not implemented yet... if( stat == YAHOO_STATUS_IDLE ) - imcb_buddy_times( ic, who, 0, away ); - */ + imcb_buddy_times( ic, who, 0, idle ); } void ext_yahoo_got_im( int id, const char *me, const char *who, const char *msg, long tm, int stat, int utf8 ) |