Changeset ec86b22 for protocols/nogaim.c


Ignore:
Timestamp:
2010-05-15T23:28:16Z (14 years ago)
Author:
Wilmer van der Gaast <wilmer@…>
Branches:
master
Children:
2309152
Parents:
ca0981a (diff), 6e6b3d7 (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the (diff) links above to see all the changes relative to each parent.
Message:

Mainline merge. (Probably mostly irrelevant for this branch, oh well.)

File:
1 edited

Legend:

Unmodified
Added
Removed
  • protocols/nogaim.c

    rca0981a rec86b22  
    665665        u->away = u->status_msg = NULL;
    666666       
    667         if( ( flags & OPT_LOGGED_IN ) && !u->online )
    668         {
     667        if( set_getbool( &ic->irc->set, "show_offline" ) && !u->online )
     668        {
     669                /* always set users as online */
    669670                irc_spawn( ic->irc, u );
    670671                u->online = 1;
     672                if( !( flags & OPT_LOGGED_IN ) )
     673                {
     674                        /* set away message if user isn't really online */
     675                        u->away = g_strdup( "User is offline" );
     676                }
     677        }
     678        else if( ( flags & OPT_LOGGED_IN ) && !u->online )
     679        {
     680                irc_spawn( ic->irc, u );
     681                u->online = 1;
    671682        }
    672683        else if( !( flags & OPT_LOGGED_IN ) && u->online )
     
    674685                struct groupchat *c;
    675686               
    676                 irc_kill( ic->irc, u );
    677                 u->online = 0;
    678                
    679                 /* Remove him/her from the groupchats to prevent PART messages after he/she QUIT already */
    680                 for( c = ic->groupchats; c; c = c->next )
    681                         remove_chat_buddy_silent( c, handle );
    682         }
    683        
     687                if( set_getbool( &ic->irc->set, "show_offline" ) )
     688                {
     689                        /* keep offline users in channel and set away message to "offline" */
     690                        u->away = g_strdup( "User is offline" );
     691
     692                        /* Keep showing him/her in the control channel but not in groupchats. */
     693                        for( c = ic->groupchats; c; c = c->next )
     694                        {
     695                                if( remove_chat_buddy_silent( c, handle ) && c->joined )
     696                                        irc_part( c->ic->irc, u, c->channel );
     697                        }
     698                }
     699                else
     700                {
     701                        /* kill offline users */
     702                        irc_kill( ic->irc, u );
     703                        u->online = 0;
     704
     705                        /* Remove him/her from the groupchats to prevent PART messages after he/she QUIT already */
     706                        for( c = ic->groupchats; c; c = c->next )
     707                                remove_chat_buddy_silent( c, handle );
     708                }
     709        }
     710
    684711        if( flags & OPT_AWAY )
    685712        {
     
    706733        }
    707734       
    708         /* LISPy... */
    709         if( ( set_getbool( &ic->irc->set, "away_devoice" ) ) &&         /* Don't do a thing when user doesn't want it */
    710             ( u->online ) &&                                            /* Don't touch offline people */
    711             ( ( ( u->online != oo ) && !u->away ) ||                    /* Voice joining people */
    712               ( ( u->online == oo ) && ( oa == !u->away ) ) ) )         /* (De)voice people changing state */
     735        /* early if-clause for show_offline even if there is some redundant code here because this isn't LISP but C ;) */
     736        if( set_getbool( &ic->irc->set, "show_offline" ) && set_getbool( &ic->irc->set, "away_devoice" ) )
    713737        {
    714738                char *from;
     
    723747                                                            ic->irc->myhost );
    724748                }
    725                 irc_write( ic->irc, ":%s MODE %s %cv %s", from, ic->irc->channel,
    726                                                           u->away?'-':'+', u->nick );
    727                 g_free( from );
     749
     750                /* if we use show_offline, we op online users, voice away users, and devoice/deop offline users */
     751                if( flags & OPT_LOGGED_IN )
     752                {
     753                        /* user is "online" (either really online or away) */
     754                        irc_write( ic->irc, ":%s MODE %s %cv%co %s %s", from, ic->irc->channel,
     755                                                                  u->away?'+':'-', u->away?'-':'+', u->nick, u->nick );
     756                }
     757                else
     758                {
     759                        /* user is offline */
     760                        irc_write( ic->irc, ":%s MODE %s -vo %s %s", from, ic->irc->channel, u->nick, u->nick );
     761                }
     762        }
     763        else
     764        {
     765                /* LISPy... */
     766                if( ( set_getbool( &ic->irc->set, "away_devoice" ) ) &&         /* Don't do a thing when user doesn't want it */
     767                    ( u->online ) &&                                            /* Don't touch offline people */
     768                    ( ( ( u->online != oo ) && !u->away ) ||                    /* Voice joining people */
     769                      ( ( u->online == oo ) && ( oa == !u->away ) ) ) )         /* (De)voice people changing state */
     770                {
     771                        char *from;
     772
     773                        if( set_getbool( &ic->irc->set, "simulate_netsplit" ) )
     774                        {
     775                                from = g_strdup( ic->irc->myhost );
     776                        }
     777                        else
     778                        {
     779                                from = g_strdup_printf( "%s!%s@%s", ic->irc->mynick, ic->irc->mynick,
     780                                                                    ic->irc->myhost );
     781                        }
     782                        irc_write( ic->irc, ":%s MODE %s %cv %s", from, ic->irc->channel,
     783                                                                  u->away?'-':'+', u->nick );
     784                        g_free( from );
     785                }
    728786        }
    729787}
     
    12021260                return g_strdup_printf( "\x02[\x02\x02\x02%04d-%02d-%02d "
    12031261                                        "%02d:%02d:%02d\x02]\x02 ",
    1204                                         msg.tm_year + 1900, msg.tm_mon, msg.tm_mday,
     1262                                        msg.tm_year + 1900, msg.tm_mon + 1, msg.tm_mday,
    12051263                                        msg.tm_hour, msg.tm_min, msg.tm_sec );
    12061264}
Note: See TracChangeset for help on using the changeset viewer.