Changeset 0da65d5


Ignore:
Timestamp:
2007-03-31T05:40:45Z (17 years ago)
Author:
Wilmer van der Gaast <wilmer@…>
Branches:
master
Children:
aef4828
Parents:
fa29d093
Message:

s/gaim_connection/im_connection/ and some other minor API changes. The rest
will come tomorrow. It compiles, I'll leave the real testing up to someone
else. ;-)

Files:
29 edited

Legend:

Unmodified
Added
Removed
  • account.c

    rfa29d093 r0da65d5  
    6565        /* This function adds some more settings (and might want to do more
    6666           things that have to be done now, although I can't think of anything. */
    67         if( prpl->acc_init )
    68                 prpl->acc_init( a );
     67        if( prpl->init )
     68                prpl->init( a );
    6969       
    7070        return( a );
     
    7676       
    7777        /* Double-check: We refuse to edit on-line accounts. */
    78         if( set->flags & ACC_SET_OFFLINE_ONLY && acc->gc )
     78        if( set->flags & ACC_SET_OFFLINE_ONLY && acc->ic )
    7979                return NULL;
    8080       
     
    180180                if( a == acc )
    181181                {
    182                         if( a->gc ) return; /* Caller should have checked, accounts still in use can't be deleted. */
     182                        if( a->ic ) return; /* Caller should have checked, accounts still in use can't be deleted. */
    183183                       
    184184                        if( l )
     
    209209void account_on( irc_t *irc, account_t *a )
    210210{
    211         if( a->gc )
     211        if( a->ic )
    212212        {
    213213                /* Trying to enable an already-enabled account */
     
    223223void account_off( irc_t *irc, account_t *a )
    224224{
    225         a->gc->wants_to_die = TRUE;
    226         signoff( a->gc );
    227         a->gc = NULL;
     225        a->ic->wants_to_die = TRUE;
     226        signoff( a->ic );
     227        a->ic = NULL;
    228228        if( a->reconnect )
    229229        {
  • account.h

    rfa29d093 r0da65d5  
    4141       
    4242        struct irc *irc;
    43         struct gaim_connection *gc;
     43        struct im_connection *ic;
    4444        struct account *next;
    4545} account_t;
  • irc.c

    rfa29d093 r0da65d5  
    230230       
    231231        for (account = irc->accounts; account; account = account->next) {
    232                 if (account->gc) {
    233                         account->gc->wants_to_die = TRUE;
    234                         signoff(account->gc);
     232                if (account->ic) {
     233                        account->ic->wants_to_die = TRUE;
     234                        signoff(account->ic);
    235235                } else if (account->reconnect) {
    236236                        cancel_auto_reconnect(account);
     
    256256       
    257257        while (irc->accounts)
    258                 if (irc->accounts->gc == NULL)
     258                if (irc->accounts->ic == NULL)
    259259                        account_del(irc, irc->accounts);
    260260                else
     
    633633        user_t *u;
    634634        char namelist[385] = "";
    635         struct conversation *c = NULL;
     635        struct groupchat *c = NULL;
    636636        char *ops = set_getstr( &irc->set, "ops" );
    637637       
     
    649649                        }
    650650                       
    651                         if( u->gc && !u->away && set_getbool( &irc->set, "away_devoice" ) )
     651                        if( u->ic && !u->away && set_getbool( &irc->set, "away_devoice" ) )
    652652                                strcat( namelist, "+" );
    653653                        else if( ( strcmp( u->nick, irc->mynick ) == 0 && ( strcmp( ops, "root" ) == 0 || strcmp( ops, "both" ) == 0 ) ) ||
     
    668668                                                 strcmp( ops, "user" ) == 0 || strcmp( ops, "both" ) ? "@" : "", irc->nick );
    669669               
    670                 for( l = c->in_room; l; l = l->next ) if( ( u = user_findhandle( c->gc, l->data ) ) )
     670                for( l = c->in_room; l; l = l->next ) if( ( u = user_findhandle( c->ic, l->data ) ) )
    671671                {
    672672                        if( strlen( namelist ) + strlen( u->nick ) > sizeof( namelist ) - 4 )
     
    812812        else
    813813        {
    814                 struct conversation *c = chat_by_channel( channel );
     814                struct groupchat *c = chat_by_channel( channel );
    815815               
    816816                if( c )
     
    911911        char reason[128];
    912912       
    913         if( u->gc && u->gc->flags & OPT_LOGGING_OUT )
    914         {
    915                 if( u->gc->acc->server )
     913        if( u->ic && u->ic->flags & OPT_LOGGING_OUT )
     914        {
     915                if( u->ic->acc->server )
    916916                        g_snprintf( reason, sizeof( reason ), "%s %s", irc->myhost,
    917                                     u->gc->acc->server );
    918                 else if( ( s = strchr( u->gc->username, '@' ) ) )
     917                                    u->ic->acc->server );
     918                else if( ( s = strchr( u->ic->username, '@' ) ) )
    919919                        g_snprintf( reason, sizeof( reason ), "%s %s", irc->myhost,
    920920                                    s + 1 );
    921921                else
    922922                        g_snprintf( reason, sizeof( reason ), "%s %s.%s", irc->myhost,
    923                                     u->gc->acc->prpl->name, irc->myhost );
     923                                    u->ic->acc->prpl->name, irc->myhost );
    924924               
    925925                /* proto_opt might contain garbage after the : */
     
    945945int irc_send( irc_t *irc, char *nick, char *s, int flags )
    946946{
    947         struct conversation *c = NULL;
     947        struct groupchat *c = NULL;
    948948        user_t *u = NULL;
    949949       
     
    997997                else if( g_strncasecmp( s + 1, "TYPING", 6 ) == 0 )
    998998                {
    999                         if( u && u->gc && u->gc->acc->prpl->send_typing && strlen( s ) >= 10 )
     999                        if( u && u->ic && u->ic->acc->prpl->send_typing && strlen( s ) >= 10 )
    10001000                        {
    10011001                                time_t current_typing_notice = time( NULL );
     
    10031003                                if( current_typing_notice - u->last_typing_notice >= 5 )
    10041004                                {
    1005                                         u->gc->acc->prpl->send_typing( u->gc, u->handle, s[8] == '1' );
     1005                                        u->ic->acc->prpl->send_typing( u->ic, u->handle, s[8] == '1' );
    10061006                                        u->last_typing_notice = current_typing_notice;
    10071007                                }
     
    10361036                }
    10371037        }
    1038         else if( c && c->gc && c->gc->acc && c->gc->acc->prpl )
    1039         {
    1040                 return( bim_chat_msg( c, s ) );
     1038        else if( c && c->ic && c->ic->acc && c->ic->acc->prpl )
     1039        {
     1040                return( bim_chat_msg( c, s, 0 ) );
    10411041        }
    10421042       
     
    10531053       
    10541054        u->sendbuf[u->sendbuf_len-2] = 0; /* Cut off the last newline */
    1055         bim_buddy_msg( u->gc, u->handle, u->sendbuf, u->sendbuf_flags );
     1055        bim_buddy_msg( u->ic, u->handle, u->sendbuf, u->sendbuf_flags );
    10561056       
    10571057        g_free( u->sendbuf );
     
    10661066void buddy_send_handler( irc_t *irc, user_t *u, char *msg, int flags )
    10671067{
    1068         if( !u || !u->gc ) return;
     1068        if( !u || !u->ic ) return;
    10691069       
    10701070        if( set_getbool( &irc->set, "buddy_sendbuffer" ) && set_getint( &irc->set, "buddy_sendbuffer_delay" ) > 0 )
     
    11051105        else
    11061106        {
    1107                 bim_buddy_msg( u->gc, u->handle, msg, flags );
     1107                bim_buddy_msg( u->ic, u->handle, msg, flags );
    11081108        }
    11091109}
  • irc_commands.c

    rfa29d093 r0da65d5  
    134134static void irc_cmd_part( irc_t *irc, char **cmd )
    135135{
    136         struct conversation *c;
     136        struct groupchat *c;
    137137       
    138138        if( g_strcasecmp( cmd[1], irc->channel ) == 0 )
     
    150150                irc_part( irc, u, c->channel );
    151151               
    152                 if( c->gc )
     152                if( c->ic )
    153153                {
    154154                        c->joined = 0;
    155                         c->gc->acc->prpl->chat_leave( c );
     155                        c->ic->acc->prpl->chat_leave( c );
    156156                }
    157157        }
     
    173173                        user_t *u = user_find( irc, cmd[1] + 1 );
    174174                       
    175                         if( u && u->gc && u->gc->acc->prpl->chat_open )
     175                        if( u && u->ic && u->ic->acc->prpl->chat_with )
    176176                        {
    177177                                irc_reply( irc, 403, "%s :Initializing groupchat in a different channel", cmd[1] );
    178178                               
    179                                 if( !u->gc->acc->prpl->chat_open( u->gc, u->handle ) )
     179                                if( !u->ic->acc->prpl->chat_with( u->ic, u->handle ) )
    180180                                {
    181181                                        irc_usermsg( irc, "Could not open a groupchat with %s.", u->nick );
     
    201201{
    202202        char *nick = cmd[1], *channel = cmd[2];
    203         struct conversation *c = chat_by_channel( channel );
     203        struct groupchat *c = chat_by_channel( channel );
    204204        user_t *u = user_find( irc, nick );
    205205       
    206         if( u && c && ( u->gc == c->gc ) )
    207                 if( c->gc && c->gc->acc->prpl->chat_invite )
    208                 {
    209                         c->gc->acc->prpl->chat_invite( c, "", u->handle );
     206        if( u && c && ( u->ic == c->ic ) )
     207                if( c->ic && c->ic->acc->prpl->chat_invite )
     208                {
     209                        c->ic->acc->prpl->chat_invite( c, "", u->handle );
    210210                        irc_reply( irc, 341, "%s %s", nick, channel );
    211211                        return;
     
    271271        char *channel = cmd[1];
    272272        user_t *u = irc->users;
    273         struct conversation *c;
     273        struct groupchat *c;
    274274        GList *l;
    275275       
     
    290290                for( l = c->in_room; l; l = l->next )
    291291                {
    292                         if( ( u = user_findhandle( c->gc, l->data ) ) )
     292                        if( ( u = user_findhandle( c->ic, l->data ) ) )
    293293                                irc_reply( irc, 352, "%s %s %s %s %s %c :0 %s", channel, u->user, u->host, irc->myhost, u->nick, u->away ? 'G' : 'H', u->realname );
    294294                }
     
    460460        for( a = irc->accounts; a; a = a->next )
    461461        {
    462                 struct gaim_connection *gc = a->gc;
    463                
    464                 if( gc && gc->flags & OPT_LOGGED_IN )
    465                         bim_set_away( gc, u->away );
     462                struct im_connection *ic = a->ic;
     463               
     464                if( ic && ic->flags & OPT_LOGGED_IN )
     465                        bim_set_away( ic, u->away );
    466466        }
    467467}
     
    476476                irc_reply( irc, 311, "%s %s %s * :%s", u->nick, u->user, u->host, u->realname );
    477477               
    478                 if( u->gc )
    479                         irc_reply( irc, 312, "%s %s.%s :%s network", u->nick, u->gc->acc->user,
    480                                    u->gc->acc->server && *u->gc->acc->server ? u->gc->acc->server : "",
    481                                    u->gc->acc->prpl->name );
     478                if( u->ic )
     479                        irc_reply( irc, 312, "%s %s.%s :%s network", u->nick, u->ic->acc->user,
     480                                   u->ic->acc->server && *u->ic->acc->server ? u->ic->acc->server : "",
     481                                   u->ic->acc->prpl->name );
    482482                else
    483483                        irc_reply( irc, 312, "%s %s :%s", u->nick, irc->myhost, IRCD_INFO );
  • protocols/jabber/io.c

    rfa29d093 r0da65d5  
    2626
    2727static gboolean jabber_write_callback( gpointer data, gint fd, b_input_condition cond );
    28 static gboolean jabber_write_queue( struct gaim_connection *gc );
    29 
    30 int jabber_write_packet( struct gaim_connection *gc, struct xt_node *node )
     28static gboolean jabber_write_queue( struct im_connection *ic );
     29
     30int jabber_write_packet( struct im_connection *ic, struct xt_node *node )
    3131{
    3232        char *buf;
     
    3434       
    3535        buf = xt_to_string( node );
    36         st = jabber_write( gc, buf, strlen( buf ) );
     36        st = jabber_write( ic, buf, strlen( buf ) );
    3737        g_free( buf );
    3838       
     
    4040}
    4141
    42 int jabber_write( struct gaim_connection *gc, char *buf, int len )
    43 {
    44         struct jabber_data *jd = gc->proto_data;
     42int jabber_write( struct im_connection *ic, char *buf, int len )
     43{
     44        struct jabber_data *jd = ic->proto_data;
    4545        gboolean ret;
    4646       
     
    5454                   it via the event handler. If not, add the handler. (In
    5555                   most cases it probably won't be necessary.) */
    56                 if( ( ret = jabber_write_queue( gc ) ) && jd->tx_len > 0 )
    57                         jd->w_inpa = b_input_add( jd->fd, GAIM_INPUT_WRITE, jabber_write_callback, gc );
     56                if( ( ret = jabber_write_queue( ic ) ) && jd->tx_len > 0 )
     57                        jd->w_inpa = b_input_add( jd->fd, GAIM_INPUT_WRITE, jabber_write_callback, ic );
    5858        }
    5959        else
     
    8585static gboolean jabber_write_callback( gpointer data, gint fd, b_input_condition cond )
    8686{
    87         struct jabber_data *jd = ((struct gaim_connection *)data)->proto_data;
     87        struct jabber_data *jd = ((struct im_connection *)data)->proto_data;
    8888       
    8989        return jd->fd != -1 &&
     
    9292}
    9393
    94 static gboolean jabber_write_queue( struct gaim_connection *gc )
    95 {
    96         struct jabber_data *jd = gc->proto_data;
     94static gboolean jabber_write_queue( struct im_connection *ic )
     95{
     96        struct jabber_data *jd = ic->proto_data;
    9797        int st;
    9898       
     
    117117                jd->fd = -1;
    118118               
    119                 hide_login_progress_error( gc, "Short write() to server" );
    120                 signoff( gc );
     119                hide_login_progress_error( ic, "Short write() to server" );
     120                signoff( ic );
    121121                return FALSE;
    122122        }
     
    142142static gboolean jabber_read_callback( gpointer data, gint fd, b_input_condition cond )
    143143{
    144         struct gaim_connection *gc = data;
    145         struct jabber_data *jd = gc->proto_data;
     144        struct im_connection *ic = data;
     145        struct jabber_data *jd = ic->proto_data;
    146146        char buf[512];
    147147        int st;
     
    160160                if( xt_feed( jd->xt, buf, st ) < 0 )
    161161                {
    162                         hide_login_progress_error( gc, "XML stream error" );
    163                         signoff( gc );
     162                        hide_login_progress_error( ic, "XML stream error" );
     163                        signoff( ic );
    164164                        return FALSE;
    165165                }
     
    176176                {
    177177                        jd->flags &= ~JFLAG_STREAM_RESTART;
    178                         jabber_start_stream( gc );
     178                        jabber_start_stream( ic );
    179179                }
    180180               
     
    196196                                   this is an old server that can't do SASL
    197197                                   authentication. */
    198                                 if( !sasl_supported( gc ) )
     198                                if( !sasl_supported( ic ) )
    199199                                {
    200200                                        /* If there's no version= tag, we suppose
    201201                                           this server does NOT implement: XMPP 1.0,
    202202                                           SASL and TLS. */
    203                                         if( set_getbool( &gc->acc->set, "tls" ) )
     203                                        if( set_getbool( &ic->acc->set, "tls" ) )
    204204                                        {
    205                                                 hide_login_progress( gc, "TLS is turned on for this "
     205                                                hide_login_progress( ic, "TLS is turned on for this "
    206206                                                          "account, but is not supported by this server" );
    207                                                 signoff( gc );
     207                                                signoff( ic );
    208208                                                return FALSE;
    209209                                        }
    210210                                        else
    211211                                        {
    212                                                 return jabber_init_iq_auth( gc );
     212                                                return jabber_init_iq_auth( ic );
    213213                                        }
    214214                                }
     
    216216                        else
    217217                        {
    218                                 hide_login_progress( gc, "XML stream error" );
    219                                 signoff( gc );
     218                                hide_login_progress( ic, "XML stream error" );
     219                                signoff( ic );
    220220                                return FALSE;
    221221                        }
     
    227227                jd->fd = -1;
    228228               
    229                 hide_login_progress_error( gc, "Error while reading from server" );
    230                 signoff( gc );
     229                hide_login_progress_error( ic, "Error while reading from server" );
     230                signoff( ic );
    231231                return FALSE;
    232232        }
     
    238238gboolean jabber_connected_plain( gpointer data, gint source, b_input_condition cond )
    239239{
    240         struct gaim_connection *gc = data;
     240        struct im_connection *ic = data;
    241241       
    242242        if( source == -1 )
    243243        {
    244                 hide_login_progress( gc, "Could not connect to server" );
    245                 signoff( gc );
     244                hide_login_progress( ic, "Could not connect to server" );
     245                signoff( ic );
    246246                return FALSE;
    247247        }
    248248       
    249         set_login_progress( gc, 1, "Connected to server, logging in" );
    250        
    251         return jabber_start_stream( gc );
     249        set_login_progress( ic, 1, "Connected to server, logging in" );
     250       
     251        return jabber_start_stream( ic );
    252252}
    253253
    254254gboolean jabber_connected_ssl( gpointer data, void *source, b_input_condition cond )
    255255{
    256         struct gaim_connection *gc = data;
    257         struct jabber_data *jd = gc->proto_data;
     256        struct im_connection *ic = data;
     257        struct jabber_data *jd = ic->proto_data;
    258258       
    259259        if( source == NULL )
     
    263263                jd->ssl = NULL;
    264264               
    265                 hide_login_progress( gc, "Could not connect to server" );
    266                 signoff( gc );
     265                hide_login_progress( ic, "Could not connect to server" );
     266                signoff( ic );
    267267                return FALSE;
    268268        }
    269269       
    270         set_login_progress( gc, 1, "Connected to server, logging in" );
    271        
    272         return jabber_start_stream( gc );
     270        set_login_progress( ic, 1, "Connected to server, logging in" );
     271       
     272        return jabber_start_stream( ic );
    273273}
    274274
     
    281281static xt_status jabber_pkt_features( struct xt_node *node, gpointer data )
    282282{
    283         struct gaim_connection *gc = data;
    284         struct jabber_data *jd = gc->proto_data;
     283        struct im_connection *ic = data;
     284        struct jabber_data *jd = ic->proto_data;
    285285        struct xt_node *c, *reply;
    286286        int trytls;
    287287       
    288         trytls = g_strcasecmp( set_getstr( &gc->acc->set, "tls" ), "try" ) == 0;
     288        trytls = g_strcasecmp( set_getstr( &ic->acc->set, "tls" ), "try" ) == 0;
    289289        c = xt_find_node( node->children, "starttls" );
    290290        if( c && !jd->ssl )
     
    295295                c = xt_find_node( c->children, "required" );
    296296               
    297                 if( c && ( !trytls && !set_getbool( &gc->acc->set, "tls" ) ) )
    298                 {
    299                         hide_login_progress( gc, "Server requires TLS connections, but TLS is turned off for this account" );
    300                         signoff( gc );
     297                if( c && ( !trytls && !set_getbool( &ic->acc->set, "tls" ) ) )
     298                {
     299                        hide_login_progress( ic, "Server requires TLS connections, but TLS is turned off for this account" );
     300                        signoff( ic );
    301301                       
    302302                        return XT_ABORT;
     
    304304               
    305305                /* Only run this if the tls setting is set to true or try: */
    306                 if( ( trytls || set_getbool( &gc->acc->set, "tls" ) ) )
     306                if( ( trytls || set_getbool( &ic->acc->set, "tls" ) ) )
    307307                {
    308308                        reply = xt_new_node( "starttls", NULL, NULL );
    309309                        xt_add_attr( reply, "xmlns", XMLNS_TLS );
    310                         if( !jabber_write_packet( gc, reply ) )
     310                        if( !jabber_write_packet( ic, reply ) )
    311311                        {
    312312                                xt_free_node( reply );
     
    325325                   using SSL/TLS. */
    326326               
    327                 if( !trytls && set_getbool( &gc->acc->set, "tls" ) )
    328                 {
    329                         hide_login_progress( gc, "TLS is turned on for this account, but is not supported by this server" );
    330                         signoff( gc );
     327                if( !trytls && set_getbool( &ic->acc->set, "tls" ) )
     328                {
     329                        hide_login_progress( ic, "TLS is turned on for this account, but is not supported by this server" );
     330                        signoff( ic );
    331331                       
    332332                        return XT_ABORT;
     
    346346           other way. jabber.com doesn't seem to do SASL while it pretends
    347347           to be XMPP 1.0 compliant! */
    348         else if( !( jd->flags & JFLAG_AUTHENTICATED ) && sasl_supported( gc ) )
    349         {
    350                 if( !jabber_init_iq_auth( gc ) )
     348        else if( !( jd->flags & JFLAG_AUTHENTICATED ) && sasl_supported( ic ) )
     349        {
     350                if( !jabber_init_iq_auth( ic ) )
    351351                        return XT_ABORT;
    352352        }
     
    354354        if( ( c = xt_find_node( node->children, "bind" ) ) )
    355355        {
    356                 reply = xt_new_node( "bind", NULL, xt_new_node( "resource", set_getstr( &gc->acc->set, "resource" ), NULL ) );
     356                reply = xt_new_node( "bind", NULL, xt_new_node( "resource", set_getstr( &ic->acc->set, "resource" ), NULL ) );
    357357                xt_add_attr( reply, "xmlns", XMLNS_BIND );
    358358                reply = jabber_make_packet( "iq", "set", NULL, reply );
    359                 jabber_cache_add( gc, reply, jabber_pkt_bind_sess );
    360                
    361                 if( !jabber_write_packet( gc, reply ) )
     359                jabber_cache_add( ic, reply, jabber_pkt_bind_sess );
     360               
     361                if( !jabber_write_packet( ic, reply ) )
    362362                        return XT_ABORT;
    363363               
     
    370370                xt_add_attr( reply, "xmlns", XMLNS_SESSION );
    371371                reply = jabber_make_packet( "iq", "set", NULL, reply );
    372                 jabber_cache_add( gc, reply, jabber_pkt_bind_sess );
    373                
    374                 if( !jabber_write_packet( gc, reply ) )
     372                jabber_cache_add( ic, reply, jabber_pkt_bind_sess );
     373               
     374                if( !jabber_write_packet( ic, reply ) )
    375375                        return XT_ABORT;
    376376               
     
    383383        if( jd->flags & JFLAG_AUTHENTICATED && ( jd->flags & ( JFLAG_WAIT_BIND | JFLAG_WAIT_SESSION ) ) == 0 )
    384384        {
    385                 if( !jabber_get_roster( gc ) )
     385                if( !jabber_get_roster( ic ) )
    386386                        return XT_ABORT;
    387387        }
     
    392392static xt_status jabber_pkt_proceed_tls( struct xt_node *node, gpointer data )
    393393{
    394         struct gaim_connection *gc = data;
    395         struct jabber_data *jd = gc->proto_data;
     394        struct im_connection *ic = data;
     395        struct jabber_data *jd = ic->proto_data;
    396396        char *xmlns;
    397397       
     
    417417        jd->w_inpa = jd->r_inpa = 0;
    418418       
    419         set_login_progress( gc, 1, "Converting stream to TLS" );
    420        
    421         jd->ssl = ssl_starttls( jd->fd, jabber_connected_ssl, gc );
     419        set_login_progress( ic, 1, "Converting stream to TLS" );
     420       
     421        jd->ssl = ssl_starttls( jd->fd, jabber_connected_ssl, ic );
    422422       
    423423        return XT_HANDLED;
     
    426426static xt_status jabber_pkt_stream_error( struct xt_node *node, gpointer data )
    427427{
    428         struct gaim_connection *gc = data;
     428        struct im_connection *ic = data;
    429429        struct xt_node *c;
    430430        char *s, *type = NULL, *text = NULL;
     
    452452        if( type == NULL )
    453453        {
    454                 hide_login_progress_error( gc, "Unknown stream error reported by server" );
    455                 signoff( gc );
     454                hide_login_progress_error( ic, "Unknown stream error reported by server" );
     455                signoff( ic );
    456456                return XT_ABORT;
    457457        }
     
    462462        if( strcmp( type, "conflict" ) == 0 )
    463463        {
    464                 hide_login_progress( gc, "Account and resource used from a different location" );
    465                 gc->wants_to_die = TRUE;
     464                hide_login_progress( ic, "Account and resource used from a different location" );
     465                ic->wants_to_die = TRUE;
    466466        }
    467467        else
    468468        {
    469469                s = g_strdup_printf( "Stream error: %s%s%s", type, text ? ": " : "", text ? text : "" );
    470                 hide_login_progress_error( gc, s );
     470                hide_login_progress_error( ic, s );
    471471                g_free( s );
    472472        }
    473473       
    474         signoff( gc );
     474        signoff( ic );
    475475       
    476476        return XT_ABORT;
     
    500500};
    501501
    502 gboolean jabber_start_stream( struct gaim_connection *gc )
    503 {
    504         struct jabber_data *jd = gc->proto_data;
     502gboolean jabber_start_stream( struct im_connection *ic )
     503{
     504        struct jabber_data *jd = ic->proto_data;
    505505        int st;
    506506        char *greet;
     
    509509           from the server too. */
    510510        xt_free( jd->xt );      /* In case we're RE-starting. */
    511         jd->xt = xt_new( gc );
     511        jd->xt = xt_new( ic );
    512512        jd->xt->handlers = (struct xt_handler_entry*) jabber_handlers;
    513513       
    514514        if( jd->r_inpa <= 0 )
    515                 jd->r_inpa = b_input_add( jd->fd, GAIM_INPUT_READ, jabber_read_callback, gc );
     515                jd->r_inpa = b_input_add( jd->fd, GAIM_INPUT_READ, jabber_read_callback, ic );
    516516       
    517517        greet = g_strdup_printf( "<?xml version='1.0' ?>"
     
    519519                                  "xmlns:stream=\"http://etherx.jabber.org/streams\" version=\"1.0\">", jd->server );
    520520       
    521         st = jabber_write( gc, greet, strlen( greet ) );
     521        st = jabber_write( ic, greet, strlen( greet ) );
    522522       
    523523        g_free( greet );
     
    526526}
    527527
    528 void jabber_end_stream( struct gaim_connection *gc )
    529 {
    530         struct jabber_data *jd = gc->proto_data;
     528void jabber_end_stream( struct im_connection *ic )
     529{
     530        struct jabber_data *jd = ic->proto_data;
    531531       
    532532        /* Let's only do this if the queue is currently empty, otherwise it'd
     
    538538                int st = 1;
    539539               
    540                 if( gc->flags & OPT_LOGGED_IN )
     540                if( ic->flags & OPT_LOGGED_IN )
    541541                {
    542542                        node = jabber_make_packet( "presence", "unavailable", NULL, NULL );
    543                         st = jabber_write_packet( gc, node );
     543                        st = jabber_write_packet( ic, node );
    544544                        xt_free_node( node );
    545545                }
    546546               
    547547                if( st )
    548                         jabber_write( gc, eos, strlen( eos ) );
    549         }
    550 }
     548                        jabber_write( ic, eos, strlen( eos ) );
     549        }
     550}
  • protocols/jabber/iq.c

    rfa29d093 r0da65d5  
    2424#include "jabber.h"
    2525
    26 static xt_status jabber_parse_roster( struct gaim_connection *gc, struct xt_node *node, struct xt_node *orig );
    27 static xt_status jabber_iq_display_vcard( struct gaim_connection *gc, struct xt_node *node, struct xt_node *orig );
     26static xt_status jabber_parse_roster( struct im_connection *ic, struct xt_node *node, struct xt_node *orig );
     27static xt_status jabber_iq_display_vcard( struct im_connection *ic, struct xt_node *node, struct xt_node *orig );
    2828
    2929xt_status jabber_pkt_iq( struct xt_node *node, gpointer data )
    3030{
    31         struct gaim_connection *gc = data;
    32         struct jabber_data *jd = gc->proto_data;
     31        struct im_connection *ic = data;
     32        struct jabber_data *jd = ic->proto_data;
    3333        struct xt_node *c, *reply = NULL;
    3434        char *type, *s;
     
    3939        if( !type )
    4040        {
    41                 hide_login_progress_error( gc, "Received IQ packet without type." );
    42                 signoff( gc );
     41                hide_login_progress_error( ic, "Received IQ packet without type." );
     42                signoff( ic );
    4343                return XT_ABORT;
    4444        }
     
    6060               
    6161                if( entry == NULL )
    62                         serv_got_crap( gc, "WARNING: Received IQ-%s packet with unknown/expired ID %s!", type, s );
     62                        serv_got_crap( ic, "WARNING: Received IQ-%s packet with unknown/expired ID %s!", type, s );
    6363                else if( entry->func )
    64                         return entry->func( gc, node, entry->node );
     64                        return entry->func( ic, node, entry->node );
    6565        }
    6666        else if( strcmp( type, "get" ) == 0 )
     
    6969                    !( s = xt_find_attr( c, "xmlns" ) ) )
    7070                {
    71                         serv_got_crap( gc, "WARNING: Received incomplete IQ-%s packet", type );
     71                        serv_got_crap( ic, "WARNING: Received incomplete IQ-%s packet", type );
    7272                        return XT_HANDLED;
    7373                }
     
    132132                    !( s = xt_find_attr( c, "xmlns" ) ) )
    133133                {
    134                         serv_got_crap( gc, "WARNING: Received incomplete IQ-%s packet", type );
     134                        serv_got_crap( ic, "WARNING: Received incomplete IQ-%s packet", type );
    135135                        return XT_HANDLED;
    136136                }
     
    141141                if( strcmp( s, XMLNS_ROSTER ) == 0 )
    142142                {
    143                         int bare_len = strlen( gc->acc->user );
     143                        int bare_len = strlen( ic->acc->user );
    144144                       
    145145                        if( ( s = xt_find_attr( node, "from" ) ) == NULL ||
    146                             ( strncmp( s, gc->acc->user, bare_len ) == 0 &&
     146                            ( strncmp( s, ic->acc->user, bare_len ) == 0 &&
    147147                              ( s[bare_len] == 0 || s[bare_len] == '/' ) ) )
    148148                        {
    149                                 jabber_parse_roster( gc, node, NULL );
     149                                jabber_parse_roster( ic, node, NULL );
    150150                               
    151151                                /* Should we generate a reply here? Don't think it's
     
    154154                        else
    155155                        {
    156                                 serv_got_crap( gc, "WARNING: %s tried to fake a roster push!", s ? s : "(unknown)" );
     156                                serv_got_crap( ic, "WARNING: %s tried to fake a roster push!", s ? s : "(unknown)" );
    157157                               
    158158                                xt_free_node( reply );
     
    182182                }
    183183               
    184                 st = jabber_write_packet( gc, reply );
     184                st = jabber_write_packet( ic, reply );
    185185                xt_free_node( reply );
    186186                if( !st )
     
    191191}
    192192
    193 static xt_status jabber_do_iq_auth( struct gaim_connection *gc, struct xt_node *node, struct xt_node *orig );
    194 static xt_status jabber_finish_iq_auth( struct gaim_connection *gc, struct xt_node *node, struct xt_node *orig );
    195 
    196 int jabber_init_iq_auth( struct gaim_connection *gc )
    197 {
    198         struct jabber_data *jd = gc->proto_data;
     193static xt_status jabber_do_iq_auth( struct im_connection *ic, struct xt_node *node, struct xt_node *orig );
     194static xt_status jabber_finish_iq_auth( struct im_connection *ic, struct xt_node *node, struct xt_node *orig );
     195
     196int jabber_init_iq_auth( struct im_connection *ic )
     197{
     198        struct jabber_data *jd = ic->proto_data;
    199199        struct xt_node *node;
    200200        int st;
     
    204204        node = jabber_make_packet( "iq", "get", NULL, node );
    205205       
    206         jabber_cache_add( gc, node, jabber_do_iq_auth );
    207         st = jabber_write_packet( gc, node );
     206        jabber_cache_add( ic, node, jabber_do_iq_auth );
     207        st = jabber_write_packet( ic, node );
    208208       
    209209        return st;
    210210}
    211211
    212 static xt_status jabber_do_iq_auth( struct gaim_connection *gc, struct xt_node *node, struct xt_node *orig )
    213 {
    214         struct jabber_data *jd = gc->proto_data;
     212static xt_status jabber_do_iq_auth( struct im_connection *ic, struct xt_node *node, struct xt_node *orig )
     213{
     214        struct jabber_data *jd = ic->proto_data;
    215215        struct xt_node *reply, *query;
    216216        xt_status st;
     
    219219        if( !( query = xt_find_node( node->children, "query" ) ) )
    220220        {
    221                 serv_got_crap( gc, "WARNING: Received incomplete IQ packet while authenticating" );
    222                 signoff( gc );
     221                serv_got_crap( ic, "WARNING: Received incomplete IQ packet while authenticating" );
     222                signoff( ic );
    223223                return XT_HANDLED;
    224224        }
     
    228228        xt_add_attr( reply, "xmlns", XMLNS_AUTH );
    229229        xt_add_child( reply, xt_new_node( "username", jd->username, NULL ) );
    230         xt_add_child( reply, xt_new_node( "resource", set_getstr( &gc->acc->set, "resource" ), NULL ) );
     230        xt_add_child( reply, xt_new_node( "resource", set_getstr( &ic->acc->set, "resource" ), NULL ) );
    231231       
    232232        if( xt_find_node( query->children, "digest" ) && ( s = xt_find_attr( jd->xt->root, "id" ) ) )
     
    241241                shaInit( &sha );
    242242                shaUpdate( &sha, (unsigned char*) s, strlen( s ) );
    243                 shaUpdate( &sha, (unsigned char*) gc->acc->pass, strlen( gc->acc->pass ) );
     243                shaUpdate( &sha, (unsigned char*) ic->acc->pass, strlen( ic->acc->pass ) );
    244244                shaFinal( &sha, hash );
    245245               
     
    252252        {
    253253                /* We'll have to stick with plaintext. Let's hope we're using SSL/TLS... */
    254                 xt_add_child( reply, xt_new_node( "password", gc->acc->pass, NULL ) );
     254                xt_add_child( reply, xt_new_node( "password", ic->acc->pass, NULL ) );
    255255        }
    256256        else
     
    258258                xt_free_node( reply );
    259259               
    260                 hide_login_progress( gc, "Can't find suitable authentication method" );
    261                 signoff( gc );
     260                hide_login_progress( ic, "Can't find suitable authentication method" );
     261                signoff( ic );
    262262                return XT_ABORT;
    263263        }
    264264       
    265265        reply = jabber_make_packet( "iq", "set", NULL, reply );
    266         jabber_cache_add( gc, reply, jabber_finish_iq_auth );
    267         st = jabber_write_packet( gc, reply );
     266        jabber_cache_add( ic, reply, jabber_finish_iq_auth );
     267        st = jabber_write_packet( ic, reply );
    268268       
    269269        return st ? XT_HANDLED : XT_ABORT;
    270270}
    271271
    272 static xt_status jabber_finish_iq_auth( struct gaim_connection *gc, struct xt_node *node, struct xt_node *orig )
    273 {
    274         struct jabber_data *jd = gc->proto_data;
     272static xt_status jabber_finish_iq_auth( struct im_connection *ic, struct xt_node *node, struct xt_node *orig )
     273{
     274        struct jabber_data *jd = ic->proto_data;
    275275        char *type;
    276276       
    277277        if( !( type = xt_find_attr( node, "type" ) ) )
    278278        {
    279                 serv_got_crap( gc, "WARNING: Received incomplete IQ packet while authenticating" );
    280                 signoff( gc );
     279                serv_got_crap( ic, "WARNING: Received incomplete IQ packet while authenticating" );
     280                signoff( ic );
    281281                return XT_HANDLED;
    282282        }
     
    284284        if( strcmp( type, "error" ) == 0 )
    285285        {
    286                 hide_login_progress( gc, "Authentication failure" );
    287                 signoff( gc );
     286                hide_login_progress( ic, "Authentication failure" );
     287                signoff( ic );
    288288                return XT_ABORT;
    289289        }
     
    293293                   old (non-SASL) way. */
    294294                jd->flags |= JFLAG_AUTHENTICATED;
    295                 if( !jabber_get_roster( gc ) )
     295                if( !jabber_get_roster( ic ) )
    296296                        return XT_ABORT;
    297297        }
     
    300300}
    301301
    302 xt_status jabber_pkt_bind_sess( struct gaim_connection *gc, struct xt_node *node, struct xt_node *orig )
    303 {
    304         struct jabber_data *jd = gc->proto_data;
     302xt_status jabber_pkt_bind_sess( struct im_connection *ic, struct xt_node *node, struct xt_node *orig )
     303{
     304        struct jabber_data *jd = ic->proto_data;
    305305        struct xt_node *c;
    306306        char *s;
     
    310310                c = xt_find_node( c->children, "jid" );
    311311                if( c && c->text_len && ( s = strchr( c->text, '/' ) ) &&
    312                     strcmp( s + 1, set_getstr( &gc->acc->set, "resource" ) ) != 0 )
    313                         serv_got_crap( gc, "Server changed session resource string to `%s'", s + 1 );
     312                    strcmp( s + 1, set_getstr( &ic->acc->set, "resource" ) ) != 0 )
     313                        serv_got_crap( ic, "Server changed session resource string to `%s'", s + 1 );
    314314               
    315315                jd->flags &= ~JFLAG_WAIT_BIND;
     
    322322        if( ( jd->flags & ( JFLAG_WAIT_BIND | JFLAG_WAIT_SESSION ) ) == 0 )
    323323        {
    324                 if( !jabber_get_roster( gc ) )
     324                if( !jabber_get_roster( ic ) )
    325325                        return XT_ABORT;
    326326        }
     
    329329}
    330330
    331 int jabber_get_roster( struct gaim_connection *gc )
     331int jabber_get_roster( struct im_connection *ic )
    332332{
    333333        struct xt_node *node;
    334334        int st;
    335335       
    336         set_login_progress( gc, 1, "Authenticated, requesting buddy list" );
     336        set_login_progress( ic, 1, "Authenticated, requesting buddy list" );
    337337       
    338338        node = xt_new_node( "query", NULL, NULL );
     
    340340        node = jabber_make_packet( "iq", "get", NULL, node );
    341341       
    342         jabber_cache_add( gc, node, jabber_parse_roster );
    343         st = jabber_write_packet( gc, node );
     342        jabber_cache_add( ic, node, jabber_parse_roster );
     343        st = jabber_write_packet( ic, node );
    344344       
    345345        return st;
    346346}
    347347
    348 static xt_status jabber_parse_roster( struct gaim_connection *gc, struct xt_node *node, struct xt_node *orig )
     348static xt_status jabber_parse_roster( struct im_connection *ic, struct xt_node *node, struct xt_node *orig )
    349349{
    350350        struct xt_node *query, *c;
     
    353353        if( !( query = xt_find_node( node->children, "query" ) ) )
    354354        {
    355                 serv_got_crap( gc, "WARNING: Received NULL roster packet" );
     355                serv_got_crap( ic, "WARNING: Received NULL roster packet" );
    356356                return XT_HANDLED;
    357357        }
     
    371371                {
    372372                        if( ( strcmp( sub, "both" ) == 0 || strcmp( sub, "to" ) == 0 ) )
    373                                 add_buddy( gc, NULL, jid, name );
     373                                add_buddy( ic, NULL, jid, name );
    374374                }
    375375                else
     
    378378                        if( ( strcmp( sub, "both" ) == 0 || strcmp( sub, "to" ) == 0 ) )
    379379                        {
    380                                 if( find_buddy( gc, jid ) == NULL )
    381                                         add_buddy( gc, NULL, jid, name );
     380                                if( find_buddy( ic, jid ) == NULL )
     381                                        add_buddy( ic, NULL, jid, name );
    382382                                else if( name )
    383                                         serv_buddy_rename( gc, jid, name );
     383                                        serv_buddy_rename( ic, jid, name );
    384384                        }
    385385                        else if( strcmp( sub, "remove" ) == 0 )
     
    387387                                /* Don't have any API call for this yet! So let's
    388388                                   just try to handle this as well as we can. */
    389                                 jabber_buddy_remove_bare( gc, jid );
    390                                 serv_got_update( gc, jid, 0, 0, 0, 0, 0, 0 );
     389                                jabber_buddy_remove_bare( ic, jid );
     390                                serv_got_update( ic, jid, 0, 0, 0, 0, 0, 0 );
    391391                                /* FIXME! */
    392392                        }
     
    397397       
    398398        if( initial )
    399                 account_online( gc );
     399                account_online( ic );
    400400       
    401401        return XT_HANDLED;
    402402}
    403403
    404 int jabber_get_vcard( struct gaim_connection *gc, char *bare_jid )
     404int jabber_get_vcard( struct im_connection *ic, char *bare_jid )
    405405{
    406406        struct xt_node *node;
     
    413413        node = jabber_make_packet( "iq", "get", bare_jid, node );
    414414       
    415         jabber_cache_add( gc, node, jabber_iq_display_vcard );
    416         return jabber_write_packet( gc, node );
    417 }
    418 
    419 static xt_status jabber_iq_display_vcard( struct gaim_connection *gc, struct xt_node *node, struct xt_node *orig )
    420 {
    421         struct xt_node *vc, *c, *sc; /* subchild, gc is already in use ;-) */
     415        jabber_cache_add( ic, node, jabber_iq_display_vcard );
     416        return jabber_write_packet( ic, node );
     417}
     418
     419static xt_status jabber_iq_display_vcard( struct im_connection *ic, struct xt_node *node, struct xt_node *orig )
     420{
     421        struct xt_node *vc, *c, *sc; /* subchild, ic is already in use ;-) */
    422422        GString *reply;
    423423        char *s;
     
    428428        {
    429429                s = xt_find_attr( orig, "to" ); /* If this returns NULL something's wrong.. */
    430                 serv_got_crap( gc, "Could not retrieve vCard of %s", s ? s : "(NULL)" );
     430                serv_got_crap( ic, "Could not retrieve vCard of %s", s ? s : "(NULL)" );
    431431                return XT_HANDLED;
    432432        }
     
    536536        /* *sigh* */
    537537       
    538         serv_got_crap( gc, reply->str );
     538        serv_got_crap( ic, reply->str );
    539539        g_string_free( reply, TRUE );
    540540       
     
    542542}
    543543
    544 int jabber_add_to_roster( struct gaim_connection *gc, char *handle, char *name )
     544int jabber_add_to_roster( struct im_connection *ic, char *handle, char *name )
    545545{
    546546        struct xt_node *node;
     
    558558        node = jabber_make_packet( "iq", "set", NULL, node );
    559559       
    560         st = jabber_write_packet( gc, node );
     560        st = jabber_write_packet( ic, node );
    561561       
    562562        xt_free_node( node );
     
    564564}
    565565
    566 int jabber_remove_from_roster( struct gaim_connection *gc, char *handle )
     566int jabber_remove_from_roster( struct im_connection *ic, char *handle )
    567567{
    568568        struct xt_node *node;
     
    579579        node = jabber_make_packet( "iq", "set", NULL, node );
    580580       
    581         st = jabber_write_packet( gc, node );
     581        st = jabber_write_packet( ic, node );
    582582       
    583583        xt_free_node( node );
  • protocols/jabber/jabber.c

    rfa29d093 r0da65d5  
    3333#include "jabber.h"
    3434
    35 static void jabber_acc_init( account_t *acc )
     35static void jabber_init( account_t *acc )
    3636{
    3737        set_t *s;
     
    5959static void jabber_login( account_t *acc )
    6060{
    61         struct gaim_connection *gc = new_gaim_conn( acc );
     61        struct im_connection *ic = new_gaim_conn( acc );
    6262        struct jabber_data *jd = g_new0( struct jabber_data, 1 );
    6363        struct ns_srv_reply *srv = NULL;
    6464        char *connect_to, *s;
    6565       
    66         jd->gc = gc;
    67         gc->proto_data = jd;
     66        jd->ic = ic;
     67        ic->proto_data = jd;
    6868       
    6969        jd->username = g_strdup( acc->user );
     
    7272        if( jd->server == NULL )
    7373        {
    74                 hide_login_progress( gc, "Incomplete account name (format it like <username@jabberserver.name>)" );
    75                 signoff( gc );
     74                hide_login_progress( ic, "Incomplete account name (format it like <username@jabberserver.name>)" );
     75                signoff( ic );
    7676                return;
    7777        }
     
    159159                connect_to = jd->server;
    160160       
    161         set_login_progress( gc, 0, "Connecting" );
     161        set_login_progress( ic, 0, "Connecting" );
    162162       
    163163        if( set_getint( &acc->set, "port" ) < JABBER_PORT_MIN ||
    164164            set_getint( &acc->set, "port" ) > JABBER_PORT_MAX )
    165165        {
    166                 serv_got_crap( gc, "Incorrect port number, must be in the %d-%d range",
     166                serv_got_crap( ic, "Incorrect port number, must be in the %d-%d range",
    167167                               JABBER_PORT_MIN, JABBER_PORT_MAX );
    168                 signoff( gc );
     168                signoff( ic );
    169169                return;
    170170        }
     
    175175        if( set_getbool( &acc->set, "ssl" ) )
    176176        {
    177                 jd->ssl = ssl_connect( connect_to, set_getint( &acc->set, "port" ), jabber_connected_ssl, gc );
     177                jd->ssl = ssl_connect( connect_to, set_getint( &acc->set, "port" ), jabber_connected_ssl, ic );
    178178                jd->fd = jd->ssl ? ssl_getfd( jd->ssl ) : -1;
    179179        }
    180180        else
    181181        {
    182                 jd->fd = proxy_connect( connect_to, srv ? srv->port : set_getint( &acc->set, "port" ), jabber_connected_plain, gc );
     182                jd->fd = proxy_connect( connect_to, srv ? srv->port : set_getint( &acc->set, "port" ), jabber_connected_plain, ic );
    183183        }
    184184        g_free( srv );
     
    186186        if( jd->fd == -1 )
    187187        {
    188                 hide_login_progress( gc, "Could not connect to server" );
    189                 signoff( gc );
    190         }
    191 }
    192 
    193 static void jabber_close( struct gaim_connection *gc )
    194 {
    195         struct jabber_data *jd = gc->proto_data;
    196        
    197         jabber_end_stream( gc );
     188                hide_login_progress( ic, "Could not connect to server" );
     189                signoff( ic );
     190        }
     191}
     192
     193static void jabber_logout( struct im_connection *ic )
     194{
     195        struct jabber_data *jd = ic->proto_data;
     196       
     197        jabber_end_stream( ic );
    198198       
    199199        if( jd->r_inpa >= 0 )
     
    219219}
    220220
    221 static int jabber_send_im( struct gaim_connection *gc, char *who, char *message, int len, int away )
    222 {
    223         struct jabber_data *jd = gc->proto_data;
     221static int jabber_send_im( struct im_connection *ic, char *who, char *message, int flags )
     222{
     223        struct jabber_data *jd = ic->proto_data;
    224224        struct jabber_buddy *bud;
    225225        struct xt_node *node;
    226226        int st;
    227227       
    228         bud = jabber_buddy_by_jid( gc, who, 0 );
     228        bud = jabber_buddy_by_jid( ic, who, 0 );
    229229       
    230230        node = xt_new_node( "body", message, NULL );
     
    251251        }
    252252       
    253         st = jabber_write_packet( gc, node );
     253        st = jabber_write_packet( ic, node );
    254254        xt_free_node( node );
    255255       
     
    257257}
    258258
    259 static GList *jabber_away_states( struct gaim_connection *gc )
     259static GList *jabber_away_states( struct im_connection *ic )
    260260{
    261261        static GList *l = NULL;
     
    269269}
    270270
    271 static void jabber_get_info( struct gaim_connection *gc, char *who )
    272 {
    273         struct jabber_data *jd = gc->proto_data;
     271static void jabber_get_info( struct im_connection *ic, char *who )
     272{
     273        struct jabber_data *jd = ic->proto_data;
    274274        struct jabber_buddy *bud;
    275275       
    276276        if( strchr( who, '/' ) )
    277                 bud = jabber_buddy_by_jid( gc, who, 0 );
     277                bud = jabber_buddy_by_jid( ic, who, 0 );
    278278        else
    279279        {
     
    285285        while( bud )
    286286        {
    287                 serv_got_crap( gc, "Buddy %s (%d) information:\nAway state: %s\nAway message: %s",
     287                serv_got_crap( ic, "Buddy %s (%d) information:\nAway state: %s\nAway message: %s",
    288288                                   bud->full_jid, bud->priority,
    289289                                   bud->away_state ? bud->away_state->full_name : "(none)",
     
    292292        }
    293293       
    294         jabber_get_vcard( gc, bud ? bud->full_jid : who );
    295 }
    296 
    297 static void jabber_set_away( struct gaim_connection *gc, char *state_txt, char *message )
    298 {
    299         struct jabber_data *jd = gc->proto_data;
     294        jabber_get_vcard( ic, bud ? bud->full_jid : who );
     295}
     296
     297static void jabber_set_away( struct im_connection *ic, char *state_txt, char *message )
     298{
     299        struct jabber_data *jd = ic->proto_data;
    300300        struct jabber_away_state *state;
    301301       
     
    306306        jd->away_message = ( message && *message ) ? g_strdup( message ) : NULL;
    307307       
    308         presence_send_update( gc );
    309 }
    310 
    311 static void jabber_add_buddy( struct gaim_connection *gc, char *who )
    312 {
    313         if( jabber_add_to_roster( gc, who, NULL ) )
    314                 presence_send_request( gc, who, "subscribe" );
    315 }
    316 
    317 static void jabber_remove_buddy( struct gaim_connection *gc, char *who, char *group )
     308        presence_send_update( ic );
     309}
     310
     311static void jabber_add_buddy( struct im_connection *ic, char *who, char *group )
     312{
     313        if( jabber_add_to_roster( ic, who, NULL ) )
     314                presence_send_request( ic, who, "subscribe" );
     315}
     316
     317static void jabber_remove_buddy( struct im_connection *ic, char *who, char *group )
    318318{
    319319        /* We should always do this part. Clean up our administration a little bit. */
    320         jabber_buddy_remove_bare( gc, who );
    321        
    322         if( jabber_remove_from_roster( gc, who ) )
    323                 presence_send_request( gc, who, "unsubscribe" );
    324 }
    325 
    326 static void jabber_keepalive( struct gaim_connection *gc )
     320        jabber_buddy_remove_bare( ic, who );
     321       
     322        if( jabber_remove_from_roster( ic, who ) )
     323                presence_send_request( ic, who, "unsubscribe" );
     324}
     325
     326static void jabber_keepalive( struct im_connection *ic )
    327327{
    328328        /* Just any whitespace character is enough as a keepalive for XMPP sessions. */
    329         jabber_write( gc, "\n", 1 );
     329        jabber_write( ic, "\n", 1 );
    330330       
    331331        /* This runs the garbage collection every minute, which means every packet
    332332           is in the cache for about a minute (which should be enough AFAIK). */
    333         jabber_cache_clean( gc );
    334 }
    335 
    336 static int jabber_send_typing( struct gaim_connection *gc, char *who, int typing )
    337 {
    338         struct jabber_data *jd = gc->proto_data;
     333        jabber_cache_clean( ic );
     334}
     335
     336static int jabber_send_typing( struct im_connection *ic, char *who, int typing )
     337{
     338        struct jabber_data *jd = ic->proto_data;
    339339        struct jabber_buddy *bud;
    340340       
     
    342342        jd->flags |= JFLAG_WANT_TYPING;
    343343       
    344         if( ( bud = jabber_buddy_by_jid( gc, who, 0 ) ) == NULL )
     344        if( ( bud = jabber_buddy_by_jid( ic, who, 0 ) ) == NULL )
    345345        {
    346346                /* Sending typing notifications to unknown buddies is
     
    369369                node = jabber_make_packet( "message", "chat", bud->full_jid, node );
    370370               
    371                 st = jabber_write_packet( gc, node );
     371                st = jabber_write_packet( ic, node );
    372372                xt_free_node( node );
    373373               
     
    378378}
    379379
    380 void jabber_init()
     380void jabber_initmodule()
    381381{
    382382        struct prpl *ret = g_new0( struct prpl, 1 );
     
    384384        ret->name = "jabber";
    385385        ret->login = jabber_login;
    386         ret->acc_init = jabber_acc_init;
    387         ret->close = jabber_close;
     386        ret->init = jabber_init;
     387        ret->logout = jabber_logout;
    388388        ret->send_im = jabber_send_im;
    389389        ret->away_states = jabber_away_states;
  • protocols/jabber/jabber.h

    rfa29d093 r0da65d5  
    5858struct jabber_data
    5959{
    60         struct gaim_connection *gc;
     60        struct im_connection *ic;
    6161       
    6262        int fd;
     
    8787};
    8888
    89 typedef xt_status (*jabber_cache_event) ( struct gaim_connection *gc, struct xt_node *node, struct xt_node *orig );
     89typedef xt_status (*jabber_cache_event) ( struct im_connection *ic, struct xt_node *node, struct xt_node *orig );
    9090
    9191struct jabber_cache_entry
     
    137137/* iq.c */
    138138xt_status jabber_pkt_iq( struct xt_node *node, gpointer data );
    139 int jabber_init_iq_auth( struct gaim_connection *gc );
    140 xt_status jabber_pkt_bind_sess( struct gaim_connection *gc, struct xt_node *node, struct xt_node *orig );
    141 int jabber_get_roster( struct gaim_connection *gc );
    142 int jabber_get_vcard( struct gaim_connection *gc, char *bare_jid );
    143 int jabber_add_to_roster( struct gaim_connection *gc, char *handle, char *name );
    144 int jabber_remove_from_roster( struct gaim_connection *gc, char *handle );
     139int jabber_init_iq_auth( struct im_connection *ic );
     140xt_status jabber_pkt_bind_sess( struct im_connection *ic, struct xt_node *node, struct xt_node *orig );
     141int jabber_get_roster( struct im_connection *ic );
     142int jabber_get_vcard( struct im_connection *ic, char *bare_jid );
     143int jabber_add_to_roster( struct im_connection *ic, char *handle, char *name );
     144int jabber_remove_from_roster( struct im_connection *ic, char *handle );
    145145
    146146/* message.c */
     
    149149/* presence.c */
    150150xt_status jabber_pkt_presence( struct xt_node *node, gpointer data );
    151 int presence_send_update( struct gaim_connection *gc );
    152 int presence_send_request( struct gaim_connection *gc, char *handle, char *request );
     151int presence_send_update( struct im_connection *ic );
     152int presence_send_request( struct im_connection *ic, char *handle, char *request );
    153153
    154154/* jabber_util.c */
     
    157157struct xt_node *jabber_make_packet( char *name, char *type, char *to, struct xt_node *children );
    158158struct xt_node *jabber_make_error_packet( struct xt_node *orig, char *err_cond, char *err_type );
    159 void jabber_cache_add( struct gaim_connection *gc, struct xt_node *node, jabber_cache_event func );
    160 struct xt_node *jabber_cache_get( struct gaim_connection *gc, char *id );
     159void jabber_cache_add( struct im_connection *ic, struct xt_node *node, jabber_cache_event func );
     160struct xt_node *jabber_cache_get( struct im_connection *ic, char *id );
    161161void jabber_cache_entry_free( gpointer entry );
    162 void jabber_cache_clean( struct gaim_connection *gc );
     162void jabber_cache_clean( struct im_connection *ic );
    163163const struct jabber_away_state *jabber_away_state_by_code( char *code );
    164164const struct jabber_away_state *jabber_away_state_by_name( char *name );
    165 void jabber_buddy_ask( struct gaim_connection *gc, char *handle );
     165void jabber_buddy_ask( struct im_connection *ic, char *handle );
    166166char *jabber_normalize( char *orig );
    167167
     
    172172} get_buddy_flags_t;
    173173
    174 struct jabber_buddy *jabber_buddy_add( struct gaim_connection *gc, char *full_jid );
    175 struct jabber_buddy *jabber_buddy_by_jid( struct gaim_connection *gc, char *jid, get_buddy_flags_t flags );
    176 int jabber_buddy_remove( struct gaim_connection *gc, char *full_jid );
    177 int jabber_buddy_remove_bare( struct gaim_connection *gc, char *bare_jid );
     174struct jabber_buddy *jabber_buddy_add( struct im_connection *ic, char *full_jid );
     175struct jabber_buddy *jabber_buddy_by_jid( struct im_connection *ic, char *jid, get_buddy_flags_t flags );
     176int jabber_buddy_remove( struct im_connection *ic, char *full_jid );
     177int jabber_buddy_remove_bare( struct im_connection *ic, char *bare_jid );
    178178
    179179extern const struct jabber_away_state jabber_away_state_list[];
    180180
    181181/* io.c */
    182 int jabber_write_packet( struct gaim_connection *gc, struct xt_node *node );
    183 int jabber_write( struct gaim_connection *gc, char *buf, int len );
     182int jabber_write_packet( struct im_connection *ic, struct xt_node *node );
     183int jabber_write( struct im_connection *ic, char *buf, int len );
    184184gboolean jabber_connected_plain( gpointer data, gint source, b_input_condition cond );
    185185gboolean jabber_connected_ssl( gpointer data, void *source, b_input_condition cond );
    186 gboolean jabber_start_stream( struct gaim_connection *gc );
    187 void jabber_end_stream( struct gaim_connection *gc );
     186gboolean jabber_start_stream( struct im_connection *ic );
     187void jabber_end_stream( struct im_connection *ic );
    188188
    189189/* sasl.c */
     
    191191xt_status sasl_pkt_challenge( struct xt_node *node, gpointer data );
    192192xt_status sasl_pkt_result( struct xt_node *node, gpointer data );
    193 gboolean sasl_supported( struct gaim_connection *gc );
     193gboolean sasl_supported( struct im_connection *ic );
    194194
    195195#endif
  • protocols/jabber/jabber_util.c

    rfa29d093 r0da65d5  
    4242        /* Only run this stuff if the account is online ATM,
    4343           and if the setting seems to be acceptable. */
    44         if( acc->gc )
     44        if( acc->ic )
    4545        {
    4646                /* Although set_eval functions usually are very nice and
     
    5858                /* (Yes, sorry, I prefer the hack. :-P) */
    5959               
    60                 presence_send_update( acc->gc );
     60                presence_send_update( acc->ic );
    6161        }
    6262       
     
    130130   them when you receive the response. Use this BEFORE sending the packet so
    131131   it'll get a new id= tag, and do NOT free() the packet after writing it! */
    132 void jabber_cache_add( struct gaim_connection *gc, struct xt_node *node, jabber_cache_event func )
    133 {
    134         struct jabber_data *jd = gc->proto_data;
     132void jabber_cache_add( struct im_connection *ic, struct xt_node *node, jabber_cache_event func )
     133{
     134        struct jabber_data *jd = ic->proto_data;
    135135        char *id = g_strdup_printf( "%s%05x", JABBER_CACHED_ID, ( next_id++ ) & 0xfffff );
    136136        struct jabber_cache_entry *entry = g_new0( struct jabber_cache_entry, 1 );
     
    159159   node should be available in the cache for at least a minute (assuming the
    160160   function is indeed called every minute). */
    161 void jabber_cache_clean( struct gaim_connection *gc )
    162 {
    163         struct jabber_data *jd = gc->proto_data;
     161void jabber_cache_clean( struct im_connection *ic )
     162{
     163        struct jabber_data *jd = ic->proto_data;
    164164       
    165165        g_hash_table_foreach_remove( jd->node_cache, jabber_cache_clean_entry, NULL );
     
    214214struct jabber_buddy_ask_data
    215215{
    216         struct gaim_connection *gc;
     216        struct im_connection *ic;
    217217        char *handle;
    218218        char *realname;
     
    221221static void jabber_buddy_ask_yes( gpointer w, struct jabber_buddy_ask_data *bla )
    222222{
    223         presence_send_request( bla->gc, bla->handle, "subscribed" );
    224        
    225         if( find_buddy( bla->gc, bla->handle ) == NULL )
    226                 show_got_added( bla->gc, bla->handle, NULL );
     223        presence_send_request( bla->ic, bla->handle, "subscribed" );
     224       
     225        if( find_buddy( bla->ic, bla->handle ) == NULL )
     226                show_got_added( bla->ic, bla->handle, NULL );
    227227       
    228228        g_free( bla->handle );
     
    232232static void jabber_buddy_ask_no( gpointer w, struct jabber_buddy_ask_data *bla )
    233233{
    234         presence_send_request( bla->gc, bla->handle, "subscribed" );
     234        presence_send_request( bla->ic, bla->handle, "subscribed" );
    235235       
    236236        g_free( bla->handle );
     
    238238}
    239239
    240 void jabber_buddy_ask( struct gaim_connection *gc, char *handle )
     240void jabber_buddy_ask( struct im_connection *ic, char *handle )
    241241{
    242242        struct jabber_buddy_ask_data *bla = g_new0( struct jabber_buddy_ask_data, 1 );
    243243        char *buf;
    244244       
    245         bla->gc = gc;
     245        bla->ic = ic;
    246246        bla->handle = g_strdup( handle );
    247247       
    248248        buf = g_strdup_printf( "The user %s wants to add you to his/her buddy list.", handle );
    249         do_ask_dialog( gc, buf, bla, jabber_buddy_ask_yes, jabber_buddy_ask_no );
     249        do_ask_dialog( ic, buf, bla, jabber_buddy_ask_yes, jabber_buddy_ask_no );
    250250        g_free( buf );
    251251}
     
    271271   to deal with that properly. Set their ->resource property to NULL. Do *NOT*
    272272   allow to mix this stuff, though... */
    273 struct jabber_buddy *jabber_buddy_add( struct gaim_connection *gc, char *full_jid_ )
    274 {
    275         struct jabber_data *jd = gc->proto_data;
     273struct jabber_buddy *jabber_buddy_add( struct im_connection *ic, char *full_jid_ )
     274{
     275        struct jabber_data *jd = ic->proto_data;
    276276        struct jabber_buddy *bud, *new, *bi;
    277277        char *s, *full_jid;
     
    343343   asked for a bare JID, it uses the "resource_select" setting to see which
    344344   resource to pick. */
    345 struct jabber_buddy *jabber_buddy_by_jid( struct gaim_connection *gc, char *jid_, get_buddy_flags_t flags )
    346 {
    347         struct jabber_data *jd = gc->proto_data;
     345struct jabber_buddy *jabber_buddy_by_jid( struct im_connection *ic, char *jid_, get_buddy_flags_t flags )
     346{
     347        struct jabber_data *jd = ic->proto_data;
    348348        struct jabber_buddy *bud;
    349349        char *s, *jid;
     
    371371                }
    372372               
    373                 if( bud == NULL && ( flags & GET_BUDDY_CREAT ) && find_buddy( gc, jid ) )
     373                if( bud == NULL && ( flags & GET_BUDDY_CREAT ) && find_buddy( ic, jid ) )
    374374                {
    375375                        *s = '/';
    376                         bud = jabber_buddy_add( gc, jid );
     376                        bud = jabber_buddy_add( ic, jid );
    377377                }
    378378               
     
    391391                if( bud == NULL )
    392392                        /* No match. Create it now? */
    393                         return ( ( flags & GET_BUDDY_CREAT ) && find_buddy( gc, jid_ ) ) ?
    394                                    jabber_buddy_add( gc, jid_ ) : NULL;
     393                        return ( ( flags & GET_BUDDY_CREAT ) && find_buddy( ic, jid_ ) ) ?
     394                                   jabber_buddy_add( ic, jid_ ) : NULL;
    395395                else if( bud->resource && ( flags & GET_BUDDY_EXACT ) )
    396396                        /* We want an exact match, so in thise case there shouldn't be a /resource. */
     
    409409                }
    410410               
    411                 if( ( set = set_getstr( &gc->acc->set, "resource_select" ) ) == NULL )
     411                if( ( set = set_getstr( &ic->acc->set, "resource_select" ) ) == NULL )
    412412                        return NULL;
    413413                else if( strcmp( set, "activity" ) == 0 )
     
    421421   off-line (because (s)he can still be online from a different location.
    422422   XXX: See above, we should accept bare JIDs too... */
    423 int jabber_buddy_remove( struct gaim_connection *gc, char *full_jid_ )
    424 {
    425         struct jabber_data *jd = gc->proto_data;
     423int jabber_buddy_remove( struct im_connection *ic, char *full_jid_ )
     424{
     425        struct jabber_data *jd = ic->proto_data;
    426426        struct jabber_buddy *bud, *prev, *bi;
    427427        char *s, *full_jid;
     
    495495   specified bare JID. Use this when removing someone from the contact
    496496   list, for example. */
    497 int jabber_buddy_remove_bare( struct gaim_connection *gc, char *bare_jid_ )
    498 {
    499         struct jabber_data *jd = gc->proto_data;
     497int jabber_buddy_remove_bare( struct im_connection *ic, char *bare_jid_ )
     498{
     499        struct jabber_data *jd = ic->proto_data;
    500500        struct jabber_buddy *bud, *next;
    501501        char *bare_jid;
  • protocols/jabber/message.c

    rfa29d093 r0da65d5  
    2626xt_status jabber_pkt_message( struct xt_node *node, gpointer data )
    2727{
    28         struct gaim_connection *gc = data;
     28        struct im_connection *ic = data;
    2929        char *from = xt_find_attr( node, "from" );
    3030        char *type = xt_find_attr( node, "type" );
     
    4747                if( ( s = strchr( from, '/' ) ) )
    4848                {
    49                         if( ( bud = jabber_buddy_by_jid( gc, from, GET_BUDDY_EXACT ) ) )
     49                        if( ( bud = jabber_buddy_by_jid( ic, from, GET_BUDDY_EXACT ) ) )
    5050                                bud->last_act = time( NULL );
    5151                        else
     
    7676               
    7777                if( fullmsg->len > 0 )
    78                         serv_got_im( gc, bud ? bud->bare_jid : from, fullmsg->str, 0, 0, fullmsg->len );
     78                        serv_got_im( ic, bud ? bud->bare_jid : from, fullmsg->str, 0, 0, fullmsg->len );
    7979               
    8080                g_string_free( fullmsg, TRUE );
     
    8484                {
    8585                        bud->flags |= JBFLAG_DOES_XEP85;
    86                         serv_got_typing( gc, bud ? bud->bare_jid : from, 0, 1 );
     86                        serv_got_typing( ic, bud ? bud->bare_jid : from, 0, 1 );
    8787                }
    8888                /* No need to send a "stopped typing" signal when there's a message. */
     
    9090                {
    9191                        bud->flags |= JBFLAG_DOES_XEP85;
    92                         serv_got_typing( gc, bud ? bud->bare_jid : from, 0, 0 );
     92                        serv_got_typing( ic, bud ? bud->bare_jid : from, 0, 0 );
    9393                }
    9494                else if( xt_find_node( node->children, "paused" ) )
    9595                {
    9696                        bud->flags |= JBFLAG_DOES_XEP85;
    97                         serv_got_typing( gc, bud ? bud->bare_jid : from, 0, 2 );
     97                        serv_got_typing( ic, bud ? bud->bare_jid : from, 0, 2 );
    9898                }
    9999               
  • protocols/jabber/presence.c

    rfa29d093 r0da65d5  
    2626xt_status jabber_pkt_presence( struct xt_node *node, gpointer data )
    2727{
    28         struct gaim_connection *gc = data;
     28        struct im_connection *ic = data;
    2929        char *from = xt_find_attr( node, "from" );
    3030        char *type = xt_find_attr( node, "type" );      /* NULL should mean the person is online. */
     
    3838        if( type == NULL )
    3939        {
    40                 if( !( bud = jabber_buddy_by_jid( gc, from, GET_BUDDY_EXACT | GET_BUDDY_CREAT ) ) )
     40                if( !( bud = jabber_buddy_by_jid( ic, from, GET_BUDDY_EXACT | GET_BUDDY_CREAT ) ) )
    4141                {
    42                         if( set_getbool( &gc->irc->set, "debug" ) )
    43                                 serv_got_crap( gc, "WARNING: Could not handle presence information from JID: %s", from );
     42                        if( set_getbool( &ic->irc->set, "debug" ) )
     43                                serv_got_crap( ic, "WARNING: Could not handle presence information from JID: %s", from );
    4444                        return XT_HANDLED;
    4545                }
     
    6666                        bud->priority = 0;
    6767               
    68                 serv_got_update( gc, bud->bare_jid, 1, 0, 0, 0,
     68                serv_got_update( ic, bud->bare_jid, 1, 0, 0, 0,
    6969                                 bud->away_state ? UC_UNAVAILABLE : 0, 0 );
    7070        }
    7171        else if( strcmp( type, "unavailable" ) == 0 )
    7272        {
    73                 if( jabber_buddy_by_jid( gc, from, GET_BUDDY_EXACT ) == NULL )
     73                if( jabber_buddy_by_jid( ic, from, GET_BUDDY_EXACT ) == NULL )
    7474                {
    75                         if( set_getbool( &gc->irc->set, "debug" ) )
    76                                 serv_got_crap( gc, "WARNING: Received presence information from unknown JID: %s", from );
     75                        if( set_getbool( &ic->irc->set, "debug" ) )
     76                                serv_got_crap( ic, "WARNING: Received presence information from unknown JID: %s", from );
    7777                        return XT_HANDLED;
    7878                }
    7979               
    80                 jabber_buddy_remove( gc, from );
     80                jabber_buddy_remove( ic, from );
    8181               
    8282                if( ( s = strchr( from, '/' ) ) )
     
    8686                        /* Only count this as offline if there's no other resource
    8787                           available anymore. */
    88                         if( jabber_buddy_by_jid( gc, from, 0 ) == NULL )
    89                                 serv_got_update( gc, from, 0, 0, 0, 0, 0, 0 );
     88                        if( jabber_buddy_by_jid( ic, from, 0 ) == NULL )
     89                                serv_got_update( ic, from, 0, 0, 0, 0, 0, 0 );
    9090                       
    9191                        *s = '/';
     
    9393                else
    9494                {
    95                         serv_got_update( gc, from, 0, 0, 0, 0, 0, 0 );
     95                        serv_got_update( ic, from, 0, 0, 0, 0, 0, 0 );
    9696                }
    9797        }
    9898        else if( strcmp( type, "subscribe" ) == 0 )
    9999        {
    100                 jabber_buddy_ask( gc, from );
     100                jabber_buddy_ask( ic, from );
    101101        }
    102102        else if( strcmp( type, "subscribed" ) == 0 )
    103103        {
    104104                /* Not sure about this one, actually... */
    105                 serv_got_crap( gc, "%s just accepted your authorization request", from );
     105                serv_got_crap( ic, "%s just accepted your authorization request", from );
    106106        }
    107107        else if( strcmp( type, "unsubscribe" ) == 0 || strcmp( type, "unsubscribed" ) == 0 )
     
    131131/* Whenever presence information is updated, call this function to inform the
    132132   server. */
    133 int presence_send_update( struct gaim_connection *gc )
     133int presence_send_update( struct im_connection *ic )
    134134{
    135         struct jabber_data *jd = gc->proto_data;
     135        struct jabber_data *jd = ic->proto_data;
    136136        struct xt_node *node;
    137137        char *show = jd->away_state->code;
     
    140140       
    141141        node = jabber_make_packet( "presence", NULL, NULL, NULL );
    142         xt_add_child( node, xt_new_node( "priority", set_getstr( &gc->acc->set, "priority" ), NULL ) );
     142        xt_add_child( node, xt_new_node( "priority", set_getstr( &ic->acc->set, "priority" ), NULL ) );
    143143        if( show && *show )
    144144                xt_add_child( node, xt_new_node( "show", show, NULL ) );
     
    146146                xt_add_child( node, xt_new_node( "status", status, NULL ) );
    147147       
    148         st = jabber_write_packet( gc, node );
     148        st = jabber_write_packet( ic, node );
    149149       
    150150        xt_free_node( node );
     
    153153
    154154/* Send a subscribe/unsubscribe request to a buddy. */
    155 int presence_send_request( struct gaim_connection *gc, char *handle, char *request )
     155int presence_send_request( struct im_connection *ic, char *handle, char *request )
    156156{
    157157        struct xt_node *node;
     
    162162        xt_add_attr( node, "type", request );
    163163       
    164         st = jabber_write_packet( gc, node );
     164        st = jabber_write_packet( ic, node );
    165165       
    166166        xt_free_node( node );
  • protocols/jabber/sasl.c

    rfa29d093 r0da65d5  
    2727xt_status sasl_pkt_mechanisms( struct xt_node *node, gpointer data )
    2828{
    29         struct gaim_connection *gc = data;
    30         struct jabber_data *jd = gc->proto_data;
     29        struct im_connection *ic = data;
     30        struct jabber_data *jd = ic->proto_data;
    3131        struct xt_node *c, *reply;
    3232        char *s;
    3333        int sup_plain = 0, sup_digest = 0;
    3434       
    35         if( !sasl_supported( gc ) )
     35        if( !sasl_supported( ic ) )
    3636        {
    3737                /* Should abort this now, since we should already be doing
    3838                   IQ authentication. Strange things happen when you try
    3939                   to do both... */
    40                 serv_got_crap( gc, "XMPP 1.0 non-compliant server seems to support SASL, please report this as a BitlBee bug!" );
     40                serv_got_crap( ic, "XMPP 1.0 non-compliant server seems to support SASL, please report this as a BitlBee bug!" );
    4141                return XT_HANDLED;
    4242        }
     
    4545        if( !s || strcmp( s, XMLNS_SASL ) != 0 )
    4646        {
    47                 signoff( gc );
     47                signoff( ic );
    4848                return XT_ABORT;
    4949        }
     
    6262        if( !sup_plain && !sup_digest )
    6363        {
    64                 hide_login_progress( gc, "No known SASL authentication schemes supported" );
    65                 signoff( gc );
     64                hide_login_progress( ic, "No known SASL authentication schemes supported" );
     65                signoff( ic );
    6666                return XT_ABORT;
    6767        }
     
    8383               
    8484                /* With SASL PLAIN in XMPP, the text should be b64(\0user\0pass) */
    85                 len = strlen( jd->username ) + strlen( gc->acc->pass ) + 2;
     85                len = strlen( jd->username ) + strlen( ic->acc->pass ) + 2;
    8686                s = g_malloc( len + 1 );
    8787                s[0] = 0;
    8888                strcpy( s + 1, jd->username );
    89                 strcpy( s + 2 + strlen( jd->username ), gc->acc->pass );
     89                strcpy( s + 2 + strlen( jd->username ), ic->acc->pass );
    9090                reply->text = base64_encode( s, len );
    9191                reply->text_len = strlen( reply->text );
     
    9393        }
    9494       
    95         if( !jabber_write_packet( gc, reply ) )
     95        if( !jabber_write_packet( ic, reply ) )
    9696        {
    9797                xt_free_node( reply );
     
    181181xt_status sasl_pkt_challenge( struct xt_node *node, gpointer data )
    182182{
    183         struct gaim_connection *gc = data;
    184         struct jabber_data *jd = gc->proto_data;
     183        struct im_connection *ic = data;
     184        struct jabber_data *jd = ic->proto_data;
    185185        struct xt_node *reply = NULL;
    186186        char *nonce = NULL, *realm = NULL, *cnonce = NULL, cnonce_bin[30];
     
    222222                   I decided to call it H. */
    223223                md5_init( &H );
    224                 s = g_strdup_printf( "%s:%s:%s", jd->username, realm, gc->acc->pass );
     224                s = g_strdup_printf( "%s:%s:%s", jd->username, realm, ic->acc->pass );
    225225                md5_append( &H, (unsigned char *) s, strlen( s ) );
    226226                g_free( s );
     
    272272        xt_add_attr( reply, "xmlns", XMLNS_SASL );
    273273       
    274         if( !jabber_write_packet( gc, reply ) )
     274        if( !jabber_write_packet( ic, reply ) )
    275275                goto silent_error;
    276276       
     
    279279
    280280error:
    281         hide_login_progress( gc, "Incorrect SASL challenge received" );
    282         signoff( gc );
     281        hide_login_progress( ic, "Incorrect SASL challenge received" );
     282        signoff( ic );
    283283
    284284silent_error:
     
    296296xt_status sasl_pkt_result( struct xt_node *node, gpointer data )
    297297{
    298         struct gaim_connection *gc = data;
    299         struct jabber_data *jd = gc->proto_data;
     298        struct im_connection *ic = data;
     299        struct jabber_data *jd = ic->proto_data;
    300300        char *s;
    301301       
     
    303303        if( !s || strcmp( s, XMLNS_SASL ) != 0 )
    304304        {
    305                 signoff( gc );
     305                signoff( ic );
    306306                return XT_ABORT;
    307307        }
     
    309309        if( strcmp( node->name, "success" ) == 0 )
    310310        {
    311                 set_login_progress( gc, 1, "Authentication finished" );
     311                set_login_progress( ic, 1, "Authentication finished" );
    312312                jd->flags |= JFLAG_AUTHENTICATED | JFLAG_STREAM_RESTART;
    313313        }
    314314        else if( strcmp( node->name, "failure" ) == 0 )
    315315        {
    316                 hide_login_progress( gc, "Authentication failure" );
    317                 signoff( gc );
     316                hide_login_progress( ic, "Authentication failure" );
     317                signoff( ic );
    318318                return XT_ABORT;
    319319        }
     
    325325   It's done by checking if the <stream:stream> from the server has a
    326326   version attribute. I don't know if this is the right way though... */
    327 gboolean sasl_supported( struct gaim_connection *gc )
    328 {
    329         struct jabber_data *jd = gc->proto_data;
     327gboolean sasl_supported( struct im_connection *ic )
     328{
     329        struct jabber_data *jd = ic->proto_data;
    330330       
    331331        return ( (void*) ( jd->xt && jd->xt->root && xt_find_attr( jd->xt->root, "version" ) ) ) != NULL;
  • protocols/msn/msn.c

    rfa29d093 r0da65d5  
    2929static char *msn_set_display_name( set_t *set, char *value );
    3030
    31 static void msn_acc_init( account_t *acc )
     31static void msn_init( account_t *acc )
    3232{
    3333        set_t *s;
     
    3939static void msn_login( account_t *acc )
    4040{
    41         struct gaim_connection *gc = new_gaim_conn( acc );
     41        struct im_connection *ic = new_gaim_conn( acc );
    4242        struct msn_data *md = g_new0( struct msn_data, 1 );
    4343       
    44         gc->proto_data = md;
     44        ic->proto_data = md;
    4545        md->fd = -1;
    4646       
    4747        if( strchr( acc->user, '@' ) == NULL )
    4848        {
    49                 hide_login_progress( gc, "Invalid account name" );
    50                 signoff( gc );
     49                hide_login_progress( ic, "Invalid account name" );
     50                signoff( ic );
    5151                return;
    5252        }
    5353       
    54         set_login_progress( gc, 1, "Connecting" );
    55        
    56         md->fd = proxy_connect( "messenger.hotmail.com", 1863, msn_ns_connected, gc );
     54        set_login_progress( ic, 1, "Connecting" );
     55       
     56        md->fd = proxy_connect( "messenger.hotmail.com", 1863, msn_ns_connected, ic );
    5757        if( md->fd < 0 )
    5858        {
    59                 hide_login_progress( gc, "Could not connect to server" );
    60                 signoff( gc );
     59                hide_login_progress( ic, "Could not connect to server" );
     60                signoff( ic );
    6161                return;
    6262        }
    6363       
    64         md->gc = gc;
     64        md->ic = ic;
    6565        md->away_state = msn_away_state_list;
    6666       
    67         msn_connections = g_slist_append( msn_connections, gc );
    68 }
    69 
    70 static void msn_close( struct gaim_connection *gc )
    71 {
    72         struct msn_data *md = gc->proto_data;
     67        msn_connections = g_slist_append( msn_connections, ic );
     68}
     69
     70static void msn_logout( struct im_connection *ic )
     71{
     72        struct msn_data *md = ic->proto_data;
    7373        GSList *l;
    7474       
     
    9696                                m = l->data;
    9797                       
    98                                 serv_got_crap( gc, "Warning: Closing down MSN connection with unsent message to %s, you'll have to resend it.", m->who );
     98                                serv_got_crap( ic, "Warning: Closing down MSN connection with unsent message to %s, you'll have to resend it.", m->who );
    9999                                g_free( m->who );
    100100                                g_free( m->text );
     
    111111        }
    112112       
    113         for( l = gc->permit; l; l = l->next )
     113        for( l = ic->permit; l; l = l->next )
    114114                g_free( l->data );
    115         g_slist_free( gc->permit );
    116        
    117         for( l = gc->deny; l; l = l->next )
     115        g_slist_free( ic->permit );
     116       
     117        for( l = ic->deny; l; l = l->next )
    118118                g_free( l->data );
    119         g_slist_free( gc->deny );
    120        
    121         msn_connections = g_slist_remove( msn_connections, gc );
    122 }
    123 
    124 static int msn_send_im( struct gaim_connection *gc, char *who, char *message, int len, int away )
     119        g_slist_free( ic->deny );
     120       
     121        msn_connections = g_slist_remove( msn_connections, ic );
     122}
     123
     124static int msn_send_im( struct im_connection *ic, char *who, char *message, int away )
    125125{
    126126        struct msn_switchboard *sb;
    127         struct msn_data *md = gc->proto_data;
    128        
    129         if( ( sb = msn_sb_by_handle( gc, who ) ) )
     127        struct msn_data *md = ic->proto_data;
     128       
     129        if( ( sb = msn_sb_by_handle( ic, who ) ) )
    130130        {
    131131                return( msn_sb_sendmessage( sb, message ) );
     
    142142               
    143143                /* FIXME: *CHECK* the reliability of using spare sb's! */
    144                 if( ( sb = msn_sb_spare( gc ) ) )
     144                if( ( sb = msn_sb_spare( ic ) ) )
    145145                {
    146146                        debug( "Trying to use a spare switchboard to message %s", who );
     
    160160                /* If we reach this line, there was no spare switchboard, so let's make one. */
    161161                g_snprintf( buf, sizeof( buf ), "XFR %d SB\r\n", ++md->trId );
    162                 if( !msn_write( gc, buf, strlen( buf ) ) )
     162                if( !msn_write( ic, buf, strlen( buf ) ) )
    163163                {
    164164                        g_free( m->who );
     
    180180}
    181181
    182 static GList *msn_away_states( struct gaim_connection *gc )
     182static GList *msn_away_states( struct im_connection *ic )
    183183{
    184184        static GList *l = NULL;
     
    192192}
    193193
    194 static char *msn_get_status_string( struct gaim_connection *gc, int number )
     194static char *msn_get_status_string( struct im_connection *ic, int number )
    195195{
    196196        const struct msn_away_state *st = msn_away_state_by_number( number );
     
    202202}
    203203
    204 static void msn_set_away( struct gaim_connection *gc, char *state, char *message )
     204static void msn_set_away( struct im_connection *ic, char *state, char *message )
    205205{
    206206        char buf[1024];
    207         struct msn_data *md = gc->proto_data;
     207        struct msn_data *md = ic->proto_data;
    208208        const struct msn_away_state *st;
    209209       
     
    217217       
    218218        g_snprintf( buf, sizeof( buf ), "CHG %d %s\r\n", ++md->trId, st->code );
    219         msn_write( gc, buf, strlen( buf ) );
    220 }
    221 
    222 static void msn_set_info( struct gaim_connection *gc, char *info )
    223 {
    224         msn_set_display_name( set_find( &gc->acc->set, "display_name" ), info );
    225 }
    226 
    227 static void msn_get_info(struct gaim_connection *gc, char *who)
     219        msn_write( ic, buf, strlen( buf ) );
     220}
     221
     222static void msn_set_my_name( struct im_connection *ic, char *info )
     223{
     224        msn_set_display_name( set_find( &ic->acc->set, "display_name" ), info );
     225}
     226
     227static void msn_get_info(struct im_connection *ic, char *who)
    228228{
    229229        /* Just make an URL and let the user fetch the info */
    230         serv_got_crap( gc, "%s\n%s: %s%s", _("User Info"), _("For now, fetch yourself"), PROFILE_URL, who );
    231 }
    232 
    233 static void msn_add_buddy( struct gaim_connection *gc, char *who )
    234 {
    235         msn_buddy_list_add( gc, "FL", who, who );
    236 }
    237 
    238 static void msn_remove_buddy( struct gaim_connection *gc, char *who, char *group )
    239 {
    240         msn_buddy_list_remove( gc, "FL", who );
    241 }
    242 
    243 static int msn_chat_send( struct conversation *c, char *message )
     230        serv_got_crap( ic, "%s\n%s: %s%s", _("User Info"), _("For now, fetch yourself"), PROFILE_URL, who );
     231}
     232
     233static void msn_add_buddy( struct im_connection *ic, char *who, char *group )
     234{
     235        msn_buddy_list_add( ic, "FL", who, who );
     236}
     237
     238static void msn_remove_buddy( struct im_connection *ic, char *who, char *group )
     239{
     240        msn_buddy_list_remove( ic, "FL", who );
     241}
     242
     243static void msn_chat_send( struct groupchat *c, char *message, int flags )
    244244{
    245245        struct msn_switchboard *sb = msn_sb_by_chat( c );
    246246       
    247247        if( sb )
    248                 return( msn_sb_sendmessage( sb, message ) );
    249         else
    250                 return( 0 );
    251 }
    252 
    253 static void msn_chat_invite( struct conversation *c, char *msg, char *who )
     248                msn_sb_sendmessage( sb, message );
     249        /* FIXME: Error handling (although this can't happen unless something's
     250           already severely broken) disappeared here! */
     251}
     252
     253static void msn_chat_invite( struct groupchat *c, char *msg, char *who )
    254254{
    255255        struct msn_switchboard *sb = msn_sb_by_chat( c );
     
    263263}
    264264
    265 static void msn_chat_leave( struct conversation *c )
     265static void msn_chat_leave( struct groupchat *c )
    266266{
    267267        struct msn_switchboard *sb = msn_sb_by_chat( c );
     
    271271}
    272272
    273 static struct conversation *msn_chat_open( struct gaim_connection *gc, char *who )
     273static struct groupchat *msn_chat_with( struct im_connection *ic, char *who )
    274274{
    275275        struct msn_switchboard *sb;
    276         struct msn_data *md = gc->proto_data;
     276        struct msn_data *md = ic->proto_data;
    277277        char buf[1024];
    278278       
    279         if( ( sb = msn_sb_by_handle( gc, who ) ) )
     279        if( ( sb = msn_sb_by_handle( ic, who ) ) )
    280280        {
    281281                debug( "Converting existing switchboard to %s to a groupchat", who );
     
    286286                struct msn_message *m;
    287287               
    288                 if( ( sb = msn_sb_spare( gc ) ) )
     288                if( ( sb = msn_sb_spare( ic ) ) )
    289289                {
    290290                        debug( "Trying to reuse an existing switchboard as a groupchat with %s", who );
     
    299299                /* Request a new switchboard. */
    300300                g_snprintf( buf, sizeof( buf ), "XFR %d SB\r\n", ++md->trId );
    301                 if( !msn_write( gc, buf, strlen( buf ) ) )
     301                if( !msn_write( ic, buf, strlen( buf ) ) )
    302302                        return( 0 );
    303303               
     
    317317}
    318318
    319 static void msn_keepalive( struct gaim_connection *gc )
    320 {
    321         msn_write( gc, "PNG\r\n", strlen( "PNG\r\n" ) );
    322 }
    323 
    324 static void msn_add_permit( struct gaim_connection *gc, char *who )
    325 {
    326         msn_buddy_list_add( gc, "AL", who, who );
    327 }
    328 
    329 static void msn_rem_permit( struct gaim_connection *gc, char *who )
    330 {
    331         msn_buddy_list_remove( gc, "AL", who );
    332 }
    333 
    334 static void msn_add_deny( struct gaim_connection *gc, char *who )
     319static void msn_keepalive( struct im_connection *ic )
     320{
     321        msn_write( ic, "PNG\r\n", strlen( "PNG\r\n" ) );
     322}
     323
     324static void msn_add_permit( struct im_connection *ic, char *who )
     325{
     326        msn_buddy_list_add( ic, "AL", who, who );
     327}
     328
     329static void msn_rem_permit( struct im_connection *ic, char *who )
     330{
     331        msn_buddy_list_remove( ic, "AL", who );
     332}
     333
     334static void msn_add_deny( struct im_connection *ic, char *who )
    335335{
    336336        struct msn_switchboard *sb;
    337337       
    338         msn_buddy_list_add( gc, "BL", who, who );
     338        msn_buddy_list_add( ic, "BL", who, who );
    339339       
    340340        /* If there's still a conversation with this person, close it. */
    341         if( ( sb = msn_sb_by_handle( gc, who ) ) )
     341        if( ( sb = msn_sb_by_handle( ic, who ) ) )
    342342        {
    343343                msn_sb_destroy( sb );
     
    345345}
    346346
    347 static void msn_rem_deny( struct gaim_connection *gc, char *who )
    348 {
    349         msn_buddy_list_remove( gc, "BL", who );
    350 }
    351 
    352 static int msn_send_typing( struct gaim_connection *gc, char *who, int typing )
     347static void msn_rem_deny( struct im_connection *ic, char *who )
     348{
     349        msn_buddy_list_remove( ic, "BL", who );
     350}
     351
     352static int msn_send_typing( struct im_connection *ic, char *who, int typing )
    353353{
    354354        if( typing )
    355                 return( msn_send_im( gc, who, TYPING_NOTIFICATION_MESSAGE, strlen( TYPING_NOTIFICATION_MESSAGE ), 0 ) );
     355                return( msn_send_im( ic, who, TYPING_NOTIFICATION_MESSAGE, 0 ) );
    356356        else
    357357                return( 1 );
     
    361361{
    362362        account_t *acc = set->data;
    363         struct gaim_connection *gc = acc->gc;
     363        struct im_connection *ic = acc->ic;
    364364        struct msn_data *md;
    365365        char buf[1024], *fn;
    366366       
    367367        /* Double-check. */
    368         if( gc == NULL )
     368        if( ic == NULL )
    369369                return NULL;
    370370       
    371         md = gc->proto_data;
     371        md = ic->proto_data;
    372372       
    373373        if( strlen( value ) > 129 )
    374374        {
    375                 serv_got_crap( gc, "Maximum name length exceeded" );
     375                serv_got_crap( ic, "Maximum name length exceeded" );
    376376                return NULL;
    377377        }
     
    379379        fn = msn_http_encode( value );
    380380       
    381         g_snprintf( buf, sizeof( buf ), "REA %d %s %s\r\n", ++md->trId, gc->username, fn );
    382         msn_write( gc, buf, strlen( buf ) );
     381        g_snprintf( buf, sizeof( buf ), "REA %d %s %s\r\n", ++md->trId, ic->username, fn );
     382        msn_write( ic, buf, strlen( buf ) );
    383383        g_free( fn );
    384384       
     
    389389}
    390390
    391 void msn_init()
     391void msn_initmodule()
    392392{
    393393        struct prpl *ret = g_new0(struct prpl, 1);
     
    395395        ret->name = "msn";
    396396        ret->login = msn_login;
    397         ret->acc_init = msn_acc_init;
    398         ret->close = msn_close;
     397        ret->init = msn_init;
     398        ret->logout = msn_logout;
    399399        ret->send_im = msn_send_im;
    400400        ret->away_states = msn_away_states;
    401401        ret->get_status_string = msn_get_status_string;
    402402        ret->set_away = msn_set_away;
    403         ret->set_info = msn_set_info;
    404403        ret->get_info = msn_get_info;
     404        ret->set_my_name = msn_set_my_name;
    405405        ret->add_buddy = msn_add_buddy;
    406406        ret->remove_buddy = msn_remove_buddy;
     
    408408        ret->chat_invite = msn_chat_invite;
    409409        ret->chat_leave = msn_chat_leave;
    410         ret->chat_open = msn_chat_open;
     410        ret->chat_with = msn_chat_with;
    411411        ret->keepalive = msn_keepalive;
    412412        ret->add_permit = msn_add_permit;
  • protocols/msn/msn.h

    rfa29d093 r0da65d5  
    5757struct msn_data
    5858{
    59         struct gaim_connection *gc;
     59        struct im_connection *ic;
    6060       
    6161        int fd;
     
    7575struct msn_switchboard
    7676{
    77         struct gaim_connection *gc;
     77        struct im_connection *ic;
    7878       
    7979        int fd;
     
    8989        GSList *msgq;
    9090        char *who;
    91         struct conversation *chat;
     91        struct groupchat *chat;
    9292};
    9393
     
    149149
    150150/* msn_util.c */
    151 int msn_write( struct gaim_connection *gc, char *s, int len );
    152 int msn_logged_in( struct gaim_connection *gc );
    153 int msn_buddy_list_add( struct gaim_connection *gc, char *list, char *who, char *realname );
    154 int msn_buddy_list_remove( struct gaim_connection *gc, char *list, char *who );
    155 void msn_buddy_ask( struct gaim_connection *gc, char *handle, char *realname );
     151int msn_write( struct im_connection *ic, char *s, int len );
     152int msn_logged_in( struct im_connection *ic );
     153int msn_buddy_list_add( struct im_connection *ic, char *list, char *who, char *realname );
     154int msn_buddy_list_remove( struct im_connection *ic, char *list, char *who );
     155void msn_buddy_ask( struct im_connection *ic, char *handle, char *realname );
    156156char *msn_findheader( char *text, char *header, int len );
    157157char **msn_linesplit( char *line );
     
    167167/* sb.c */
    168168int msn_sb_write( struct msn_switchboard *sb, char *s, int len );
    169 struct msn_switchboard *msn_sb_create( struct gaim_connection *gc, char *host, int port, char *key, int session );
    170 struct msn_switchboard *msn_sb_by_handle( struct gaim_connection *gc, char *handle );
    171 struct msn_switchboard *msn_sb_by_chat( struct conversation *c );
    172 struct msn_switchboard *msn_sb_spare( struct gaim_connection *gc );
     169struct msn_switchboard *msn_sb_create( struct im_connection *ic, char *host, int port, char *key, int session );
     170struct msn_switchboard *msn_sb_by_handle( struct im_connection *ic, char *handle );
     171struct msn_switchboard *msn_sb_by_chat( struct groupchat *c );
     172struct msn_switchboard *msn_sb_spare( struct im_connection *ic );
    173173int msn_sb_sendmessage( struct msn_switchboard *sb, char *text );
    174 struct conversation *msn_sb_to_chat( struct msn_switchboard *sb );
     174struct groupchat *msn_sb_to_chat( struct msn_switchboard *sb );
    175175void msn_sb_destroy( struct msn_switchboard *sb );
    176176gboolean msn_sb_connected( gpointer data, gint source, b_input_condition cond );
  • protocols/msn/msn_util.c

    rfa29d093 r0da65d5  
    2828#include <ctype.h>
    2929
    30 int msn_write( struct gaim_connection *gc, char *s, int len )
    31 {
    32         struct msn_data *md = gc->proto_data;
     30int msn_write( struct im_connection *ic, char *s, int len )
     31{
     32        struct msn_data *md = ic->proto_data;
    3333        int st;
    3434       
     
    3636        if( st != len )
    3737        {
    38                 hide_login_progress_error( gc, "Short write() to main server" );
    39                 signoff( gc );
     38                hide_login_progress_error( ic, "Short write() to main server" );
     39                signoff( ic );
    4040                return( 0 );
    4141        }
     
    4444}
    4545
    46 int msn_logged_in( struct gaim_connection *gc )
    47 {
    48         account_online( gc );
     46int msn_logged_in( struct im_connection *ic )
     47{
     48        account_online( ic );
    4949       
    5050        return( 0 );
    5151}
    5252
    53 int msn_buddy_list_add( struct gaim_connection *gc, char *list, char *who, char *realname_ )
    54 {
    55         struct msn_data *md = gc->proto_data;
     53int msn_buddy_list_add( struct im_connection *ic, char *list, char *who, char *realname_ )
     54{
     55        struct msn_data *md = ic->proto_data;
    5656        char buf[1024], *realname;
    5757       
     
    5959       
    6060        g_snprintf( buf, sizeof( buf ), "ADD %d %s %s %s\r\n", ++md->trId, list, who, realname );
    61         if( msn_write( gc, buf, strlen( buf ) ) )
     61        if( msn_write( ic, buf, strlen( buf ) ) )
    6262        {
    6363                g_free( realname );
     
    7171}
    7272
    73 int msn_buddy_list_remove( struct gaim_connection *gc, char *list, char *who )
    74 {
    75         struct msn_data *md = gc->proto_data;
     73int msn_buddy_list_remove( struct im_connection *ic, char *list, char *who )
     74{
     75        struct msn_data *md = ic->proto_data;
    7676        char buf[1024];
    7777       
    7878        g_snprintf( buf, sizeof( buf ), "REM %d %s %s\r\n", ++md->trId, list, who );
    79         if( msn_write( gc, buf, strlen( buf ) ) )
     79        if( msn_write( ic, buf, strlen( buf ) ) )
    8080                return( 1 );
    8181       
     
    8585struct msn_buddy_ask_data
    8686{
    87         struct gaim_connection *gc;
     87        struct im_connection *ic;
    8888        char *handle;
    8989        char *realname;
     
    9292static void msn_buddy_ask_yes( gpointer w, struct msn_buddy_ask_data *bla )
    9393{
    94         msn_buddy_list_add( bla->gc, "AL", bla->handle, bla->realname );
    95        
    96         if( find_buddy( bla->gc, bla->handle ) == NULL )
    97                 show_got_added( bla->gc, bla->handle, NULL );
     94        msn_buddy_list_add( bla->ic, "AL", bla->handle, bla->realname );
     95       
     96        if( find_buddy( bla->ic, bla->handle ) == NULL )
     97                show_got_added( bla->ic, bla->handle, NULL );
    9898       
    9999        g_free( bla->handle );
     
    104104static void msn_buddy_ask_no( gpointer w, struct msn_buddy_ask_data *bla )
    105105{
    106         msn_buddy_list_add( bla->gc, "BL", bla->handle, bla->realname );
     106        msn_buddy_list_add( bla->ic, "BL", bla->handle, bla->realname );
    107107       
    108108        g_free( bla->handle );
     
    111111}
    112112
    113 void msn_buddy_ask( struct gaim_connection *gc, char *handle, char *realname )
     113void msn_buddy_ask( struct im_connection *ic, char *handle, char *realname )
    114114{
    115115        struct msn_buddy_ask_data *bla = g_new0( struct msn_buddy_ask_data, 1 );
    116116        char buf[1024];
    117117       
    118         bla->gc = gc;
     118        bla->ic = ic;
    119119        bla->handle = g_strdup( handle );
    120120        bla->realname = g_strdup( realname );
     
    123123                    "The user %s (%s) wants to add you to his/her buddy list.",
    124124                    handle, realname );
    125         do_ask_dialog( gc, buf, bla, msn_buddy_ask_yes, msn_buddy_ask_no );
     125        do_ask_dialog( ic, buf, bla, msn_buddy_ask_yes, msn_buddy_ask_no );
    126126}
    127127
  • protocols/msn/ns.c

    rfa29d093 r0da65d5  
    3838gboolean msn_ns_connected( gpointer data, gint source, b_input_condition cond )
    3939{
    40         struct gaim_connection *gc = data;
     40        struct im_connection *ic = data;
    4141        struct msn_data *md;
    4242        char s[1024];
    4343       
    44         if( !g_slist_find( msn_connections, gc ) )
     44        if( !g_slist_find( msn_connections, ic ) )
    4545                return FALSE;
    4646       
    4747        if( source == -1 )
    4848        {
    49                 hide_login_progress( gc, "Could not connect to server" );
    50                 signoff( gc );
     49                hide_login_progress( ic, "Could not connect to server" );
     50                signoff( ic );
    5151                return FALSE;
    5252        }
    5353       
    54         md = gc->proto_data;
     54        md = ic->proto_data;
    5555       
    5656        if( !md->handler )
    5757        {
    5858                md->handler = g_new0( struct msn_handler_data, 1 );
    59                 md->handler->data = gc;
     59                md->handler->data = ic;
    6060                md->handler->exec_command = msn_ns_command;
    6161                md->handler->exec_message = msn_ns_message;
     
    7373       
    7474        g_snprintf( s, sizeof( s ), "VER %d MSNP8 CVR0\r\n", ++md->trId );
    75         if( msn_write( gc, s, strlen( s ) ) )
    76         {
    77                 gc->inpa = b_input_add( md->fd, GAIM_INPUT_READ, msn_ns_callback, gc );
    78                 set_login_progress( gc, 1, "Connected to server, waiting for reply" );
     75        if( msn_write( ic, s, strlen( s ) ) )
     76        {
     77                ic->inpa = b_input_add( md->fd, GAIM_INPUT_READ, msn_ns_callback, ic );
     78                set_login_progress( ic, 1, "Connected to server, waiting for reply" );
    7979        }
    8080       
     
    8484static gboolean msn_ns_callback( gpointer data, gint source, b_input_condition cond )
    8585{
    86         struct gaim_connection *gc = data;
    87         struct msn_data *md = gc->proto_data;
     86        struct im_connection *ic = data;
     87        struct msn_data *md = ic->proto_data;
    8888       
    8989        if( msn_handler( md->handler ) == -1 ) /* Don't do this on ret == 0, it's already done then. */
    9090        {
    91                 hide_login_progress( gc, "Error while reading from server" );
    92                 signoff( gc );
     91                hide_login_progress( ic, "Error while reading from server" );
     92                signoff( ic );
    9393               
    9494                return FALSE;
     
    100100static int msn_ns_command( gpointer data, char **cmd, int num_parts )
    101101{
    102         struct gaim_connection *gc = data;
    103         struct msn_data *md = gc->proto_data;
     102        struct im_connection *ic = data;
     103        struct msn_data *md = ic->proto_data;
    104104        char buf[1024];
    105105       
     
    114114                if( cmd[2] && strncmp( cmd[2], "MSNP8", 5 ) != 0 )
    115115                {
    116                         hide_login_progress( gc, "Unsupported protocol" );
    117                         signoff( gc );
     116                        hide_login_progress( ic, "Unsupported protocol" );
     117                        signoff( ic );
    118118                        return( 0 );
    119119                }
    120120               
    121121                g_snprintf( buf, sizeof( buf ), "CVR %d 0x0409 mac 10.2.0 ppc macmsgs 3.5.1 macmsgs %s\r\n",
    122                                                 ++md->trId, gc->username );
    123                 return( msn_write( gc, buf, strlen( buf ) ) );
     122                                                ++md->trId, ic->username );
     123                return( msn_write( ic, buf, strlen( buf ) ) );
    124124        }
    125125        else if( strcmp( cmd[0], "CVR" ) == 0 )
    126126        {
    127127                /* We don't give a damn about the information we just received */
    128                 g_snprintf( buf, sizeof( buf ), "USR %d TWN I %s\r\n", ++md->trId, gc->username );
    129                 return( msn_write( gc, buf, strlen( buf ) ) );
     128                g_snprintf( buf, sizeof( buf ), "USR %d TWN I %s\r\n", ++md->trId, ic->username );
     129                return( msn_write( ic, buf, strlen( buf ) ) );
    130130        }
    131131        else if( strcmp( cmd[0], "XFR" ) == 0 )
     
    136136                if( num_parts == 6 && strcmp( cmd[2], "NS" ) == 0 )
    137137                {
    138                         b_event_remove( gc->inpa );
    139                         gc->inpa = 0;
     138                        b_event_remove( ic->inpa );
     139                        ic->inpa = 0;
    140140                        closesocket( md->fd );
    141141                       
     
    143143                        if( !server )
    144144                        {
    145                                 hide_login_progress_error( gc, "Syntax error" );
    146                                 signoff( gc );
     145                                hide_login_progress_error( ic, "Syntax error" );
     146                                signoff( ic );
    147147                                return( 0 );
    148148                        }
     
    151151                        server = cmd[3];
    152152                       
    153                         set_login_progress( gc, 1, "Transferring to other server" );
    154                        
    155                         md->fd = proxy_connect( server, port, msn_ns_connected, gc );
     153                        set_login_progress( ic, 1, "Transferring to other server" );
     154                       
     155                        md->fd = proxy_connect( server, port, msn_ns_connected, ic );
    156156                }
    157157                else if( num_parts == 6 && strcmp( cmd[2], "SB" ) == 0 )
     
    162162                        if( !server )
    163163                        {
    164                                 hide_login_progress_error( gc, "Syntax error" );
    165                                 signoff( gc );
     164                                hide_login_progress_error( ic, "Syntax error" );
     165                                signoff( ic );
    166166                                return( 0 );
    167167                        }
     
    172172                        if( strcmp( cmd[4], "CKI" ) != 0 )
    173173                        {
    174                                 hide_login_progress_error( gc, "Unknown authentication method for switchboard" );
    175                                 signoff( gc );
     174                                hide_login_progress_error( ic, "Unknown authentication method for switchboard" );
     175                                signoff( ic );
    176176                                return( 0 );
    177177                        }
    178178                       
    179179                        debug( "Connecting to a new switchboard with key %s", cmd[5] );
    180                         sb = msn_sb_create( gc, server, port, cmd[5], MSN_SB_NEW );
     180                        sb = msn_sb_create( ic, server, port, cmd[5], MSN_SB_NEW );
    181181                       
    182182                        if( md->msgq )
     
    204204                else
    205205                {
    206                         hide_login_progress_error( gc, "Syntax error" );
    207                         signoff( gc );
     206                        hide_login_progress_error( ic, "Syntax error" );
     207                        signoff( ic );
    208208                        return( 0 );
    209209                }
     
    214214                {
    215215                        /* Time for some Passport black magic... */
    216                         if( !passport_get_id( msn_auth_got_passport_id, gc, gc->username, gc->password, cmd[4] ) )
    217                         {
    218                                 hide_login_progress_error( gc, "Error while contacting Passport server" );
    219                                 signoff( gc );
     216                        if( !passport_get_id( msn_auth_got_passport_id, ic, ic->username, ic->password, cmd[4] ) )
     217                        {
     218                                hide_login_progress_error( ic, "Error while contacting Passport server" );
     219                                signoff( ic );
    220220                                return( 0 );
    221221                        }
     
    227227                        http_decode( cmd[4] );
    228228                       
    229                         strncpy( gc->displayname, cmd[4], sizeof( gc->displayname ) );
    230                         gc->displayname[sizeof(gc->displayname)-1] = 0;
    231                        
    232                         if( ( s = set_find( &gc->acc->set, "display_name" ) ) )
     229                        strncpy( ic->displayname, cmd[4], sizeof( ic->displayname ) );
     230                        ic->displayname[sizeof(ic->displayname)-1] = 0;
     231                       
     232                        if( ( s = set_find( &ic->acc->set, "display_name" ) ) )
    233233                        {
    234234                                g_free( s->value );
     
    236236                        }
    237237                       
    238                         set_login_progress( gc, 1, "Authenticated, getting buddy list" );
     238                        set_login_progress( ic, 1, "Authenticated, getting buddy list" );
    239239                       
    240240                        g_snprintf( buf, sizeof( buf ), "SYN %d 0\r\n", ++md->trId );
    241                         return( msn_write( gc, buf, strlen( buf ) ) );
     241                        return( msn_write( ic, buf, strlen( buf ) ) );
    242242                }
    243243                else
    244244                {
    245                         hide_login_progress( gc, "Unknown authentication type" );
    246                         signoff( gc );
     245                        hide_login_progress( ic, "Unknown authentication type" );
     246                        signoff( ic );
    247247                        return( 0 );
    248248                }
     
    252252                if( num_parts != 4 )
    253253                {
    254                         hide_login_progress_error( gc, "Syntax error" );
    255                         signoff( gc );
     254                        hide_login_progress_error( ic, "Syntax error" );
     255                        signoff( ic );
    256256                        return( 0 );
    257257                }
     
    261261                if( md->handler->msglen <= 0 )
    262262                {
    263                         hide_login_progress_error( gc, "Syntax error" );
    264                         signoff( gc );
     263                        hide_login_progress_error( ic, "Syntax error" );
     264                        signoff( ic );
    265265                        return( 0 );
    266266                }
     
    276276                       
    277277                        if( !*cmd[3] || md->buddycount == 0 )
    278                                 msn_logged_in( gc );
     278                                msn_logged_in( ic );
    279279                }
    280280                else
     
    283283                           Let's assume everything is okay. */
    284284                       
    285                         msn_logged_in( gc );
     285                        msn_logged_in( ic );
    286286                }
    287287        }
     
    292292                if( num_parts != 4 && num_parts != 5 )
    293293                {
    294                         hide_login_progress( gc, "Syntax error" );
    295                         signoff( gc );
     294                        hide_login_progress( ic, "Syntax error" );
     295                        signoff( ic );
    296296                        return( 0 );
    297297                }
     
    308308                                group = md->grouplist[num];
    309309                       
    310                         add_buddy( gc, group, cmd[1], cmd[2] );
     310                        add_buddy( ic, group, cmd[1], cmd[2] );
    311311                }
    312312                if( list & 2 ) /* AL */
    313313                {
    314                         gc->permit = g_slist_append( gc->permit, g_strdup( cmd[1] ) );
     314                        ic->permit = g_slist_append( ic->permit, g_strdup( cmd[1] ) );
    315315                }
    316316                if( list & 4 ) /* BL */
    317317                {
    318                         gc->deny = g_slist_append( gc->deny, g_strdup( cmd[1] ) );
     318                        ic->deny = g_slist_append( ic->deny, g_strdup( cmd[1] ) );
    319319                }
    320320                if( list & 8 ) /* RL */
    321321                {
    322322                        if( ( list & 6 ) == 0 )
    323                                 msn_buddy_ask( gc, cmd[1], cmd[2] );
     323                                msn_buddy_ask( ic, cmd[1], cmd[2] );
    324324                }
    325325               
    326326                if( --md->buddycount == 0 )
    327327                {
    328                         if( gc->flags & OPT_LOGGED_IN )
    329                         {
    330                                 serv_got_crap( gc, "Successfully transferred to different server" );
     328                        if( ic->flags & OPT_LOGGED_IN )
     329                        {
     330                                serv_got_crap( ic, "Successfully transferred to different server" );
    331331                                g_snprintf( buf, sizeof( buf ), "CHG %d %s %d\r\n", ++md->trId, md->away_state->code, 0 );
    332                                 return( msn_write( gc, buf, strlen( buf ) ) );
     332                                return( msn_write( ic, buf, strlen( buf ) ) );
    333333                        }
    334334                        else
    335335                        {
    336                                 msn_logged_in( gc );
     336                                msn_logged_in( ic );
    337337                        }
    338338                }
     
    344344                if( num_parts != 4 )
    345345                {
    346                         hide_login_progress_error( gc, "Syntax error" );
    347                         signoff( gc );
     346                        hide_login_progress_error( ic, "Syntax error" );
     347                        signoff( ic );
    348348                        return( 0 );
    349349                }
     
    363363                if( num_parts != 3 )
    364364                {
    365                         hide_login_progress_error( gc, "Syntax error" );
    366                         signoff( gc );
     365                        hide_login_progress_error( ic, "Syntax error" );
     366                        signoff( ic );
    367367                        return( 0 );
    368368                }
     
    377377                        g_snprintf( buf + strlen( buf ), 3, "%02x", digest[i] );
    378378               
    379                 return( msn_write( gc, buf, strlen( buf ) ) );
     379                return( msn_write( ic, buf, strlen( buf ) ) );
    380380        }
    381381        else if( strcmp( cmd[0], "ILN" ) == 0 )
     
    385385                if( num_parts != 6 )
    386386                {
    387                         hide_login_progress_error( gc, "Syntax error" );
    388                         signoff( gc );
     387                        hide_login_progress_error( ic, "Syntax error" );
     388                        signoff( ic );
    389389                        return( 0 );
    390390                }
    391391               
    392392                http_decode( cmd[4] );
    393                 serv_buddy_rename( gc, cmd[3], cmd[4] );
     393                serv_buddy_rename( ic, cmd[3], cmd[4] );
    394394               
    395395                st = msn_away_state_by_code( cmd[2] );
     
    400400                }
    401401               
    402                 serv_got_update( gc, cmd[3], 1, 0, 0, 0, st->number, 0 );
     402                serv_got_update( ic, cmd[3], 1, 0, 0, 0, st->number, 0 );
    403403        }
    404404        else if( strcmp( cmd[0], "FLN" ) == 0 )
    405405        {
    406406                if( cmd[1] )
    407                         serv_got_update( gc, cmd[1], 0, 0, 0, 0, 0, 0 );
     407                        serv_got_update( ic, cmd[1], 0, 0, 0, 0, 0, 0 );
    408408        }
    409409        else if( strcmp( cmd[0], "NLN" ) == 0 )
     
    413413                if( num_parts != 5 )
    414414                {
    415                         hide_login_progress_error( gc, "Syntax error" );
    416                         signoff( gc );
     415                        hide_login_progress_error( ic, "Syntax error" );
     416                        signoff( ic );
    417417                        return( 0 );
    418418                }
    419419               
    420420                http_decode( cmd[3] );
    421                 serv_buddy_rename( gc, cmd[2], cmd[3] );
     421                serv_buddy_rename( ic, cmd[2], cmd[3] );
    422422               
    423423                st = msn_away_state_by_code( cmd[1] );
     
    428428                }
    429429               
    430                 serv_got_update( gc, cmd[2], 1, 0, 0, 0, st->number, 0 );
     430                serv_got_update( ic, cmd[2], 1, 0, 0, 0, st->number, 0 );
    431431        }
    432432        else if( strcmp( cmd[0], "RNG" ) == 0 )
     
    438438                if( num_parts != 7 )
    439439                {
    440                         hide_login_progress_error( gc, "Syntax error" );
    441                         signoff( gc );
     440                        hide_login_progress_error( ic, "Syntax error" );
     441                        signoff( ic );
    442442                        return( 0 );
    443443                }
     
    448448                if( !server )
    449449                {
    450                         hide_login_progress_error( gc, "Syntax error" );
    451                         signoff( gc );
     450                        hide_login_progress_error( ic, "Syntax error" );
     451                        signoff( ic );
    452452                        return( 0 );
    453453                }
     
    458458                if( strcmp( cmd[3], "CKI" ) != 0 )
    459459                {
    460                         hide_login_progress_error( gc, "Unknown authentication method for switchboard" );
    461                         signoff( gc );
     460                        hide_login_progress_error( ic, "Unknown authentication method for switchboard" );
     461                        signoff( ic );
    462462                        return( 0 );
    463463                }
     
    465465                debug( "Got a call from %s (session %d). Key = %s", cmd[5], session, cmd[4] );
    466466               
    467                 sb = msn_sb_create( gc, server, port, cmd[4], session );
     467                sb = msn_sb_create( ic, server, port, cmd[4], session );
    468468                sb->who = g_strdup( cmd[5] );
    469469        }
     
    478478                        if( strchr( cmd[4], '@' ) == NULL )
    479479                        {
    480                                 hide_login_progress_error( gc, "Syntax error" );
    481                                 signoff( gc );
     480                                hide_login_progress_error( ic, "Syntax error" );
     481                                signoff( ic );
    482482                                return( 0 );
    483483                        }
    484484                       
    485485                        /* We got added by someone. If we don't have this person in permit/deny yet, inform the user. */
    486                         for( l = gc->permit; l; l = l->next )
     486                        for( l = ic->permit; l; l = l->next )
    487487                                if( g_strcasecmp( l->data, cmd[4] ) == 0 )
    488488                                        return( 1 );
    489489                       
    490                         for( l = gc->deny; l; l = l->next )
     490                        for( l = ic->deny; l; l = l->next )
    491491                                if( g_strcasecmp( l->data, cmd[4] ) == 0 )
    492492                                        return( 1 );
    493493                       
    494                         msn_buddy_ask( gc, cmd[4], cmd[5] );
     494                        msn_buddy_ask( ic, cmd[4], cmd[5] );
    495495                }
    496496        }
     
    499499                if( cmd[1] && strcmp( cmd[1], "OTH" ) == 0 )
    500500                {
    501                         hide_login_progress_error( gc, "Someone else logged in with your account" );
    502                         gc->wants_to_die = 1;
     501                        hide_login_progress_error( ic, "Someone else logged in with your account" );
     502                        ic->wants_to_die = 1;
    503503                }
    504504                else if( cmd[1] && strcmp( cmd[1], "SSD" ) == 0 )
    505505                {
    506                         hide_login_progress_error( gc, "Terminating session because of server shutdown" );
     506                        hide_login_progress_error( ic, "Terminating session because of server shutdown" );
    507507                }
    508508                else
    509509                {
    510                         hide_login_progress_error( gc, "Session terminated by remote server (reason unknown)" );
    511                 }
    512                
    513                 signoff( gc );
     510                        hide_login_progress_error( ic, "Session terminated by remote server (reason unknown)" );
     511                }
     512               
     513                signoff( ic );
    514514                return( 0 );
    515515        }
     
    518518                if( num_parts != 5 )
    519519                {
    520                         hide_login_progress_error( gc, "Syntax error" );
    521                         signoff( gc );
    522                         return( 0 );
    523                 }
    524                
    525                 if( g_strcasecmp( cmd[3], gc->username ) == 0 )
     520                        hide_login_progress_error( ic, "Syntax error" );
     521                        signoff( ic );
     522                        return( 0 );
     523                }
     524               
     525                if( g_strcasecmp( cmd[3], ic->username ) == 0 )
    526526                {
    527527                        set_t *s;
    528528                       
    529529                        http_decode( cmd[4] );
    530                         strncpy( gc->displayname, cmd[4], sizeof( gc->displayname ) );
    531                         gc->displayname[sizeof(gc->displayname)-1] = 0;
    532                        
    533                         if( ( s = set_find( &gc->acc->set, "display_name" ) ) )
     530                        strncpy( ic->displayname, cmd[4], sizeof( ic->displayname ) );
     531                        ic->displayname[sizeof(ic->displayname)-1] = 0;
     532                       
     533                        if( ( s = set_find( &ic->acc->set, "display_name" ) ) )
    534534                        {
    535535                                g_free( s->value );
     
    541541                        /* This is not supposed to happen, but let's handle it anyway... */
    542542                        http_decode( cmd[4] );
    543                         serv_buddy_rename( gc, cmd[3], cmd[4] );
     543                        serv_buddy_rename( ic, cmd[3], cmd[4] );
    544544                }
    545545        }
    546546        else if( strcmp( cmd[0], "IPG" ) == 0 )
    547547        {
    548                 do_error_dialog( gc, "Received IPG command, we don't handle them yet.", "MSN" );
     548                do_error_dialog( ic, "Received IPG command, we don't handle them yet.", "MSN" );
    549549               
    550550                md->handler->msglen = atoi( cmd[1] );
     
    552552                if( md->handler->msglen <= 0 )
    553553                {
    554                         hide_login_progress_error( gc, "Syntax error" );
    555                         signoff( gc );
     554                        hide_login_progress_error( ic, "Syntax error" );
     555                        signoff( ic );
    556556                        return( 0 );
    557557                }
     
    563563               
    564564                g_snprintf( buf, sizeof( buf ), "Error reported by MSN server: %s", err->text );
    565                 do_error_dialog( gc, buf, "MSN" );
     565                do_error_dialog( ic, buf, "MSN" );
    566566               
    567567                if( err->flags & STATUS_FATAL )
    568568                {
    569                         signoff( gc );
     569                        signoff( ic );
    570570                        return( 0 );
    571571                }
     
    581581static int msn_ns_message( gpointer data, char *msg, int msglen, char **cmd, int num_parts )
    582582{
    583         struct gaim_connection *gc = data;
     583        struct im_connection *ic = data;
    584584        char *body;
    585585        int blen = 0;
     
    617617                                {
    618618                                        if( arg1 )
    619                                                 serv_got_crap( gc, "The server is going down for maintenance in %s minutes.", arg1 );
     619                                                serv_got_crap( ic, "The server is going down for maintenance in %s minutes.", arg1 );
    620620                                }
    621621                               
     
    634634                                if( inbox && folders )
    635635                                {
    636                                         serv_got_crap( gc, "INBOX contains %s new messages, plus %s messages in other folders.", inbox, folders );
     636                                        serv_got_crap( ic, "INBOX contains %s new messages, plus %s messages in other folders.", inbox, folders );
    637637                                }
    638638                        }
     
    644644                                if( from && fromname )
    645645                                {
    646                                         serv_got_crap( gc, "Received an e-mail message from %s <%s>.", fromname, from );
     646                                        serv_got_crap( ic, "Received an e-mail message from %s <%s>.", fromname, from );
    647647                                }
    648648                        }
     
    665665static void msn_auth_got_passport_id( struct passport_reply *rep )
    666666{
    667         struct gaim_connection *gc = rep->data;
    668         struct msn_data *md = gc->proto_data;
     667        struct im_connection *ic = rep->data;
     668        struct msn_data *md = ic->proto_data;
    669669        char *key = rep->result;
    670670        char buf[1024];
     
    677677                                       rep->error_string ? rep->error_string : "Unknown error" );
    678678               
    679                 hide_login_progress( gc, err );
    680                 signoff( gc );
     679                hide_login_progress( ic, err );
     680                signoff( ic );
    681681               
    682682                g_free( err );
     
    685685        {
    686686                g_snprintf( buf, sizeof( buf ), "USR %d TWN S %s\r\n", ++md->trId, key );
    687                 msn_write( gc, buf, strlen( buf ) );
     687                msn_write( ic, buf, strlen( buf ) );
    688688        }
    689689}
  • protocols/msn/sb.c

    rfa29d093 r0da65d5  
    4848}
    4949
    50 struct msn_switchboard *msn_sb_create( struct gaim_connection *gc, char *host, int port, char *key, int session )
    51 {
    52         struct msn_data *md = gc->proto_data;
     50struct msn_switchboard *msn_sb_create( struct im_connection *ic, char *host, int port, char *key, int session )
     51{
     52        struct msn_data *md = ic->proto_data;
    5353        struct msn_switchboard *sb = g_new0( struct msn_switchboard, 1 );
    5454       
     
    6060        }
    6161       
    62         sb->gc = gc;
     62        sb->ic = ic;
    6363        sb->key = g_strdup( key );
    6464        sb->session = session;
     
    7070}
    7171
    72 struct msn_switchboard *msn_sb_by_handle( struct gaim_connection *gc, char *handle )
    73 {
    74         struct msn_data *md = gc->proto_data;
     72struct msn_switchboard *msn_sb_by_handle( struct im_connection *ic, char *handle )
     73{
     74        struct msn_data *md = ic->proto_data;
    7575        struct msn_switchboard *sb;
    7676        GSList *l;
     
    8686}
    8787
    88 struct msn_switchboard *msn_sb_by_chat( struct conversation *c )
    89 {
    90         struct msn_data *md = c->gc->proto_data;
     88struct msn_switchboard *msn_sb_by_chat( struct groupchat *c )
     89{
     90        struct msn_data *md = c->ic->proto_data;
    9191        struct msn_switchboard *sb;
    9292        GSList *l;
     
    102102}
    103103
    104 struct msn_switchboard *msn_sb_spare( struct gaim_connection *gc )
    105 {
    106         struct msn_data *md = gc->proto_data;
     104struct msn_switchboard *msn_sb_spare( struct im_connection *ic )
     105{
     106        struct msn_data *md = ic->proto_data;
    107107        struct msn_switchboard *sb;
    108108        GSList *l;
     
    142142                else
    143143                {
    144                         i = strlen( MSN_TYPING_HEADERS ) + strlen( sb->gc->username );
     144                        i = strlen( MSN_TYPING_HEADERS ) + strlen( sb->ic->username );
    145145                        buf = g_new0( char, i );
    146                         i = g_snprintf( buf, i, MSN_TYPING_HEADERS, sb->gc->username );
     146                        i = g_snprintf( buf, i, MSN_TYPING_HEADERS, sb->ic->username );
    147147                }
    148148               
     
    177177}
    178178
    179 struct conversation *msn_sb_to_chat( struct msn_switchboard *sb )
    180 {
    181         struct gaim_connection *gc = sb->gc;
     179struct groupchat *msn_sb_to_chat( struct msn_switchboard *sb )
     180{
     181        struct im_connection *ic = sb->ic;
    182182        char buf[1024];
    183183       
    184184        /* Create the groupchat structure. */
    185185        g_snprintf( buf, sizeof( buf ), "MSN groupchat session %d", sb->session );
    186         sb->chat = serv_got_joined_chat( gc, buf );
     186        sb->chat = serv_got_joined_chat( ic, buf );
    187187       
    188188        /* Populate the channel. */
    189189        if( sb->who ) add_chat_buddy( sb->chat, sb->who );
    190         add_chat_buddy( sb->chat, gc->username );
     190        add_chat_buddy( sb->chat, ic->username );
    191191       
    192192        /* And make sure the switchboard doesn't look like a regular chat anymore. */
     
    202202void msn_sb_destroy( struct msn_switchboard *sb )
    203203{
    204         struct gaim_connection *gc = sb->gc;
    205         struct msn_data *md = gc->proto_data;
     204        struct im_connection *ic = sb->ic;
     205        struct msn_data *md = ic->proto_data;
    206206       
    207207        debug( "Destroying switchboard: %s", sb->who ? sb->who : sb->key ? sb->key : "" );
     
    222222                g_slist_free( sb->msgq );
    223223               
    224                 serv_got_crap( gc, "Warning: Closing down MSN switchboard connection with "
     224                serv_got_crap( ic, "Warning: Closing down MSN switchboard connection with "
    225225                                   "unsent message to %s, you'll have to resend it.",
    226226                                   sb->who ? sb->who : "(unknown)" );
     
    253253{
    254254        struct msn_switchboard *sb = data;
    255         struct gaim_connection *gc;
     255        struct im_connection *ic;
    256256        struct msn_data *md;
    257257        char buf[1024];
     
    261261                return FALSE;
    262262       
    263         gc = sb->gc;
    264         md = gc->proto_data;
     263        ic = sb->ic;
     264        md = ic->proto_data;
    265265       
    266266        if( source != sb->fd )
     
    280280       
    281281        if( sb->session == MSN_SB_NEW )
    282                 g_snprintf( buf, sizeof( buf ), "USR %d %s %s\r\n", ++sb->trId, gc->username, sb->key );
     282                g_snprintf( buf, sizeof( buf ), "USR %d %s %s\r\n", ++sb->trId, ic->username, sb->key );
    283283        else
    284                 g_snprintf( buf, sizeof( buf ), "ANS %d %s %s %d\r\n", ++sb->trId, gc->username, sb->key, sb->session );
     284                g_snprintf( buf, sizeof( buf ), "ANS %d %s %s %d\r\n", ++sb->trId, ic->username, sb->key, sb->session );
    285285       
    286286        if( msn_sb_write( sb, buf, strlen( buf ) ) )
     
    310310{
    311311        struct msn_switchboard *sb = data;
    312         struct gaim_connection *gc = sb->gc;
     312        struct im_connection *ic = sb->ic;
    313313        char buf[1024];
    314314       
     
    321321        if( strcmp( cmd[0], "XFR" ) == 0 )
    322322        {
    323                 hide_login_progress_error( gc, "Received an XFR from a switchboard server, unable to comply! This is likely to be a bug, please report it!" );
    324                 signoff( gc );
     323                hide_login_progress_error( ic, "Received an XFR from a switchboard server, unable to comply! This is likely to be a bug, please report it!" );
     324                signoff( ic );
    325325                return( 0 );
    326326        }
     
    374374                        {
    375375                                g_snprintf( buf, sizeof( buf ), "MSN groupchat session %d", sb->session );
    376                                 sb->chat = serv_got_joined_chat( gc, buf );
     376                                sb->chat = serv_got_joined_chat( ic, buf );
    377377                               
    378378                                g_free( sb->who );
     
    384384                        if( num == tot )
    385385                        {
    386                                 add_chat_buddy( sb->chat, gc->username );
     386                                add_chat_buddy( sb->chat, ic->username );
    387387                        }
    388388                }
     
    529529               
    530530                g_snprintf( buf, sizeof( buf ), "Error reported by switchboard server: %s", err->text );
    531                 do_error_dialog( gc, buf, "MSN" );
     531                do_error_dialog( ic, buf, "MSN" );
    532532               
    533533                if( err->flags & STATUS_SB_FATAL )
     
    538538                else if( err->flags & STATUS_FATAL )
    539539                {
    540                         signoff( gc );
     540                        signoff( ic );
    541541                        return 0;
    542542                }
     
    579579{
    580580        struct msn_switchboard *sb = data;
    581         struct gaim_connection *gc = sb->gc;
     581        struct im_connection *ic = sb->ic;
    582582        char *body;
    583583        int blen = 0;
     
    608608                        if( sb->who )
    609609                        {
    610                                 serv_got_im( gc, cmd[1], body, 0, 0, blen );
     610                                serv_got_im( ic, cmd[1], body, 0, 0, blen );
    611611                        }
    612612                        else if( sb->chat )
     
    667667                        if( sb->who )
    668668                        {
    669                                 serv_got_im( gc, cmd[1], buf, 0, 0, strlen( buf ) );
     669                                serv_got_im( ic, cmd[1], buf, 0, 0, strlen( buf ) );
    670670                        }
    671671                        else if( sb->chat )
     
    684684                        if( who )
    685685                        {
    686                                 serv_got_typing( gc, who, 5, 1 );
     686                                serv_got_typing( ic, who, 5, 1 );
    687687                                g_free( who );
    688688                        }
  • protocols/nogaim.c

    rfa29d093 r0da65d5  
    3636#include <ctype.h>
    3737
    38 static int remove_chat_buddy_silent( struct conversation *b, char *handle );
     38static int remove_chat_buddy_silent( struct groupchat *b, char *handle );
    3939
    4040GSList *connections;
     
    115115void nogaim_init()
    116116{
    117         extern void msn_init();
    118         extern void oscar_init();
    119         extern void byahoo_init();
    120         extern void jabber_init();
     117        extern void msn_initmodule();
     118        extern void oscar_initmodule();
     119        extern void byahoo_initmodule();
     120        extern void jabber_initmodule();
    121121
    122122#ifdef WITH_MSN
    123         msn_init();
     123        msn_initmodule();
    124124#endif
    125125
    126126#ifdef WITH_OSCAR
    127         oscar_init();
     127        oscar_initmodule();
    128128#endif
    129129       
    130130#ifdef WITH_YAHOO
    131         byahoo_init();
     131        byahoo_initmodule();
    132132#endif
    133133       
    134134#ifdef WITH_JABBER
    135         jabber_init();
     135        jabber_initmodule();
    136136#endif
    137137
     
    145145/* multi.c */
    146146
    147 struct gaim_connection *new_gaim_conn( account_t *acc )
    148 {
    149         struct gaim_connection *gc;
    150        
    151         gc = g_new0( struct gaim_connection, 1 );
     147struct im_connection *new_gaim_conn( account_t *acc )
     148{
     149        struct im_connection *ic;
     150       
     151        ic = g_new0( struct im_connection, 1 );
    152152       
    153153        /* Maybe we should get rid of this memory waste later. ;-) */
    154         g_snprintf( gc->username, sizeof( gc->username ), "%s", acc->user );
    155         g_snprintf( gc->password, sizeof( gc->password ), "%s", acc->pass );
    156        
    157         gc->irc = acc->irc;
    158         gc->acc = acc;
    159         acc->gc = gc;
    160        
    161         connections = g_slist_append( connections, gc );
    162        
    163         return( gc );
    164 }
    165 
    166 void destroy_gaim_conn( struct gaim_connection *gc )
     154        g_snprintf( ic->username, sizeof( ic->username ), "%s", acc->user );
     155        g_snprintf( ic->password, sizeof( ic->password ), "%s", acc->pass );
     156       
     157        ic->irc = acc->irc;
     158        ic->acc = acc;
     159        acc->ic = ic;
     160       
     161        connections = g_slist_append( connections, ic );
     162       
     163        return( ic );
     164}
     165
     166void destroy_gaim_conn( struct im_connection *ic )
    167167{
    168168        account_t *a;
    169169       
    170170        /* Destroy the pointer to this connection from the account list */
    171         for( a = gc->irc->accounts; a; a = a->next )
    172                 if( a->gc == gc )
    173                 {
    174                         a->gc = NULL;
     171        for( a = ic->irc->accounts; a; a = a->next )
     172                if( a->ic == ic )
     173                {
     174                        a->ic = NULL;
    175175                        break;
    176176                }
    177177       
    178         connections = g_slist_remove( connections, gc );
    179         g_free( gc );
    180 }
    181 
    182 void set_login_progress( struct gaim_connection *gc, int step, char *msg )
    183 {
    184         serv_got_crap( gc, "Logging in: %s", msg );
     178        connections = g_slist_remove( connections, ic );
     179        g_free( ic );
     180}
     181
     182void set_login_progress( struct im_connection *ic, int step, char *msg )
     183{
     184        serv_got_crap( ic, "Logging in: %s", msg );
    185185}
    186186
    187187/* Errors *while* logging in */
    188 void hide_login_progress( struct gaim_connection *gc, char *msg )
    189 {
    190         serv_got_crap( gc, "Login error: %s", msg );
     188void hide_login_progress( struct im_connection *ic, char *msg )
     189{
     190        serv_got_crap( ic, "Login error: %s", msg );
    191191}
    192192
    193193/* Errors *after* logging in */
    194 void hide_login_progress_error( struct gaim_connection *gc, char *msg )
    195 {
    196         serv_got_crap( gc, "Logged out: %s", msg );
    197 }
    198 
    199 void serv_got_crap( struct gaim_connection *gc, char *format, ... )
     194void hide_login_progress_error( struct im_connection *ic, char *msg )
     195{
     196        serv_got_crap( ic, "Logged out: %s", msg );
     197}
     198
     199void serv_got_crap( struct im_connection *ic, char *format, ... )
    200200{
    201201        va_list params;
     
    207207        va_end( params );
    208208
    209         if( ( g_strcasecmp( set_getstr( &gc->irc->set, "strip_html" ), "always" ) == 0 ) ||
    210             ( ( gc->flags & OPT_CONN_HTML ) && set_getbool( &gc->irc->set, "strip_html" ) ) )
     209        if( ( g_strcasecmp( set_getstr( &ic->irc->set, "strip_html" ), "always" ) == 0 ) ||
     210            ( ( ic->flags & OPT_CONN_HTML ) && set_getbool( &ic->irc->set, "strip_html" ) ) )
    211211                strip_html( text );
    212212       
    213213        /* Try to find a different connection on the same protocol. */
    214         for( a = gc->irc->accounts; a; a = a->next )
    215                 if( a->prpl == gc->acc->prpl && a->gc != gc )
     214        for( a = ic->irc->accounts; a; a = a->next )
     215                if( a->prpl == ic->acc->prpl && a->ic != ic )
    216216                        break;
    217217       
    218218        /* If we found one, include the screenname in the message. */
    219219        if( a )
    220                 irc_usermsg( gc->irc, "%s(%s) - %s", gc->acc->prpl->name, gc->username, text );
     220                irc_usermsg( ic->irc, "%s(%s) - %s", ic->acc->prpl->name, ic->username, text );
    221221        else
    222                 irc_usermsg( gc->irc, "%s - %s", gc->acc->prpl->name, text );
     222                irc_usermsg( ic->irc, "%s - %s", ic->acc->prpl->name, text );
    223223       
    224224        g_free( text );
     
    227227static gboolean send_keepalive( gpointer d, gint fd, b_input_condition cond )
    228228{
    229         struct gaim_connection *gc = d;
    230        
    231         if( gc->acc->prpl->keepalive )
    232                 gc->acc->prpl->keepalive( gc );
     229        struct im_connection *ic = d;
     230       
     231        if( ic->acc->prpl->keepalive )
     232                ic->acc->prpl->keepalive( ic );
    233233       
    234234        return TRUE;
    235235}
    236236
    237 void account_online( struct gaim_connection *gc )
     237void account_online( struct im_connection *ic )
    238238{
    239239        user_t *u;
     
    242242           the whole login sequence again, so these "late" calls to this
    243243           function should be handled correctly. (IOW, ignored) */
    244         if( gc->flags & OPT_LOGGED_IN )
     244        if( ic->flags & OPT_LOGGED_IN )
    245245                return;
    246246       
    247         u = user_find( gc->irc, gc->irc->nick );
    248        
    249         serv_got_crap( gc, "Logged in" );
    250        
    251         gc->keepalive = b_timeout_add( 60000, send_keepalive, gc );
    252         gc->flags |= OPT_LOGGED_IN;
     247        u = user_find( ic->irc, ic->irc->nick );
     248       
     249        serv_got_crap( ic, "Logged in" );
     250       
     251        ic->keepalive = b_timeout_add( 60000, send_keepalive, ic );
     252        ic->flags |= OPT_LOGGED_IN;
    253253       
    254254        /* Also necessary when we're not away, at least for some of the
    255255           protocols. */
    256         bim_set_away( gc, u->away );
     256        bim_set_away( ic, u->away );
    257257}
    258258
     
    274274}
    275275
    276 void signoff( struct gaim_connection *gc )
    277 {
    278         irc_t *irc = gc->irc;
     276void signoff( struct im_connection *ic )
     277{
     278        irc_t *irc = ic->irc;
    279279        user_t *t, *u = irc->users;
    280280        account_t *a;
     
    282282        /* Nested calls might happen sometimes, this is probably the best
    283283           place to catch them. */
    284         if( gc->flags & OPT_LOGGING_OUT )
     284        if( ic->flags & OPT_LOGGING_OUT )
    285285                return;
    286286        else
    287                 gc->flags |= OPT_LOGGING_OUT;
    288        
    289         serv_got_crap( gc, "Signing off.." );
    290        
    291         b_event_remove( gc->keepalive );
    292         gc->keepalive = 0;
    293         gc->acc->prpl->close( gc );
    294         b_event_remove( gc->inpa );
     287                ic->flags |= OPT_LOGGING_OUT;
     288       
     289        serv_got_crap( ic, "Signing off.." );
     290       
     291        b_event_remove( ic->keepalive );
     292        ic->keepalive = 0;
     293        ic->acc->prpl->logout( ic );
     294        b_event_remove( ic->inpa );
    295295       
    296296        while( u )
    297297        {
    298                 if( u->gc == gc )
     298                if( u->ic == ic )
    299299                {
    300300                        t = u->next;
     
    306306        }
    307307       
    308         query_del_by_gc( gc->irc, gc );
     308        query_del_by_conn( ic->irc, ic );
    309309       
    310310        for( a = irc->accounts; a; a = a->next )
    311                 if( a->gc == gc )
     311                if( a->ic == ic )
    312312                        break;
    313313       
     
    316316                /* Uhm... This is very sick. */
    317317        }
    318         else if( !gc->wants_to_die && set_getbool( &irc->set, "auto_reconnect" ) &&
     318        else if( !ic->wants_to_die && set_getbool( &irc->set, "auto_reconnect" ) &&
    319319                 set_getbool( &a->set, "auto_reconnect" ) )
    320320        {
    321321                int delay = set_getint( &irc->set, "auto_reconnect_delay" );
    322322               
    323                 serv_got_crap( gc, "Reconnecting in %d seconds..", delay );
     323                serv_got_crap( ic, "Reconnecting in %d seconds..", delay );
    324324                a->reconnect = b_timeout_add( delay * 1000, auto_reconnect, a );
    325325        }
    326326       
    327         destroy_gaim_conn( gc );
     327        destroy_gaim_conn( ic );
    328328}
    329329
     
    331331/* dialogs.c */
    332332
    333 void do_error_dialog( struct gaim_connection *gc, char *msg, char *title )
     333void do_error_dialog( struct im_connection *ic, char *msg, char *title )
    334334{
    335335        if( msg && title )
    336                 serv_got_crap( gc, "Error: %s: %s", title, msg );
     336                serv_got_crap( ic, "Error: %s: %s", title, msg );
    337337        else if( msg )
    338                 serv_got_crap( gc, "Error: %s", msg );
     338                serv_got_crap( ic, "Error: %s", msg );
    339339        else if( title )
    340                 serv_got_crap( gc, "Error: %s", title );
     340                serv_got_crap( ic, "Error: %s", title );
    341341        else
    342                 serv_got_crap( gc, "Error" );
    343 }
    344 
    345 void do_ask_dialog( struct gaim_connection *gc, char *msg, void *data, void *doit, void *dont )
    346 {
    347         query_add( gc->irc, gc, msg, doit, dont, data );
     342                serv_got_crap( ic, "Error" );
     343}
     344
     345void do_ask_dialog( struct im_connection *ic, char *msg, void *data, void *doit, void *dont )
     346{
     347        query_add( ic->irc, ic, msg, doit, dont, data );
    348348}
    349349
     
    351351/* list.c */
    352352
    353 void add_buddy( struct gaim_connection *gc, char *group, char *handle, char *realname )
     353void add_buddy( struct im_connection *ic, char *group, char *handle, char *realname )
    354354{
    355355        user_t *u;
    356356        char nick[MAX_NICK_LENGTH+1];
    357357        char *s;
    358         irc_t *irc = gc->irc;
     358        irc_t *irc = ic->irc;
    359359       
    360360        if( set_getbool( &irc->set, "debug" ) && 0 ) /* This message is too useless */
    361                 serv_got_crap( gc, "Receiving user add from handle: %s", handle );
    362        
    363         if( user_findhandle( gc, handle ) )
     361                serv_got_crap( ic, "Receiving user add from handle: %s", handle );
     362       
     363        if( user_findhandle( ic, handle ) )
    364364        {
    365365                if( set_getbool( &irc->set, "debug" ) )
    366                         serv_got_crap( gc, "User already exists, ignoring add request: %s", handle );
     366                        serv_got_crap( ic, "User already exists, ignoring add request: %s", handle );
    367367               
    368368                return;
     
    372372       
    373373        memset( nick, 0, MAX_NICK_LENGTH + 1 );
    374         strcpy( nick, nick_get( gc->acc, handle, realname ) );
    375        
    376         u = user_add( gc->irc, nick );
     374        strcpy( nick, nick_get( ic->acc, handle, realname ) );
     375       
     376        u = user_add( ic->irc, nick );
    377377       
    378378        if( !realname || !*realname ) realname = nick;
     
    384384                u->user = g_strndup( handle, s - handle );
    385385        }
    386         else if( gc->acc->server )
     386        else if( ic->acc->server )
    387387        {
    388388                char *colon;
    389389               
    390                 if( ( colon = strchr( gc->acc->server, ':' ) ) )
    391                         u->host = g_strndup( gc->acc->server,
    392                                              colon - gc->acc->server );
     390                if( ( colon = strchr( ic->acc->server, ':' ) ) )
     391                        u->host = g_strndup( ic->acc->server,
     392                                             colon - ic->acc->server );
    393393                else
    394                         u->host = g_strdup( gc->acc->server );
     394                        u->host = g_strdup( ic->acc->server );
    395395               
    396396                u->user = g_strdup( handle );
     
    403403        else
    404404        {
    405                 u->host = g_strdup( gc->acc->prpl->name );
     405                u->host = g_strdup( ic->acc->prpl->name );
    406406                u->user = g_strdup( handle );
    407407        }
    408408       
    409         u->gc = gc;
     409        u->ic = ic;
    410410        u->handle = g_strdup( handle );
    411411        if( group ) u->group = g_strdup( group );
     
    414414}
    415415
    416 struct buddy *find_buddy( struct gaim_connection *gc, char *handle )
     416struct buddy *find_buddy( struct im_connection *ic, char *handle )
    417417{
    418418        static struct buddy b[1];
    419419        user_t *u;
    420420       
    421         u = user_findhandle( gc, handle );
     421        u = user_findhandle( ic, handle );
    422422       
    423423        if( !u )
     
    428428        strncpy( b->show, u->realname, BUDDY_ALIAS_MAXLEN );
    429429        b->present = u->online;
    430         b->gc = u->gc;
     430        b->ic = u->ic;
    431431       
    432432        return( b );
    433433}
    434434
    435 void signoff_blocked( struct gaim_connection *gc )
     435void signoff_blocked( struct im_connection *ic )
    436436{
    437437        return; /* Make all blocked users look invisible (TODO?) */
     
    439439
    440440
    441 void serv_buddy_rename( struct gaim_connection *gc, char *handle, char *realname )
    442 {
    443         user_t *u = user_findhandle( gc, handle );
     441void serv_buddy_rename( struct im_connection *ic, char *handle, char *realname )
     442{
     443        user_t *u = user_findhandle( ic, handle );
    444444       
    445445        if( !u ) return;
     
    451451                u->realname = g_strdup( realname );
    452452               
    453                 if( ( gc->flags & OPT_LOGGED_IN ) && set_getbool( &gc->irc->set, "display_namechanges" ) )
    454                         serv_got_crap( gc, "User `%s' changed name to `%s'", u->nick, u->realname );
     453                if( ( ic->flags & OPT_LOGGED_IN ) && set_getbool( &ic->irc->set, "display_namechanges" ) )
     454                        serv_got_crap( ic, "User `%s' changed name to `%s'", u->nick, u->realname );
    455455        }
    456456}
     
    461461struct show_got_added_data
    462462{
    463         struct gaim_connection *gc;
     463        struct im_connection *ic;
    464464        char *handle;
    465465};
     
    473473void show_got_added_yes( gpointer w, struct show_got_added_data *data )
    474474{
    475         data->gc->acc->prpl->add_buddy( data->gc, data->handle );
    476         add_buddy( data->gc, NULL, data->handle, data->handle );
     475        data->ic->acc->prpl->add_buddy( data->ic, data->handle, NULL );
     476        add_buddy( data->ic, NULL, data->handle, data->handle );
    477477       
    478478        return show_got_added_no( w, data );
    479479}
    480480
    481 void show_got_added( struct gaim_connection *gc, char *handle, const char *realname )
     481void show_got_added( struct im_connection *ic, char *handle, const char *realname )
    482482{
    483483        struct show_got_added_data *data = g_new0( struct show_got_added_data, 1 );
     
    485485       
    486486        /* TODO: Make a setting for this! */
    487         if( user_findhandle( gc, handle ) != NULL )
     487        if( user_findhandle( ic, handle ) != NULL )
    488488                return;
    489489       
    490490        s = g_strdup_printf( "The user %s is not in your buddy list yet. Do you want to add him/her now?", handle );
    491491       
    492         data->gc = gc;
     492        data->ic = ic;
    493493        data->handle = g_strdup( handle );
    494         query_add( gc->irc, gc, s, show_got_added_yes, show_got_added_no, data );
     494        query_add( ic->irc, ic, s, show_got_added_yes, show_got_added_no, data );
    495495}
    496496
     
    498498/* server.c */                   
    499499
    500 void serv_got_update( struct gaim_connection *gc, char *handle, int loggedin, int evil, time_t signon, time_t idle, int type, guint caps )
     500void serv_got_update( struct im_connection *ic, char *handle, int loggedin, int evil, time_t signon, time_t idle, int type, guint caps )
    501501{
    502502        user_t *u;
    503503        int oa, oo;
    504504       
    505         u = user_findhandle( gc, handle );
     505        u = user_findhandle( ic, handle );
    506506       
    507507        if( !u )
    508508        {
    509                 if( g_strcasecmp( set_getstr( &gc->irc->set, "handle_unknown" ), "add" ) == 0 )
    510                 {
    511                         add_buddy( gc, NULL, handle, NULL );
    512                         u = user_findhandle( gc, handle );
     509                if( g_strcasecmp( set_getstr( &ic->irc->set, "handle_unknown" ), "add" ) == 0 )
     510                {
     511                        add_buddy( ic, NULL, handle, NULL );
     512                        u = user_findhandle( ic, handle );
    513513                }
    514514                else
    515515                {
    516                         if( set_getbool( &gc->irc->set, "debug" ) || g_strcasecmp( set_getstr( &gc->irc->set, "handle_unknown" ), "ignore" ) != 0 )
     516                        if( set_getbool( &ic->irc->set, "debug" ) || g_strcasecmp( set_getstr( &ic->irc->set, "handle_unknown" ), "ignore" ) != 0 )
    517517                        {
    518                                 serv_got_crap( gc, "serv_got_update() for handle %s:", handle );
    519                                 serv_got_crap( gc, "loggedin = %d, type = %d", loggedin, type );
     518                                serv_got_crap( ic, "serv_got_update() for handle %s:", handle );
     519                                serv_got_crap( ic, "loggedin = %d, type = %d", loggedin, type );
    520520                        }
    521521                       
     
    537537        if( loggedin && !u->online )
    538538        {
    539                 irc_spawn( gc->irc, u );
     539                irc_spawn( ic->irc, u );
    540540                u->online = 1;
    541541        }
    542542        else if( !loggedin && u->online )
    543543        {
    544                 struct conversation *c;
    545                
    546                 irc_kill( gc->irc, u );
     544                struct groupchat *c;
     545               
     546                irc_kill( ic->irc, u );
    547547                u->online = 0;
    548548               
    549549                /* Remove him/her from the conversations to prevent PART messages after he/she QUIT already */
    550                 for( c = gc->conversations; c; c = c->next )
     550                for( c = ic->conversations; c; c = c->next )
    551551                        remove_chat_buddy_silent( c, handle );
    552552        }
    553553       
    554         if( ( type & UC_UNAVAILABLE ) && ( strcmp( gc->acc->prpl->name, "oscar" ) == 0 || strcmp( gc->acc->prpl->name, "icq" ) == 0 ) )
     554        if( ( type & UC_UNAVAILABLE ) && ( strcmp( ic->acc->prpl->name, "oscar" ) == 0 || strcmp( ic->acc->prpl->name, "icq" ) == 0 ) )
    555555        {
    556556                u->away = g_strdup( "Away" );
    557557        }
    558         else if( ( type & UC_UNAVAILABLE ) && ( strcmp( gc->acc->prpl->name, "jabber" ) == 0 ) )
     558        else if( ( type & UC_UNAVAILABLE ) && ( strcmp( ic->acc->prpl->name, "jabber" ) == 0 ) )
    559559        {
    560560                if( type & UC_DND )
     
    565565                        u->away = g_strdup( "Away" );
    566566        }
    567         else if( ( type & UC_UNAVAILABLE ) && gc->acc->prpl->get_status_string )
    568         {
    569                 u->away = g_strdup( gc->acc->prpl->get_status_string( gc, type ) );
     567        else if( ( type & UC_UNAVAILABLE ) && ic->acc->prpl->get_status_string )
     568        {
     569                u->away = g_strdup( ic->acc->prpl->get_status_string( ic, type ) );
    570570        }
    571571        else
     
    573573       
    574574        /* LISPy... */
    575         if( ( set_getbool( &gc->irc->set, "away_devoice" ) ) &&         /* Don't do a thing when user doesn't want it */
     575        if( ( set_getbool( &ic->irc->set, "away_devoice" ) ) &&         /* Don't do a thing when user doesn't want it */
    576576            ( u->online ) &&                                            /* Don't touch offline people */
    577577            ( ( ( u->online != oo ) && !u->away ) ||                    /* Voice joining people */
    578578              ( ( u->online == oo ) && ( oa == !u->away ) ) ) )         /* (De)voice people changing state */
    579579        {
    580                 irc_write( gc->irc, ":%s MODE %s %cv %s", gc->irc->myhost,
    581                                                                 gc->irc->channel, u->away?'-':'+', u->nick );
    582         }
    583 }
    584 
    585 void serv_got_im( struct gaim_connection *gc, char *handle, char *msg, guint32 flags, time_t mtime, gint len )
    586 {
    587         irc_t *irc = gc->irc;
     580                irc_write( ic->irc, ":%s MODE %s %cv %s", ic->irc->myhost,
     581                                                                ic->irc->channel, u->away?'-':'+', u->nick );
     582        }
     583}
     584
     585void serv_got_im( struct im_connection *ic, char *handle, char *msg, guint32 flags, time_t mtime, gint len )
     586{
     587        irc_t *irc = ic->irc;
    588588        user_t *u;
    589589       
    590         u = user_findhandle( gc, handle );
     590        u = user_findhandle( ic, handle );
    591591       
    592592        if( !u )
     
    597597                {
    598598                        if( set_getbool( &irc->set, "debug" ) )
    599                                 serv_got_crap( gc, "Ignoring message from unknown handle %s", handle );
     599                                serv_got_crap( ic, "Ignoring message from unknown handle %s", handle );
    600600                       
    601601                        return;
     
    613613                        }
    614614                       
    615                         add_buddy( gc, NULL, handle, NULL );
    616                         u = user_findhandle( gc, handle );
     615                        add_buddy( ic, NULL, handle, NULL );
     616                        u = user_findhandle( ic, handle );
    617617                        u->is_private = private;
    618618                }
    619619                else
    620620                {
    621                         serv_got_crap( gc, "Message from unknown handle %s:", handle );
     621                        serv_got_crap( ic, "Message from unknown handle %s:", handle );
    622622                        u = user_find( irc, irc->mynick );
    623623                }
    624624        }
    625625       
    626         if( ( g_strcasecmp( set_getstr( &gc->irc->set, "strip_html" ), "always" ) == 0 ) ||
    627             ( ( gc->flags & OPT_CONN_HTML ) && set_getbool( &gc->irc->set, "strip_html" ) ) )
     626        if( ( g_strcasecmp( set_getstr( &ic->irc->set, "strip_html" ), "always" ) == 0 ) ||
     627            ( ( ic->flags & OPT_CONN_HTML ) && set_getbool( &ic->irc->set, "strip_html" ) ) )
    628628                strip_html( msg );
    629629
     
    661661}
    662662
    663 void serv_got_typing( struct gaim_connection *gc, char *handle, int timeout, int type )
     663void serv_got_typing( struct im_connection *ic, char *handle, int timeout, int type )
    664664{
    665665        user_t *u;
    666666       
    667         if( !set_getbool( &gc->irc->set, "typing_notice" ) )
     667        if( !set_getbool( &ic->irc->set, "typing_notice" ) )
    668668                return;
    669669       
    670         if( ( u = user_findhandle( gc, handle ) ) ) {
     670        if( ( u = user_findhandle( ic, handle ) ) ) {
    671671                /* If type is:
    672672                 * 0: user has stopped typing
     
    677677                        char buf[256];
    678678                        g_snprintf(buf, 256, "\1TYPING %d\1", type);
    679                         irc_privmsg( gc->irc, u, "PRIVMSG", gc->irc->nick, NULL, buf );
    680                 }
    681         }
    682 }
    683 
    684 void serv_got_chat_left( struct conversation *c )
    685 {
    686         struct gaim_connection *gc = c->gc;
    687         struct conversation *l = NULL;
     679                        irc_privmsg( ic->irc, u, "PRIVMSG", ic->irc->nick, NULL, buf );
     680                }
     681        }
     682}
     683
     684void serv_got_chat_left( struct groupchat *c )
     685{
     686        struct im_connection *ic = c->ic;
     687        struct groupchat *l = NULL;
    688688        GList *ir;
    689689       
    690         if( set_getbool( &gc->irc->set, "debug" ) )
    691                 serv_got_crap( gc, "You were removed from conversation 0x%x", (int) c );
     690        if( set_getbool( &ic->irc->set, "debug" ) )
     691                serv_got_crap( ic, "You were removed from conversation 0x%x", (int) c );
    692692       
    693693        if( c )
     
    697697                        user_t *u, *r;
    698698                       
    699                         r = user_find( gc->irc, gc->irc->mynick );
    700                         irc_privmsg( gc->irc, r, "PRIVMSG", c->channel, "", "Cleaning up channel, bye!" );
     699                        r = user_find( ic->irc, ic->irc->mynick );
     700                        irc_privmsg( ic->irc, r, "PRIVMSG", c->channel, "", "Cleaning up channel, bye!" );
    701701                       
    702                         u = user_find( gc->irc, gc->irc->nick );
    703                         irc_kick( gc->irc, u, c->channel, r );
    704                         /* irc_part( gc->irc, u, c->channel ); */
     702                        u = user_find( ic->irc, ic->irc->nick );
     703                        irc_kick( ic->irc, u, c->channel, r );
     704                        /* irc_part( ic->irc, u, c->channel ); */
    705705                }
    706706               
     
    708708                        l->next = c->next;
    709709                else
    710                         gc->conversations = c->next;
     710                        ic->conversations = c->next;
    711711               
    712712                for( ir = c->in_room; ir; ir = ir->next )
     
    719719}
    720720
    721 void serv_got_chat_in( struct conversation *c, char *who, int whisper, char *msg, time_t mtime )
    722 {
    723         struct gaim_connection *gc = c->gc;
     721void serv_got_chat_in( struct groupchat *c, char *who, int whisper, char *msg, time_t mtime )
     722{
     723        struct im_connection *ic = c->ic;
    724724        user_t *u;
    725725       
    726726        /* Gaim sends own messages through this too. IRC doesn't want this, so kill them */
    727         if( g_strcasecmp( who, gc->username ) == 0 )
     727        if( g_strcasecmp( who, ic->username ) == 0 )
    728728                return;
    729729       
    730         u = user_findhandle( gc, who );
    731        
    732         if( ( g_strcasecmp( set_getstr( &gc->irc->set, "strip_html" ), "always" ) == 0 ) ||
    733             ( ( gc->flags & OPT_CONN_HTML ) && set_getbool( &gc->irc->set, "strip_html" ) ) )
     730        u = user_findhandle( ic, who );
     731       
     732        if( ( g_strcasecmp( set_getstr( &ic->irc->set, "strip_html" ), "always" ) == 0 ) ||
     733            ( ( ic->flags & OPT_CONN_HTML ) && set_getbool( &ic->irc->set, "strip_html" ) ) )
    734734                strip_html( msg );
    735735       
    736736        if( c && u )
    737                 irc_privmsg( gc->irc, u, "PRIVMSG", c->channel, "", msg );
     737                irc_privmsg( ic->irc, u, "PRIVMSG", c->channel, "", msg );
    738738        else
    739                 serv_got_crap( gc, "Message from/to conversation %s@0x%x (unknown conv/user): %s", who, (int) c, msg );
    740 }
    741 
    742 struct conversation *serv_got_joined_chat( struct gaim_connection *gc, char *handle )
    743 {
    744         struct conversation *c;
     739                serv_got_crap( ic, "Message from/to conversation %s@0x%x (unknown conv/user): %s", who, (int) c, msg );
     740}
     741
     742struct groupchat *serv_got_joined_chat( struct im_connection *ic, char *handle )
     743{
     744        struct groupchat *c;
    745745       
    746746        /* This one just creates the conversation structure, user won't see anything yet */
    747747       
    748         if( gc->conversations )
    749         {
    750                 for( c = gc->conversations; c->next; c = c->next );
    751                 c = c->next = g_new0( struct conversation, 1 );
     748        if( ic->conversations )
     749        {
     750                for( c = ic->conversations; c->next; c = c->next );
     751                c = c->next = g_new0( struct groupchat, 1 );
    752752        }
    753753        else
    754                 gc->conversations = c = g_new0( struct conversation, 1 );
    755        
    756         c->gc = gc;
     754                ic->conversations = c = g_new0( struct groupchat, 1 );
     755       
     756        c->ic = ic;
    757757        c->title = g_strdup( handle );
    758         c->channel = g_strdup_printf( "&chat_%03d", gc->irc->c_id++ );
    759        
    760         if( set_getbool( &gc->irc->set, "debug" ) )
    761                 serv_got_crap( gc, "Creating new conversation: (id=0x%x,handle=%s)", (int) c, handle );
     758        c->channel = g_strdup_printf( "&chat_%03d", ic->irc->c_id++ );
     759       
     760        if( set_getbool( &ic->irc->set, "debug" ) )
     761                serv_got_crap( ic, "Creating new conversation: (id=0x%x,handle=%s)", (int) c, handle );
    762762       
    763763        return c;
     
    767767/* buddy_chat.c */
    768768
    769 void add_chat_buddy( struct conversation *b, char *handle )
    770 {
    771         user_t *u = user_findhandle( b->gc, handle );
     769void add_chat_buddy( struct groupchat *b, char *handle )
     770{
     771        user_t *u = user_findhandle( b->ic, handle );
    772772        int me = 0;
    773773       
    774         if( set_getbool( &b->gc->irc->set, "debug" ) )
    775                 serv_got_crap( b->gc, "User %s added to conversation 0x%x", handle, (int) b );
     774        if( set_getbool( &b->ic->irc->set, "debug" ) )
     775                serv_got_crap( b->ic, "User %s added to conversation 0x%x", handle, (int) b );
    776776       
    777777        /* It might be yourself! */
    778         if( b->gc->acc->prpl->handle_cmp( handle, b->gc->username ) == 0 )
    779         {
    780                 u = user_find( b->gc->irc, b->gc->irc->nick );
     778        if( b->ic->acc->prpl->handle_cmp( handle, b->ic->username ) == 0 )
     779        {
     780                u = user_find( b->ic->irc, b->ic->irc->nick );
    781781                if( !b->joined )
    782                         irc_join( b->gc->irc, u, b->channel );
     782                        irc_join( b->ic->irc, u, b->channel );
    783783                b->joined = me = 1;
    784784        }
     
    788788        if( !u )
    789789        {
    790                 add_buddy( b->gc, NULL, handle, NULL );
    791                 u = user_findhandle( b->gc, handle );
     790                add_buddy( b->ic, NULL, handle, NULL );
     791                u = user_findhandle( b->ic, handle );
    792792        }
    793793       
     
    796796        {
    797797                if( b->joined )
    798                         irc_join( b->gc->irc, u, b->channel );
     798                        irc_join( b->ic->irc, u, b->channel );
    799799                b->in_room = g_list_append( b->in_room, g_strdup( handle ) );
    800800        }
    801801}
    802802
    803 void remove_chat_buddy( struct conversation *b, char *handle, char *reason )
     803void remove_chat_buddy( struct groupchat *b, char *handle, char *reason )
    804804{
    805805        user_t *u;
    806806        int me = 0;
    807807       
    808         if( set_getbool( &b->gc->irc->set, "debug" ) )
    809                 serv_got_crap( b->gc, "User %s removed from conversation 0x%x (%s)", handle, (int) b, reason ? reason : "" );
     808        if( set_getbool( &b->ic->irc->set, "debug" ) )
     809                serv_got_crap( b->ic, "User %s removed from conversation 0x%x (%s)", handle, (int) b, reason ? reason : "" );
    810810       
    811811        /* It might be yourself! */
    812         if( g_strcasecmp( handle, b->gc->username ) == 0 )
    813         {
    814                 u = user_find( b->gc->irc, b->gc->irc->nick );
     812        if( g_strcasecmp( handle, b->ic->username ) == 0 )
     813        {
     814                u = user_find( b->ic->irc, b->ic->irc->nick );
    815815                b->joined = 0;
    816816                me = 1;
     
    818818        else
    819819        {
    820                 u = user_findhandle( b->gc, handle );
     820                u = user_findhandle( b->ic, handle );
    821821        }
    822822       
    823823        if( remove_chat_buddy_silent( b, handle ) )
    824824                if( ( b->joined || me ) && u )
    825                         irc_part( b->gc->irc, u, b->channel );
    826 }
    827 
    828 static int remove_chat_buddy_silent( struct conversation *b, char *handle )
     825                        irc_part( b->ic->irc, u, b->channel );
     826}
     827
     828static int remove_chat_buddy_silent( struct groupchat *b, char *handle )
    829829{
    830830        GList *i;
     
    850850/* Misc. BitlBee stuff which shouldn't really be here */
    851851
    852 struct conversation *chat_by_channel( char *channel )
    853 {
    854         struct gaim_connection *gc;
    855         struct conversation *c;
     852struct groupchat *chat_by_channel( char *channel )
     853{
     854        struct im_connection *ic;
     855        struct groupchat *c;
    856856        GSList *l;
    857857       
     
    859859        for( l = connections; l; l = l->next )
    860860        {
    861                 gc = l->data;
    862                 for( c = gc->conversations; c && g_strcasecmp( c->channel, channel ) != 0; c = c->next );
     861                ic = l->data;
     862                for( c = ic->conversations; c && g_strcasecmp( c->channel, channel ) != 0; c = c->next );
    863863                if( c )
    864864                        return c;
     
    899899                while( u )
    900900                {
    901                         if( u->gc && u->online && !u->away )
     901                        if( u->ic && u->online && !u->away )
    902902                        {
    903903                                if( ( strlen( list ) + strlen( u->nick ) ) >= 79 )
     
    933933   them all from some wrappers. We'll start to define some down here: */
    934934
    935 int bim_buddy_msg( struct gaim_connection *gc, char *handle, char *msg, int flags )
     935int bim_buddy_msg( struct im_connection *ic, char *handle, char *msg, int flags )
    936936{
    937937        char *buf = NULL;
    938938        int st;
    939939       
    940         if( ( gc->flags & OPT_CONN_HTML ) && ( g_strncasecmp( msg, "<html>", 6 ) != 0 ) )
     940        if( ( ic->flags & OPT_CONN_HTML ) && ( g_strncasecmp( msg, "<html>", 6 ) != 0 ) )
    941941        {
    942942                buf = escape_html( msg );
     
    944944        }
    945945       
    946         st = gc->acc->prpl->send_im( gc, handle, msg, strlen( msg ), flags );
     946        st = ic->acc->prpl->send_im( ic, handle, msg, flags );
    947947        g_free( buf );
    948948       
     
    950950}
    951951
    952 int bim_chat_msg( struct conversation *c, char *msg )
     952int bim_chat_msg( struct groupchat *c, char *msg, int flags )
    953953{
    954954        char *buf = NULL;
    955955        int st;
    956956       
    957         if( ( c->gc->flags & OPT_CONN_HTML ) && ( g_strncasecmp( msg, "<html>", 6 ) != 0 ) )
     957        if( ( c->ic->flags & OPT_CONN_HTML ) && ( g_strncasecmp( msg, "<html>", 6 ) != 0 ) )
    958958        {
    959959                buf = escape_html( msg );
     
    961961        }
    962962       
    963         st = c->gc->acc->prpl->chat_send( c, msg );
     963        c->ic->acc->prpl->chat_send( c, msg, flags );
    964964        g_free( buf );
    965965       
    966         return st;
     966        return 1;
    967967}
    968968
    969969static char *bim_away_alias_find( GList *gcm, char *away );
    970970
    971 int bim_set_away( struct gaim_connection *gc, char *away )
     971int bim_set_away( struct im_connection *ic, char *away )
    972972{
    973973        GList *m, *ms;
     
    975975       
    976976        if( !away ) away = "";
    977         ms = m = gc->acc->prpl->away_states( gc );
     977        ms = m = ic->acc->prpl->away_states( ic );
    978978       
    979979        while( m )
     
    996996        if( m )
    997997        {
    998                 gc->acc->prpl->set_away( gc, m->data, *away ? away : NULL );
     998                ic->acc->prpl->set_away( ic, m->data, *away ? away : NULL );
    999999        }
    10001000        else
     
    10031003                if( s )
    10041004                {
    1005                         gc->acc->prpl->set_away( gc, s, away );
    1006                         if( set_getbool( &gc->irc->set, "debug" ) )
    1007                                 serv_got_crap( gc, "Setting away state to %s", s );
     1005                        ic->acc->prpl->set_away( ic, s, away );
     1006                        if( set_getbool( &ic->irc->set, "debug" ) )
     1007                                serv_got_crap( ic, "Setting away state to %s", s );
    10081008                }
    10091009                else
    1010                         gc->acc->prpl->set_away( gc, GAIM_AWAY_CUSTOM, away );
     1010                        ic->acc->prpl->set_away( ic, GAIM_AWAY_CUSTOM, away );
    10111011        }
    10121012       
     
    10561056}
    10571057
    1058 void bim_add_allow( struct gaim_connection *gc, char *handle )
    1059 {
    1060         if( g_slist_find_custom( gc->permit, handle, (GCompareFunc) gc->acc->prpl->handle_cmp ) == NULL )
    1061         {
    1062                 gc->permit = g_slist_prepend( gc->permit, g_strdup( handle ) );
    1063         }
    1064        
    1065         gc->acc->prpl->add_permit( gc, handle );
    1066 }
    1067 
    1068 void bim_rem_allow( struct gaim_connection *gc, char *handle )
     1058void bim_add_allow( struct im_connection *ic, char *handle )
     1059{
     1060        if( g_slist_find_custom( ic->permit, handle, (GCompareFunc) ic->acc->prpl->handle_cmp ) == NULL )
     1061        {
     1062                ic->permit = g_slist_prepend( ic->permit, g_strdup( handle ) );
     1063        }
     1064       
     1065        ic->acc->prpl->add_permit( ic, handle );
     1066}
     1067
     1068void bim_rem_allow( struct im_connection *ic, char *handle )
    10691069{
    10701070        GSList *l;
    10711071       
    1072         if( ( l = g_slist_find_custom( gc->permit, handle, (GCompareFunc) gc->acc->prpl->handle_cmp ) ) )
     1072        if( ( l = g_slist_find_custom( ic->permit, handle, (GCompareFunc) ic->acc->prpl->handle_cmp ) ) )
    10731073        {
    10741074                g_free( l->data );
    1075                 gc->permit = g_slist_delete_link( gc->permit, l );
    1076         }
    1077        
    1078         gc->acc->prpl->rem_permit( gc, handle );
    1079 }
    1080 
    1081 void bim_add_block( struct gaim_connection *gc, char *handle )
    1082 {
    1083         if( g_slist_find_custom( gc->deny, handle, (GCompareFunc) gc->acc->prpl->handle_cmp ) == NULL )
    1084         {
    1085                 gc->deny = g_slist_prepend( gc->deny, g_strdup( handle ) );
    1086         }
    1087        
    1088         gc->acc->prpl->add_deny( gc, handle );
    1089 }
    1090 
    1091 void bim_rem_block( struct gaim_connection *gc, char *handle )
     1075                ic->permit = g_slist_delete_link( ic->permit, l );
     1076        }
     1077       
     1078        ic->acc->prpl->rem_permit( ic, handle );
     1079}
     1080
     1081void bim_add_block( struct im_connection *ic, char *handle )
     1082{
     1083        if( g_slist_find_custom( ic->deny, handle, (GCompareFunc) ic->acc->prpl->handle_cmp ) == NULL )
     1084        {
     1085                ic->deny = g_slist_prepend( ic->deny, g_strdup( handle ) );
     1086        }
     1087       
     1088        ic->acc->prpl->add_deny( ic, handle );
     1089}
     1090
     1091void bim_rem_block( struct im_connection *ic, char *handle )
    10921092{
    10931093        GSList *l;
    10941094       
    1095         if( ( l = g_slist_find_custom( gc->deny, handle, (GCompareFunc) gc->acc->prpl->handle_cmp ) ) )
     1095        if( ( l = g_slist_find_custom( ic->deny, handle, (GCompareFunc) ic->acc->prpl->handle_cmp ) ) )
    10961096        {
    10971097                g_free( l->data );
    1098                 gc->deny = g_slist_delete_link( gc->deny, l );
    1099         }
    1100        
    1101         gc->acc->prpl->rem_deny( gc, handle );
    1102 }
     1098                ic->deny = g_slist_delete_link( ic->deny, l );
     1099        }
     1100       
     1101        ic->acc->prpl->rem_deny( ic, handle );
     1102}
  • protocols/nogaim.h

    rfa29d093 r0da65d5  
    6262
    6363/* ok. now the fun begins. first we create a connection structure */
    64 struct gaim_connection
     64struct im_connection
    6565{
    6666        account_t *acc;
     
    9292        irc_t *irc;
    9393       
    94         struct conversation *conversations;
     94        struct groupchat *conversations;
    9595};
    9696
    9797/* struct buddy_chat went away and got merged with this. */
    98 struct conversation {
    99         struct gaim_connection *gc;
     98struct groupchat {
     99        struct im_connection *ic;
    100100
    101101        /* stuff used just for chat */
     
    104104       
    105105        /* BitlBee */
    106         struct conversation *next;
     106        struct groupchat *next;
    107107        char *channel;
    108108        char *title;
     
    121121        guint caps; /* woohoo! */
    122122        void *proto_data; /* what a hack */
    123         struct gaim_connection *gc; /* the connection it belongs to */
     123        struct im_connection *ic; /* the connection it belongs to */
    124124};
    125125
     
    128128        const char *name;
    129129
    130         void (* acc_init)       (account_t *);
     130        /* Added this one to be able to add per-account settings, don't think
     131           it should be used for anything else. */
     132        void (* init)           (account_t *);
     133        /* These should all be pretty obvious. */
    131134        void (* login)          (account_t *);
    132         void (* keepalive)      (struct gaim_connection *);
    133         void (* close)          (struct gaim_connection *);
    134        
    135         int  (* send_im)        (struct gaim_connection *, char *who, char *message, int len, int away);
    136         void (* set_away)       (struct gaim_connection *, char *state, char *message);
    137         void (* get_away)       (struct gaim_connection *, char *who);
    138         int  (* send_typing)    (struct gaim_connection *, char *who, int typing);
    139        
    140         void (* add_buddy)      (struct gaim_connection *, char *name);
    141         void (* group_buddy)    (struct gaim_connection *, char *who, char *old_group, char *new_group);
    142         void (* remove_buddy)   (struct gaim_connection *, char *name, char *group);
    143         void (* add_permit)     (struct gaim_connection *, char *name);
    144         void (* add_deny)       (struct gaim_connection *, char *name);
    145         void (* rem_permit)     (struct gaim_connection *, char *name);
    146         void (* rem_deny)       (struct gaim_connection *, char *name);
    147         void (* set_permit_deny)(struct gaim_connection *);
    148        
    149         void (* set_info)       (struct gaim_connection *, char *info);
    150         void (* get_info)       (struct gaim_connection *, char *who);
    151         void (* alias_buddy)    (struct gaim_connection *, char *who);  /* save/store buddy's alias on server list/roster */
     135        void (* keepalive)      (struct im_connection *);
     136        void (* logout)         (struct im_connection *);
     137       
     138        int  (* send_im)        (struct im_connection *, char *to, char *message, int flags);
     139        void (* set_away)       (struct im_connection *, char *state, char *message);
     140        void (* get_away)       (struct im_connection *, char *who);
     141        int  (* send_typing)    (struct im_connection *, char *who, int typing);
     142       
     143        /* For now BitlBee doesn't really handle groups, just set it to NULL. */
     144        void (* add_buddy)      (struct im_connection *, char *name, char *group);
     145        void (* remove_buddy)   (struct im_connection *, char *name, char *group);
     146       
     147        /* Block list stuff. */
     148        void (* add_permit)     (struct im_connection *, char *who);
     149        void (* add_deny)       (struct im_connection *, char *who);
     150        void (* rem_permit)     (struct im_connection *, char *who);
     151        void (* rem_deny)       (struct im_connection *, char *who);
     152        /* Doesn't actually have UI hooks. */
     153        void (* set_permit_deny)(struct im_connection *);
     154       
     155        /* Request profile info. Free-formatted stuff, the IM module gives back
     156           this info via imc_log(). */
     157        void (* get_info)       (struct im_connection *, char *who);
     158        void (* set_my_name)    (struct im_connection *, char *name);
     159        void (* set_name)       (struct im_connection *, char *who, char *name);
    152160       
    153161        /* Group chat stuff. */
    154         void (* chat_invite)    (struct conversation *, char *who, char *message);
    155         void (* chat_leave)     (struct conversation *);
    156         int  (* chat_send)      (struct conversation *, char *message);
    157         struct conversation *
    158              (* chat_open)      (struct gaim_connection *, char *who);
    159         struct conversation *
    160              (* chat_join)      (struct gaim_connection *, char *chat, char *nick, char *password);
     162        void (* chat_invite)    (struct groupchat *, char *who, char *message);
     163        void (* chat_leave)     (struct groupchat *);
     164        void (* chat_send)      (struct groupchat *, char *message, int flags);
     165        struct groupchat *
     166             (* chat_with)      (struct im_connection *, char *who);
     167        struct groupchat *
     168             (* chat_join)      (struct im_connection *, char *chat, char *nick, char *password);
    161169       
    162170        /* DIE! */
    163         char *(* get_status_string) (struct gaim_connection *gc, int stat);
    164        
    165         GList *(* away_states)(struct gaim_connection *gc);
     171        char *(* get_status_string) (struct im_connection *ic, int stat);
     172       
     173        GList *(* away_states)(struct im_connection *ic);
    166174       
    167175        /* Mainly for AOL, since they think "Bung hole" == "Bu ngho le". *sigh* */
     
    182190
    183191/* nogaim.c */
    184 int bim_set_away( struct gaim_connection *gc, char *away );
    185 int bim_buddy_msg( struct gaim_connection *gc, char *handle, char *msg, int flags );
    186 int bim_chat_msg( struct conversation *c, char *msg );
    187 
    188 void bim_add_allow( struct gaim_connection *gc, char *handle );
    189 void bim_rem_allow( struct gaim_connection *gc, char *handle );
    190 void bim_add_block( struct gaim_connection *gc, char *handle );
    191 void bim_rem_block( struct gaim_connection *gc, char *handle );
     192int bim_set_away( struct im_connection *ic, char *away );
     193int bim_buddy_msg( struct im_connection *ic, char *handle, char *msg, int flags );
     194int bim_chat_msg( struct groupchat *c, char *msg, int flags );
     195
     196void bim_add_allow( struct im_connection *ic, char *handle );
     197void bim_rem_allow( struct im_connection *ic, char *handle );
     198void bim_add_block( struct im_connection *ic, char *handle );
     199void bim_rem_block( struct im_connection *ic, char *handle );
    192200
    193201void nogaim_init();
     
    198206
    199207/* multi.c */
    200 G_MODULE_EXPORT struct gaim_connection *new_gaim_conn( account_t *acc );
    201 G_MODULE_EXPORT void destroy_gaim_conn( struct gaim_connection *gc );
    202 G_MODULE_EXPORT void set_login_progress( struct gaim_connection *gc, int step, char *msg );
    203 G_MODULE_EXPORT void hide_login_progress( struct gaim_connection *gc, char *msg );
    204 G_MODULE_EXPORT void hide_login_progress_error( struct gaim_connection *gc, char *msg );
    205 G_MODULE_EXPORT void serv_got_crap( struct gaim_connection *gc, char *format, ... ) G_GNUC_PRINTF( 2, 3 );
    206 G_MODULE_EXPORT void account_online( struct gaim_connection *gc );
    207 G_MODULE_EXPORT void signoff( struct gaim_connection *gc );
     208G_MODULE_EXPORT struct im_connection *new_gaim_conn( account_t *acc );
     209G_MODULE_EXPORT void destroy_gaim_conn( struct im_connection *ic );
     210G_MODULE_EXPORT void set_login_progress( struct im_connection *ic, int step, char *msg );
     211G_MODULE_EXPORT void hide_login_progress( struct im_connection *ic, char *msg );
     212G_MODULE_EXPORT void hide_login_progress_error( struct im_connection *ic, char *msg );
     213G_MODULE_EXPORT void serv_got_crap( struct im_connection *ic, char *format, ... ) G_GNUC_PRINTF( 2, 3 );
     214G_MODULE_EXPORT void account_online( struct im_connection *ic );
     215G_MODULE_EXPORT void signoff( struct im_connection *ic );
    208216
    209217/* dialogs.c */
    210 G_MODULE_EXPORT void do_error_dialog( struct gaim_connection *gc, char *msg, char *title );
    211 G_MODULE_EXPORT void do_ask_dialog( struct gaim_connection *gc, char *msg, void *data, void *doit, void *dont );
     218G_MODULE_EXPORT void do_error_dialog( struct im_connection *ic, char *msg, char *title );
     219G_MODULE_EXPORT void do_ask_dialog( struct im_connection *ic, char *msg, void *data, void *doit, void *dont );
    212220
    213221/* list.c */
    214 G_MODULE_EXPORT void add_buddy( struct gaim_connection *gc, char *group, char *handle, char *realname );
    215 G_MODULE_EXPORT struct buddy *find_buddy( struct gaim_connection *gc, char *handle );
    216 G_MODULE_EXPORT void signoff_blocked( struct gaim_connection *gc );
    217 
    218 G_MODULE_EXPORT void serv_buddy_rename( struct gaim_connection *gc, char *handle, char *realname );
     222G_MODULE_EXPORT void add_buddy( struct im_connection *ic, char *group, char *handle, char *realname );
     223G_MODULE_EXPORT struct buddy *find_buddy( struct im_connection *ic, char *handle );
     224G_MODULE_EXPORT void signoff_blocked( struct im_connection *ic );
     225
     226G_MODULE_EXPORT void serv_buddy_rename( struct im_connection *ic, char *handle, char *realname );
    219227
    220228/* buddy_chat.c */
    221 G_MODULE_EXPORT void add_chat_buddy( struct conversation *b, char *handle );
    222 G_MODULE_EXPORT void remove_chat_buddy( struct conversation *b, char *handle, char *reason );
     229G_MODULE_EXPORT void add_chat_buddy( struct groupchat *b, char *handle );
     230G_MODULE_EXPORT void remove_chat_buddy( struct groupchat *b, char *handle, char *reason );
    223231
    224232/* prpl.c */
    225 G_MODULE_EXPORT void show_got_added( struct gaim_connection *gc, char *handle, const char *realname );
     233G_MODULE_EXPORT void show_got_added( struct im_connection *ic, char *handle, const char *realname );
    226234
    227235/* server.c */
    228 G_MODULE_EXPORT void serv_got_update( struct gaim_connection *gc, char *handle, int loggedin, int evil, time_t signon, time_t idle, int type, guint caps );
    229 G_MODULE_EXPORT void serv_got_im( struct gaim_connection *gc, char *handle, char *msg, guint32 flags, time_t mtime, gint len );
    230 G_MODULE_EXPORT void serv_got_typing( struct gaim_connection *gc, char *handle, int timeout, int type );
    231 G_MODULE_EXPORT void serv_got_chat_invite( struct gaim_connection *gc, char *handle, char *who, char *msg, GList *data );
    232 G_MODULE_EXPORT struct conversation *serv_got_joined_chat( struct gaim_connection *gc, char *handle );
    233 G_MODULE_EXPORT void serv_got_chat_in( struct conversation *c, char *who, int whisper, char *msg, time_t mtime );
    234 G_MODULE_EXPORT void serv_got_chat_left( struct conversation *c );
    235 
    236 struct conversation *chat_by_channel( char *channel );
    237 struct conversation *chat_by_id( int id );
     236G_MODULE_EXPORT void serv_got_update( struct im_connection *ic, char *handle, int loggedin, int evil, time_t signon, time_t idle, int type, guint caps );
     237G_MODULE_EXPORT void serv_got_im( struct im_connection *ic, char *handle, char *msg, guint32 flags, time_t mtime, gint len );
     238G_MODULE_EXPORT void serv_got_typing( struct im_connection *ic, char *handle, int timeout, int type );
     239G_MODULE_EXPORT void serv_got_chat_invite( struct im_connection *ic, char *handle, char *who, char *msg, GList *data );
     240G_MODULE_EXPORT struct groupchat *serv_got_joined_chat( struct im_connection *ic, char *handle );
     241G_MODULE_EXPORT void serv_got_chat_in( struct groupchat *c, char *who, int whisper, char *msg, time_t mtime );
     242G_MODULE_EXPORT void serv_got_chat_left( struct groupchat *c );
     243
     244struct groupchat *chat_by_channel( char *channel );
     245struct groupchat *chat_by_id( int id );
    238246
    239247#endif
  • protocols/oscar/aim.h

    rfa29d093 r0da65d5  
    574574
    575575struct aim_chat_invitation {
    576         struct gaim_connection * gc;
     576        struct im_connection * ic;
    577577        char * name;
    578578        guint8 exchange;
  • protocols/oscar/im.c

    rfa29d093 r0da65d5  
    14171417    guint8 *plugin;
    14181418    int i = 0, tmp = 0;
    1419     struct gaim_connection *gc = sess->aux_data;
     1419    struct im_connection *ic = sess->aux_data;
    14201420
    14211421    /* at the moment we just can deal with requests, not with cancel or accept */
     
    14691469            case 0x9c:  /* ICQ 5 seems to send this */
    14701470                aim_send_im_ch2_statusmessage(sess, userinfo->sn, args->cookie,
    1471                         gc->away ? gc->away : "", sess->aim_icq_state, dc);
     1471                        ic->away ? ic->away : "", sess->aim_icq_state, dc);
    14721472                break;
    14731473
  • protocols/oscar/oscar.c

    rfa29d093 r0da65d5  
    116116        int inpa;
    117117        int id;
    118         struct gaim_connection *gc; /* i hate this. */
    119         struct conversation *cnv; /* bah. */
     118        struct im_connection *ic; /* i hate this. */
     119        struct groupchat *cnv; /* bah. */
    120120        int maxlen;
    121121        int maxvis;
     
    123123
    124124struct ask_direct {
    125         struct gaim_connection *gc;
     125        struct im_connection *ic;
    126126        char *sn;
    127127        char ip[64];
     
    130130
    131131struct icq_auth {
    132         struct gaim_connection *gc;
     132        struct im_connection *ic;
    133133        guint32 uin;
    134134};
     
    158158}
    159159
    160 static struct chat_connection *find_oscar_chat_by_conn(struct gaim_connection *gc,
     160static struct chat_connection *find_oscar_chat_by_conn(struct im_connection *ic,
    161161                                                        aim_conn_t *conn) {
    162         GSList *g = ((struct oscar_data *)gc->proto_data)->oscar_chats;
     162        GSList *g = ((struct oscar_data *)ic->proto_data)->oscar_chats;
    163163        struct chat_connection *c = NULL;
    164164
     
    243243        aim_conn_t *conn = (aim_conn_t *)data;
    244244        aim_session_t *sess = aim_conn_getsess(conn);
    245         struct gaim_connection *gc = sess ? sess->aux_data : NULL;
     245        struct im_connection *ic = sess ? sess->aux_data : NULL;
    246246        struct oscar_data *odata;
    247247
    248         if (!gc) {
    249                 /* gc is null. we return, else we seg SIGSEG on next line. */
     248        if (!ic) {
     249                /* ic is null. we return, else we seg SIGSEG on next line. */
    250250                return FALSE;
    251251        }
    252252     
    253         if (!g_slist_find(get_connections(), gc)) {
     253        if (!g_slist_find(get_connections(), ic)) {
    254254                /* oh boy. this is probably bad. i guess the only thing we
    255255                 * can really do is return? */
     
    257257        }
    258258
    259         odata = (struct oscar_data *)gc->proto_data;
     259        odata = (struct oscar_data *)ic->proto_data;
    260260
    261261        if (condition & GAIM_INPUT_READ) {
     
    263263                        aim_rxdispatch(odata->sess);
    264264                               if (odata->killme)
    265                                        signoff(gc);
     265                                       signoff(ic);
    266266                } else {
    267267                        if ((conn->type == AIM_CONN_TYPE_BOS) ||
    268268                                   !(aim_getconn_type(odata->sess, AIM_CONN_TYPE_BOS))) {
    269                                 hide_login_progress_error(gc, _("Disconnected."));
    270                                 signoff(gc);
     269                                hide_login_progress_error(ic, _("Disconnected."));
     270                                signoff(ic);
    271271                        } else if (conn->type == AIM_CONN_TYPE_CHAT) {
    272                                 struct chat_connection *c = find_oscar_chat_by_conn(gc, conn);
     272                                struct chat_connection *c = find_oscar_chat_by_conn(ic, conn);
    273273                                char buf[BUF_LONG];
    274274                                c->conn = NULL;
     
    313313static gboolean oscar_login_connect(gpointer data, gint source, b_input_condition cond)
    314314{
    315         struct gaim_connection *gc = data;
     315        struct im_connection *ic = data;
    316316        struct oscar_data *odata;
    317317        aim_session_t *sess;
    318318        aim_conn_t *conn;
    319319
    320         if (!g_slist_find(get_connections(), gc)) {
     320        if (!g_slist_find(get_connections(), ic)) {
    321321                closesocket(source);
    322322                return FALSE;
    323323        }
    324324
    325         odata = gc->proto_data;
     325        odata = ic->proto_data;
    326326        sess = odata->sess;
    327327        conn = aim_getconn_type_all(sess, AIM_CONN_TYPE_AUTH);
    328328
    329329        if (source < 0) {
    330                 hide_login_progress(gc, _("Couldn't connect to host"));
    331                 signoff(gc);
     330                hide_login_progress(ic, _("Couldn't connect to host"));
     331                signoff(ic);
    332332                return FALSE;
    333333        }
    334334
    335335        aim_conn_completeconnect(sess, conn);
    336         gc->inpa = b_input_add(conn->fd, GAIM_INPUT_READ,
     336        ic->inpa = b_input_add(conn->fd, GAIM_INPUT_READ,
    337337                        oscar_callback, conn);
    338338       
     
    340340}
    341341
    342 static void oscar_acc_init(account_t *acc)
     342static void oscar_init(account_t *acc)
    343343{
    344344        set_t *s;
     
    357357        aim_conn_t *conn;
    358358        char buf[256];
    359         struct gaim_connection *gc = new_gaim_conn(acc);
    360         struct oscar_data *odata = gc->proto_data = g_new0(struct oscar_data, 1);
     359        struct im_connection *ic = new_gaim_conn(acc);
     360        struct oscar_data *odata = ic->proto_data = g_new0(struct oscar_data, 1);
    361361
    362362        if (isdigit(acc->user[0])) {
     
    365365                   We don't do those anymore, but let's stick with it, just in case
    366366                   it accidentally fixes something else too... </bitlbee> */
    367                 gc->password[8] = 0;
     367                ic->password[8] = 0;
    368368        } else {
    369                 gc->flags |= OPT_CONN_HTML;
     369                ic->flags |= OPT_CONN_HTML;
    370370        }
    371371
     
    378378        aim_tx_setenqueue(sess, AIM_TX_IMMEDIATE, NULL);
    379379        odata->sess = sess;
    380         sess->aux_data = gc;
     380        sess->aux_data = ic;
    381381
    382382        conn = aim_newconn(sess, AIM_CONN_TYPE_AUTH, NULL);
    383383        if (conn == NULL) {
    384                 hide_login_progress(gc, _("Unable to login to AIM"));
    385                 signoff(gc);
     384                hide_login_progress(ic, _("Unable to login to AIM"));
     385                signoff(ic);
    386386                return;
    387387        }
    388388       
    389389        if (acc->server == NULL) {
    390                 hide_login_progress(gc, "No servername specified");
    391                 signoff(gc);
     390                hide_login_progress(ic, "No servername specified");
     391                signoff(ic);
    392392                return;
    393393        }
     
    395395        if (g_strcasecmp(acc->server, "login.icq.com") != 0 &&
    396396            g_strcasecmp(acc->server, "login.oscar.aol.com") != 0) {
    397                 serv_got_crap(gc, "Warning: Unknown OSCAR server: `%s'. Please review your configuration if the connection fails.",acc->server);
    398         }
    399        
    400         g_snprintf(buf, sizeof(buf), _("Signon: %s"), gc->username);
    401         set_login_progress(gc, 2, buf);
     397                serv_got_crap(ic, "Warning: Unknown OSCAR server: `%s'. Please review your configuration if the connection fails.",acc->server);
     398        }
     399       
     400        g_snprintf(buf, sizeof(buf), _("Signon: %s"), ic->username);
     401        set_login_progress(ic, 2, buf);
    402402
    403403        aim_conn_addhandler(sess, conn, 0x0017, 0x0007, gaim_parse_login, 0);
     
    405405
    406406        conn->status |= AIM_CONN_STATUS_INPROGRESS;
    407         conn->fd = proxy_connect(acc->server, AIM_LOGIN_PORT, oscar_login_connect, gc);
     407        conn->fd = proxy_connect(acc->server, AIM_LOGIN_PORT, oscar_login_connect, ic);
    408408        if (conn->fd < 0) {
    409                 hide_login_progress(gc, _("Couldn't connect to host"));
    410                 signoff(gc);
     409                hide_login_progress(ic, _("Couldn't connect to host"));
     410                signoff(ic);
    411411                return;
    412412        }
    413         aim_request_login(sess, conn, gc->username);
    414 }
    415 
    416 static void oscar_close(struct gaim_connection *gc) {
    417         struct oscar_data *odata = (struct oscar_data *)gc->proto_data;
     413        aim_request_login(sess, conn, ic->username);
     414}
     415
     416static void oscar_logout(struct im_connection *ic) {
     417        struct oscar_data *odata = (struct oscar_data *)ic->proto_data;
    418418       
    419419        while (odata->oscar_chats) {
     
    438438        if (odata->oldp)
    439439                g_free(odata->oldp);
    440         if (gc->inpa > 0)
    441                 b_event_remove(gc->inpa);
     440        if (ic->inpa > 0)
     441                b_event_remove(ic->inpa);
    442442        if (odata->cnpa > 0)
    443443                b_event_remove(odata->cnpa);
     
    447447        g_free(odata->sess);
    448448        odata->sess = NULL;
    449         g_free(gc->proto_data);
    450         gc->proto_data = NULL;
     449        g_free(ic->proto_data);
     450        ic->proto_data = NULL;
    451451}
    452452
    453453static gboolean oscar_bos_connect(gpointer data, gint source, b_input_condition cond) {
    454         struct gaim_connection *gc = data;
     454        struct im_connection *ic = data;
    455455        struct oscar_data *odata;
    456456        aim_session_t *sess;
    457457        aim_conn_t *bosconn;
    458458
    459         if (!g_slist_find(get_connections(), gc)) {
     459        if (!g_slist_find(get_connections(), ic)) {
    460460                closesocket(source);
    461461                return FALSE;
    462462        }
    463463
    464         odata = gc->proto_data;
     464        odata = ic->proto_data;
    465465        sess = odata->sess;
    466466        bosconn = odata->conn;
    467467
    468468        if (source < 0) {
    469                 hide_login_progress(gc, _("Could Not Connect"));
    470                 signoff(gc);
     469                hide_login_progress(ic, _("Could Not Connect"));
     470                signoff(ic);
    471471                return FALSE;
    472472        }
    473473
    474474        aim_conn_completeconnect(sess, bosconn);
    475         gc->inpa = b_input_add(bosconn->fd, GAIM_INPUT_READ,
     475        ic->inpa = b_input_add(bosconn->fd, GAIM_INPUT_READ,
    476476                        oscar_callback, bosconn);
    477         set_login_progress(gc, 4, _("Connection established, cookie sent"));
     477        set_login_progress(ic, 4, _("Connection established, cookie sent"));
    478478       
    479479        return FALSE;
     
    486486        aim_conn_t *bosconn;
    487487
    488         struct gaim_connection *gc = sess->aux_data;
    489         struct oscar_data *od = gc->proto_data;
     488        struct im_connection *ic = sess->aux_data;
     489        struct oscar_data *od = ic->proto_data;
    490490        port = AIM_LOGIN_PORT;
    491491
     
    498498                case 0x05:
    499499                        /* Incorrect nick/password */
    500                         hide_login_progress(gc, _("Incorrect nickname or password."));
     500                        hide_login_progress(ic, _("Incorrect nickname or password."));
    501501//                      plugin_event(event_error, (void *)980, 0, 0, 0);
    502502                        break;
    503503                case 0x11:
    504504                        /* Suspended account */
    505                         hide_login_progress(gc, _("Your account is currently suspended."));
     505                        hide_login_progress(ic, _("Your account is currently suspended."));
    506506                        break;
    507507                case 0x18:
    508508                        /* connecting too frequently */
    509                         hide_login_progress(gc, _("You have been connecting and disconnecting too frequently. Wait ten minutes and try again. If you continue to try, you will need to wait even longer."));
     509                        hide_login_progress(ic, _("You have been connecting and disconnecting too frequently. Wait ten minutes and try again. If you continue to try, you will need to wait even longer."));
    510510                        break;
    511511                case 0x1c:
    512512                        /* client too old */
    513                         hide_login_progress(gc, _("The client version you are using is too old. Please upgrade at " WEBSITE));
     513                        hide_login_progress(ic, _("The client version you are using is too old. Please upgrade at " WEBSITE));
    514514                        break;
    515515                default:
    516                         hide_login_progress(gc, _("Authentication Failed"));
     516                        hide_login_progress(ic, _("Authentication Failed"));
    517517                        break;
    518518                }
     
    526526        bosconn = aim_newconn(sess, AIM_CONN_TYPE_BOS, NULL);
    527527        if (bosconn == NULL) {
    528                 hide_login_progress(gc, _("Internal Error"));
     528                hide_login_progress(ic, _("Internal Error"));
    529529                od->killme = TRUE;
    530530                return 0;
     
    560560        aim_conn_addhandler(sess, bosconn, AIM_CB_FAM_MSG, AIM_CB_MSG_MTN, gaim_parsemtn, 0);
    561561
    562         ((struct oscar_data *)gc->proto_data)->conn = bosconn;
     562        ((struct oscar_data *)ic->proto_data)->conn = bosconn;
    563563        for (i = 0; i < (int)strlen(info->bosip); i++) {
    564564                if (info->bosip[i] == ':') {
     
    569569        host = g_strndup(info->bosip, i);
    570570        bosconn->status |= AIM_CONN_STATUS_INPROGRESS;
    571         bosconn->fd = proxy_connect(host, port, oscar_bos_connect, gc);
     571        bosconn->fd = proxy_connect(host, port, oscar_bos_connect, ic);
    572572        g_free(host);
    573573        if (bosconn->fd < 0) {
    574                 hide_login_progress(gc, _("Could Not Connect"));
     574                hide_login_progress(ic, _("Could Not Connect"));
    575575                od->killme = TRUE;
    576576                return 0;
    577577        }
    578578        aim_sendcookie(sess, bosconn, info->cookie);
    579         b_event_remove(gc->inpa);
     579        b_event_remove(ic->inpa);
    580580
    581581        return 1;
     
    583583
    584584struct pieceofcrap {
    585         struct gaim_connection *gc;
     585        struct im_connection *ic;
    586586        unsigned long offset;
    587587        unsigned long len;
     
    595595{
    596596        struct pieceofcrap *pos = data;
    597         struct oscar_data *od = pos->gc->proto_data;
     597        struct oscar_data *od = pos->ic->proto_data;
    598598        char in = '\0';
    599599        int x = 0;
     
    610610        }
    611611        if (in != '\n') {
    612                 do_error_dialog(pos->gc, "Gaim was unable to get a valid hash for logging into AIM."
     612                do_error_dialog(pos->ic, "Gaim was unable to get a valid hash for logging into AIM."
    613613                                " You may be disconnected shortly.", "Login Error");
    614614                b_event_remove(pos->inpa);
     
    633633
    634634        if (source < 0) {
    635                 do_error_dialog(pos->gc, "Gaim was unable to get a valid hash for logging into AIM."
     635                do_error_dialog(pos->ic, "Gaim was unable to get a valid hash for logging into AIM."
    636636                                " You may be disconnected shortly.", "Login Error");
    637637                if (pos->modname)
     
    699699
    700700        pos = g_new0(struct pieceofcrap, 1);
    701         pos->gc = sess->aux_data;
     701        pos->ic = sess->aux_data;
    702702        pos->conn = fr->conn;
    703703
     
    727727        char *key;
    728728        va_list ap;
    729         struct gaim_connection *gc = sess->aux_data;
     729        struct im_connection *ic = sess->aux_data;
    730730
    731731        va_start(ap, fr);
     
    733733        va_end(ap);
    734734
    735         aim_send_login(sess, fr->conn, gc->username, gc->password, &info, key);
     735        aim_send_login(sess, fr->conn, ic->username, ic->password, &info, key);
    736736
    737737        return 1;
     
    739739
    740740static int conninitdone_chat(aim_session_t *sess, aim_frame_t *fr, ...) {
    741         struct gaim_connection *gc = sess->aux_data;
     741        struct im_connection *ic = sess->aux_data;
    742742        struct chat_connection *chatcon;
    743743        static int id = 1;
     
    751751        aim_clientready(sess, fr->conn);
    752752
    753         chatcon = find_oscar_chat_by_conn(gc, fr->conn);
     753        chatcon = find_oscar_chat_by_conn(ic, fr->conn);
    754754        chatcon->id = id;
    755         chatcon->cnv = serv_got_joined_chat(gc, chatcon->show);
     755        chatcon->cnv = serv_got_joined_chat(ic, chatcon->show);
    756756        chatcon->cnv->data = chatcon;
    757757
     
    772772
    773773static gboolean oscar_chatnav_connect(gpointer data, gint source, b_input_condition cond) {
    774         struct gaim_connection *gc = data;
     774        struct im_connection *ic = data;
    775775        struct oscar_data *odata;
    776776        aim_session_t *sess;
    777777        aim_conn_t *tstconn;
    778778
    779         if (!g_slist_find(get_connections(), gc)) {
     779        if (!g_slist_find(get_connections(), ic)) {
    780780                closesocket(source);
    781781                return FALSE;
    782782        }
    783783
    784         odata = gc->proto_data;
     784        odata = ic->proto_data;
    785785        sess = odata->sess;
    786786        tstconn = aim_getconn_type_all(sess, AIM_CONN_TYPE_CHATNAV);
     
    800800static gboolean oscar_auth_connect(gpointer data, gint source, b_input_condition cond)
    801801{
    802         struct gaim_connection *gc = data;
     802        struct im_connection *ic = data;
    803803        struct oscar_data *odata;
    804804        aim_session_t *sess;
    805805        aim_conn_t *tstconn;
    806806
    807         if (!g_slist_find(get_connections(), gc)) {
     807        if (!g_slist_find(get_connections(), ic)) {
    808808                closesocket(source);
    809809                return FALSE;
    810810        }
    811811
    812         odata = gc->proto_data;
     812        odata = ic->proto_data;
    813813        sess = odata->sess;
    814814        tstconn = aim_getconn_type_all(sess, AIM_CONN_TYPE_AUTH);
     
    829829{
    830830        struct chat_connection *ccon = data;
    831         struct gaim_connection *gc = ccon->gc;
     831        struct im_connection *ic = ccon->ic;
    832832        struct oscar_data *odata;
    833833        aim_session_t *sess;
    834834        aim_conn_t *tstconn;
    835835
    836         if (!g_slist_find(get_connections(), gc)) {
     836        if (!g_slist_find(get_connections(), ic)) {
    837837                closesocket(source);
    838838                g_free(ccon->show);
     
    842842        }
    843843
    844         odata = gc->proto_data;
     844        odata = ic->proto_data;
    845845        sess = odata->sess;
    846846        tstconn = ccon->conn;
     
    867867        va_list ap;
    868868        struct aim_redirect_data *redir;
    869         struct gaim_connection *gc = sess->aux_data;
     869        struct im_connection *ic = sess->aux_data;
    870870        aim_conn_t *tstconn;
    871871        int i;
     
    899899
    900900                tstconn->status |= AIM_CONN_STATUS_INPROGRESS;
    901                 tstconn->fd = proxy_connect(host, port, oscar_auth_connect, gc);
     901                tstconn->fd = proxy_connect(host, port, oscar_auth_connect, ic);
    902902                if (tstconn->fd < 0) {
    903903                        aim_conn_kill(sess, &tstconn);
     
    916916
    917917                tstconn->status |= AIM_CONN_STATUS_INPROGRESS;
    918                 tstconn->fd = proxy_connect(host, port, oscar_chatnav_connect, gc);
     918                tstconn->fd = proxy_connect(host, port, oscar_chatnav_connect, ic);
    919919                if (tstconn->fd < 0) {
    920920                        aim_conn_kill(sess, &tstconn);
     
    938938                ccon = g_new0(struct chat_connection, 1);
    939939                ccon->conn = tstconn;
    940                 ccon->gc = gc;
     940                ccon->ic = ic;
    941941                ccon->fd = -1;
    942942                ccon->name = g_strdup(redir->chat.room);
     
    967967
    968968static int gaim_parse_oncoming(aim_session_t *sess, aim_frame_t *fr, ...) {
    969         struct gaim_connection *gc = sess->aux_data;
    970         struct oscar_data *od = gc->proto_data;
     969        struct im_connection *ic = sess->aux_data;
     970        struct oscar_data *od = ic->proto_data;
    971971        aim_userinfo_t *info;
    972972        time_t time_idle = 0, signon = 0;
     
    10181018                signon = time(NULL) - info->sessionlen;
    10191019
    1020         tmp = g_strdup(normalize(gc->username));
     1020        tmp = g_strdup(normalize(ic->username));
    10211021        if (!strcmp(tmp, normalize(info->sn)))
    1022                 g_snprintf(gc->displayname, sizeof(gc->displayname), "%s", info->sn);
     1022                g_snprintf(ic->displayname, sizeof(ic->displayname), "%s", info->sn);
    10231023        g_free(tmp);
    10241024
    1025         serv_got_update(gc, info->sn, 1, info->warnlevel/10, signon,
     1025        serv_got_update(ic, info->sn, 1, info->warnlevel/10, signon,
    10261026                        time_idle, type, caps);
    10271027
     
    10321032        aim_userinfo_t *info;
    10331033        va_list ap;
    1034         struct gaim_connection *gc = sess->aux_data;
     1034        struct im_connection *ic = sess->aux_data;
    10351035
    10361036        va_start(ap, fr);
     
    10381038        va_end(ap);
    10391039
    1040         serv_got_update(gc, info->sn, 0, 0, 0, 0, 0, 0);
     1040        serv_got_update(ic, info->sn, 0, 0, 0, 0, 0, 0);
    10411041
    10421042        return 1;
     
    10451045static int incomingim_chan1(aim_session_t *sess, aim_conn_t *conn, aim_userinfo_t *userinfo, struct aim_incomingim_ch1_args *args) {
    10461046        char *tmp = g_malloc(BUF_LONG + 1);
    1047         struct gaim_connection *gc = sess->aux_data;
     1047        struct im_connection *ic = sess->aux_data;
    10481048        int flags = 0;
    10491049       
     
    10831083       
    10841084        strip_linefeed(tmp);
    1085         serv_got_im(gc, userinfo->sn, tmp, flags, time(NULL), -1);
     1085        serv_got_im(ic, userinfo->sn, tmp, flags, time(NULL), -1);
    10861086        g_free(tmp);
    10871087       
     
    10931093       
    10941094static int incomingim_chan2(aim_session_t *sess, aim_conn_t *conn, aim_userinfo_t *userinfo, struct aim_incomingim_ch2_args *args) {
    1095         struct gaim_connection *gc = sess->aux_data;
     1095        struct im_connection *ic = sess->aux_data;
    10961096
    10971097        if (args->status != AIM_RENDEZVOUS_PROPOSE)
     
    11111111                g_snprintf( txt, 1024, "Got an invitation to chatroom %s from %s: %s", name, userinfo->sn, args->msg );
    11121112
    1113                 inv->gc = gc;
     1113                inv->ic = ic;
    11141114                inv->exchange = *exch;
    11151115                inv->name = g_strdup(name);
    11161116               
    1117                 do_ask_dialog( gc, txt, inv, oscar_accept_chat, oscar_reject_chat);
     1117                do_ask_dialog( ic, txt, inv, oscar_accept_chat, oscar_reject_chat);
    11181118       
    11191119                if (name)
     
    11261126static void gaim_icq_authgrant(gpointer w, struct icq_auth *data) {
    11271127        char *uin, message;
    1128         struct oscar_data *od = (struct oscar_data *)data->gc->proto_data;
     1128        struct oscar_data *od = (struct oscar_data *)data->ic->proto_data;
    11291129       
    11301130        uin = g_strdup_printf("%u", data->uin);
     
    11321132        aim_ssi_auth_reply(od->sess, od->conn, uin, 1, "");
    11331133        // aim_send_im_ch4(od->sess, uin, AIM_ICQMSG_AUTHGRANTED, &message);
    1134         if(find_buddy(data->gc, uin) == NULL)
    1135                 show_got_added(data->gc, uin, NULL);
     1134        if(find_buddy(data->ic, uin) == NULL)
     1135                show_got_added(data->ic, uin, NULL);
    11361136       
    11371137        g_free(uin);
     
    11411141static void gaim_icq_authdeny(gpointer w, struct icq_auth *data) {
    11421142        char *uin, *message;
    1143         struct oscar_data *od = (struct oscar_data *)data->gc->proto_data;
     1143        struct oscar_data *od = (struct oscar_data *)data->ic->proto_data;
    11441144       
    11451145        uin = g_strdup_printf("%u", data->uin);
     
    11561156 * For when other people ask you for authorization
    11571157 */
    1158 static void gaim_icq_authask(struct gaim_connection *gc, guint32 uin, char *msg) {
     1158static void gaim_icq_authask(struct im_connection *ic, guint32 uin, char *msg) {
    11591159        struct icq_auth *data = g_new(struct icq_auth, 1);
    11601160        char *reason = NULL;
     
    11651165       
    11661166        dialog_msg = g_strdup_printf("The user %u wants to add you to their buddy list for the following reason: %s", uin, reason ? reason : "No reason given.");
    1167         data->gc = gc;
     1167        data->ic = ic;
    11681168        data->uin = uin;
    1169         do_ask_dialog(gc, dialog_msg, data, gaim_icq_authgrant, gaim_icq_authdeny);
     1169        do_ask_dialog(ic, dialog_msg, data, gaim_icq_authgrant, gaim_icq_authdeny);
    11701170        g_free(dialog_msg);
    11711171}
    11721172
    11731173static int incomingim_chan4(aim_session_t *sess, aim_conn_t *conn, aim_userinfo_t *userinfo, struct aim_incomingim_ch4_args *args) {
    1174         struct gaim_connection *gc = sess->aux_data;
     1174        struct im_connection *ic = sess->aux_data;
    11751175
    11761176        switch (args->type) {
     
    11801180                        message = g_strdup(args->msg);
    11811181                        strip_linefeed(message);
    1182                         serv_got_im(gc, uin, message, 0, time(NULL), -1);
     1182                        serv_got_im(ic, uin, message, 0, time(NULL), -1);
    11831183                        g_free(uin);
    11841184                        g_free(message);
     
    11991199
    12001200                        strip_linefeed(message);
    1201                         serv_got_im(gc, uin, message, 0, time(NULL), -1);
     1201                        serv_got_im(ic, uin, message, 0, time(NULL), -1);
    12021202                        g_free(uin);
    12031203                        g_free(m);
     
    12061206               
    12071207                case 0x0006: { /* Someone requested authorization */
    1208                         gaim_icq_authask(gc, args->uin, args->msg);
     1208                        gaim_icq_authask(ic, args->uin, args->msg);
    12091209                } break;
    12101210
     
    14181418        va_list ap;
    14191419        guint16 type;
    1420         struct gaim_connection *gc = sess->aux_data;
    1421         struct oscar_data *odata = (struct oscar_data *)gc->proto_data;
     1420        struct im_connection *ic = sess->aux_data;
     1421        struct oscar_data *odata = (struct oscar_data *)ic->proto_data;
    14221422
    14231423        va_start(ap, fr);
     
    14771477        int count, i;
    14781478        aim_userinfo_t *info;
    1479         struct gaim_connection *g = sess->aux_data;
     1479        struct im_connection *g = sess->aux_data;
    14801480
    14811481        struct chat_connection *c = NULL;
     
    15001500        int count, i;
    15011501        aim_userinfo_t *info;
    1502         struct gaim_connection *g = sess->aux_data;
     1502        struct im_connection *g = sess->aux_data;
    15031503
    15041504        struct chat_connection *c = NULL;
     
    15281528        guint16 unknown_c9, unknown_d2, unknown_d5, maxmsglen, maxvisiblemsglen;
    15291529        guint32 creationtime;
    1530         struct gaim_connection *gc = sess->aux_data;
    1531         struct chat_connection *ccon = find_oscar_chat_by_conn(gc, fr->conn);
     1530        struct im_connection *ic = sess->aux_data;
     1531        struct chat_connection *ccon = find_oscar_chat_by_conn(ic, fr->conn);
    15321532
    15331533        va_start(ap, fr);
     
    15551555        aim_userinfo_t *info;
    15561556        char *msg;
    1557         struct gaim_connection *gc = sess->aux_data;
    1558         struct chat_connection *ccon = find_oscar_chat_by_conn(gc, fr->conn);
     1557        struct im_connection *ic = sess->aux_data;
     1558        struct chat_connection *ccon = find_oscar_chat_by_conn(ic, fr->conn);
    15591559        char *tmp;
    15601560
     
    16171617        va_list ap;
    16181618        aim_userinfo_t *info;
    1619         struct gaim_connection *gc = sess->aux_data;
     1619        struct im_connection *ic = sess->aux_data;
    16201620
    16211621        va_start(ap, fr);
     
    16231623        va_end(ap);
    16241624
    1625         gc->evil = info->warnlevel/10;
    1626         /* gc->correction_time = (info->onlinesince - gc->login_time); */
     1625        ic->evil = info->warnlevel/10;
     1626        /* ic->correction_time = (info->onlinesince - ic->login_time); */
    16271627
    16281628        return 1;
     
    16461646
    16471647static int conninitdone_admin(aim_session_t *sess, aim_frame_t *fr, ...) {
    1648         struct gaim_connection *gc = sess->aux_data;
    1649         struct oscar_data *od = gc->proto_data;
     1648        struct im_connection *ic = sess->aux_data;
     1649        struct oscar_data *od = ic->proto_data;
    16501650
    16511651        aim_clientready(sess, fr->conn);
     
    17041704        va_list ap;
    17051705        guint16 maxsiglen;
    1706         struct gaim_connection *gc = sess->aux_data;
    1707         struct oscar_data *odata = (struct oscar_data *)gc->proto_data;
     1706        struct im_connection *ic = sess->aux_data;
     1707        struct oscar_data *odata = (struct oscar_data *)ic->proto_data;
    17081708
    17091709        va_start(ap, fr);
     
    17151715        /* FIXME: It seems we're not really using this, and it broke now that
    17161716           struct aim_user is dead.
    1717         aim_bos_setprofile(sess, fr->conn, gc->user->user_info, NULL, gaim_caps);
     1717        aim_bos_setprofile(sess, fr->conn, ic->user->user_info, NULL, gaim_caps);
    17181718        */
    17191719       
     
    17241724        va_list ap;
    17251725        guint16 maxbuddies, maxwatchers;
    1726         struct gaim_connection *gc = sess->aux_data;
    1727         struct oscar_data *odata = (struct oscar_data *)gc->proto_data;
     1726        struct im_connection *ic = sess->aux_data;
     1727        struct oscar_data *odata = (struct oscar_data *)ic->proto_data;
    17281728
    17291729        va_start(ap, fr);
     
    17411741        guint16 maxpermits, maxdenies;
    17421742        va_list ap;
    1743         struct gaim_connection *gc = sess->aux_data;
    1744         struct oscar_data *odata = (struct oscar_data *)gc->proto_data;
     1743        struct im_connection *ic = sess->aux_data;
     1744        struct oscar_data *odata = (struct oscar_data *)ic->proto_data;
    17451745
    17461746        va_start(ap, fr);
     
    17651765        va_list ap;
    17661766        struct aim_icq_offlinemsg *msg;
    1767         struct gaim_connection *gc = sess->aux_data;
     1767        struct im_connection *ic = sess->aux_data;
    17681768
    17691769        va_start(ap, fr);
     
    17781778                        g_snprintf(sender, sizeof(sender), "%u", msg->sender);
    17791779                        strip_linefeed(dialog_msg);
    1780                         serv_got_im(gc, sender, dialog_msg, 0, t, -1);
     1780                        serv_got_im(ic, sender, dialog_msg, 0, t, -1);
    17811781                        g_free(dialog_msg);
    17821782                } break;
     
    17991799
    18001800                        strip_linefeed(dialog_msg);
    1801                         serv_got_im(gc, sender, dialog_msg, 0, t, -1);
     1801                        serv_got_im(ic, sender, dialog_msg, 0, t, -1);
    18021802                        g_free(dialog_msg);
    18031803                        g_free(m);
     
    18051805               
    18061806                case 0x0006: { /* Authorization request */
    1807                         gaim_icq_authask(gc, msg->sender, msg->msg);
     1807                        gaim_icq_authask(ic, msg->sender, msg->msg);
    18081808                } break;
    18091809
     
    18331833}
    18341834
    1835 static void oscar_keepalive(struct gaim_connection *gc) {
    1836         struct oscar_data *odata = (struct oscar_data *)gc->proto_data;
     1835static void oscar_keepalive(struct im_connection *ic) {
     1836        struct oscar_data *odata = (struct oscar_data *)ic->proto_data;
    18371837        aim_flap_nop(odata->sess, odata->conn);
    18381838}
    18391839
    1840 static int oscar_send_im(struct gaim_connection *gc, char *name, char *message, int len, int imflags) {
    1841         struct oscar_data *odata = (struct oscar_data *)gc->proto_data;
    1842         int ret = 0;
     1840static int oscar_send_im(struct im_connection *ic, char *name, char *message, int imflags) {
     1841        struct oscar_data *odata = (struct oscar_data *)ic->proto_data;
     1842        int ret = 0, len = strlen(message);
    18431843        if (imflags & IM_FLAG_AWAY) {
    18441844                ret = aim_send_im(odata->sess, name, AIM_IMFLAGS_AWAY, message);
     
    18921892}
    18931893
    1894 static void oscar_get_info(struct gaim_connection *g, char *name) {
     1894static void oscar_get_info(struct im_connection *g, char *name) {
    18951895        struct oscar_data *odata = (struct oscar_data *)g->proto_data;
    18961896        if (odata->icq)
     
    19021902}
    19031903
    1904 static void oscar_get_away(struct gaim_connection *g, char *who) {
     1904static void oscar_get_away(struct im_connection *g, char *who) {
    19051905        struct oscar_data *odata = (struct oscar_data *)g->proto_data;
    19061906        if (odata->icq) {
     
    19141914}
    19151915
    1916 static void oscar_set_away_aim(struct gaim_connection *gc, struct oscar_data *od, const char *state, const char *message)
     1916static void oscar_set_away_aim(struct im_connection *ic, struct oscar_data *od, const char *state, const char *message)
    19171917{
    19181918
     
    19261926
    19271927        if (od->rights.maxawaymsglen == 0)
    1928                 do_error_dialog(gc, "oscar_set_away_aim called before locate rights received", "Protocol Error");
     1928                do_error_dialog(ic, "oscar_set_away_aim called before locate rights received", "Protocol Error");
    19291929
    19301930        aim_setextstatus(od->sess, od->conn, AIM_ICQ_STATE_NORMAL);
    19311931
    1932         if (gc->away)
    1933                 g_free(gc->away);
    1934         gc->away = NULL;
     1932        if (ic->away)
     1933                g_free(ic->away);
     1934        ic->away = NULL;
    19351935
    19361936        if (!message) {
     
    19441944                errstr = g_strdup_printf("Maximum away message length of %d bytes exceeded, truncating", od->rights.maxawaymsglen);
    19451945
    1946                 do_error_dialog(gc, errstr, "Away Message Too Long");
     1946                do_error_dialog(ic, errstr, "Away Message Too Long");
    19471947
    19481948                g_free(errstr);
    19491949        }
    19501950
    1951         gc->away = g_strndup(message, od->rights.maxawaymsglen);
    1952         aim_bos_setprofile(od->sess, od->conn, NULL, gc->away, gaim_caps);
     1951        ic->away = g_strndup(message, od->rights.maxawaymsglen);
     1952        aim_bos_setprofile(od->sess, od->conn, NULL, ic->away, gaim_caps);
    19531953
    19541954        return;
    19551955}
    19561956
    1957 static void oscar_set_away_icq(struct gaim_connection *gc, struct oscar_data *od, const char *state, const char *message)
     1957static void oscar_set_away_icq(struct im_connection *ic, struct oscar_data *od, const char *state, const char *message)
    19581958{
    19591959    const char *msg = NULL;
     
    19611961
    19621962        /* clean old states */
    1963     if (gc->away) {
    1964                 g_free(gc->away);
    1965                 gc->away = NULL;
     1963    if (ic->away) {
     1964                g_free(ic->away);
     1965                ic->away = NULL;
    19661966    }
    19671967        od->sess->aim_icq_state = 0;
     
    19791979        } else if (!g_strcasecmp(state, "Away")) {
    19801980                aim_setextstatus(od->sess, od->conn, AIM_ICQ_STATE_AWAY);
    1981         gc->away = g_strdup(msg);
     1981        ic->away = g_strdup(msg);
    19821982                od->sess->aim_icq_state = AIM_MTYPE_AUTOAWAY;
    19831983        } else if (!g_strcasecmp(state, "Do Not Disturb")) {
    19841984                aim_setextstatus(od->sess, od->conn, AIM_ICQ_STATE_AWAY | AIM_ICQ_STATE_DND | AIM_ICQ_STATE_BUSY);
    1985         gc->away = g_strdup(msg);
     1985        ic->away = g_strdup(msg);
    19861986                od->sess->aim_icq_state = AIM_MTYPE_AUTODND;
    19871987        } else if (!g_strcasecmp(state, "Not Available")) {
    19881988                aim_setextstatus(od->sess, od->conn, AIM_ICQ_STATE_OUT | AIM_ICQ_STATE_AWAY);
    1989         gc->away = g_strdup(msg);
     1989        ic->away = g_strdup(msg);
    19901990                od->sess->aim_icq_state = AIM_MTYPE_AUTONA;
    19911991        } else if (!g_strcasecmp(state, "Occupied")) {
    19921992                aim_setextstatus(od->sess, od->conn, AIM_ICQ_STATE_AWAY | AIM_ICQ_STATE_BUSY);
    1993         gc->away = g_strdup(msg);
     1993        ic->away = g_strdup(msg);
    19941994                od->sess->aim_icq_state = AIM_MTYPE_AUTOBUSY;
    19951995        } else if (!g_strcasecmp(state, "Free For Chat")) {
    19961996                aim_setextstatus(od->sess, od->conn, AIM_ICQ_STATE_CHAT);
    1997         gc->away = g_strdup(msg);
     1997        ic->away = g_strdup(msg);
    19981998                od->sess->aim_icq_state = AIM_MTYPE_AUTOFFC;
    19991999        } else if (!g_strcasecmp(state, "Invisible")) {
    20002000                aim_setextstatus(od->sess, od->conn, AIM_ICQ_STATE_INVISIBLE);
    2001         gc->away = g_strdup(msg);
     2001        ic->away = g_strdup(msg);
    20022002        } else if (!g_strcasecmp(state, GAIM_AWAY_CUSTOM)) {
    20032003                if (no_message) {
     
    20052005                } else {
    20062006                        aim_setextstatus(od->sess, od->conn, AIM_ICQ_STATE_AWAY);
    2007             gc->away = g_strdup(msg);
     2007            ic->away = g_strdup(msg);
    20082008                        od->sess->aim_icq_state = AIM_MTYPE_AUTOAWAY;
    20092009                }
     
    20132013}
    20142014
    2015 static void oscar_set_away(struct gaim_connection *gc, char *state, char *message)
    2016 {
    2017         struct oscar_data *od = (struct oscar_data *)gc->proto_data;
    2018 
    2019     oscar_set_away_aim(gc, od, state, message);
     2015static void oscar_set_away(struct im_connection *ic, char *state, char *message)
     2016{
     2017        struct oscar_data *od = (struct oscar_data *)ic->proto_data;
     2018
     2019    oscar_set_away_aim(ic, od, state, message);
    20202020        if (od->icq)
    2021                 oscar_set_away_icq(gc, od, state, message);
     2021                oscar_set_away_icq(ic, od, state, message);
    20222022
    20232023        return;
    20242024}
    20252025
    2026 static void oscar_add_buddy(struct gaim_connection *g, char *name) {
     2026static void oscar_add_buddy(struct im_connection *g, char *name, char *group) {
    20272027        struct oscar_data *odata = (struct oscar_data *)g->proto_data;
    20282028        aim_ssi_addbuddies(odata->sess, odata->conn, OSCAR_GROUP, &name, 1, 0);
    20292029}
    20302030
    2031 static void oscar_remove_buddy(struct gaim_connection *g, char *name, char *group) {
     2031static void oscar_remove_buddy(struct im_connection *g, char *name, char *group) {
    20322032        struct oscar_data *odata = (struct oscar_data *)g->proto_data;
    20332033        struct aim_ssi_item *ssigroup;
     
    20402040
    20412041static int gaim_ssi_parselist(aim_session_t *sess, aim_frame_t *fr, ...) {
    2042         struct gaim_connection *gc = sess->aux_data;
     2042        struct im_connection *ic = sess->aux_data;
    20432043        struct aim_ssi_item *curitem;
    20442044        int tmp;
     
    20492049                switch (curitem->type) {
    20502050                        case 0x0000: /* Buddy */
    2051                                 if ((curitem->name) && (!find_buddy(gc, curitem->name))) {
     2051                                if ((curitem->name) && (!find_buddy(ic, curitem->name))) {
    20522052                                        char *realname = NULL;
    20532053
     
    20552055                                                    realname = aim_gettlv_str(curitem->data, 0x0131, 1);
    20562056                                               
    2057                                         add_buddy(gc, NULL, curitem->name, realname);
     2057                                        add_buddy(ic, NULL, curitem->name, realname);
    20582058                                       
    20592059                                        if (realname)
     
    20652065                                if (curitem->name) {
    20662066                                        GSList *list;
    2067                                         for (list=gc->permit; (list && aim_sncmp(curitem->name, list->data)); list=list->next);
     2067                                        for (list=ic->permit; (list && aim_sncmp(curitem->name, list->data)); list=list->next);
    20682068                                        if (!list) {
    20692069                                                char *name;
    20702070                                                name = g_strdup(normalize(curitem->name));
    2071                                                 gc->permit = g_slist_append(gc->permit, name);
     2071                                                ic->permit = g_slist_append(ic->permit, name);
    20722072                                                tmp++;
    20732073                                        }
     
    20782078                                if (curitem->name) {
    20792079                                        GSList *list;
    2080                                         for (list=gc->deny; (list && aim_sncmp(curitem->name, list->data)); list=list->next);
     2080                                        for (list=ic->deny; (list && aim_sncmp(curitem->name, list->data)); list=list->next);
    20812081                                        if (!list) {
    20822082                                                char *name;
    20832083                                                name = g_strdup(normalize(curitem->name));
    2084                                                 gc->deny = g_slist_append(gc->deny, name);
     2084                                                ic->deny = g_slist_append(ic->deny, name);
    20852085                                                tmp++;
    20862086                                        }
     
    20912091                                if (curitem->data) {
    20922092                                        guint8 permdeny;
    2093                                         if ((permdeny = aim_ssi_getpermdeny(sess->ssi.items)) && (permdeny != gc->permdeny)) {
    2094                                                 gc->permdeny = permdeny;
     2093                                        if ((permdeny = aim_ssi_getpermdeny(sess->ssi.items)) && (permdeny != ic->permdeny)) {
     2094                                                ic->permdeny = permdeny;
    20952095                                                tmp++;
    20962096                                        }
     
    21102110       
    21112111        /* Now that we have a buddy list, we can tell BitlBee that we're online. */
    2112         account_online(gc);
     2112        account_online(ic);
    21132113       
    21142114        return 1;
     
    21552155}
    21562156
    2157 static void oscar_set_permit_deny(struct gaim_connection *gc) {
    2158         struct oscar_data *od = (struct oscar_data *)gc->proto_data;
     2157static void oscar_set_permit_deny(struct im_connection *ic) {
     2158        struct oscar_data *od = (struct oscar_data *)ic->proto_data;
    21592159        if (od->icq) {
    21602160                GSList *list;
     
    21622162                int at;
    21632163
    2164                 switch(gc->permdeny) {
     2164                switch(ic->permdeny) {
    21652165                case 1:
    2166                         aim_bos_changevisibility(od->sess, od->conn, AIM_VISIBILITYCHANGE_DENYADD, gc->username);
     2166                        aim_bos_changevisibility(od->sess, od->conn, AIM_VISIBILITYCHANGE_DENYADD, ic->username);
    21672167                        break;
    21682168                case 2:
    2169                         aim_bos_changevisibility(od->sess, od->conn, AIM_VISIBILITYCHANGE_PERMITADD, gc->username);
     2169                        aim_bos_changevisibility(od->sess, od->conn, AIM_VISIBILITYCHANGE_PERMITADD, ic->username);
    21702170                        break;
    21712171                case 3:
    2172                         list = gc->permit;
     2172                        list = ic->permit;
    21732173                        at = 0;
    21742174                        while (list) {
     
    21792179                        break;
    21802180                case 4:
    2181                         list = gc->deny;
     2181                        list = ic->deny;
    21822182                        at = 0;
    21832183                        while (list) {
     
    21902190                        break;
    21912191                }
    2192                 signoff_blocked(gc);
     2192                signoff_blocked(ic);
    21932193        } else {
    21942194                if (od->sess->ssi.received_data)
    2195                         aim_ssi_setpermdeny(od->sess, od->conn, gc->permdeny, 0xffffffff);
    2196         }
    2197 }
    2198 
    2199 static void oscar_add_permit(struct gaim_connection *gc, char *who) {
    2200         struct oscar_data *od = (struct oscar_data *)gc->proto_data;
     2195                        aim_ssi_setpermdeny(od->sess, od->conn, ic->permdeny, 0xffffffff);
     2196        }
     2197}
     2198
     2199static void oscar_add_permit(struct im_connection *ic, char *who) {
     2200        struct oscar_data *od = (struct oscar_data *)ic->proto_data;
    22012201        if (od->icq) {
    22022202                aim_ssi_auth_reply(od->sess, od->conn, who, 1, "");
     
    22072207}
    22082208
    2209 static void oscar_add_deny(struct gaim_connection *gc, char *who) {
    2210         struct oscar_data *od = (struct oscar_data *)gc->proto_data;
     2209static void oscar_add_deny(struct im_connection *ic, char *who) {
     2210        struct oscar_data *od = (struct oscar_data *)ic->proto_data;
    22112211        if (od->icq) {
    22122212                aim_ssi_auth_reply(od->sess, od->conn, who, 0, "");
     
    22172217}
    22182218
    2219 static void oscar_rem_permit(struct gaim_connection *gc, char *who) {
    2220         struct oscar_data *od = (struct oscar_data *)gc->proto_data;
     2219static void oscar_rem_permit(struct im_connection *ic, char *who) {
     2220        struct oscar_data *od = (struct oscar_data *)ic->proto_data;
    22212221        if (!od->icq) {
    22222222                if (od->sess->ssi.received_data)
     
    22252225}
    22262226
    2227 static void oscar_rem_deny(struct gaim_connection *gc, char *who) {
    2228         struct oscar_data *od = (struct oscar_data *)gc->proto_data;
     2227static void oscar_rem_deny(struct im_connection *ic, char *who) {
     2228        struct oscar_data *od = (struct oscar_data *)ic->proto_data;
    22292229        if (!od->icq) {
    22302230                if (od->sess->ssi.received_data)
     
    22332233}
    22342234
    2235 static GList *oscar_away_states(struct gaim_connection *gc)
    2236 {
    2237         struct oscar_data *od = gc->proto_data;
     2235static GList *oscar_away_states(struct im_connection *ic)
     2236{
     2237        struct oscar_data *od = ic->proto_data;
    22382238        GList *m = NULL;
    22392239
     
    22542254static int gaim_icqinfo(aim_session_t *sess, aim_frame_t *fr, ...)
    22552255{
    2256         struct gaim_connection *gc = sess->aux_data;
     2256        struct im_connection *ic = sess->aux_data;
    22572257        gchar who[16];
    22582258        GString *str;
     
    23302330        }
    23312331
    2332                 serv_got_crap(gc, "%s\n%s", _("User Info"), str->str);
     2332                serv_got_crap(ic, "%s\n%s", _("User Info"), str->str);
    23332333        g_string_free(str, TRUE);
    23342334
     
    23952395static int gaim_parseaiminfo(aim_session_t *sess, aim_frame_t *fr, ...)
    23962396{
    2397         struct gaim_connection *gc = sess->aux_data;
     2397        struct im_connection *ic = sess->aux_data;
    23982398        va_list ap;
    23992399        aim_userinfo_t *userinfo;
     
    24242424                        idletime.tm_sec = 0;
    24252425                        strftime(buff, 256, _("%d days %H hours %M minutes"), &idletime);
    2426                         serv_got_crap(gc, "%s: %s", _("Idle Time"), buff);
     2426                        serv_got_crap(ic, "%s: %s", _("Idle Time"), buff);
    24272427                }
    24282428               
    24292429                if(text) {
    24302430                        utf8 = oscar_encoding_to_utf8(extracted_encoding, text, text_length);
    2431                         serv_got_crap(gc, "%s\n%s", _("User Info"), utf8);
     2431                        serv_got_crap(ic, "%s\n%s", _("User Info"), utf8);
    24322432                } else {
    2433                         serv_got_crap(gc, _("No user info available."));
     2433                        serv_got_crap(ic, _("No user info available."));
    24342434                }
    24352435        } else if(infotype == AIM_GETINFO_AWAYMESSAGE && userinfo->flags & AIM_FLAG_AWAY) {
    24362436                utf8 = oscar_encoding_to_utf8(extracted_encoding, text, text_length);
    2437                 serv_got_crap(gc, "%s\n%s", _("Away Message"), utf8);
     2437                serv_got_crap(ic, "%s\n%s", _("Away Message"), utf8);
    24382438        }
    24392439
     
    24452445int gaim_parsemtn(aim_session_t *sess, aim_frame_t *fr, ...)
    24462446{
    2447         struct gaim_connection * gc = sess->aux_data;
     2447        struct im_connection * ic = sess->aux_data;
    24482448        va_list ap;
    24492449        guint16 type1, type2;
     
    24582458        if(type2 == 0x0002) {
    24592459                /* User is typing */
    2460                 serv_got_typing(gc, sn, 0, 1);
     2460                serv_got_typing(ic, sn, 0, 1);
    24612461        }
    24622462        else if (type2 == 0x0001) {
    24632463                /* User has typed something, but is not actively typing (stale) */
    2464                 serv_got_typing(gc, sn, 0, 2);
     2464                serv_got_typing(ic, sn, 0, 2);
    24652465        }
    24662466        else {
    24672467                /* User has stopped typing */
    2468                 serv_got_typing(gc, sn, 0, 0);
     2468                serv_got_typing(ic, sn, 0, 0);
    24692469        }       
    24702470       
     
    24722472}
    24732473
    2474 static char *oscar_get_status_string( struct gaim_connection *gc, int number )
    2475 {
    2476         struct oscar_data *od = gc->proto_data;
     2474static char *oscar_get_status_string( struct im_connection *ic, int number )
     2475{
     2476        struct oscar_data *od = ic->proto_data;
    24772477       
    24782478        if( ! number & UC_UNAVAILABLE )
     
    25002500}
    25012501
    2502 int oscar_send_typing(struct gaim_connection *gc, char * who, int typing)
    2503 {
    2504         struct oscar_data *od = gc->proto_data;
     2502int oscar_send_typing(struct im_connection *ic, char * who, int typing)
     2503{
     2504        struct oscar_data *od = ic->proto_data;
    25052505        return( aim_im_sendmtn(od->sess, 1, who, typing ? 0x0002 : 0x0000) );
    25062506}
    25072507
    2508 int oscar_chat_send(struct conversation *c, char *message)
    2509 {
    2510         struct gaim_connection *gc = c->gc;
    2511         struct oscar_data * od = (struct oscar_data*)gc->proto_data;
     2508void oscar_chat_send(struct groupchat *c, char *message, int msgflags)
     2509{
     2510        struct im_connection *ic = c->ic;
     2511        struct oscar_data * od = (struct oscar_data*)ic->proto_data;
    25122512        struct chat_connection * ccon;
    25132513        int ret;
     
    25502550  }
    25512551 
    2552   return (ret >= 0);
    2553 }
    2554 
    2555 void oscar_chat_invite(struct conversation *c, char *message, char *who)
    2556 {
    2557         struct gaim_connection *gc = c->gc;
    2558         struct oscar_data * od = (struct oscar_data *)gc->proto_data;
     2552/*  return (ret >= 0); */
     2553}
     2554
     2555void oscar_chat_invite(struct groupchat *c, char *message, char *who)
     2556{
     2557        struct im_connection *ic = c->ic;
     2558        struct oscar_data * od = (struct oscar_data *)ic->proto_data;
    25592559        struct chat_connection *ccon = c->data;
    25602560       
     
    25632563}
    25642564
    2565 void oscar_chat_kill(struct gaim_connection *gc, struct chat_connection *cc)
    2566 {
    2567         struct oscar_data *od = (struct oscar_data *)gc->proto_data;
     2565void oscar_chat_kill(struct im_connection *ic, struct chat_connection *cc)
     2566{
     2567        struct oscar_data *od = (struct oscar_data *)ic->proto_data;
    25682568
    25692569        /* Notify the conversation window that we've left the chat */
     
    25802580}
    25812581
    2582 void oscar_chat_leave(struct conversation *c)
    2583 {
    2584         oscar_chat_kill(c->gc, c->data);
    2585 }
    2586 
    2587 int oscar_chat_join(struct gaim_connection * gc, char * name)
    2588 {
    2589         struct oscar_data * od = (struct oscar_data *)gc->proto_data;
     2582void oscar_chat_leave(struct groupchat *c)
     2583{
     2584        oscar_chat_kill(c->ic, c->data);
     2585}
     2586
     2587int oscar_chat_join(struct im_connection * ic, char * name)
     2588{
     2589        struct oscar_data * od = (struct oscar_data *)ic->proto_data;
    25902590       
    25912591        aim_conn_t * cur;
     
    26052605}
    26062606
    2607 struct conversation *oscar_chat_open(struct gaim_connection * gc, char *who)
    2608 {
    2609         struct oscar_data * od = (struct oscar_data *)gc->proto_data;
     2607struct groupchat *oscar_chat_with(struct im_connection * ic, char *who)
     2608{
     2609        struct oscar_data * od = (struct oscar_data *)ic->proto_data;
    26102610        int ret;
    26112611        static int chat_id = 0;
    26122612        char * chatname;
    26132613       
    2614         chatname = g_strdup_printf("%s%d", gc->username, chat_id++);
     2614        chatname = g_strdup_printf("%s%d", ic->username, chat_id++);
    26152615 
    2616         ret = oscar_chat_join(gc, chatname);
     2616        ret = oscar_chat_join(ic, chatname);
    26172617
    26182618        aim_chat_invite(od->sess, od->conn, who, "", 4, chatname, 0x0);
     
    26252625void oscar_accept_chat(gpointer w, struct aim_chat_invitation * inv)
    26262626{
    2627         oscar_chat_join(inv->gc, inv->name);
     2627        oscar_chat_join(inv->ic, inv->name);
    26282628        g_free(inv->name);
    26292629        g_free(inv);
     
    26362636}
    26372637
    2638 void oscar_init()
     2638void oscar_initmodule()
    26392639{
    26402640        struct prpl *ret = g_new0(struct prpl, 1);
    26412641        ret->name = "oscar";
    26422642        ret->away_states = oscar_away_states;
     2643        ret->init = oscar_init;
    26432644        ret->login = oscar_login;
    2644         ret->acc_init = oscar_acc_init;
    2645         ret->close = oscar_close;
     2645        ret->keepalive = oscar_keepalive;
     2646        ret->logout = oscar_logout;
    26462647        ret->send_im = oscar_send_im;
    26472648        ret->get_info = oscar_get_info;
     
    26532654        ret->chat_invite = oscar_chat_invite;
    26542655        ret->chat_leave = oscar_chat_leave;
    2655         ret->chat_open = oscar_chat_open;
     2656        ret->chat_with = oscar_chat_with;
    26562657        ret->add_permit = oscar_add_permit;
    26572658        ret->add_deny = oscar_add_deny;
     
    26592660        ret->rem_deny = oscar_rem_deny;
    26602661        ret->set_permit_deny = oscar_set_permit_deny;
    2661         ret->keepalive = oscar_keepalive;
    26622662        ret->get_status_string = oscar_get_status_string;
    26632663        ret->send_typing = oscar_send_typing;
  • protocols/oscar/service.c

    rfa29d093 r0da65d5  
    732732        guint32 data;
    733733        int tlvlen;
    734         struct gaim_connection *gc = sess ? sess->aux_data : NULL;
     734        struct im_connection *ic = sess ? sess->aux_data : NULL;
    735735
    736736        data = AIM_ICQ_STATE_HIDEIP | status; /* yay for error checking ;^) */
    737737       
    738         if (gc && set_getbool(&gc->acc->set, "web_aware"))
     738        if (ic && set_getbool(&ic->acc->set, "web_aware"))
    739739                data |= AIM_ICQ_STATE_WEBAWARE;
    740740
  • protocols/yahoo/yahoo.c

    rfa29d093 r0da65d5  
    5858{
    5959        char *name;
    60         struct conversation *c;
     60        struct groupchat *c;
    6161        int yid;
    6262        YList *members;
    63         struct gaim_connection *gc;
     63        struct im_connection *ic;
    6464};
    6565
     
    123123static void byahoo_login( account_t *acc )
    124124{
    125         struct gaim_connection *gc = new_gaim_conn( acc );
    126         struct byahoo_data *yd = gc->proto_data = g_new0( struct byahoo_data, 1 );
     125        struct im_connection *ic = new_gaim_conn( acc );
     126        struct byahoo_data *yd = ic->proto_data = g_new0( struct byahoo_data, 1 );
    127127       
    128128        yd->logged_in = FALSE;
    129129        yd->current_status = YAHOO_STATUS_AVAILABLE;
    130130       
    131         set_login_progress( gc, 1, "Connecting" );
     131        set_login_progress( ic, 1, "Connecting" );
    132132        yd->y2_id = yahoo_init( acc->user, acc->pass );
    133133        yahoo_login( yd->y2_id, yd->current_status );
    134134}
    135135
    136 static void byahoo_close( struct gaim_connection *gc )
    137 {
    138         struct byahoo_data *yd = (struct byahoo_data *) gc->proto_data;
     136static void byahoo_logout( struct im_connection *ic )
     137{
     138        struct byahoo_data *yd = (struct byahoo_data *) ic->proto_data;
    139139        GSList *l;
    140140       
    141         while( gc->conversations )
    142                 serv_got_chat_left( gc->conversations );
     141        while( ic->conversations )
     142                serv_got_chat_left( ic->conversations );
    143143       
    144144        for( l = yd->buddygroups; l; l = l->next )
     
    160160}
    161161
    162 static void byahoo_get_info(struct gaim_connection *gc, char *who)
     162static void byahoo_get_info(struct im_connection *ic, char *who)
    163163{
    164164        /* Just make an URL and let the user fetch the info */
    165         serv_got_crap(gc, "%s\n%s: %s%s", _("User Info"),
     165        serv_got_crap(ic, "%s\n%s: %s%s", _("User Info"),
    166166                        _("For now, fetch yourself"), yahoo_get_profile_url(),
    167167                        who);
    168168}
    169169
    170 static int byahoo_send_im( struct gaim_connection *gc, char *who, char *what, int len, int flags )
    171 {
    172         struct byahoo_data *yd = gc->proto_data;
     170static int byahoo_send_im( struct im_connection *ic, char *who, char *what, int flags )
     171{
     172        struct byahoo_data *yd = ic->proto_data;
    173173       
    174174        yahoo_send_im( yd->y2_id, NULL, who, what, 1 );
     
    177177}
    178178
    179 static int byahoo_send_typing( struct gaim_connection *gc, char *who, int typing )
    180 {
    181         struct byahoo_data *yd = gc->proto_data;
     179static int byahoo_send_typing( struct im_connection *ic, char *who, int typing )
     180{
     181        struct byahoo_data *yd = ic->proto_data;
    182182       
    183183        yahoo_send_typing( yd->y2_id, NULL, who, typing );
     
    186186}
    187187
    188 static void byahoo_set_away( struct gaim_connection *gc, char *state, char *msg )
    189 {
    190         struct byahoo_data *yd = (struct byahoo_data *) gc->proto_data;
    191        
    192         gc->away = NULL;
     188static void byahoo_set_away( struct im_connection *ic, char *state, char *msg )
     189{
     190        struct byahoo_data *yd = (struct byahoo_data *) ic->proto_data;
     191       
     192        ic->away = NULL;
    193193       
    194194        if( state && msg && g_strcasecmp( state, msg ) != 0 )
    195195        {
    196196                yd->current_status = YAHOO_STATUS_CUSTOM;
    197                 gc->away = "";
     197                ic->away = "";
    198198        }
    199199        else if( state )
     
    204204                msg = NULL;
    205205               
    206                 gc->away = "";
     206                ic->away = "";
    207207                if( g_strcasecmp( state, "Available" ) == 0 )
    208208                {
    209209                        yd->current_status = YAHOO_STATUS_AVAILABLE;
    210                         gc->away = NULL;
     210                        ic->away = NULL;
    211211                }
    212212                else if( g_strcasecmp( state, "Be Right Back" ) == 0 )
     
    234234                        yd->current_status = YAHOO_STATUS_AVAILABLE;
    235235                       
    236                         gc->away = NULL;
     236                        ic->away = NULL;
    237237                }
    238238        }
     
    240240                yd->current_status = YAHOO_STATUS_AVAILABLE;
    241241       
    242         yahoo_set_away( yd->y2_id, yd->current_status, msg, gc->away != NULL );
    243 }
    244 
    245 static GList *byahoo_away_states( struct gaim_connection *gc )
     242        yahoo_set_away( yd->y2_id, yd->current_status, msg, ic->away != NULL );
     243}
     244
     245static GList *byahoo_away_states( struct im_connection *ic )
    246246{
    247247        GList *m = NULL;
     
    263263}
    264264
    265 static void byahoo_keepalive( struct gaim_connection *gc )
    266 {
    267         struct byahoo_data *yd = gc->proto_data;
     265static void byahoo_keepalive( struct im_connection *ic )
     266{
     267        struct byahoo_data *yd = ic->proto_data;
    268268       
    269269        yahoo_keepalive( yd->y2_id );
    270270}
    271271
    272 static void byahoo_add_buddy( struct gaim_connection *gc, char *who )
    273 {
    274         struct byahoo_data *yd = (struct byahoo_data *) gc->proto_data;
    275        
    276         yahoo_add_buddy( yd->y2_id, who, BYAHOO_DEFAULT_GROUP );
    277 }
    278 
    279 static void byahoo_remove_buddy( struct gaim_connection *gc, char *who, char *group )
    280 {
    281         struct byahoo_data *yd = (struct byahoo_data *) gc->proto_data;
     272static void byahoo_add_buddy( struct im_connection *ic, char *who, char *group )
     273{
     274        struct byahoo_data *yd = (struct byahoo_data *) ic->proto_data;
     275       
     276        yahoo_add_buddy( yd->y2_id, who, group ? group : BYAHOO_DEFAULT_GROUP );
     277}
     278
     279static void byahoo_remove_buddy( struct im_connection *ic, char *who, char *group )
     280{
     281        struct byahoo_data *yd = (struct byahoo_data *) ic->proto_data;
    282282        GSList *bgl;
    283283       
     
    293293}
    294294
    295 static char *byahoo_get_status_string( struct gaim_connection *gc, int stat )
     295static char *byahoo_get_status_string( struct im_connection *ic, int stat )
    296296{
    297297        enum yahoo_status a = stat >> 1;
     
    332332}
    333333
    334 static int byahoo_chat_send( struct conversation *c, char *message )
    335 {
    336         struct byahoo_data *yd = (struct byahoo_data *) c->gc->proto_data;
     334static void byahoo_chat_send( struct groupchat *c, char *message, int flags )
     335{
     336        struct byahoo_data *yd = (struct byahoo_data *) c->ic->proto_data;
    337337       
    338338        yahoo_conference_message( yd->y2_id, NULL, c->data, c->title, message, 1 );
    339        
    340         return( 0 );
    341 }
    342 
    343 static void byahoo_chat_invite( struct conversation *c, char *msg, char *who )
    344 {
    345         struct byahoo_data *yd = (struct byahoo_data *) c->gc->proto_data;
     339}
     340
     341static void byahoo_chat_invite( struct groupchat *c, char *msg, char *who )
     342{
     343        struct byahoo_data *yd = (struct byahoo_data *) c->ic->proto_data;
    346344       
    347345        yahoo_conference_invite( yd->y2_id, NULL, c->data, c->title, msg );
    348346}
    349347
    350 static void byahoo_chat_leave( struct conversation *c )
    351 {
    352         struct byahoo_data *yd = (struct byahoo_data *) c->gc->proto_data;
     348static void byahoo_chat_leave( struct groupchat *c )
     349{
     350        struct byahoo_data *yd = (struct byahoo_data *) c->ic->proto_data;
    353351       
    354352        yahoo_conference_logoff( yd->y2_id, NULL, c->data, c->title );
     
    356354}
    357355
    358 static struct conversation *byahoo_chat_open( struct gaim_connection *gc, char *who )
    359 {
    360         struct byahoo_data *yd = (struct byahoo_data *) gc->proto_data;
    361         struct conversation *c;
     356static struct groupchat *byahoo_chat_with( struct im_connection *ic, char *who )
     357{
     358        struct byahoo_data *yd = (struct byahoo_data *) ic->proto_data;
     359        struct groupchat *c;
    362360        char *roomname;
    363361        YList *members;
    364362       
    365         roomname = g_new0( char, strlen( gc->username ) + 16 );
    366         g_snprintf( roomname, strlen( gc->username ) + 16, "%s-Bee-%d", gc->username, byahoo_chat_id );
    367        
    368         c = serv_got_joined_chat( gc, roomname );
    369         add_chat_buddy( c, gc->username );
     363        roomname = g_new0( char, strlen( ic->username ) + 16 );
     364        g_snprintf( roomname, strlen( ic->username ) + 16, "%s-Bee-%d", ic->username, byahoo_chat_id );
     365       
     366        c = serv_got_joined_chat( ic, roomname );
     367        add_chat_buddy( c, ic->username );
    370368       
    371369        /* FIXME: Free this thing when the chat's destroyed. We can't *always*
     
    381379}
    382380
    383 void byahoo_init( )
     381void byahoo_initmodule( )
    384382{
    385383        struct prpl *ret = g_new0(struct prpl, 1);
     
    387385       
    388386        ret->login = byahoo_login;
    389         ret->close = byahoo_close;
     387        ret->keepalive = byahoo_keepalive;
     388        ret->logout = byahoo_logout;
     389       
    390390        ret->send_im = byahoo_send_im;
    391391        ret->get_info = byahoo_get_info;
    392392        ret->away_states = byahoo_away_states;
    393393        ret->set_away = byahoo_set_away;
    394         ret->keepalive = byahoo_keepalive;
    395394        ret->add_buddy = byahoo_add_buddy;
    396395        ret->remove_buddy = byahoo_remove_buddy;
     
    401400        ret->chat_invite = byahoo_chat_invite;
    402401        ret->chat_leave = byahoo_chat_leave;
    403         ret->chat_open = byahoo_chat_open;
     402        ret->chat_with = byahoo_chat_with;
    404403
    405404        ret->handle_cmp = g_strcasecmp;
     
    408407}
    409408
    410 static struct gaim_connection *byahoo_get_gc_by_id( int id )
     409static struct im_connection *byahoo_get_ic_by_id( int id )
    411410{
    412411        GSList *l;
    413         struct gaim_connection *gc;
     412        struct im_connection *ic;
    414413        struct byahoo_data *yd;
    415414       
    416415        for( l = get_connections(); l; l = l->next )
    417416        {
    418                 gc = l->data;
    419                 yd = gc->proto_data;
    420                
    421                 if( strcmp( gc->acc->prpl->name, "yahoo" ) == 0 && yd->y2_id == id )
    422                         return( gc );
     417                ic = l->data;
     418                yd = ic->proto_data;
     419               
     420                if( strcmp( ic->acc->prpl->name, "yahoo" ) == 0 && yd->y2_id == id )
     421                        return( ic );
    423422        }
    424423       
     
    441440        struct byahoo_connect_callback_data *d = data;
    442441       
    443         if( !byahoo_get_gc_by_id( d->id ) )
     442        if( !byahoo_get_ic_by_id( d->id ) )
    444443        {
    445444                g_free( d );
     
    463462        struct byahoo_read_ready_data *d = data;
    464463       
    465         if( !byahoo_get_gc_by_id( d->id ) )
     464        if( !byahoo_get_ic_by_id( d->id ) )
    466465                /* WTF doesn't libyahoo clean this up? */
    467466                return FALSE;
     
    484483        struct byahoo_write_ready_data *d = data;
    485484       
    486         if( !byahoo_get_gc_by_id( d->id ) )
     485        if( !byahoo_get_ic_by_id( d->id ) )
    487486                /* WTF doesn't libyahoo clean this up? */
    488487                return FALSE;
     
    495494void ext_yahoo_login_response( int id, int succ, char *url )
    496495{
    497         struct gaim_connection *gc = byahoo_get_gc_by_id( id );
     496        struct im_connection *ic = byahoo_get_ic_by_id( id );
    498497        struct byahoo_data *yd = NULL;
    499498       
    500         if( gc == NULL )
     499        if( ic == NULL )
    501500        {
    502501                /* libyahoo2 seems to call this one twice when something
     
    508507        }
    509508       
    510         yd = (struct byahoo_data *) gc->proto_data;
     509        yd = (struct byahoo_data *) ic->proto_data;
    511510       
    512511        if( succ == YAHOO_LOGIN_OK )
    513512        {
    514                 account_online( gc );
     513                account_online( ic );
    515514               
    516515                yd->logged_in = TRUE;
     
    532531                {
    533532                        errstr = "Logged in on a different machine or device";
    534                         gc->wants_to_die = TRUE;
     533                        ic->wants_to_die = TRUE;
    535534                }
    536535                else if( succ == YAHOO_LOGIN_SOCK )
     
    551550               
    552551                if( yd->logged_in )
    553                         hide_login_progress_error( gc, s );
     552                        hide_login_progress_error( ic, s );
    554553                else
    555                         hide_login_progress( gc, s );
     554                        hide_login_progress( ic, s );
    556555               
    557556                g_free( s );
    558557               
    559                 signoff( gc );
     558                signoff( ic );
    560559        }
    561560}
     
    563562void ext_yahoo_got_buddies( int id, YList *buds )
    564563{
    565         struct gaim_connection *gc = byahoo_get_gc_by_id( id );
    566         struct byahoo_data *yd = gc->proto_data;
     564        struct im_connection *ic = byahoo_get_ic_by_id( id );
     565        struct byahoo_data *yd = ic->proto_data;
    567566        YList *bl = buds;
    568567       
     
    581580                }
    582581               
    583                 add_buddy( gc, b->group, b->id, b->real_name );
     582                add_buddy( ic, b->group, b->id, b->real_name );
    584583                bl = bl->next;
    585584        }
     
    600599void ext_yahoo_status_changed( int id, char *who, int stat, char *msg, int away )
    601600{
    602         struct gaim_connection *gc = byahoo_get_gc_by_id( id );
    603        
    604         serv_got_update( gc, who, stat != YAHOO_STATUS_OFFLINE, 0, 0,
     601        struct im_connection *ic = byahoo_get_ic_by_id( id );
     602       
     603        serv_got_update( ic, who, stat != YAHOO_STATUS_OFFLINE, 0, 0,
    605604                         ( stat == YAHOO_STATUS_IDLE ) ? away : 0,
    606605                         ( stat != YAHOO_STATUS_AVAILABLE ) | ( stat << 1 ), 0 );
     
    609608void ext_yahoo_got_im( int id, char *who, char *msg, long tm, int stat, int utf8 )
    610609{
    611         struct gaim_connection *gc = byahoo_get_gc_by_id( id );
     610        struct im_connection *ic = byahoo_get_ic_by_id( id );
    612611        char *m = byahoo_strip( msg );
    613612       
    614         serv_got_im( gc, who, m, 0, 0, strlen( m ) );
     613        serv_got_im( ic, who, m, 0, 0, strlen( m ) );
    615614        g_free( m );
    616615}
     
    618617void ext_yahoo_got_file( int id, char *who, char *url, long expires, char *msg, char *fname, unsigned long fesize )
    619618{
    620         struct gaim_connection *gc = byahoo_get_gc_by_id( id );
    621        
    622         serv_got_crap( gc, "Got a file transfer (file = %s) from %s. Ignoring for now due to lack of support.", fname, who );
     619        struct im_connection *ic = byahoo_get_ic_by_id( id );
     620       
     621        serv_got_crap( ic, "Got a file transfer (file = %s) from %s. Ignoring for now due to lack of support.", fname, who );
    623622}
    624623
    625624void ext_yahoo_typing_notify( int id, char *who, int stat )
    626625{
    627         struct gaim_connection *gc = byahoo_get_gc_by_id( id );
     626        struct im_connection *ic = byahoo_get_ic_by_id( id );
    628627        if (stat == 1) {
    629628                /* User is typing */
    630                 serv_got_typing( gc, who, 1, 1 );
     629                serv_got_typing( ic, who, 1, 1 );
    631630        }
    632631        else {
    633632                /* User stopped typing */
    634                 serv_got_typing( gc, who, 1, 0 );
     633                serv_got_typing( ic, who, 1, 0 );
    635634        }
    636635}
     
    638637void ext_yahoo_system_message( int id, char *msg )
    639638{
    640         struct gaim_connection *gc = byahoo_get_gc_by_id( id );
    641        
    642         serv_got_crap( gc, "Yahoo! system message: %s", msg );
     639        struct im_connection *ic = byahoo_get_ic_by_id( id );
     640       
     641        serv_got_crap( ic, "Yahoo! system message: %s", msg );
    643642}
    644643
    645644void ext_yahoo_webcam_invite( int id, char *from )
    646645{
    647         struct gaim_connection *gc = byahoo_get_gc_by_id( id );
    648        
    649         serv_got_crap( gc, "Got a webcam invitation from %s. IRC+webcams is a no-no though...", from );
     646        struct im_connection *ic = byahoo_get_ic_by_id( id );
     647       
     648        serv_got_crap( ic, "Got a webcam invitation from %s. IRC+webcams is a no-no though...", from );
    650649}
    651650
    652651void ext_yahoo_error( int id, char *err, int fatal )
    653652{
    654         struct gaim_connection *gc = byahoo_get_gc_by_id( id );
     653        struct im_connection *ic = byahoo_get_ic_by_id( id );
    655654       
    656655        if( fatal )
    657656        {
    658                 hide_login_progress_error( gc, err );
    659                 signoff( gc );
     657                hide_login_progress_error( ic, err );
     658                signoff( ic );
    660659        }
    661660        else
    662661        {
    663                 do_error_dialog( gc, err, "Yahoo! error" );
     662                do_error_dialog( ic, err, "Yahoo! error" );
    664663        }
    665664}
     
    788787{
    789788        yahoo_conference_logon( inv->yid, NULL, inv->members, inv->name );
    790         add_chat_buddy( inv->c, inv->gc->username );
     789        add_chat_buddy( inv->c, inv->ic->username );
    791790        g_free( inv->name );
    792791        g_free( inv );
     
    803802void ext_yahoo_got_conf_invite( int id, char *who, char *room, char *msg, YList *members )
    804803{
    805         struct gaim_connection *gc = byahoo_get_gc_by_id( id );
     804        struct im_connection *ic = byahoo_get_ic_by_id( id );
    806805        struct byahoo_conf_invitation *inv;
    807806        char txt[1024];
     
    811810        memset( inv, 0, sizeof( struct byahoo_conf_invitation ) );
    812811        inv->name = g_strdup( room );
    813         inv->c = serv_got_joined_chat( gc, room );
     812        inv->c = serv_got_joined_chat( ic, room );
    814813        inv->c->data = members;
    815814        inv->yid = id;
    816815        inv->members = members;
    817         inv->gc = gc;
     816        inv->ic = ic;
    818817       
    819818        for( m = members; m; m = m->next )
    820                 if( g_strcasecmp( m->data, gc->username ) != 0 )
     819                if( g_strcasecmp( m->data, ic->username ) != 0 )
    821820                        add_chat_buddy( inv->c, m->data );
    822821       
    823822        g_snprintf( txt, 1024, "Got an invitation to chatroom %s from %s: %s", room, who, msg );
    824823       
    825         do_ask_dialog( gc, txt, inv, byahoo_accept_conf, byahoo_reject_conf );
     824        do_ask_dialog( ic, txt, inv, byahoo_accept_conf, byahoo_reject_conf );
    826825}
    827826
    828827void ext_yahoo_conf_userdecline( int id, char *who, char *room, char *msg )
    829828{
    830         struct gaim_connection *gc = byahoo_get_gc_by_id( id );
    831        
    832         serv_got_crap( gc, "Invite to chatroom %s rejected by %s: %s", room, who, msg );
     829        struct im_connection *ic = byahoo_get_ic_by_id( id );
     830       
     831        serv_got_crap( ic, "Invite to chatroom %s rejected by %s: %s", room, who, msg );
    833832}
    834833
    835834void ext_yahoo_conf_userjoin( int id, char *who, char *room )
    836835{
    837         struct gaim_connection *gc = byahoo_get_gc_by_id( id );
    838         struct conversation *c;
    839        
    840         for( c = gc->conversations; c && strcmp( c->title, room ) != 0; c = c->next );
     836        struct im_connection *ic = byahoo_get_ic_by_id( id );
     837        struct groupchat *c;
     838       
     839        for( c = ic->conversations; c && strcmp( c->title, room ) != 0; c = c->next );
    841840       
    842841        if( c )
     
    846845void ext_yahoo_conf_userleave( int id, char *who, char *room )
    847846{
    848         struct gaim_connection *gc = byahoo_get_gc_by_id( id );
    849         struct conversation *c;
    850        
    851         for( c = gc->conversations; c && strcmp( c->title, room ) != 0; c = c->next );
     847        struct im_connection *ic = byahoo_get_ic_by_id( id );
     848        struct groupchat *c;
     849       
     850        for( c = ic->conversations; c && strcmp( c->title, room ) != 0; c = c->next );
    852851       
    853852        if( c )
     
    857856void ext_yahoo_conf_message( int id, char *who, char *room, char *msg, int utf8 )
    858857{
    859         struct gaim_connection *gc = byahoo_get_gc_by_id( id );
     858        struct im_connection *ic = byahoo_get_ic_by_id( id );
    860859        char *m = byahoo_strip( msg );
    861         struct conversation *c;
    862        
    863         for( c = gc->conversations; c && strcmp( c->title, room ) != 0; c = c->next );
     860        struct groupchat *c;
     861       
     862        for( c = ic->conversations; c && strcmp( c->title, room ) != 0; c = c->next );
    864863       
    865864        if( c )
     
    910909void ext_yahoo_mail_notify( int id, char *from, char *subj, int cnt )
    911910{
    912         struct gaim_connection *gc = byahoo_get_gc_by_id( id );
     911        struct im_connection *ic = byahoo_get_ic_by_id( id );
    913912       
    914913        if( from && subj )
    915                 serv_got_crap( gc, "Received e-mail message from %s with subject `%s'", from, subj );
     914                serv_got_crap( ic, "Received e-mail message from %s with subject `%s'", from, subj );
    916915        else if( cnt > 0 )
    917                 serv_got_crap( gc, "Received %d new e-mails", cnt );
     916                serv_got_crap( ic, "Received %d new e-mails", cnt );
    918917}
    919918
  • query.c

    rfa29d093 r0da65d5  
    3030static query_t *query_default( irc_t *irc );
    3131
    32 query_t *query_add( irc_t *irc, struct gaim_connection *gc, char *question, void *yes, void *no, void *data )
     32query_t *query_add( irc_t *irc, struct im_connection *ic, char *question, void *yes, void *no, void *data )
    3333{
    3434        query_t *q = g_new0( query_t, 1 );
    3535       
    36         q->gc = gc;
     36        q->ic = ic;
    3737        q->question = g_strdup( question );
    3838        q->yes = yes;
     
    9797}
    9898
    99 void query_del_by_gc( irc_t *irc, struct gaim_connection *gc )
     99void query_del_by_conn( irc_t *irc, struct im_connection *ic )
    100100{
    101101        query_t *q, *n, *def;
     
    107107        while( q )
    108108        {
    109                 if( q->gc == gc )
     109                if( q->ic == ic )
    110110                {
    111111                        n = q->next;
     
    122122       
    123123        if( count > 0 )
    124                 serv_got_crap( gc, "Flushed %d unanswered question(s) for this connection.", count );
     124                serv_got_crap( ic, "Flushed %d unanswered question(s) for this connection.", count );
    125125       
    126126        q = query_default( irc );
     
    140140        if( ans )
    141141        {
    142                 serv_got_crap( q->gc, "Accepted: %s", q->question );
     142                serv_got_crap( q->ic, "Accepted: %s", q->question );
    143143                q->yes( NULL, q->data );
    144144        }
    145145        else
    146146        {
    147                 serv_got_crap( q->gc, "Rejected: %s", q->question );
     147                serv_got_crap( q->ic, "Rejected: %s", q->question );
    148148                q->no( NULL, q->data );
    149149        }
     
    158158static void query_display( irc_t *irc, query_t *q )
    159159{
    160         if( q->gc )
     160        if( q->ic )
    161161        {
    162                 serv_got_crap( q->gc, "New request: %s\nYou can use the \2yes\2/\2no\2 commands to accept/reject this request.", q->question );
     162                serv_got_crap( q->ic, "New request: %s\nYou can use the \2yes\2/\2no\2 commands to accept/reject this request.", q->question );
    163163        }
    164164        else
  • query.h

    rfa29d093 r0da65d5  
    2929typedef struct query
    3030{
    31         struct gaim_connection *gc;
     31        struct im_connection *ic;
    3232        char *question;
    3333        void (* yes) ( gpointer w, void *data );
     
    3737} query_t;
    3838
    39 query_t *query_add( irc_t *irc, struct gaim_connection *gc, char *question, void *yes, void *no, void *data );
     39query_t *query_add( irc_t *irc, struct im_connection *ic, char *question, void *yes, void *no, void *data );
    4040void query_del( irc_t *irc, query_t *q );
    41 void query_del_by_gc( irc_t *irc, struct gaim_connection *gc );
     41void query_del_by_conn( irc_t *irc, struct im_connection *ic );
    4242void query_answer( irc_t *irc, query_t *q, int ans );
    4343
  • root_commands.c

    rfa29d093 r0da65d5  
    248248                        irc_usermsg( irc, "Invalid account" );
    249249                }
    250                 else if( a->gc )
     250                else if( a->ic )
    251251                {
    252252                        irc_usermsg( irc, "Account is still logged in, can't delete" );
     
    269269                        char *con;
    270270                       
    271                         if( a->gc && ( a->gc->flags & OPT_LOGGED_IN ) )
     271                        if( a->ic && ( a->ic->flags & OPT_LOGGED_IN ) )
    272272                                con = " (connected)";
    273                         else if( a->gc )
     273                        else if( a->ic )
    274274                                con = " (connecting)";
    275275                        else if( a->reconnect )
     
    290290                        if( ( a = account_get( irc, cmd[2] ) ) )
    291291                        {
    292                                 if( a->gc )
     292                                if( a->ic )
    293293                                {
    294294                                        irc_usermsg( irc, "Account already online" );
     
    312312                       
    313313                                for( a = irc->accounts; a; a = a->next )
    314                                         if( !a->gc && a->auto_connect )
     314                                        if( !a->ic && a->auto_connect )
    315315                                                account_on( irc, a );
    316316                        }
     
    329329                        for( a = irc->accounts; a; a = a->next )
    330330                        {
    331                                 if( a->gc )
     331                                if( a->ic )
    332332                                        account_off( irc, a );
    333333                                else if( a->reconnect )
     
    337337                else if( ( a = account_get( irc, cmd[2] ) ) )
    338338                {
    339                         if( a->gc )
     339                        if( a->ic )
    340340                        {
    341341                                account_off( irc, a );
     
    387387                        set_t *s = set_find( &a->set, set_name );
    388388                       
    389                         if( a->gc && s && s->flags & ACC_SET_OFFLINE_ONLY )
     389                        if( a->ic && s && s->flags & ACC_SET_OFFLINE_ONLY )
    390390                        {
    391391                                g_free( acc_handle );
     
    393393                                return;
    394394                        }
    395                         else if( !a->gc && s && s->flags & ACC_SET_ONLINE_ONLY )
     395                        else if( !a->ic && s && s->flags & ACC_SET_ONLINE_ONLY )
    396396                        {
    397397                                g_free( acc_handle );
     
    450450                return;
    451451        }
    452         else if( !( a->gc && ( a->gc->flags & OPT_LOGGED_IN ) ) )
     452        else if( !( a->ic && ( a->ic->flags & OPT_LOGGED_IN ) ) )
    453453        {
    454454                irc_usermsg( irc, "That account is not on-line" );
     
    477477           add them to your *real* (server-side) contact list. */
    478478        if( add_for_real )
    479                 a->gc->acc->prpl->add_buddy( a->gc, cmd[2] );
    480                
    481         add_buddy( a->gc, NULL, cmd[2], cmd[2] );
    482        
    483         irc_usermsg( irc, "User `%s' added to your contact list as `%s'", cmd[2], user_findhandle( a->gc, cmd[2] )->nick );
     479                a->ic->acc->prpl->add_buddy( a->ic, cmd[2], NULL );
     480               
     481        add_buddy( a->ic, NULL, cmd[2], cmd[2] );
     482       
     483        irc_usermsg( irc, "User `%s' added to your contact list as `%s'", cmd[2], user_findhandle( a->ic, cmd[2] )->nick );
    484484}
    485485
    486486static void cmd_info( irc_t *irc, char **cmd )
    487487{
    488         struct gaim_connection *gc;
     488        struct im_connection *ic;
    489489        account_t *a;
    490490       
     
    492492        {
    493493                user_t *u = user_find( irc, cmd[1] );
    494                 if( !u || !u->gc )
     494                if( !u || !u->ic )
    495495                {
    496496                        irc_usermsg( irc, "Nick `%s' does not exist", cmd[1] );
    497497                        return;
    498498                }
    499                 gc = u->gc;
     499                ic = u->ic;
    500500                cmd[2] = u->handle;
    501501        }
     
    505505                return;
    506506        }
    507         else if( !( ( gc = a->gc ) && ( a->gc->flags & OPT_LOGGED_IN ) ) )
     507        else if( !( ( ic = a->ic ) && ( a->ic->flags & OPT_LOGGED_IN ) ) )
    508508        {
    509509                irc_usermsg( irc, "That account is not on-line" );
     
    511511        }
    512512       
    513         if( !gc->acc->prpl->get_info )
     513        if( !ic->acc->prpl->get_info )
    514514        {
    515515                irc_usermsg( irc, "Command `%s' not supported by this protocol", cmd[0] );
     
    517517        else
    518518        {
    519                 gc->acc->prpl->get_info( gc, cmd[2] );
     519                ic->acc->prpl->get_info( ic, cmd[2] );
    520520        }
    521521}
     
    552552                else if( u->send_handler == buddy_send_handler )
    553553                {
    554                         nick_set( u->gc->acc, u->handle, cmd[2] );
     554                        nick_set( u->ic->acc, u->handle, cmd[2] );
    555555                }
    556556               
     
    564564        char *s;
    565565       
    566         if( !( u = user_find( irc, cmd[1] ) ) || !u->gc )
     566        if( !( u = user_find( irc, cmd[1] ) ) || !u->ic )
    567567        {
    568568                irc_usermsg( irc, "Buddy `%s' not found", cmd[1] );
     
    571571        s = g_strdup( u->handle );
    572572       
    573         u->gc->acc->prpl->remove_buddy( u->gc, u->handle, NULL );
    574         nick_del( u->gc->acc, u->handle );
     573        u->ic->acc->prpl->remove_buddy( u->ic, u->handle, NULL );
     574        nick_del( u->ic->acc, u->handle );
    575575        user_del( irc, cmd[1] );
    576576       
     
    583583static void cmd_block( irc_t *irc, char **cmd )
    584584{
    585         struct gaim_connection *gc;
     585        struct im_connection *ic;
    586586        account_t *a;
    587587       
    588         if( !cmd[2] && ( a = account_get( irc, cmd[1] ) ) && a->gc )
     588        if( !cmd[2] && ( a = account_get( irc, cmd[1] ) ) && a->ic )
    589589        {
    590590                char *format;
     
    597597               
    598598                irc_usermsg( irc, format, "Handle", "Nickname" );
    599                 for( l = a->gc->deny; l; l = l->next )
    600                 {
    601                         user_t *u = user_findhandle( a->gc, l->data );
     599                for( l = a->ic->deny; l; l = l->next )
     600                {
     601                        user_t *u = user_findhandle( a->ic, l->data );
    602602                        irc_usermsg( irc, format, l->data, u ? u->nick : "(none)" );
    603603                }
     
    609609        {
    610610                user_t *u = user_find( irc, cmd[1] );
    611                 if( !u || !u->gc )
     611                if( !u || !u->ic )
    612612                {
    613613                        irc_usermsg( irc, "Nick `%s' does not exist", cmd[1] );
    614614                        return;
    615615                }
    616                 gc = u->gc;
     616                ic = u->ic;
    617617                cmd[2] = u->handle;
    618618        }
     
    622622                return;
    623623        }
    624         else if( !( ( gc = a->gc ) && ( a->gc->flags & OPT_LOGGED_IN ) ) )
     624        else if( !( ( ic = a->ic ) && ( a->ic->flags & OPT_LOGGED_IN ) ) )
    625625        {
    626626                irc_usermsg( irc, "That account is not on-line" );
     
    628628        }
    629629       
    630         if( !gc->acc->prpl->add_deny || !gc->acc->prpl->rem_permit )
     630        if( !ic->acc->prpl->add_deny || !ic->acc->prpl->rem_permit )
    631631        {
    632632                irc_usermsg( irc, "Command `%s' not supported by this protocol", cmd[0] );
     
    634634        else
    635635        {
    636                 bim_rem_allow( gc, cmd[2] );
    637                 bim_add_block( gc, cmd[2] );
     636                bim_rem_allow( ic, cmd[2] );
     637                bim_add_block( ic, cmd[2] );
    638638                irc_usermsg( irc, "Buddy `%s' moved from your allow- to your block-list", cmd[2] );
    639639        }
     
    642642static void cmd_allow( irc_t *irc, char **cmd )
    643643{
    644         struct gaim_connection *gc;
     644        struct im_connection *ic;
    645645        account_t *a;
    646646       
    647         if( !cmd[2] && ( a = account_get( irc, cmd[1] ) ) && a->gc )
     647        if( !cmd[2] && ( a = account_get( irc, cmd[1] ) ) && a->ic )
    648648        {
    649649                char *format;
     
    656656               
    657657                irc_usermsg( irc, format, "Handle", "Nickname" );
    658                 for( l = a->gc->permit; l; l = l->next )
    659                 {
    660                         user_t *u = user_findhandle( a->gc, l->data );
     658                for( l = a->ic->permit; l; l = l->next )
     659                {
     660                        user_t *u = user_findhandle( a->ic, l->data );
    661661                        irc_usermsg( irc, format, l->data, u ? u->nick : "(none)" );
    662662                }
     
    668668        {
    669669                user_t *u = user_find( irc, cmd[1] );
    670                 if( !u || !u->gc )
     670                if( !u || !u->ic )
    671671                {
    672672                        irc_usermsg( irc, "Nick `%s' does not exist", cmd[1] );
    673673                        return;
    674674                }
    675                 gc = u->gc;
     675                ic = u->ic;
    676676                cmd[2] = u->handle;
    677677        }
     
    681681                return;
    682682        }
    683         else if( !( ( gc = a->gc ) && ( a->gc->flags & OPT_LOGGED_IN ) ) )
     683        else if( !( ( ic = a->ic ) && ( a->ic->flags & OPT_LOGGED_IN ) ) )
    684684        {
    685685                irc_usermsg( irc, "That account is not on-line" );
     
    687687        }
    688688       
    689         if( !gc->acc->prpl->rem_deny || !gc->acc->prpl->add_permit )
     689        if( !ic->acc->prpl->rem_deny || !ic->acc->prpl->add_permit )
    690690        {
    691691                irc_usermsg( irc, "Command `%s' not supported by this protocol", cmd[0] );
     
    693693        else
    694694        {
    695                 bim_rem_block( gc, cmd[2] );
    696                 bim_add_allow( gc, cmd[2] );
     695                bim_rem_block( ic, cmd[2] );
     696                bim_add_allow( ic, cmd[2] );
    697697               
    698698                irc_usermsg( irc, "Buddy `%s' moved from your block- to your allow-list", cmd[2] );
     
    803803        irc_usermsg( irc, format, "Nick", "User/Host/Network", "Status" );
    804804       
    805         for( u = irc->users; u; u = u->next ) if( u->gc && u->online && !u->away )
     805        for( u = irc->users; u; u = u->next ) if( u->ic && u->online && !u->away )
    806806        {
    807807                if( online == 1 )
    808808                {
    809                         g_snprintf( s, sizeof( s ) - 1, "%s@%s (%s)", u->user, u->host, u->gc->acc->prpl->name );
     809                        g_snprintf( s, sizeof( s ) - 1, "%s@%s (%s)", u->user, u->host, u->ic->acc->prpl->name );
    810810                        irc_usermsg( irc, format, u->nick, s, "Online" );
    811811                }
     
    814814        }
    815815
    816         for( u = irc->users; u; u = u->next ) if( u->gc && u->online && u->away )
     816        for( u = irc->users; u; u = u->next ) if( u->ic && u->online && u->away )
    817817        {
    818818                if( away == 1 )
    819819                {
    820                         g_snprintf( s, sizeof( s ) - 1, "%s@%s (%s)", u->user, u->host, u->gc->acc->prpl->name );
     820                        g_snprintf( s, sizeof( s ) - 1, "%s@%s (%s)", u->user, u->host, u->ic->acc->prpl->name );
    821821                        irc_usermsg( irc, format, u->nick, s, u->away );
    822822                }
     
    824824        }
    825825       
    826         for( u = irc->users; u; u = u->next ) if( u->gc && !u->online )
     826        for( u = irc->users; u; u = u->next ) if( u->ic && !u->online )
    827827        {
    828828                if( offline == 1 )
    829829                {
    830                         g_snprintf( s, sizeof( s ) - 1, "%s@%s (%s)", u->user, u->host, u->gc->acc->prpl->name );
     830                        g_snprintf( s, sizeof( s ) - 1, "%s@%s (%s)", u->user, u->host, u->ic->acc->prpl->name );
    831831                        irc_usermsg( irc, format, u->nick, s, "Offline" );
    832832                }
     
    845845                irc_usermsg( irc, "Invalid account");
    846846        }
    847         else if( !( a->gc && ( a->gc->flags & OPT_LOGGED_IN ) ) )
     847        else if( !( a->ic && ( a->ic->flags & OPT_LOGGED_IN ) ) )
    848848        {
    849849                irc_usermsg( irc, "That account is not on-line" );
     
    851851        else if ( !cmd[2] )
    852852        {
    853                 irc_usermsg( irc, "Your name is `%s'" , a->gc->displayname ? a->gc->displayname : "NULL" );
    854         }
    855         else if ( !a->prpl->set_info )
     853                irc_usermsg( irc, "Your name is `%s'" , a->ic->displayname ? a->ic->displayname : "NULL" );
     854        }
     855        else if ( !a->prpl->set_my_name )
    856856        {
    857857                irc_usermsg( irc, "Command `%s' not supported by this protocol", cmd[0] );
     
    861861                irc_usermsg( irc, "Setting your name to `%s'", cmd[2] );
    862862               
    863                 a->prpl->set_info( a->gc, cmd[2] );
     863                a->prpl->set_my_name( a->ic, cmd[2] );
    864864        }
    865865}
     
    879879       
    880880        for( num = 0; q; q = q->next, num ++ )
    881                 if( q->gc ) /* Not necessary yet, but it might come later */
    882                         irc_usermsg( irc, "%d, %s(%s): %s", num, q->gc->acc->prpl->name, q->gc->username, q->question );
     881                if( q->ic ) /* Not necessary yet, but it might come later */
     882                        irc_usermsg( irc, "%d, %s(%s): %s", num, q->ic->acc->prpl->name, q->ic->username, q->question );
    883883                else
    884884                        irc_usermsg( irc, "%d, BitlBee: %s", num, q->question );
     
    888888{
    889889        account_t *a;
    890         struct gaim_connection *gc;
     890        struct im_connection *ic;
    891891        char *chat, *channel, *nick = NULL, *password = NULL;
    892         struct conversation *c;
     892        struct groupchat *c;
    893893       
    894894        if( !( a = account_get( irc, cmd[1] ) ) )
     
    897897                return;
    898898        }
    899         else if( !( a->gc && ( a->gc->flags & OPT_LOGGED_IN ) ) )
     899        else if( !( a->ic && ( a->ic->flags & OPT_LOGGED_IN ) ) )
    900900        {
    901901                irc_usermsg( irc, "That account is not on-line" );
     
    907907                return;
    908908        }
    909         gc = a->gc;
     909        ic = a->ic;
    910910       
    911911        chat = cmd[2];
     
    927927                password = cmd[5];
    928928       
    929         c = a->prpl->chat_join( gc, chat, nick, password );
     929        c = a->prpl->chat_join( ic, chat, nick, password );
    930930       
    931931        g_free( channel );
  • user.c

    rfa29d093 r0da65d5  
    141141}
    142142
    143 user_t *user_findhandle( struct gaim_connection *gc, char *handle )
     143user_t *user_findhandle( struct im_connection *ic, char *handle )
    144144{
    145145        user_t *u;
     
    147147       
    148148        /* First, let's try a hash lookup. If it works, it's probably faster. */
    149         if( ( nick = g_hash_table_lookup( gc->acc->nicks, handle ) ) &&
    150             ( u = user_find( gc->irc, nick ) ) &&
    151             ( gc->acc->prpl->handle_cmp( handle, u->handle ) == 0 ) )
     149        if( ( nick = g_hash_table_lookup( ic->acc->nicks, handle ) ) &&
     150            ( u = user_find( ic->irc, nick ) ) &&
     151            ( ic->acc->prpl->handle_cmp( handle, u->handle ) == 0 ) )
    152152                return u;
    153153       
    154154        /* However, it doesn't always work, so in that case we'll have to dig
    155155           through the whole userlist. :-( */
    156         for( u = gc->irc->users; u; u = u->next )
    157                 if( u->gc == gc && u->handle && gc->acc->prpl->handle_cmp( u->handle, handle ) == 0 )
     156        for( u = ic->irc->users; u; u = u->next )
     157                if( u->ic == ic && u->handle && ic->acc->prpl->handle_cmp( u->handle, handle ) == 0 )
    158158                        return u;
    159159       
  • user.h

    rfa29d093 r0da65d5  
    3838        char *handle;
    3939        char *group;
    40         struct gaim_connection *gc;
     40        struct im_connection *ic;
    4141
    4242        char *sendbuf;
     
    5454int user_del( irc_t *irc, char *nick );
    5555G_MODULE_EXPORT user_t *user_find( irc_t *irc, char *nick );
    56 G_MODULE_EXPORT user_t *user_findhandle( struct gaim_connection *gc, char *handle );
     56G_MODULE_EXPORT user_t *user_findhandle( struct im_connection *ic, char *handle );
    5757void user_rename( irc_t *irc, char *oldnick, char *newnick );
Note: See TracChangeset for help on using the changeset viewer.