Changeset 6bbb939 for protocols/nogaim.c


Ignore:
Timestamp:
2007-04-16T04:01:13Z (17 years ago)
Author:
Wilmer van der Gaast <wilmer@…>
Branches:
master
Children:
cfc8d58
Parents:
84b045d
Message:

Split serv_got_update() into imcb_buddy_(status|times). (Well, the second
one isn't implemented yet, but I'll do that later.) At last I got rid of
the hack called get_status_string(). And now Yahoo seems to mess up away
messages...

File:
1 edited

Legend:

Unmodified
Added
Removed
  • protocols/nogaim.c

    r84b045d r6bbb939  
    187187
    188188        if( ( g_strcasecmp( set_getstr( &ic->irc->set, "strip_html" ), "always" ) == 0 ) ||
    189             ( ( ic->flags & OPT_CONN_HTML ) && set_getbool( &ic->irc->set, "strip_html" ) ) )
     189            ( ( ic->flags & OPT_DOES_HTML ) && set_getbool( &ic->irc->set, "strip_html" ) ) )
    190190                strip_html( text );
    191191       
     
    494494/* server.c */                   
    495495
    496 void serv_got_update( struct im_connection *ic, char *handle, int loggedin, int evil, time_t signon, time_t idle, int type, guint caps )
     496void imcb_buddy_status( struct im_connection *ic, const char *handle, int flags, const char *state, const char *message )
    497497{
    498498        user_t *u;
    499499        int oa, oo;
    500500       
    501         u = user_findhandle( ic, handle );
     501        u = user_findhandle( ic, (char*) handle );
    502502       
    503503        if( !u )
     
    505505                if( g_strcasecmp( set_getstr( &ic->irc->set, "handle_unknown" ), "add" ) == 0 )
    506506                {
    507                         add_buddy( ic, NULL, handle, NULL );
    508                         u = user_findhandle( ic, handle );
     507                        add_buddy( ic, NULL, (char*) handle, NULL );
     508                        u = user_findhandle( ic, (char*) handle );
    509509                }
    510510                else
     
    512512                        if( set_getbool( &ic->irc->set, "debug" ) || g_strcasecmp( set_getstr( &ic->irc->set, "handle_unknown" ), "ignore" ) != 0 )
    513513                        {
    514                                 imcb_log( ic, "serv_got_update() for handle %s:", handle );
    515                                 imcb_log( ic, "loggedin = %d, type = %d", loggedin, type );
     514                                imcb_log( ic, "imcb_buddy_status() for unknown handle %s:", handle );
     515                                imcb_log( ic, "flags = %d, state = %s, message = %s", flags,
     516                                          state ? state : "NULL", message ? message : "NULL" );
    516517                        }
    517518                       
    518519                        return;
    519520                }
    520                 /* Why did we have this here....
    521                 return; */
    522521        }
    523522       
     
    531530        }
    532531       
    533         if( loggedin && !u->online )
     532        if( ( flags & OPT_LOGGED_IN ) && !u->online )
    534533        {
    535534                irc_spawn( ic->irc, u );
    536535                u->online = 1;
    537536        }
    538         else if( !loggedin && u->online )
     537        else if( !( flags & OPT_LOGGED_IN ) && u->online )
    539538        {
    540539                struct groupchat *c;
     
    545544                /* Remove him/her from the conversations to prevent PART messages after he/she QUIT already */
    546545                for( c = ic->conversations; c; c = c->next )
    547                         remove_chat_buddy_silent( c, handle );
    548         }
    549        
    550         if( ( type & UC_UNAVAILABLE ) && ( strcmp( ic->acc->prpl->name, "oscar" ) == 0 || strcmp( ic->acc->prpl->name, "icq" ) == 0 ) )
    551         {
    552                 u->away = g_strdup( "Away" );
    553         }
    554         else if( ( type & UC_UNAVAILABLE ) && ic->acc->prpl->get_status_string )
    555         {
    556                 u->away = g_strdup( ic->acc->prpl->get_status_string( ic, type ) );
    557         }
    558         else
    559                 u->away = NULL;
     546                        remove_chat_buddy_silent( c, (char*) handle );
     547        }
     548       
     549        if( flags & OPT_AWAY )
     550        {
     551                if( state && message )
     552                {
     553                        u->away = g_strdup_printf( "%s (%s)", state, message );
     554                }
     555                else if( state )
     556                {
     557                        u->away = g_strdup( state );
     558                }
     559                else if( message )
     560                {
     561                        u->away = g_strdup( message );
     562                }
     563                else
     564                {
     565                        u->away = g_strdup( "Away" );
     566                }
     567        }
     568        /* else waste_any_state_information_for_now(); */
    560569       
    561570        /* LISPy... */
     
    612621       
    613622        if( ( g_strcasecmp( set_getstr( &ic->irc->set, "strip_html" ), "always" ) == 0 ) ||
    614             ( ( ic->flags & OPT_CONN_HTML ) && set_getbool( &ic->irc->set, "strip_html" ) ) )
     623            ( ( ic->flags & OPT_DOES_HTML ) && set_getbool( &ic->irc->set, "strip_html" ) ) )
    615624                strip_html( msg );
    616625
     
    718727       
    719728        if( ( g_strcasecmp( set_getstr( &ic->irc->set, "strip_html" ), "always" ) == 0 ) ||
    720             ( ( ic->flags & OPT_CONN_HTML ) && set_getbool( &ic->irc->set, "strip_html" ) ) )
     729            ( ( ic->flags & OPT_DOES_HTML ) && set_getbool( &ic->irc->set, "strip_html" ) ) )
    721730                strip_html( msg );
    722731       
     
    925934        int st;
    926935       
    927         if( ( ic->flags & OPT_CONN_HTML ) && ( g_strncasecmp( msg, "<html>", 6 ) != 0 ) )
     936        if( ( ic->flags & OPT_DOES_HTML ) && ( g_strncasecmp( msg, "<html>", 6 ) != 0 ) )
    928937        {
    929938                buf = escape_html( msg );
     
    941950        char *buf = NULL;
    942951       
    943         if( ( c->ic->flags & OPT_CONN_HTML ) && ( g_strncasecmp( msg, "<html>", 6 ) != 0 ) )
     952        if( ( c->ic->flags & OPT_DOES_HTML ) && ( g_strncasecmp( msg, "<html>", 6 ) != 0 ) )
    944953        {
    945954                buf = escape_html( msg );
Note: See TracChangeset for help on using the changeset viewer.