Changeset 84b045d for protocols/nogaim.c


Ignore:
Timestamp:
2007-04-16T01:03:08Z (14 years ago)
Author:
Wilmer van der Gaast <wilmer@…>
Branches:
master
Children:
6bbb939
Parents:
c2fb3809
Message:

s/imc/imcb/ for callback functions. Moved things aroundin nogaim.h a
little bit, grouping things by category instead of original Gaim 0.58
filename.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • protocols/nogaim.c

    rc2fb3809 r84b045d  
    145145/* multi.c */
    146146
    147 struct im_connection *imc_new( account_t *acc )
     147struct im_connection *imcb_new( account_t *acc )
    148148{
    149149        struct im_connection *ic;
     
    204204}
    205205
    206 void imc_log( struct im_connection *ic, char *format, ... )
     206void imcb_log( struct im_connection *ic, char *format, ... )
    207207{
    208208        va_list params;
     
    221221}
    222222
    223 void imc_error( struct im_connection *ic, char *format, ... )
     223void imcb_error( struct im_connection *ic, char *format, ... )
    224224{
    225225        va_list params;
     
    248248}
    249249
    250 void imc_connected( struct im_connection *ic )
     250void imcb_connected( struct im_connection *ic )
    251251{
    252252        user_t *u;
     
    260260        u = user_find( ic->irc, ic->irc->nick );
    261261       
    262         imc_log( ic, "Logged in" );
     262        imcb_log( ic, "Logged in" );
    263263       
    264264        ic->keepalive = b_timeout_add( 60000, send_keepalive, ic );
     
    267267        /* Also necessary when we're not away, at least for some of the
    268268           protocols. */
    269         bim_set_away( ic, u->away );
     269        imc_set_away( ic, u->away );
    270270}
    271271
     
    300300                ic->flags |= OPT_LOGGING_OUT;
    301301       
    302         imc_log( ic, "Signing off.." );
     302        imcb_log( ic, "Signing off.." );
    303303       
    304304        b_event_remove( ic->keepalive );
     
    334334                int delay = set_getint( &irc->set, "auto_reconnect_delay" );
    335335               
    336                 imc_log( ic, "Reconnecting in %d seconds..", delay );
     336                imcb_log( ic, "Reconnecting in %d seconds..", delay );
    337337                a->reconnect = b_timeout_add( delay * 1000, auto_reconnect, a );
    338338        }
     
    344344/* dialogs.c */
    345345
    346 void do_ask_dialog( struct im_connection *ic, char *msg, void *data, void *doit, void *dont )
     346void imcb_ask( struct im_connection *ic, char *msg, void *data, void *doit, void *dont )
    347347{
    348348        query_add( ic->irc, ic, msg, doit, dont, data );
     
    360360       
    361361        if( set_getbool( &irc->set, "debug" ) && 0 ) /* This message is too useless */
    362                 imc_log( ic, "Receiving user add from handle: %s", handle );
     362                imcb_log( ic, "Receiving user add from handle: %s", handle );
    363363       
    364364        if( user_findhandle( ic, handle ) )
    365365        {
    366366                if( set_getbool( &irc->set, "debug" ) )
    367                         imc_log( ic, "User already exists, ignoring add request: %s", handle );
     367                        imcb_log( ic, "User already exists, ignoring add request: %s", handle );
    368368               
    369369                return;
     
    448448               
    449449                if( ( ic->flags & OPT_LOGGED_IN ) && set_getbool( &ic->irc->set, "display_namechanges" ) )
    450                         imc_log( ic, "User `%s' changed name to `%s'", u->nick, u->realname );
     450                        imcb_log( ic, "User `%s' changed name to `%s'", u->nick, u->realname );
    451451        }
    452452}
     
    475475}
    476476
    477 void show_got_added( struct im_connection *ic, char *handle, const char *realname )
     477void imcb_ask_add( struct im_connection *ic, char *handle, const char *realname )
    478478{
    479479        struct show_got_added_data *data = g_new0( struct show_got_added_data, 1 );
     
    512512                        if( set_getbool( &ic->irc->set, "debug" ) || g_strcasecmp( set_getstr( &ic->irc->set, "handle_unknown" ), "ignore" ) != 0 )
    513513                        {
    514                                 imc_log( ic, "serv_got_update() for handle %s:", handle );
    515                                 imc_log( ic, "loggedin = %d, type = %d", loggedin, type );
     514                                imcb_log( ic, "serv_got_update() for handle %s:", handle );
     515                                imcb_log( ic, "loggedin = %d, type = %d", loggedin, type );
    516516                        }
    517517                       
     
    551551        {
    552552                u->away = g_strdup( "Away" );
    553         }
    554         else if( ( type & UC_UNAVAILABLE ) && ( strcmp( ic->acc->prpl->name, "jabber" ) == 0 ) )
    555         {
    556                 if( type & UC_DND )
    557                         u->away = g_strdup( "Do Not Disturb" );
    558                 else if( type & UC_XA )
    559                         u->away = g_strdup( "Extended Away" );
    560                 else // if( type & UC_AWAY )
    561                         u->away = g_strdup( "Away" );
    562553        }
    563554        else if( ( type & UC_UNAVAILABLE ) && ic->acc->prpl->get_status_string )
     
    593584                {
    594585                        if( set_getbool( &irc->set, "debug" ) )
    595                                 imc_log( ic, "Ignoring message from unknown handle %s", handle );
     586                                imcb_log( ic, "Ignoring message from unknown handle %s", handle );
    596587                       
    597588                        return;
     
    615606                else
    616607                {
    617                         imc_log( ic, "Message from unknown handle %s:", handle );
     608                        imcb_log( ic, "Message from unknown handle %s:", handle );
    618609                        u = user_find( irc, irc->mynick );
    619610                }
     
    685676       
    686677        if( set_getbool( &ic->irc->set, "debug" ) )
    687                 imc_log( ic, "You were removed from conversation 0x%x", (int) c );
     678                imcb_log( ic, "You were removed from conversation 0x%x", (int) c );
    688679       
    689680        if( c )
     
    733724                irc_privmsg( ic->irc, u, "PRIVMSG", c->channel, "", msg );
    734725        else
    735                 imc_log( ic, "Message from/to conversation %s@0x%x (unknown conv/user): %s", who, (int) c, msg );
     726                imcb_log( ic, "Message from/to conversation %s@0x%x (unknown conv/user): %s", who, (int) c, msg );
    736727}
    737728
     
    755746       
    756747        if( set_getbool( &ic->irc->set, "debug" ) )
    757                 imc_log( ic, "Creating new conversation: (id=0x%x,handle=%s)", (int) c, handle );
     748                imcb_log( ic, "Creating new conversation: (id=0x%x,handle=%s)", (int) c, handle );
    758749       
    759750        return c;
     
    769760       
    770761        if( set_getbool( &b->ic->irc->set, "debug" ) )
    771                 imc_log( b->ic, "User %s added to conversation 0x%x", handle, (int) b );
     762                imcb_log( b->ic, "User %s added to conversation 0x%x", handle, (int) b );
    772763       
    773764        /* It might be yourself! */
     
    803794       
    804795        if( set_getbool( &b->ic->irc->set, "debug" ) )
    805                 imc_log( b->ic, "User %s removed from conversation 0x%x (%s)", handle, (int) b, reason ? reason : "" );
     796                imcb_log( b->ic, "User %s removed from conversation 0x%x (%s)", handle, (int) b, reason ? reason : "" );
    806797       
    807798        /* It might be yourself! */
     
    929920   them all from some wrappers. We'll start to define some down here: */
    930921
    931 int bim_buddy_msg( struct im_connection *ic, char *handle, char *msg, int flags )
     922int imc_buddy_msg( struct im_connection *ic, char *handle, char *msg, int flags )
    932923{
    933924        char *buf = NULL;
     
    946937}
    947938
    948 int bim_chat_msg( struct groupchat *c, char *msg, int flags )
     939int imc_chat_msg( struct groupchat *c, char *msg, int flags )
    949940{
    950941        char *buf = NULL;
     
    962953}
    963954
    964 static char *bim_away_alias_find( GList *gcm, char *away );
    965 
    966 int bim_set_away( struct im_connection *ic, char *away )
     955static char *imc_away_alias_find( GList *gcm, char *away );
     956
     957int imc_set_away( struct im_connection *ic, char *away )
    967958{
    968959        GList *m, *ms;
     
    995986        else
    996987        {
    997                 s = bim_away_alias_find( ms, away );
     988                s = imc_away_alias_find( ms, away );
    998989                if( s )
    999990                {
    1000991                        ic->acc->prpl->set_away( ic, s, away );
    1001992                        if( set_getbool( &ic->irc->set, "debug" ) )
    1002                                 imc_log( ic, "Setting away state to %s", s );
     993                                imcb_log( ic, "Setting away state to %s", s );
    1003994                }
    1004995                else
     
    10091000}
    10101001
    1011 static char *bim_away_alias_list[8][5] =
     1002static char *imc_away_alias_list[8][5] =
    10121003{
    10131004        { "Away from computer", "Away", "Extended away", NULL },
     
    10211012};
    10221013
    1023 static char *bim_away_alias_find( GList *gcm, char *away )
     1014static char *imc_away_alias_find( GList *gcm, char *away )
    10241015{
    10251016        GList *m;
    10261017        int i, j;
    10271018       
    1028         for( i = 0; *bim_away_alias_list[i]; i ++ )
    1029         {
    1030                 for( j = 0; bim_away_alias_list[i][j]; j ++ )
    1031                         if( g_strncasecmp( away, bim_away_alias_list[i][j], strlen( bim_away_alias_list[i][j] ) ) == 0 )
     1019        for( i = 0; *imc_away_alias_list[i]; i ++ )
     1020        {
     1021                for( j = 0; imc_away_alias_list[i][j]; j ++ )
     1022                        if( g_strncasecmp( away, imc_away_alias_list[i][j], strlen( imc_away_alias_list[i][j] ) ) == 0 )
    10321023                                break;
    10331024               
    1034                 if( !bim_away_alias_list[i][j] )        /* If we reach the end, this row */
     1025                if( !imc_away_alias_list[i][j] )        /* If we reach the end, this row */
    10351026                        continue;                       /* is not what we want. Next!    */
    10361027               
    10371028                /* Now find an entry in this row which exists in gcm */
    1038                 for( j = 0; bim_away_alias_list[i][j]; j ++ )
     1029                for( j = 0; imc_away_alias_list[i][j]; j ++ )
    10391030                {
    10401031                        m = gcm;
    10411032                        while( m )
    10421033                        {
    1043                                 if( g_strcasecmp( bim_away_alias_list[i][j], m->data ) == 0 )
    1044                                         return( bim_away_alias_list[i][j] );
     1034                                if( g_strcasecmp( imc_away_alias_list[i][j], m->data ) == 0 )
     1035                                        return( imc_away_alias_list[i][j] );
    10451036                                m = m->next;
    10461037                        }
     
    10511042}
    10521043
    1053 void bim_add_allow( struct im_connection *ic, char *handle )
     1044void imc_add_allow( struct im_connection *ic, char *handle )
    10541045{
    10551046        if( g_slist_find_custom( ic->permit, handle, (GCompareFunc) ic->acc->prpl->handle_cmp ) == NULL )
     
    10611052}
    10621053
    1063 void bim_rem_allow( struct im_connection *ic, char *handle )
     1054void imc_rem_allow( struct im_connection *ic, char *handle )
    10641055{
    10651056        GSList *l;
     
    10741065}
    10751066
    1076 void bim_add_block( struct im_connection *ic, char *handle )
     1067void imc_add_block( struct im_connection *ic, char *handle )
    10771068{
    10781069        if( g_slist_find_custom( ic->deny, handle, (GCompareFunc) ic->acc->prpl->handle_cmp ) == NULL )
     
    10841075}
    10851076
    1086 void bim_rem_block( struct im_connection *ic, char *handle )
     1077void imc_rem_block( struct im_connection *ic, char *handle )
    10871078{
    10881079        GSList *l;
Note: See TracChangeset for help on using the changeset viewer.