Changeset b308cf9 for protocols


Ignore:
Timestamp:
2010-06-05T23:21:02Z (14 years ago)
Author:
Wilmer van der Gaast <wilmer@…>
Branches:
master
Children:
1fdb0a4
Parents:
3ab1d31 (diff), e774815 (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:

Merging libpurple branch into killerbee. It's fairly usable already, and
Debian packaging is now properly separated. This also picks up a load of
stuff from mainline it seems.

Location:
protocols
Files:
11 added
20 edited

Legend:

Unmodified
Added
Removed
  • protocols/Makefile

    r3ab1d31 rb308cf9  
    88
    99-include ../Makefile.settings
     10ifdef SRCDIR
     11SRCDIR := $(SRCDIR)protocols/
     12endif
    1013
    1114# [SH] Program variables
     
    4952$(objects): ../Makefile.settings Makefile
    5053
    51 $(objects): %.o: %.c
     54$(objects): %.o: $(SRCDIR)%.c
    5255        @echo '*' Compiling $<
    5356        @$(CC) -c $(CFLAGS) $< -o $@
  • protocols/jabber/Makefile

    r3ab1d31 rb308cf9  
    88
    99-include ../../Makefile.settings
     10ifdef SRCDIR
     11SRCDIR := $(SRCDIR)protocols/jabber/
     12endif
    1013
    1114# [SH] Program variables
     
    3336$(objects): ../../Makefile.settings Makefile
    3437
    35 $(objects): %.o: %.c
     38$(objects): %.o: $(SRCDIR)%.c
    3639        @echo '*' Compiling $<
    3740        @$(CC) -c $(CFLAGS) $< -o $@
  • protocols/jabber/conference.c

    r3ab1d31 rb308cf9  
    272272                }
    273273               
    274                 if( bud != jc->me )
    275                 {
     274                if( bud != jc->me && bud->flags & JBFLAG_IS_ANONYMOUS )
     275                {
     276                        /* If JIDs are anonymized, add them to the local
     277                           list for the duration of this chat. */
    276278                        imcb_add_buddy( ic, bud->ext_jid, NULL );
    277279                        imcb_buddy_nick_hint( ic, bud->ext_jid, bud->resource );
  • protocols/jabber/io.c

    r3ab1d31 rb308cf9  
    6464                   most cases it probably won't be necessary.) */
    6565                if( ( ret = jabber_write_queue( ic ) ) && jd->tx_len > 0 )
    66                         jd->w_inpa = b_input_add( jd->fd, GAIM_INPUT_WRITE, jabber_write_callback, ic );
     66                        jd->w_inpa = b_input_add( jd->fd, B_EV_IO_WRITE, jabber_write_callback, ic );
    6767        }
    6868        else
     
    504504       
    505505        if( jd->r_inpa <= 0 )
    506                 jd->r_inpa = b_input_add( jd->fd, GAIM_INPUT_READ, jabber_read_callback, ic );
     506                jd->r_inpa = b_input_add( jd->fd, B_EV_IO_READ, jabber_read_callback, ic );
    507507       
    508508        greet = g_strdup_printf( "%s<stream:stream to=\"%s\" xmlns=\"jabber:client\" "
  • protocols/jabber/jabber_util.c

    r3ab1d31 rb308cf9  
    671671time_t jabber_get_timestamp( struct xt_node *xt )
    672672{
    673         struct tm tp, utc;
    674673        struct xt_node *c;
    675         time_t res, tres;
    676674        char *s = NULL;
     675        struct tm tp;
    677676       
    678677        for( c = xt->children; ( c = xt_find_node( c, "x" ) ); c = c->next )
     
    692691        tp.tm_year -= 1900;
    693692        tp.tm_mon --;
    694         tp.tm_isdst = -1; /* GRRRRRRRRRRR */
    695        
    696         res = mktime( &tp );
    697         /* Problem is, mktime() just gave us the GMT timestamp for the
    698            given local time... While the given time WAS NOT local. So
    699            we should fix this now.
    700        
    701            Now I could choose between messing with environment variables
    702            (kludgy) or using timegm() (not portable)... Or doing the
    703            following, which I actually prefer... */
    704         gmtime_r( &res, &utc );
    705         utc.tm_isdst = -1; /* Once more: GRRRRRRRRRRRRRRRRRR!!! */
    706         if( utc.tm_hour == tp.tm_hour && utc.tm_min == tp.tm_min )
    707                 /* Sweet! We're in UTC right now... */
    708                 return res;
    709        
    710         tres = mktime( &utc );
    711         res += res - tres;
    712        
    713         /* Yes, this is a hack. And it will go wrong around DST changes.
    714            BUT this is more likely to be threadsafe than messing with
    715            environment variables, and possibly more portable... */
    716        
    717         return res;
     693       
     694        return mktime_utc( &tp );
    718695}
    719696
  • protocols/jabber/message.c

    r3ab1d31 rb308cf9  
    8080                if( type && strcmp( type, "headline" ) == 0 )
    8181                {
    82                         c = xt_find_node( node->children, "subject" );
    83                         g_string_append_printf( fullmsg, "Headline: %s\n", c && c->text_len > 0 ? c->text : "" );
     82                        if( ( c = xt_find_node( node->children, "subject" ) ) && c->text_len > 0 )
     83                                g_string_append_printf( fullmsg, "Headline: %s\n", c->text );
    8484                       
    8585                        /* <x xmlns="jabber:x:oob"><url>http://....</url></x> can contain a URL, it seems. */
  • protocols/jabber/s5bytestream.c

    r3ab1d31 rb308cf9  
    406406                        bt->phase = BS_PHASE_CONNECTED;
    407407                       
    408                         bt->tf->watch_out = b_input_add( fd, GAIM_INPUT_WRITE, jabber_bs_recv_handshake, bt );
     408                        bt->tf->watch_out = b_input_add( fd, B_EV_IO_WRITE, jabber_bs_recv_handshake, bt );
    409409
    410410                        /* since it takes forever(3mins?) till connect() fails on itself we schedule a timeout */
     
    433433                        bt->phase = BS_PHASE_REQUEST;
    434434
    435                         bt->tf->watch_in = b_input_add( fd, GAIM_INPUT_READ, jabber_bs_recv_handshake, bt );
     435                        bt->tf->watch_in = b_input_add( fd, B_EV_IO_READ, jabber_bs_recv_handshake, bt );
    436436
    437437                        bt->tf->watch_out = 0;
     
    590590
    591591        tf->ft->data = tf;
    592         tf->watch_in = b_input_add( tf->fd, GAIM_INPUT_READ, jabber_bs_recv_read, bt );
     592        tf->watch_in = b_input_add( tf->fd, B_EV_IO_READ, jabber_bs_recv_read, bt );
    593593        tf->ft->write_request = jabber_bs_recv_write_request;
    594594
     
    632632                if( ( ret == -1 ) && ( errno == EAGAIN ) )
    633633                {
    634                         tf->watch_in = b_input_add( tf->fd, GAIM_INPUT_READ, jabber_bs_recv_read, bt );
     634                        tf->watch_in = b_input_add( tf->fd, B_EV_IO_READ, jabber_bs_recv_read, bt );
    635635                        return FALSE;
    636636                }
     
    708708                imcb_file_finished( ft );
    709709        else
    710                 bt->tf->watch_out = b_input_add( tf->fd, GAIM_INPUT_WRITE, jabber_bs_send_can_write, bt );
     710                bt->tf->watch_out = b_input_add( tf->fd, B_EV_IO_WRITE, jabber_bs_send_can_write, bt );
    711711               
    712712        return TRUE;
     
    919919                                bt->streamhosts = g_slist_append( bt->streamhosts, sh );
    920920
    921                                 bt->tf->watch_in = b_input_add( tf->fd, GAIM_INPUT_READ, jabber_bs_send_handshake, bt );
     921                                bt->tf->watch_in = b_input_add( tf->fd, B_EV_IO_READ, jabber_bs_send_handshake, bt );
    922922                                bt->connect_timeout = b_timeout_add( JABBER_BS_LISTEN_TIMEOUT * 1000, jabber_bs_connect_timeout, bt );
    923923                        } else {
     
    10561056                        bt->phase = BS_PHASE_CONNECTED;
    10571057
    1058                         bt->tf->watch_in = b_input_add( fd, GAIM_INPUT_READ, jabber_bs_send_handshake, bt );
     1058                        bt->tf->watch_in = b_input_add( fd, B_EV_IO_READ, jabber_bs_send_handshake, bt );
    10591059                        return FALSE;
    10601060                }
  • protocols/msn/Makefile

    r3ab1d31 rb308cf9  
    88
    99-include ../../Makefile.settings
     10ifdef SRCDIR
     11SRCDIR := $(SRCDIR)protocols/msn/
     12endif
    1013
    1114# [SH] Program variables
     
    3336$(objects): ../../Makefile.settings Makefile
    3437
    35 $(objects): %.o: %.c
     38$(objects): %.o: $(SRCDIR)%.c
    3639        @echo '*' Compiling $<
    3740        @$(CC) -c $(CFLAGS) $< -o $@
  • protocols/msn/invitation.c

    r3ab1d31 rb308cf9  
    209209        sock_make_nonblocking( fd );
    210210
    211         msn_file->r_event_id = b_input_add( fd, GAIM_INPUT_READ, msn_ftp_read, file );
     211        msn_file->r_event_id = b_input_add( fd, B_EV_IO_READ, msn_ftp_read, file );
    212212
    213213        return FALSE;
     
    230230        }
    231231
    232         msn_file->r_event_id = b_input_add( msn_file->fd, GAIM_INPUT_READ, msn_ftps_connected, file );
     232        msn_file->r_event_id = b_input_add( msn_file->fd, B_EV_IO_READ, msn_ftps_connected, file );
    233233
    234234        g_snprintf( buf, sizeof( buf ),
     
    318318       
    319319        sock_make_nonblocking( msn_file->fd );
    320         msn_file->r_event_id = b_input_add( msn_file->fd, GAIM_INPUT_READ, msn_ftp_read, file );
     320        msn_file->r_event_id = b_input_add( msn_file->fd, B_EV_IO_READ, msn_ftp_read, file );
    321321       
    322322        return FALSE;
     
    415415            ( msn_file->data_sent + msn_file->sbufpos - 3 < file->file_size ) ) {
    416416                if( !msn_file->w_event_id )
    417                         msn_file->w_event_id = b_input_add( msn_file->fd, GAIM_INPUT_WRITE, msn_ftp_send, file );
     417                        msn_file->w_event_id = b_input_add( msn_file->fd, B_EV_IO_WRITE, msn_ftp_send, file );
    418418                return TRUE;
    419419        }
     
    452452                /* we might already be listening if this is data from an overflow */
    453453                if( !msn_file->w_event_id )
    454                         msn_file->w_event_id = b_input_add( msn_file->fd, GAIM_INPUT_WRITE, msn_ftp_send, file );
     454                        msn_file->w_event_id = b_input_add( msn_file->fd, B_EV_IO_WRITE, msn_ftp_send, file );
    455455        }
    456456
     
    617617
    618618        msn_file->r_event_id =
    619                 b_input_add( msn_file->fd, GAIM_INPUT_READ, msn_ftp_read, file );
     619                b_input_add( msn_file->fd, B_EV_IO_READ, msn_ftp_read, file );
    620620
    621621        return TRUE;
  • protocols/msn/msn.c

    r3ab1d31 rb308cf9  
    3131GSList *msn_switchboards;
    3232
    33 static char *msn_set_display_name( set_t *set, char *value );
     33static char *set_eval_display_name( set_t *set, char *value );
    3434
    3535static void msn_init( account_t *acc )
    3636{
    37         set_t *s;
    38        
    39         s = set_add( &acc->set, "display_name", NULL, msn_set_display_name, acc );
    40         s->flags |= ACC_SET_NOSAVE | ACC_SET_ONLINE_ONLY;
    41 
    42         s = set_add( &acc->set, "mail_notifications", "false", set_eval_bool, acc );
     37        set_add( &acc->set, "display_name", NULL, set_eval_display_name, acc );
     38        set_add( &acc->set, "local_display_name", "false", set_eval_bool, acc );
     39        set_add( &acc->set, "mail_notifications", "false", set_eval_bool, acc );
     40        set_add( &acc->set, "switchboard_keepalives", "false", set_eval_bool, acc );
    4341}
    4442
     
    171169static void msn_set_my_name( struct im_connection *ic, char *info )
    172170{
    173         msn_set_display_name( set_find( &ic->acc->set, "display_name" ), info );
     171        msn_set_display_name( ic, info );
    174172}
    175173
     
    287285}
    288286
    289 static char *msn_set_display_name( set_t *set, char *value )
     287static char *set_eval_display_name( set_t *set, char *value )
    290288{
    291289        account_t *acc = set->data;
    292290        struct im_connection *ic = acc->ic;
    293         struct msn_data *md;
    294         char buf[1024], *fn;
    295        
    296         /* Double-check. */
     291       
     292        /* Allow any name if we're offline. */
    297293        if( ic == NULL )
    298                 return NULL;
    299        
    300         md = ic->proto_data;
     294                return value;
    301295       
    302296        if( strlen( value ) > 129 )
     
    305299                return NULL;
    306300        }
    307        
    308         fn = msn_http_encode( value );
    309        
    310         g_snprintf( buf, sizeof( buf ), "REA %d %s %s\r\n", ++md->trId, ic->acc->user, fn );
    311         msn_write( ic, buf, strlen( buf ) );
    312         g_free( fn );
    313301       
    314302        /* Returning NULL would be better, because the server still has to
    315303           confirm the name change. However, it looks a bit confusing to the
    316304           user. */
    317         return value;
     305        return msn_set_display_name( ic, value ) ? value : NULL;
    318306}
    319307
  • protocols/msn/msn.h

    r3ab1d31 rb308cf9  
    3131#define TYPING_NOTIFICATION_MESSAGE "\r\r\rBEWARE, ME R TYPINK MESSAGE!!!!\r\r\r"
    3232#define GROUPCHAT_SWITCHBOARD_MESSAGE "\r\r\rME WANT TALK TO MANY PEOPLE\r\r\r"
     33#define SB_KEEPALIVE_MESSAGE "\r\r\rDONT HANG UP ON ME!\r\r\r"
    3334
    3435#ifdef DEBUG_MSN
     
    5354                           "TypingUser: %s\r\n" \
    5455                           "\r\n\r\n"
     56
     57#define SB_KEEPALIVE_HEADERS "MIME-Version: 1.0\r\n" \
     58                             "Content-Type: text/x-ping\r\n" \
     59                             "\r\n\r\n"
    5560
    5661#define PROFILE_URL "http://members.msn.com/"
     
    8489        gint inp;
    8590        struct msn_handler_data *handler;
     91        gint keepalive;
    8692       
    8793        int trId;
     
    162168char *msn_http_encode( const char *input );
    163169void msn_msgq_purge( struct im_connection *ic, GSList **list );
     170gboolean msn_set_display_name( struct im_connection *ic, const char *rawname );
    164171
    165172/* tables.c */
     
    180187gboolean msn_sb_connected( gpointer data, gint source, b_input_condition cond );
    181188int msn_sb_write_msg( struct im_connection *ic, struct msn_message *m );
     189void msn_sb_start_keepalives( struct msn_switchboard *sb, gboolean initial );
     190void msn_sb_stop_keepalives( struct msn_switchboard *sb );
    182191
    183192/* invitation.c */
  • protocols/msn/msn_util.c

    r3ab1d31 rb308cf9  
    3838                imcb_error( ic, "Short write() to main server" );
    3939                imc_logout( ic, TRUE );
    40                 return( 0 );
    41         }
    42        
    43         return( 1 );
     40                return 0;
     41        }
     42       
     43        return 1;
    4444}
    4545
     
    377377        g_string_free( ret, TRUE );
    378378}
     379
     380gboolean msn_set_display_name( struct im_connection *ic, const char *rawname )
     381{
     382        char *fn = msn_http_encode( rawname );
     383        struct msn_data *md = ic->proto_data;
     384        char buf[1024];
     385       
     386        g_snprintf( buf, sizeof( buf ), "REA %d %s %s\r\n", ++md->trId, ic->acc->user, fn );
     387        g_free( fn );
     388       
     389        return msn_write( ic, buf, strlen( buf ) ) != 0;
     390}
  • protocols/msn/ns.c

    r3ab1d31 rb308cf9  
    3535
    3636static void msn_auth_got_passport_token( struct msn_auth_data *mad );
     37static gboolean msn_ns_got_display_name( struct im_connection *ic, char *name );
    3738
    3839gboolean msn_ns_connected( gpointer data, gint source, b_input_condition cond )
     
    7576        if( msn_write( ic, s, strlen( s ) ) )
    7677        {
    77                 ic->inpa = b_input_add( md->fd, GAIM_INPUT_READ, msn_ns_callback, ic );
     78                ic->inpa = b_input_add( md->fd, B_EV_IO_READ, msn_ns_callback, ic );
    7879                imcb_log( ic, "Connected to server, waiting for reply" );
    7980        }
     
    231232                else if( num_parts >= 7 && strcmp( cmd[2], "OK" ) == 0 )
    232233                {
    233                         set_t *s;
    234                        
    235234                        if( num_parts == 7 )
    236                         {
    237                                 http_decode( cmd[4] );
    238                                
    239                                 strncpy( ic->displayname, cmd[4], sizeof( ic->displayname ) );
    240                                 ic->displayname[sizeof(ic->displayname)-1] = 0;
    241                                
    242                                 if( ( s = set_find( &ic->acc->set, "display_name" ) ) )
    243                                 {
    244                                         g_free( s->value );
    245                                         s->value = g_strdup( cmd[4] );
    246                                 }
    247                         }
     235                                msn_ns_got_display_name( ic, cmd[4] );
    248236                        else
    249                         {
    250237                                imcb_log( ic, "Warning: Friendly name in server response was corrupted" );
    251                         }
    252238                       
    253239                        imcb_log( ic, "Authenticated, getting buddy list" );
     
    436422        else if( strcmp( cmd[0], "FLN" ) == 0 )
    437423        {
    438                 if( cmd[1] )
    439                         imcb_buddy_status( ic, cmd[1], 0, NULL, NULL );
     424                if( cmd[1] == NULL )
     425                        return 1;
     426               
     427                imcb_buddy_status( ic, cmd[1], 0, NULL, NULL );
     428               
     429                msn_sb_start_keepalives( msn_sb_by_handle( ic, cmd[1] ), TRUE );
    440430        }
    441431        else if( strcmp( cmd[0], "NLN" ) == 0 )
     
    463453                                   ( st != msn_away_state_list ? OPT_AWAY : 0 ),
    464454                                   st->name, NULL );
     455               
     456                msn_sb_stop_keepalives( msn_sb_by_handle( ic, cmd[2] ) );
    465457        }
    466458        else if( strcmp( cmd[0], "RNG" ) == 0 )
     
    567559                return( 0 );
    568560        }
     561#if 0
     562        /* Discard this one completely for now since I don't care about the ack
     563           and since MSN servers can apparently screw up the formatting. */
    569564        else if( strcmp( cmd[0], "REA" ) == 0 )
    570565        {
     
    597592                }
    598593        }
     594#endif
    599595        else if( strcmp( cmd[0], "IPG" ) == 0 )
    600596        {
     
    746742        }
    747743}
     744
     745static gboolean msn_ns_got_display_name( struct im_connection *ic, char *name )
     746{
     747        set_t *s;
     748       
     749        if( ( s = set_find( &ic->acc->set, "display_name" ) ) == NULL )
     750                return FALSE; /* Shouldn't happen.. */
     751       
     752        http_decode( name );
     753       
     754        if( s->value && strcmp( s->value, name ) == 0 )
     755        {
     756                return TRUE;
     757                /* The names match, nothing to worry about. */
     758        }
     759        else if( s->value != NULL &&
     760                 ( strcmp( name, ic->acc->user ) == 0 ||
     761                   set_getbool( &ic->acc->set, "local_display_name" ) ) )
     762        {
     763                /* The server thinks our display name is our e-mail address
     764                   which is probably wrong, or the user *wants* us to do this:
     765                   Always use the locally set display_name. */
     766                return msn_set_display_name( ic, s->value );
     767        }
     768        else
     769        {
     770                if( s->value && *s->value )
     771                        imcb_log( ic, "BitlBee thinks your display name is `%s' but "
     772                                      "the MSN server says it's `%s'. Using the MSN "
     773                                      "server's name. Set local_display_name to true "
     774                                      "to use the local name.", s->value, name );
     775               
     776                if( g_utf8_validate( name, -1, NULL ) )
     777                {
     778                        g_free( s->value );
     779                        s->value = g_strdup( name );
     780                }
     781                else
     782                {
     783                        imcb_log( ic, "Warning: Friendly name in server response was corrupted" );
     784                }
     785               
     786                return TRUE;
     787        }
     788}
  • protocols/msn/sb.c

    r3ab1d31 rb308cf9  
    180180                        i = strlen( buf );
    181181                }
     182                else if( strcmp( text, SB_KEEPALIVE_MESSAGE ) == 0 )
     183                {
     184                        buf = g_strdup( SB_KEEPALIVE_HEADERS );
     185                        i = strlen( buf );
     186                }
    182187                else
    183188                {
     
    256261       
    257262        msn_msgq_purge( ic, &sb->msgq );
     263        msn_sb_stop_keepalives( sb );
    258264       
    259265        if( sb->key ) g_free( sb->key );
     
    315321       
    316322        if( msn_sb_write( sb, buf, strlen( buf ) ) )
    317                 sb->inp = b_input_add( sb->fd, GAIM_INPUT_READ, msn_sb_callback, sb );
     323                sb->inp = b_input_add( sb->fd, B_EV_IO_READ, msn_sb_callback, sb );
    318324        else
    319325                debug( "Error %d while connecting to switchboard server", 2 );
     
    328334        struct msn_data *md = ic->proto_data;
    329335       
    330         if( msn_handler( sb->handler ) == -1 )
     336        if( msn_handler( sb->handler ) != -1 )
     337                return TRUE;
     338       
     339        if( sb->msgq != NULL )
    331340        {
    332341                time_t now = time( NULL );
     342                char buf[1024];
    333343               
    334344                if( now - md->first_sb_failure > 600 )
     
    347357                                      "There might be problems delivering your messages." );
    348358               
    349                 if( sb->msgq != NULL )
    350                 {
    351                         char buf[1024];
    352                        
    353                         if( md->msgq == NULL )
    354                         {
    355                                 md->msgq = sb->msgq;
    356                         }
    357                         else
    358                         {
    359                                 GSList *l;
    360                                
    361                                 for( l = md->msgq; l->next; l = l->next );
    362                                 l->next = sb->msgq;
    363                         }
    364                         sb->msgq = NULL;
    365                        
    366                         debug( "Moved queued messages back to the main queue, creating a new switchboard to retry." );
    367                         g_snprintf( buf, sizeof( buf ), "XFR %d SB\r\n", ++md->trId );
    368                         if( !msn_write( ic, buf, strlen( buf ) ) )
    369                                 return FALSE;
    370                 }
    371                
    372                 msn_sb_destroy( sb );
    373                
    374                 return FALSE;
    375         }
    376         else
    377         {
    378                 return TRUE;
    379         }
     359                if( md->msgq == NULL )
     360                {
     361                        md->msgq = sb->msgq;
     362                }
     363                else
     364                {
     365                        GSList *l;
     366                       
     367                        for( l = md->msgq; l->next; l = l->next );
     368                        l->next = sb->msgq;
     369                }
     370                sb->msgq = NULL;
     371               
     372                debug( "Moved queued messages back to the main queue, "
     373                       "creating a new switchboard to retry." );
     374                g_snprintf( buf, sizeof( buf ), "XFR %d SB\r\n", ++md->trId );
     375                if( !msn_write( ic, buf, strlen( buf ) ) )
     376                        return FALSE;
     377        }
     378       
     379        msn_sb_destroy( sb );
     380        return FALSE;
    380381}
    381382
     
    477478               
    478479                sb->ready = 1;
     480               
     481                msn_sb_start_keepalives( sb, FALSE );
    479482        }
    480483        else if( strcmp( cmd[0], "CAL" ) == 0 )
     
    526529                        }
    527530                       
     531                        msn_sb_start_keepalives( sb, FALSE );
     532                       
    528533                        return( st );
    529534                }
     
    587592                if( sb->who )
    588593                {
     594                        msn_sb_stop_keepalives( sb );
     595                       
    589596                        /* This is a single-person chat, and the other person is leaving. */
    590597                        g_free( sb->who );
     
    749756        return( 1 );
    750757}
     758
     759static gboolean msn_sb_keepalive( gpointer data, gint source, b_input_condition cond )
     760{
     761        struct msn_switchboard *sb = data;
     762        return sb->ready && msn_sb_sendmessage( sb, SB_KEEPALIVE_MESSAGE );
     763}
     764
     765void msn_sb_start_keepalives( struct msn_switchboard *sb, gboolean initial )
     766{
     767        struct buddy *b;
     768       
     769        if( sb && sb->who && sb->keepalive == 0 &&
     770            ( b = imcb_find_buddy( sb->ic, sb->who ) ) && !b->present &&
     771            set_getbool( &sb->ic->acc->set, "switchboard_keepalives" ) )
     772        {
     773                if( initial )
     774                        msn_sb_keepalive( sb, 0, 0 );
     775               
     776                sb->keepalive = b_timeout_add( 20000, msn_sb_keepalive, sb );
     777        }
     778}
     779
     780void msn_sb_stop_keepalives( struct msn_switchboard *sb )
     781{
     782        if( sb && sb->keepalive > 0 )
     783        {
     784                b_event_remove( sb->keepalive );
     785                sb->keepalive = 0;
     786        }
     787}
  • protocols/nogaim.c

    r3ab1d31 rb308cf9  
    3939
    4040static int remove_chat_buddy_silent( struct groupchat *b, const char *handle );
     41static char *format_timestamp( irc_t *irc, time_t msg_ts );
    4142
    4243GSList *connections;
     
    116117{
    117118        GList *gl;
    118         for (gl = protocols; gl; gl = gl->next)
     119       
     120        for( gl = protocols; gl; gl = gl->next )
    119121        {
    120122                struct prpl *proto = gl->data;
    121                 if(!g_strcasecmp(proto->name, name))
     123               
     124                if( g_strcasecmp( proto->name, name ) == 0 )
    122125                        return proto;
    123126        }
     127       
    124128        return NULL;
    125129}
     
    132136        extern void byahoo_initmodule();
    133137        extern void jabber_initmodule();
     138        extern void twitter_initmodule();
     139        extern void purple_initmodule();
    134140
    135141#ifdef WITH_MSN
     
    147153#ifdef WITH_JABBER
    148154        jabber_initmodule();
     155#endif
     156
     157#ifdef WITH_TWITTER
     158        twitter_initmodule();
     159#endif
     160       
     161#ifdef WITH_PURPLE
     162        purple_initmodule();
    149163#endif
    150164
     
    651665        u->away = u->status_msg = NULL;
    652666       
    653         if( ( flags & OPT_LOGGED_IN ) && !u->online )
    654         {
     667        if( set_getbool( &ic->irc->set, "show_offline" ) && !u->online )
     668        {
     669                /* always set users as online */
    655670                irc_spawn( ic->irc, u );
    656671                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;
    657682        }
    658683        else if( !( flags & OPT_LOGGED_IN ) && u->online )
     
    660685                struct groupchat *c;
    661686               
    662                 irc_kill( ic->irc, u );
    663                 u->online = 0;
    664                
    665                 /* Remove him/her from the groupchats to prevent PART messages after he/she QUIT already */
    666                 for( c = ic->groupchats; c; c = c->next )
    667                         remove_chat_buddy_silent( c, handle );
    668         }
    669        
     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
    670711        if( flags & OPT_AWAY )
    671712        {
     
    692733        }
    693734       
    694         /* LISPy... */
    695         if( ( set_getbool( &ic->irc->set, "away_devoice" ) ) &&         /* Don't do a thing when user doesn't want it */
    696             ( u->online ) &&                                            /* Don't touch offline people */
    697             ( ( ( u->online != oo ) && !u->away ) ||                    /* Voice joining people */
    698               ( ( 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" ) )
    699737        {
    700738                char *from;
     
    709747                                                            ic->irc->myhost );
    710748                }
    711                 irc_write( ic->irc, ":%s MODE %s %cv %s", from, ic->irc->channel,
    712                                                           u->away?'-':'+', u->nick );
    713                 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                }
    714786        }
    715787}
     
    718790{
    719791        irc_t *irc = ic->irc;
    720         char *wrapped;
     792        char *wrapped, *ts = NULL;
    721793        user_t *u;
    722794       
     
    760832            ( ( ic->flags & OPT_DOES_HTML ) && set_getbool( &ic->irc->set, "strip_html" ) ) )
    761833                strip_html( msg );
    762 
     834       
     835        if( set_getbool( &ic->irc->set, "display_timestamps" ) &&
     836            ( ts = format_timestamp( irc, sent_at ) ) )
     837        {
     838                char *new = g_strconcat( ts, msg, NULL );
     839                g_free( ts );
     840                ts = msg = new;
     841        }
     842       
    763843        wrapped = word_wrap( msg, 425 );
    764844        irc_msgfrom( irc, u->nick, wrapped );
    765845        g_free( wrapped );
     846        g_free( ts );
    766847}
    767848
     
    805886       
    806887        return c;
     888}
     889
     890void imcb_chat_name_hint( struct groupchat *c, const char *name )
     891{
     892        if( !c->joined )
     893        {
     894                struct im_connection *ic = c->ic;
     895                char stripped[MAX_NICK_LENGTH+1], *full_name;
     896               
     897                strncpy( stripped, name, MAX_NICK_LENGTH );
     898                stripped[MAX_NICK_LENGTH] = '\0';
     899                nick_strip( stripped );
     900                if( set_getbool( &ic->irc->set, "lcnicks" ) )
     901                        nick_lc( stripped );
     902               
     903                full_name = g_strdup_printf( "&%s", stripped );
     904               
     905                if( stripped[0] &&
     906                    nick_cmp( stripped, ic->irc->channel + 1 ) != 0 &&
     907                    irc_chat_by_channel( ic->irc, full_name ) == NULL )
     908                {
     909                        g_free( c->channel );
     910                        c->channel = full_name;
     911                }
     912                else
     913                {
     914                        g_free( full_name );
     915                }
     916        }
    807917}
    808918
     
    867977        if( c && u )
    868978        {
    869                 irc_privmsg( ic->irc, u, "PRIVMSG", c->channel, "", wrapped );
     979                char *ts = NULL;
     980                if( set_getbool( &ic->irc->set, "display_timestamps" ) )
     981                        ts = format_timestamp( ic->irc, sent_at );
     982                irc_privmsg( ic->irc, u, "PRIVMSG", c->channel, ts ? : "", wrapped );
     983                g_free( ts );
    870984        }
    871985        else
     
    10611175}
    10621176
    1063 
    1064 
     1177char *set_eval_timezone( set_t *set, char *value )
     1178{
     1179        char *s;
     1180       
     1181        if( strcmp( value, "local" ) == 0 ||
     1182            strcmp( value, "gmt" ) == 0 || strcmp( value, "utc" ) == 0 )
     1183                return value;
     1184       
     1185        /* Otherwise: +/- at the beginning optional, then one or more numbers,
     1186           possibly followed by a colon and more numbers. Don't bother bound-
     1187           checking them since users are free to shoot themselves in the foot. */
     1188        s = value;
     1189        if( *s == '+' || *s == '-' )
     1190                s ++;
     1191       
     1192        /* \d+ */
     1193        if( !isdigit( *s ) )
     1194                return SET_INVALID;
     1195        while( *s && isdigit( *s ) ) s ++;
     1196       
     1197        /* EOS? */
     1198        if( *s == '\0' )
     1199                return value;
     1200       
     1201        /* Otherwise, colon */
     1202        if( *s != ':' )
     1203                return SET_INVALID;
     1204        s ++;
     1205       
     1206        /* \d+ */
     1207        if( !isdigit( *s ) )
     1208                return SET_INVALID;
     1209        while( *s && isdigit( *s ) ) s ++;
     1210       
     1211        /* EOS */
     1212        return *s == '\0' ? value : SET_INVALID;
     1213}
     1214
     1215static char *format_timestamp( irc_t *irc, time_t msg_ts )
     1216{
     1217        time_t now_ts = time( NULL );
     1218        struct tm now, msg;
     1219        char *set;
     1220       
     1221        /* If the timestamp is <= 0 or less than a minute ago, discard it as
     1222           it doesn't seem to add to much useful info and/or might be noise. */
     1223        if( msg_ts <= 0 || msg_ts > now_ts - 60 )
     1224                return NULL;
     1225       
     1226        set = set_getstr( &irc->set, "timezone" );
     1227        if( strcmp( set, "local" ) == 0 )
     1228        {
     1229                localtime_r( &now_ts, &now );
     1230                localtime_r( &msg_ts, &msg );
     1231        }
     1232        else
     1233        {
     1234                int hr, min = 0, sign = 60;
     1235               
     1236                if( set[0] == '-' )
     1237                {
     1238                        sign *= -1;
     1239                        set ++;
     1240                }
     1241                else if( set[0] == '+' )
     1242                {
     1243                        set ++;
     1244                }
     1245               
     1246                if( sscanf( set, "%d:%d", &hr, &min ) >= 1 )
     1247                {
     1248                        msg_ts += sign * ( hr * 60 + min );
     1249                        now_ts += sign * ( hr * 60 + min );
     1250                }
     1251               
     1252                gmtime_r( &now_ts, &now );
     1253                gmtime_r( &msg_ts, &msg );
     1254        }
     1255       
     1256        if( msg.tm_year == now.tm_year && msg.tm_yday == now.tm_yday )
     1257                return g_strdup_printf( "\x02[\x02\x02\x02%02d:%02d:%02d\x02]\x02 ",
     1258                                        msg.tm_hour, msg.tm_min, msg.tm_sec );
     1259        else
     1260                return g_strdup_printf( "\x02[\x02\x02\x02%04d-%02d-%02d "
     1261                                        "%02d:%02d:%02d\x02]\x02 ",
     1262                                        msg.tm_year + 1900, msg.tm_mon + 1, msg.tm_mday,
     1263                                        msg.tm_hour, msg.tm_min, msg.tm_sec );
     1264}
    10651265
    10661266/* The plan is to not allow straight calls to prpl functions anymore, but do
     
    11051305{
    11061306        char *away, *msg = NULL;
     1307       
     1308        if( ic->acc->prpl->away_states == NULL ||
     1309            ic->acc->prpl->set_away == NULL )
     1310                return 0;
    11071311       
    11081312        away = set_getstr( &ic->acc->set, "away" ) ?
  • protocols/nogaim.h

    r3ab1d31 rb308cf9  
    134134         * - The user sees this name ie. when imcb_log() is used. */
    135135        const char *name;
     136        void *data;
    136137
    137138        /* Added this one to be able to add per-account settings, don't think
     
    307308 *   user, too. */
    308309G_MODULE_EXPORT struct groupchat *imcb_chat_new( struct im_connection *ic, const char *handle );
     310G_MODULE_EXPORT void imcb_chat_name_hint( struct groupchat *c, const char *name );
    309311G_MODULE_EXPORT void imcb_chat_add_buddy( struct groupchat *b, const char *handle );
    310312/* To remove a handle from a group chat. Reason can be NULL. */
     
    329331
    330332/* Misc. stuff */
     333char *set_eval_timezone( set_t *set, char *value );
    331334char *set_eval_away_devoice( set_t *set, char *value );
    332335gboolean auto_reconnect( gpointer data, gint fd, b_input_condition cond );
  • protocols/oscar/Makefile

    r3ab1d31 rb308cf9  
    88
    99-include ../../Makefile.settings
     10ifdef SRCDIR
     11SRCDIR := $(SRCDIR)protocols/oscar/
     12CFLAGS += -I$(SRCDIR)
     13endif
    1014
    1115# [SH] Program variables
     
    3337$(objects): ../../Makefile.settings Makefile
    3438
    35 $(objects): %.o: %.c
     39$(objects): %.o: $(SRCDIR)%.c
    3640        @echo '*' Compiling $<
    3741        @$(CC) -c $(CFLAGS) $< -o $@
  • protocols/oscar/oscar.c

    r3ab1d31 rb308cf9  
    205205static int gaim_icbm_param_info  (aim_session_t *, aim_frame_t *, ...);
    206206static int gaim_parse_genericerr (aim_session_t *, aim_frame_t *, ...);
    207 static int gaim_memrequest       (aim_session_t *, aim_frame_t *, ...);
    208207static int gaim_selfinfo         (aim_session_t *, aim_frame_t *, ...);
    209208static int gaim_offlinemsg       (aim_session_t *, aim_frame_t *, ...);
     
    291290        odata = (struct oscar_data *)ic->proto_data;
    292291
    293         if (condition & GAIM_INPUT_READ) {
     292        if (condition & B_EV_IO_READ) {
    294293                if (aim_get_command(odata->sess, conn) >= 0) {
    295294                        aim_rxdispatch(odata->sess);
     
    363362
    364363        aim_conn_completeconnect(sess, conn);
    365         ic->inpa = b_input_add(conn->fd, GAIM_INPUT_READ,
     364        ic->inpa = b_input_add(conn->fd, B_EV_IO_READ,
    366365                        oscar_callback, conn);
    367366       
     
    493492
    494493        aim_conn_completeconnect(sess, bosconn);
    495         ic->inpa = b_input_add(bosconn->fd, GAIM_INPUT_READ,
     494        ic->inpa = b_input_add(bosconn->fd, B_EV_IO_READ,
    496495                        oscar_callback, bosconn);
    497496        imcb_log(ic, _("Connection established, cookie sent"));
     
    570569        aim_conn_addhandler(sess, bosconn, AIM_CB_FAM_BUD, AIM_CB_BUD_ERROR, gaim_parse_genericerr, 0);
    571570        aim_conn_addhandler(sess, bosconn, AIM_CB_FAM_BOS, AIM_CB_BOS_ERROR, gaim_parse_genericerr, 0);
    572         aim_conn_addhandler(sess, bosconn, AIM_CB_FAM_GEN, 0x1f, gaim_memrequest, 0);
    573571        aim_conn_addhandler(sess, bosconn, AIM_CB_FAM_GEN, AIM_CB_GEN_SELFINFO, gaim_selfinfo, 0);
    574572        aim_conn_addhandler(sess, bosconn, AIM_CB_FAM_ICQ, AIM_CB_ICQ_OFFLINEMSG, gaim_offlinemsg, 0);
     
    604602}
    605603
    606 struct pieceofcrap {
    607         struct im_connection *ic;
    608         unsigned long offset;
    609         unsigned long len;
    610         char *modname;
    611         int fd;
    612         aim_conn_t *conn;
    613         unsigned int inpa;
    614 };
    615 
    616 static gboolean damn_you(gpointer data, gint source, b_input_condition c)
    617 {
    618         struct pieceofcrap *pos = data;
    619         struct oscar_data *od = pos->ic->proto_data;
    620         char in = '\0';
    621         int x = 0;
    622         unsigned char m[17];
    623 
    624         while (read(pos->fd, &in, 1) == 1) {
    625                 if (in == '\n')
    626                         x++;
    627                 else if (in != '\r')
    628                         x = 0;
    629                 if (x == 2)
    630                         break;
    631                 in = '\0';
    632         }
    633         if (in != '\n') {
    634                 imcb_error(pos->ic, "Gaim was unable to get a valid hash for logging into AIM."
    635                                 " You may be disconnected shortly.");
    636                 b_event_remove(pos->inpa);
    637                 closesocket(pos->fd);
    638                 g_free(pos);
    639                 return FALSE;
    640         }
    641         /* [WvG] Wheeeee! Who needs error checking anyway? ;-) */
    642         read(pos->fd, m, 16);
    643         m[16] = '\0';
    644         b_event_remove(pos->inpa);
    645         closesocket(pos->fd);
    646         aim_sendmemblock(od->sess, pos->conn, 0, 16, m, AIM_SENDMEMBLOCK_FLAG_ISHASH);
    647         g_free(pos);
    648        
    649         return FALSE;
    650 }
    651 
    652 static gboolean straight_to_hell(gpointer data, gint source, b_input_condition cond) {
    653         struct pieceofcrap *pos = data;
    654         char buf[BUF_LONG];
    655 
    656         if (source < 0) {
    657                 imcb_error(pos->ic, "Gaim was unable to get a valid hash for logging into AIM."
    658                                 " You may be disconnected shortly.");
    659                 if (pos->modname)
    660                         g_free(pos->modname);
    661                 g_free(pos);
    662                 return FALSE;
    663         }
    664 
    665         g_snprintf(buf, sizeof(buf), "GET " AIMHASHDATA
    666                         "?offset=%ld&len=%ld&modname=%s HTTP/1.0\n\n",
    667                         pos->offset, pos->len, pos->modname ? pos->modname : "");
    668         write(pos->fd, buf, strlen(buf));
    669         if (pos->modname)
    670                 g_free(pos->modname);
    671         pos->inpa = b_input_add(pos->fd, GAIM_INPUT_READ, damn_you, pos);
    672         return FALSE;
    673 }
    674 
    675604/* size of icbmui.ocm, the largest module in AIM 3.5 */
    676605#define AIM_MAX_FILE_SIZE 98304
    677 
    678 int gaim_memrequest(aim_session_t *sess, aim_frame_t *fr, ...) {
    679         va_list ap;
    680         struct pieceofcrap *pos;
    681         guint32 offset, len;
    682         char *modname;
    683         int fd;
    684 
    685         va_start(ap, fr);
    686         offset = (guint32)va_arg(ap, unsigned long);
    687         len = (guint32)va_arg(ap, unsigned long);
    688         modname = va_arg(ap, char *);
    689         va_end(ap);
    690 
    691         if (len == 0) {
    692                 aim_sendmemblock(sess, fr->conn, offset, len, NULL,
    693                                 AIM_SENDMEMBLOCK_FLAG_ISREQUEST);
    694                 return 1;
    695         }
    696         /* uncomment this when you're convinced it's right. remember, it's been wrong before.
    697         if (offset > AIM_MAX_FILE_SIZE || len > AIM_MAX_FILE_SIZE) {
    698                 char *buf;
    699                 int i = 8;
    700                 if (modname)
    701                         i += strlen(modname);
    702                 buf = g_malloc(i);
    703                 i = 0;
    704                 if (modname) {
    705                         memcpy(buf, modname, strlen(modname));
    706                         i += strlen(modname);
    707                 }
    708                 buf[i++] = offset & 0xff;
    709                 buf[i++] = (offset >> 8) & 0xff;
    710                 buf[i++] = (offset >> 16) & 0xff;
    711                 buf[i++] = (offset >> 24) & 0xff;
    712                 buf[i++] = len & 0xff;
    713                 buf[i++] = (len >> 8) & 0xff;
    714                 buf[i++] = (len >> 16) & 0xff;
    715                 buf[i++] = (len >> 24) & 0xff;
    716                 aim_sendmemblock(sess, command->conn, offset, i, buf, AIM_SENDMEMBLOCK_FLAG_ISREQUEST);
    717                 g_free(buf);
    718                 return 1;
    719         }
    720         */
    721 
    722         pos = g_new0(struct pieceofcrap, 1);
    723         pos->ic = sess->aux_data;
    724         pos->conn = fr->conn;
    725 
    726         pos->offset = offset;
    727         pos->len = len;
    728         pos->modname = modname ? g_strdup(modname) : NULL;
    729 
    730         fd = proxy_connect("gaim.sourceforge.net", 80, straight_to_hell, pos);
    731         if (fd < 0) {
    732                 if (pos->modname)
    733                         g_free(pos->modname);
    734                 g_free(pos);
    735                 imcb_error(sess->aux_data, "Gaim was unable to get a valid hash for logging into AIM."
    736                                 " You may be disconnected shortly.");
    737         }
    738         pos->fd = fd;
    739 
    740         return 1;
    741 }
    742606
    743607static int gaim_parse_login(aim_session_t *sess, aim_frame_t *fr, ...) {
     
    838702
    839703        aim_conn_completeconnect(sess, tstconn);
    840         odata->cnpa = b_input_add(tstconn->fd, GAIM_INPUT_READ,
     704        odata->cnpa = b_input_add(tstconn->fd, B_EV_IO_READ,
    841705                                        oscar_callback, tstconn);
    842706       
     
    866730
    867731        aim_conn_completeconnect(sess, tstconn);
    868         odata->paspa = b_input_add(tstconn->fd, GAIM_INPUT_READ,
     732        odata->paspa = b_input_add(tstconn->fd, B_EV_IO_READ,
    869733                                oscar_callback, tstconn);
    870734       
     
    902766        aim_conn_completeconnect(sess, ccon->conn);
    903767        ccon->inpa = b_input_add(tstconn->fd,
    904                         GAIM_INPUT_READ,
     768                        B_EV_IO_READ,
    905769                        oscar_callback, tstconn);
    906770        odata->oscar_chats = g_slist_append(odata->oscar_chats, ccon);
     
    26512515        char * chatname;
    26522516       
    2653         chatname = g_strdup_printf("%s%d", ic->acc->user, chat_id++);
     2517        chatname = g_strdup_printf("%s%s_%d", isdigit(*ic->acc->user) ? "icq_" : "",
     2518                                   ic->acc->user, chat_id++);
    26542519 
    26552520        ret = oscar_chat_join(ic, chatname, NULL, NULL);
  • protocols/yahoo/Makefile

    r3ab1d31 rb308cf9  
    88
    99-include ../../Makefile.settings
     10ifdef SRCDIR
     11SRCDIR := $(SRCDIR)protocols/yahoo/
     12endif
    1013
    1114# [SH] Program variables
     
    3336$(objects): ../../Makefile.settings Makefile
    3437
    35 $(objects): %.o: %.c
     38$(objects): %.o: $(SRCDIR)%.c
    3639        @echo '*' Compiling $<
    3740        @$(CC) -c $(CFLAGS) $< -o $@
  • protocols/yahoo/yahoo.c

    r3ab1d31 rb308cf9  
    138138        struct im_connection *ic = imcb_new( acc );
    139139        struct byahoo_data *yd = ic->proto_data = g_new0( struct byahoo_data, 1 );
     140        char *s;
    140141       
    141142        yd->logged_in = FALSE;
    142143        yd->current_status = YAHOO_STATUS_AVAILABLE;
     144       
     145        if( ( s = strchr( acc->user, '@' ) ) && g_strcasecmp( s, "@yahoo.com" ) == 0 )
     146                imcb_error( ic, "Your Yahoo! username should just be a username. "
     147                                "Do not include any @domain part." );
    143148       
    144149        imcb_log( ic, "Connecting" );
     
    681686               
    682687                inp->d = d;
    683                 d->tag = inp->h = b_input_add( fd, GAIM_INPUT_READ, (b_event_handler) byahoo_read_ready_callback, (gpointer) d );
     688                d->tag = inp->h = b_input_add( fd, B_EV_IO_READ, (b_event_handler) byahoo_read_ready_callback, (gpointer) d );
    684689        }
    685690        else if( cond == YAHOO_INPUT_WRITE )
     
    692697               
    693698                inp->d = d;
    694                 d->tag = inp->h = b_input_add( fd, GAIM_INPUT_WRITE, (b_event_handler) byahoo_write_ready_callback, (gpointer) d );
     699                d->tag = inp->h = b_input_add( fd, B_EV_IO_WRITE, (b_event_handler) byahoo_write_ready_callback, (gpointer) d );
    695700        }
    696701        else
     
    828833        YList *m;
    829834       
     835        if( g_strcasecmp( who, ic->acc->user ) == 0 )
     836                /* WTF, Yahoo! seems to echo these now? */
     837                return;
     838       
    830839        inv = g_malloc( sizeof( struct byahoo_conf_invitation ) );
    831840        memset( inv, 0, sizeof( struct byahoo_conf_invitation ) );
Note: See TracChangeset for help on using the changeset viewer.