Changes in / [3f81999:fc34fb5]


Ignore:
Files:
16 edited

Legend:

Unmodified
Added
Removed
  • bitlbee.h

    r3f81999 rfc34fb5  
    3636
    3737#define PACKAGE "BitlBee"
    38 #define BITLBEE_VERSION "1.2.4"
     38#define BITLBEE_VERSION "1.2.3"
    3939#define VERSION BITLBEE_VERSION
    4040
  • doc/CHANGES

    r3f81999 rfc34fb5  
    33
    44http://bugs.bitlbee.org/bitlbee/timeline?daysback=90&changeset=on
    5 
    6 Version 1.2.4:
    7 - Most important change (and main reason for releasing now): Upgraded Yahoo!
    8   module to a newer version to get it working again.
    9 - join_chat command replaced with the much better chat command:
    10   * Similar to how account replaced login/slist/logout. Add a chatroom once,
    11     then just /join it like any other room. Also automatic joining at login
    12     time is now possible.
    13   * Note that the old way of starting groupchats (/join #nickname) is now
    14     also deprecated, use "chat with" instead.
    15   * See "help chat" and "help chat add" for more information.
    16 - Rewrote bitlbee.conf parser to be less dumb.
    17 - Fixed compatibility (hopefully) with AIM mobile messages, certain kinds
    18   of Google Talk chatrooms.
    19 - Fixed numerous stability/reliability bugs over the last year.
    20 
    21 Finished 17 Oct 2009
    225
    236Version 1.2.3:
  • doc/user-guide/commands.xml

    r3f81999 rfc34fb5  
    175175                                        After adding a room to your list, you can simply use the IRC /join command to enter the room. Also, you can tell BitlBee to automatically join the room when you log in. (See <emphasis>chat set</emphasis>)
    176176                                </para>
    177 
    178                                 <para>
    179                                         Password-protected rooms work exactly like on IRC, by passing the password as an extra argument to /join.
    180                                 </para>
    181177                        </description>
    182178
  • irc_commands.c

    r3f81999 rfc34fb5  
    415415                        if( g_hash_table_lookup_extended( irc->watches, nick, &okey, &ovalue ) )
    416416                        {
     417                                g_free( okey );
    417418                                g_hash_table_remove( irc->watches, okey );
    418                                 g_free( okey );
    419419                               
    420420                                irc_reply( irc, 602, "%s %s %s %d :%s", nick, "*", "*", 0, "Stopped watching" );
  • lib/ini.c

    r3f81999 rfc34fb5  
    4343                ini->cur = ini->file;
    4444                ini->c_section = "";
    45                
    46                 close( fd );
    47                
    4845                return ini;
    4946        }
    50 
     47       
     48        g_free( ini );
    5149        if( fd >= 0 )
    5250                close( fd );
    53        
    54         ini_close( ini );
    5551
    5652        return NULL;
  • protocols/jabber/conference.c

    r3f81999 rfc34fb5  
    234234                            ( strcmp( s, XMLNS_MUC_USER ) == 0 ) )
    235235                        {
    236                                 struct xt_node *item;
    237                                
    238                                 item = xt_find_node( c->children, "item" );
    239                                 if( ( s = xt_find_attr( item, "jid" ) ) )
     236                                c = xt_find_node( c->children, "item" );
     237                                if( ( s = xt_find_attr( c, "jid" ) ) )
    240238                                {
    241239                                        /* Yay, found what we need. :-) */
     
    285283        else if( type ) /* type can only be NULL or "unavailable" in this function */
    286284        {
    287                 if( ( bud->flags & JBFLAG_IS_CHATROOM ) && bud->ext_jid )
    288                 {
    289                         s = strchr( bud->ext_jid, '/' );
    290                         if( s ) *s = 0;
    291                         imcb_chat_remove_buddy( chat, bud->ext_jid, NULL );
    292                         if( bud != jc->me && bud->flags & JBFLAG_IS_ANONYMOUS )
    293                                 imcb_remove_buddy( ic, bud->ext_jid, NULL );
    294                         if( s ) *s = '/';
    295                 }
     285                s = strchr( bud->ext_jid, '/' );
     286                if( s ) *s = 0;
     287                imcb_chat_remove_buddy( chat, bud->ext_jid, NULL );
     288                if( bud != jc->me && bud->flags & JBFLAG_IS_ANONYMOUS )
     289                        imcb_remove_buddy( ic, bud->ext_jid, NULL );
     290                if( s ) *s = '/';
    296291               
    297292                if( bud == jc->me )
  • protocols/jabber/iq.c

    r3f81999 rfc34fb5  
    5151        {
    5252                if( !( ( c = xt_find_node( node->children, "query" ) ) ||
    53                        ( c = xt_find_node( node->children, "ping" ) ) ) ||
     53                       ( c = xt_find_node( node->children, "ping" ) ) ) || /* O_o WHAT is wrong with just <query/> ????? */
    5454                    !( s = xt_find_attr( c, "xmlns" ) ) )
    5555                {
    56                         /* Sigh. Who decided to suddenly invent new elements
    57                            instead of just sticking with <query/>? */
     56                        imcb_log( ic, "Warning: Received incomplete IQ-%s packet", type );
    5857                        return XT_HANDLED;
    5958                }
  • protocols/nogaim.c

    r3f81999 rfc34fb5  
    506506}
    507507
    508 
    509 struct imcb_ask_cb_data
     508/* prpl.c */
     509
     510struct show_got_added_data
    510511{
    511512        struct im_connection *ic;
     
    513514};
    514515
    515 static void imcb_ask_auth_cb_no( void *data )
    516 {
    517         struct imcb_ask_cb_data *cbd = data;
    518        
    519         cbd->ic->acc->prpl->auth_deny( cbd->ic, cbd->handle );
    520        
    521         g_free( cbd->handle );
    522         g_free( cbd );
    523 }
    524 
    525 static void imcb_ask_auth_cb_yes( void *data )
    526 {
    527         struct imcb_ask_cb_data *cbd = data;
    528        
    529         cbd->ic->acc->prpl->auth_allow( cbd->ic, cbd->handle );
    530        
    531         g_free( cbd->handle );
    532         g_free( cbd );
    533 }
    534 
    535 void imcb_ask_auth( struct im_connection *ic, const char *handle, const char *realname )
    536 {
    537         struct imcb_ask_cb_data *data = g_new0( struct imcb_ask_cb_data, 1 );
    538         char *s, *realname_ = NULL;
    539        
    540         if( realname != NULL )
    541                 realname_ = g_strdup_printf( " (%s)", realname );
    542        
    543         s = g_strdup_printf( "The user %s%s wants to add you to his/her buddy list.",
    544                              handle, realname_ ?: "" );
    545        
    546         g_free( realname_ );
    547        
    548         data->ic = ic;
    549         data->handle = g_strdup( handle );
    550         query_add( ic->irc, ic, s, imcb_ask_auth_cb_yes, imcb_ask_auth_cb_no, data );
    551 }
    552 
    553 
    554 static void imcb_ask_add_cb_no( void *data )
    555 {
    556         g_free( ((struct imcb_ask_cb_data*)data)->handle );
     516void show_got_added_no( void *data )
     517{
     518        g_free( ((struct show_got_added_data*)data)->handle );
    557519        g_free( data );
    558520}
    559521
    560 static void imcb_ask_add_cb_yes( void *data )
    561 {
    562         struct imcb_ask_cb_data *cbd = data;
    563        
    564         cbd->ic->acc->prpl->add_buddy( cbd->ic, cbd->handle, NULL );
    565        
    566         return imcb_ask_add_cb_no( data );
    567 }
    568 
    569 void imcb_ask_add( struct im_connection *ic, const char *handle, const char *realname )
    570 {
    571         struct imcb_ask_cb_data *data = g_new0( struct imcb_ask_cb_data, 1 );
     522void show_got_added_yes( void *data )
     523{
     524        struct show_got_added_data *sga = data;
     525       
     526        sga->ic->acc->prpl->add_buddy( sga->ic, sga->handle, NULL );
     527        /* imcb_add_buddy( sga->ic, NULL, sga->handle, sga->handle ); */
     528       
     529        return show_got_added_no( data );
     530}
     531
     532void imcb_ask_add( struct im_connection *ic, char *handle, const char *realname )
     533{
     534        struct show_got_added_data *data = g_new0( struct show_got_added_data, 1 );
    572535        char *s;
    573536       
     
    580543        data->ic = ic;
    581544        data->handle = g_strdup( handle );
    582         query_add( ic->irc, ic, s, imcb_ask_add_cb_yes, imcb_ask_add_cb_no, data );
     545        query_add( ic->irc, ic, s, show_got_added_yes, show_got_added_no, data );
    583546}
    584547
  • protocols/nogaim.h

    r3f81999 rfc34fb5  
    228228         * - Most protocols will just want to set this to g_strcasecmp().*/
    229229        int (* handle_cmp) (const char *who1, const char *who2);
    230 
    231         /* Implement these callbacks if you want to use imcb_ask_auth() */
    232         void (* auth_allow)     (struct im_connection *, const char *who);
    233         void (* auth_deny)      (struct im_connection *, const char *who);
    234230};
    235231
     
    260256/* To tell the user an error, ie. before logging out when an error occurs. */
    261257G_MODULE_EXPORT void imcb_error( struct im_connection *ic, char *format, ... ) G_GNUC_PRINTF( 2, 3 );
    262 
    263258/* To ask a your about something.
    264259 * - 'msg' is the question.
     
    267262 */
    268263G_MODULE_EXPORT void imcb_ask( struct im_connection *ic, char *msg, void *data, query_callback doit, query_callback dont );
    269 
    270 /* Two common questions you may want to ask:
    271  * - X added you to his contact list, allow?
    272  * - X is not in your contact list, want to add?
    273  */
    274 G_MODULE_EXPORT void imcb_ask_auth( struct im_connection *ic, const char *handle, const char *realname );
    275 G_MODULE_EXPORT void imcb_ask_add( struct im_connection *ic, const char *handle, const char *realname );
     264G_MODULE_EXPORT void imcb_ask_add( struct im_connection *ic, char *handle, const char *realname );
    276265
    277266/* Buddy management */
  • protocols/oscar/aim.h

    r3f81999 rfc34fb5  
    144144}
    145145
    146 #define AIM_CLIENTINFO_KNOWNGOOD_5_1_3036 { \
    147         "AOL Instant Messenger, version 5.1.3036/WIN32", \
    148         0x0109, \
    149         0x0005, \
    150         0x0001, \
    151         0x0000, \
    152         0x0bdc, \
    153         "us", \
    154         "en", \
    155 }
    156 
    157146/*
    158147 * I would make 4.1.2010 the default, but they seem to have found
     
    163152 * around. (see login.c::memrequest())
    164153 */
    165 #define AIM_CLIENTINFO_KNOWNGOOD AIM_CLIENTINFO_KNOWNGOOD_5_1_3036
     154#define AIM_CLIENTINFO_KNOWNGOOD AIM_CLIENTINFO_KNOWNGOOD_3_5_1670
    166155
    167156#ifndef TRUE
  • protocols/yahoo/libyahoo2.c

    r3f81999 rfc34fb5  
    9191
    9292#include "base64.h"
    93 #include "http_client.h"
    9493
    9594#ifdef USE_STRUCT_CALLBACKS
     
    172171        YAHOO_SERVICE_GOTGROUPRENAME, /* < 1, 36(old), 37(new) */
    173172        YAHOO_SERVICE_SYSMESSAGE = 0x14,
    174         YAHOO_SERVICE_SKINNAME = 0x15,
    175173        YAHOO_SERVICE_PASSTHROUGH2 = 0x16,
    176174        YAHOO_SERVICE_CONFINVITE = 0x18,
     
    196194        YAHOO_SERVICE_LIST,
    197195        YAHOO_SERVICE_AUTH = 0x57,
    198         YAHOO_SERVICE_AUTHBUDDY = 0x6d,
    199196        YAHOO_SERVICE_ADDBUDDY = 0x83,
    200197        YAHOO_SERVICE_REMBUDDY,
     
    202199        YAHOO_SERVICE_REJECTCONTACT,
    203200        YAHOO_SERVICE_GROUPRENAME = 0x89, /* > 1, 65(new), 66(0), 67(old) */
    204         YAHOO_SERVICE_Y7_PING = 0x8A, /* 0 - id and that's it?? */
    205201        YAHOO_SERVICE_CHATONLINE = 0x96, /* > 109(id), 1, 6(abcde) < 0,1*/
    206202        YAHOO_SERVICE_CHATGOTO,
     
    208204        YAHOO_SERVICE_CHATLEAVE,
    209205        YAHOO_SERVICE_CHATEXIT = 0x9b,
    210         YAHOO_SERVICE_CHATADDINVITE = 0x9d,
    211206        YAHOO_SERVICE_CHATLOGOUT = 0xa0,
    212207        YAHOO_SERVICE_CHATPING,
     
    216211        YAHOO_SERVICE_PICTURE = 0xbe,
    217212        YAHOO_SERVICE_PICTURE_UPDATE = 0xc1,
    218         YAHOO_SERVICE_PICTURE_UPLOAD = 0xc2,
    219         YAHOO_SERVICE_Y6_VISIBILITY=0xc5,
    220         YAHOO_SERVICE_Y6_STATUS_UPDATE=0xc6,
    221         YAHOO_PHOTOSHARE_INIT=0xd2,     
    222         YAHOO_SERVICE_CONTACT_YMSG13=0xd6,
    223         YAHOO_PHOTOSHARE_PREV=0xd7,
    224         YAHOO_PHOTOSHARE_KEY=0xd8,
    225         YAHOO_PHOTOSHARE_TRANS=0xda,
    226         YAHOO_FILE_TRANSFER_INIT_YMSG13=0xdc,
    227         YAHOO_FILE_TRANSFER_GET_YMSG13=0xdd,
    228         YAHOO_FILE_TRANSFER_PUT_YMSG13=0xde,
    229         YAHOO_SERVICE_YMSG15_STATUS=0xf0,
    230         YAHOO_SERVICE_YMSG15_BUDDY_LIST=0xf1,
     213        YAHOO_SERVICE_PICTURE_UPLOAD = 0xc2
    231214};
    232215
     
    752735
    753736        memcpy(data + pos, "YMSG", 4); pos += 4;
    754         pos += yahoo_put16(data + pos, YAHOO_PROTO_VER);
     737        pos += yahoo_put16(data + pos, 0x000c);
    755738        pos += yahoo_put16(data + pos, 0x0000);
    756739        pos += yahoo_put16(data + pos, pktlen + extra_pad);
     
    766749                yahoo_send_data(yid->fd, data, len);
    767750        else
    768                 yahoo_add_to_send_queue(yid, data, len);
     751        yahoo_add_to_send_queue(yid, data, len);
    769752        FREE(data);
    770753}
     
    14861469
    14871470                if (u->name != NULL) {
    1488                         if (pkt->service == YAHOO_SERVICE_LOGOFF) { /* || u->flags == 0) { Not in YMSG16 */
     1471                        if (pkt->service == YAHOO_SERVICE_LOGOFF || u->flags == 0) {
    14891472                                YAHOO_CALLBACK(ext_yahoo_status_changed)(yd->client_id, u->name, YAHOO_STATUS_OFFLINE, NULL, 1, 0, 0);
    14901473                        } else {
    1491                                 /* Key 47 always seems to be 1 for YMSG16 */
    1492                                 if(!u->state)
    1493                                         u->away = 0;
    1494                                 else
    1495                                         u->away = 1;
    1496 
    14971474                                YAHOO_CALLBACK(ext_yahoo_status_changed)(yd->client_id, u->name, u->state, u->msg, u->away, u->idle, u->mobile);
    14981475                        }
     
    15021479                y_list_free_1(t);
    15031480                FREE(u);
    1504         }
    1505 }
    1506 
    1507 static void yahoo_process_buddy_list(struct yahoo_input_data *yid, struct yahoo_packet *pkt)
    1508 {
    1509         struct yahoo_data *yd = yid->yd;
    1510         YList *l;
    1511         int last_packet = 0;
    1512         char *cur_group = NULL;
    1513         struct yahoo_buddy *newbud = NULL;
    1514 
    1515         /* we could be getting multiple packets here */
    1516         for (l = pkt->hash; l; l = l->next) {
    1517                 struct yahoo_pair *pair = l->data;
    1518 
    1519                 switch(pair->key) {
    1520                 case 300:
    1521                 case 301:
    1522                 case 302:
    1523                 case 303:
    1524                         if ( 315 == atoi(pair->value) )
    1525                                 last_packet = 1;
    1526                         break;
    1527                 case 65:
    1528                         g_free(cur_group);
    1529                         cur_group = strdup(pair->value);
    1530                         break;
    1531                 case 7:
    1532                         newbud = y_new0(struct yahoo_buddy, 1);
    1533                         newbud->id = strdup(pair->value);
    1534                         if(cur_group)
    1535                                 newbud->group = strdup(cur_group);
    1536                         else {
    1537                                 struct yahoo_buddy *lastbud = (struct yahoo_buddy *)y_list_nth(
    1538                                                                 yd->buddies, y_list_length(yd->buddies)-1)->data;
    1539                                 newbud->group = strdup(lastbud->group);
    1540                         }
    1541 
    1542                         yd->buddies = y_list_append(yd->buddies, newbud);
    1543 
    1544                         break;
    1545                 }
    1546         }
    1547        
    1548         g_free(cur_group);
    1549 
    1550         /* we could be getting multiple packets here */
    1551         if (last_packet)
    1552                 return;
    1553 
    1554         YAHOO_CALLBACK(ext_yahoo_got_buddies)(yd->client_id, yd->buddies);
    1555 
    1556         /*** We login at the very end of the packet communication */
    1557         if (!yd->logged_in) {
    1558                 yd->logged_in = TRUE;
    1559                 if(yd->current_status < 0)
    1560                         yd->current_status = yd->initial_status;
    1561                 YAHOO_CALLBACK(ext_yahoo_login_response)(yd->client_id, YAHOO_LOGIN_OK, NULL);
    15621481        }
    15631482}
     
    16321551                        }
    16331552
    1634                         if(yd->cookie_y && yd->cookie_t)
     1553                        if(yd->cookie_y && yd->cookie_t && yd->cookie_c)
    16351554                                YAHOO_CALLBACK(ext_yahoo_got_cookies)(yd->client_id);
    16361555
     
    23092228}
    23102229
    2311 struct yahoo_https_auth_data
    2312 {
    2313         struct yahoo_input_data *yid;
    2314         char *token;
    2315         char *chal;
    2316 };
    2317 
    2318 static void yahoo_https_auth_token_init(struct yahoo_https_auth_data *had);
    2319 static void yahoo_https_auth_token_finish(struct http_request *req);
    2320 static void yahoo_https_auth_init(struct yahoo_https_auth_data *had);
    2321 static void yahoo_https_auth_finish(struct http_request *req);
    2322 
    2323 /* Extract a value from a login.yahoo.com response. Assume CRLF-linebreaks
    2324    and FAIL miserably if they're not there... */
    2325 static char *yahoo_ha_find_key(char *response, char *key)
    2326 {
    2327         char *s, *end;
    2328         int len = strlen(key);
    2329        
    2330         s = response;
    2331         do {
    2332                 if (strncmp(s, key, len) == 0 && s[len] == '=') {
    2333                         s += len + 1;
    2334                         if ((end = strchr(s, '\r')))
    2335                                 return g_strndup(s, end - s);
    2336                         else
    2337                                 return g_strdup(s);
    2338                 }
    2339                
    2340                 if ((s = strchr(s, '\n')))
    2341                         s ++;
    2342         } while (s && *s);
    2343        
    2344         return NULL;
    2345 }
    2346 
    2347 static enum yahoo_status yahoo_https_status_parse(int code)
    2348 {
    2349         switch (code)
    2350         {
    2351                 case 1212: return YAHOO_LOGIN_PASSWD;
    2352                 case 1213: return YAHOO_LOGIN_LOCK;
    2353                 case 1235: return YAHOO_LOGIN_UNAME;
    2354                 default: return (enum yahoo_status) code;
    2355         }
    2356 }
    2357 
    2358 static void yahoo_process_auth_0x10(struct yahoo_input_data *yid, const char *seed, const char *sn)
    2359 {
    2360         struct yahoo_https_auth_data *had = g_new0(struct yahoo_https_auth_data, 1);
    2361        
    2362         had->yid = yid;
    2363         had->chal = g_strdup(seed);
    2364        
    2365         yahoo_https_auth_token_init(had);
    2366 }
    2367 
    2368 static void yahoo_https_auth_token_init(struct yahoo_https_auth_data *had)
    2369 {
    2370         struct yahoo_input_data *yid = had->yid;
    2371         struct yahoo_data *yd = yid->yd;
    2372         struct http_request *req;
    2373         char *login, *passwd, *chal;
    2374         char *url;
    2375        
    2376         login = g_strndup(yd->user, 3 * strlen(yd->user));
    2377         http_encode(login);
    2378         passwd = g_strndup(yd->password, 3 * strlen(yd->password));
    2379         http_encode(passwd);
    2380         chal = g_strndup(had->chal, 3 * strlen(had->chal));
    2381         http_encode(chal);
    2382        
    2383         url = g_strdup_printf("https://login.yahoo.com/config/pwtoken_get?src=ymsgr&ts=%d&login=%s&passwd=%s&chal=%s",
    2384                                (int) time(NULL), login, passwd, chal);
    2385        
    2386         req = http_dorequest_url(url, yahoo_https_auth_token_finish, had);
    2387        
    2388         g_free(url);
    2389         g_free(chal);
    2390         g_free(passwd);
    2391         g_free(login);
    2392 }
    2393 
    2394 static void yahoo_https_auth_token_finish(struct http_request *req)
    2395 {
    2396         struct yahoo_https_auth_data *had = req->data;
    2397         struct yahoo_input_data *yid = had->yid;
    2398         struct yahoo_data *yd = yid->yd;
    2399         int st;
    2400        
    2401         if (req->status_code != 200) {
    2402                 YAHOO_CALLBACK(ext_yahoo_login_response)(yd->client_id, 2000 + req->status_code, NULL);
    2403                 goto fail;
    2404         }
    2405        
    2406         if (sscanf(req->reply_body, "%d", &st) != 1 || st != 0) {
    2407                 YAHOO_CALLBACK(ext_yahoo_login_response)(yd->client_id, yahoo_https_status_parse(st), NULL);
    2408                 goto fail;
    2409         }
    2410        
    2411         if ((had->token = yahoo_ha_find_key(req->reply_body, "ymsgr")) == NULL) {
    2412                 YAHOO_CALLBACK(ext_yahoo_login_response)(yd->client_id, 3001, NULL);
    2413                 goto fail;
    2414         }
    2415        
    2416         return yahoo_https_auth_init(had);
    2417        
    2418 fail:
    2419         g_free(had->token);
    2420         g_free(had->chal);
    2421         g_free(had);
    2422 }
    2423 
    2424 static void yahoo_https_auth_init(struct yahoo_https_auth_data *had)
    2425 {
    2426         struct http_request *req;
    2427         char *url;
    2428        
    2429         url = g_strdup_printf("https://login.yahoo.com/config/pwtoken_login?src=ymsgr&ts=%d&token=%s",
    2430                               (int) time(NULL), had->token);
    2431        
    2432         req = http_dorequest_url(url, yahoo_https_auth_finish, had);
    2433        
    2434         g_free(url);
    2435 }
    2436 
    2437 static void yahoo_https_auth_finish(struct http_request *req)
    2438 {
    2439         struct yahoo_https_auth_data *had = req->data;
    2440         struct yahoo_input_data *yid = had->yid;
    2441         struct yahoo_data *yd = yid->yd;
    2442         struct yahoo_packet *pack;
    2443         char *crumb;
    2444         int st;
    2445        
    2446         md5_byte_t result[16];
    2447         md5_state_t ctx;
    2448        
    2449         unsigned char yhash[32];
    2450 
    2451         if (req->status_code != 200) {
    2452                 YAHOO_CALLBACK(ext_yahoo_login_response)(yd->client_id, 2000 + req->status_code, NULL);
    2453                 goto fail;
    2454         }
    2455        
    2456         if (sscanf(req->reply_body, "%d", &st) != 1 || st != 0) {
    2457                 YAHOO_CALLBACK(ext_yahoo_login_response)(yd->client_id, yahoo_https_status_parse(st), NULL);
    2458                 goto fail;
    2459         }
    2460        
    2461         if ((yd->cookie_y = yahoo_ha_find_key(req->reply_body, "Y")) == NULL ||
    2462             (yd->cookie_t = yahoo_ha_find_key(req->reply_body, "T")) == NULL ||
    2463             (crumb = yahoo_ha_find_key(req->reply_body, "crumb")) == NULL) {
    2464                 YAHOO_CALLBACK(ext_yahoo_login_response)(yd->client_id, 3002, NULL);
    2465                 goto fail;
    2466         }
    2467        
    2468         md5_init(&ctx); 
    2469         md5_append(&ctx, (unsigned char*) crumb, 11);
    2470         md5_append(&ctx, (unsigned char*) had->chal, strlen(had->chal));
    2471         md5_finish(&ctx, result);
    2472         to_y64(yhash, result, 16);
    2473 
    2474         pack = yahoo_packet_new(YAHOO_SERVICE_AUTHRESP, yd->initial_status, yd->session_id);
    2475         yahoo_packet_hash(pack, 1, yd->user);
    2476         yahoo_packet_hash(pack, 0, yd->user);
    2477         yahoo_packet_hash(pack, 277, yd->cookie_y);
    2478         yahoo_packet_hash(pack, 278, yd->cookie_t);
    2479         yahoo_packet_hash(pack, 307, (char*) yhash);
    2480         yahoo_packet_hash(pack, 244, "524223");
    2481         yahoo_packet_hash(pack, 2, yd->user);
    2482         yahoo_packet_hash(pack, 2, "1");
    2483         yahoo_packet_hash(pack, 98, "us");
    2484         yahoo_packet_hash(pack, 135, "7.5.0.647");
    2485        
    2486         yahoo_send_packet(yid, pack, 0);
    2487                
    2488         yahoo_packet_free(pack);
    2489        
    2490 fail:
    2491         g_free(crumb);
    2492         g_free(had->token);
    2493         g_free(had->chal);
    2494         g_free(had);
    2495 }
    2496 
    24972230static void yahoo_process_auth(struct yahoo_input_data *yid, struct yahoo_packet *pkt)
    24982231{
     
    25222255                case 1:
    25232256                        yahoo_process_auth_0x0b(yid, seed, sn);
    2524                         break;
    2525                 case 2:
    2526                         yahoo_process_auth_0x10(yid, seed, sn);
    25272257                        break;
    25282258                default:
     
    26802410               
    26812411                yd->buddies = y_list_append(yd->buddies, bud);
    2682        
     2412               
    26832413                /* Possibly called already, but at least the call above doesn't
    26842414                   seem to happen every time (not anytime I tried). */
     
    26872417
    26882418/*      YAHOO_CALLBACK(ext_yahoo_status_changed)(yd->client_id, who, status, NULL, (status==YAHOO_STATUS_AVAILABLE?0:1)); */
    2689 }
    2690 
    2691 static void yahoo_process_contact_ymsg13(struct yahoo_input_data *yid, struct yahoo_packet *pkt)
    2692 {
    2693         char* who=NULL;
    2694         char* me=NULL; 
    2695         char* msg=NULL;
    2696         YList *l;
    2697         for (l = pkt->hash; l; l = l->next) {
    2698                 struct yahoo_pair *pair = l->data;
    2699                 if (pair->key == 4)
    2700                         who = pair->value;
    2701                 else if (pair->key == 5)
    2702                         me = pair->value;
    2703                 else
    2704                         DEBUG_MSG(("unknown key: %d = %s", pair->key, pair->value));
    2705         }
    2706 
    2707         if(pkt->status==3)
    2708                 YAHOO_CALLBACK(ext_yahoo_contact_auth_request)(yid->yd->client_id, me, who, msg);
    27092419}
    27102420
     
    29202630
    29212631        YList *l;
    2922         // yahoo_dump_unhandled(pkt);
     2632        yahoo_dump_unhandled(pkt);
    29232633        for (l = pkt->hash; l; l = l->next) {
    29242634                struct yahoo_pair *pair = l->data;
     
    29422652{
    29432653        DEBUG_MSG(("yahoo_packet_process: 0x%02x", pkt->service));
    2944         yahoo_dump_unhandled(pkt);
    29452654        switch (pkt->service)
    29462655        {
     
    29542663        case YAHOO_SERVICE_IDACT:
    29552664        case YAHOO_SERVICE_IDDEACT:
    2956         case YAHOO_SERVICE_Y6_STATUS_UPDATE:
    2957         case YAHOO_SERVICE_YMSG15_STATUS:
    29582665                yahoo_process_status(yid, pkt);
    29592666                break;
     
    29692676                yahoo_process_mail(yid, pkt);
    29702677                break;
    2971         case YAHOO_SERVICE_REJECTCONTACT:
    29722678        case YAHOO_SERVICE_NEWCONTACT:
    29732679                yahoo_process_contact(yid, pkt);
     
    30102716                yahoo_process_buddyadd(yid, pkt);
    30112717                break;
    3012         case YAHOO_SERVICE_CONTACT_YMSG13:
    3013                 yahoo_process_contact_ymsg13(yid,pkt);
    3014                 break;
    30152718        case YAHOO_SERVICE_REMBUDDY:
    30162719                yahoo_process_buddydel(yid, pkt);
     
    30412744        case YAHOO_SERVICE_CHATLOGOFF:
    30422745        case YAHOO_SERVICE_CHATMSG:
     2746        case YAHOO_SERVICE_REJECTCONTACT:
    30432747        case YAHOO_SERVICE_PEERTOPEER:
    30442748                WARNING(("unhandled service 0x%02x", pkt->service));
     
    30542758                yahoo_process_picture_upload(yid, pkt);
    30552759                break; 
    3056         case YAHOO_SERVICE_YMSG15_BUDDY_LIST:   /* Buddy List */
    3057                 yahoo_process_buddy_list(yid, pkt);
    30582760        default:
    30592761                WARNING(("unknown service 0x%02x", pkt->service));
     
    38393541        yahoo_process_webcam_connection,
    38403542        yahoo_process_chatcat_connection,
    3841         yahoo_process_search_connection,
     3543        yahoo_process_search_connection
    38423544};
    38433545
     
    38573559        } while(len == -1 && errno == EINTR);
    38583560
    3859         if(len == -1 && (errno == EAGAIN||errno == EINTR))      /* we'll try again later */
     3561        if(len == -1 && errno == EAGAIN)        /* we'll try again later */
    38603562                return 1;
    38613563
     
    40603762
    40613763        yahoo_packet_hash(pkt, 5, who);
    4062         yahoo_packet_hash(pkt, 1, from?from:yd->user);
     3764        yahoo_packet_hash(pkt, 4, from?from:yd->user);
    40633765        yahoo_packet_hash(pkt, 14, " ");
    40643766        yahoo_packet_hash(pkt, 13, typ ? "1" : "0");
     
    40753777        struct yahoo_data *yd;
    40763778        struct yahoo_packet *pkt = NULL;
    4077         int old_status;
     3779        int service;
    40783780        char s[4];
    40793781
     
    40833785        yd = yid->yd;
    40843786
    4085         old_status = yd->current_status;
    4086 
    4087         if (msg && strncmp(msg,"Invisible",9)) {
     3787        if (msg) {
    40883788                yd->current_status = YAHOO_STATUS_CUSTOM;
    40893789        } else {
     
    40913791        }
    40923792
    4093         /* Thank you libpurple :) */
    4094         if (yd->current_status == YAHOO_STATUS_INVISIBLE) {
    4095                 pkt = yahoo_packet_new(YAHOO_SERVICE_Y6_VISIBILITY, YAHOO_STATUS_AVAILABLE, 0);
    4096                 yahoo_packet_hash(pkt, 13, "2");
    4097                 yahoo_send_packet(yid, pkt, 0);
    4098                 yahoo_packet_free(pkt);
    4099 
    4100                 return;
    4101         }
    4102 
    4103         pkt = yahoo_packet_new(YAHOO_SERVICE_Y6_STATUS_UPDATE, yd->current_status, yd->session_id);
    4104         snprintf(s, sizeof(s), "%d", yd->current_status);
    4105         yahoo_packet_hash(pkt, 10, s);
     3793        if (yd->current_status == YAHOO_STATUS_AVAILABLE)
     3794                service = YAHOO_SERVICE_ISBACK;
     3795        else
     3796                service = YAHOO_SERVICE_ISAWAY;
    41063797         
    4107         if (yd->current_status == YAHOO_STATUS_CUSTOM) {
    4108                 yahoo_packet_hash(pkt, 19, msg);
    4109         } else {
    4110                 yahoo_packet_hash(pkt, 19, "");
    4111         }
    4112        
    4113         yahoo_packet_hash(pkt, 47, (away == 2)? "2": (away) ?"1":"0");
     3798        if ((away == 2) && (yd->current_status == YAHOO_STATUS_AVAILABLE)) {
     3799                pkt = yahoo_packet_new(YAHOO_SERVICE_ISAWAY, YAHOO_STATUS_BRB, yd->session_id);
     3800                yahoo_packet_hash(pkt, 10, "999");
     3801                yahoo_packet_hash(pkt, 47, "2");
     3802        }else {
     3803                pkt = yahoo_packet_new(service, YAHOO_STATUS_AVAILABLE, yd->session_id);
     3804                snprintf(s, sizeof(s), "%d", yd->current_status);
     3805                yahoo_packet_hash(pkt, 10, s);
     3806                if (yd->current_status == YAHOO_STATUS_CUSTOM) {
     3807                        yahoo_packet_hash(pkt, 19, msg);
     3808                        yahoo_packet_hash(pkt, 47, (away == 2)? "2": (away) ?"1":"0");
     3809                } else {
     3810                        yahoo_packet_hash(pkt, 47, (away == 2)? "2": (away) ?"1":"0");
     3811                }
     3812               
     3813               
     3814               
     3815        }
    41143816
    41153817        yahoo_send_packet(yid, pkt, 0);
    41163818        yahoo_packet_free(pkt);
    4117 
    4118         if(old_status == YAHOO_STATUS_INVISIBLE) {
    4119                 pkt = yahoo_packet_new(YAHOO_SERVICE_Y6_VISIBILITY, YAHOO_STATUS_AVAILABLE, 0);
    4120                 yahoo_packet_hash(pkt, 13, "1");
    4121                 yahoo_send_packet(yid, pkt, 0);
    4122                 yahoo_packet_free(pkt);
    4123         }
    41243819}
    41253820
     
    41363831        LOG(("yahoo_logoff: current status: %d", yd->current_status));
    41373832
    4138         if(yd->current_status != -1 && 0) {
    4139                 /* Meh. Don't send this. The event handlers are not going to
    4140                    get to do this so it'll just leak memory. And the TCP
    4141                    connection reset will hopefully be clear enough. */
     3833        if(yd->current_status != -1) {
    41423834                pkt = yahoo_packet_new(YAHOO_SERVICE_LOGOFF, YAHOO_STATUS_AVAILABLE, yd->session_id);
    41433835                yd->current_status = -1;
     
    43724064                return;
    43734065
    4374         pkt = yahoo_packet_new(YAHOO_SERVICE_ADDBUDDY, YPACKET_STATUS_DEFAULT, yd->session_id);
    4375 
     4066        pkt = yahoo_packet_new(YAHOO_SERVICE_ADDBUDDY, YAHOO_STATUS_AVAILABLE, yd->session_id);
     4067        yahoo_packet_hash(pkt, 1, yd->user);
     4068        yahoo_packet_hash(pkt, 7, who);
     4069        yahoo_packet_hash(pkt, 65, group);
    43764070        if (msg != NULL) /* add message/request "it's me add me" */
    43774071                yahoo_packet_hash(pkt, 14, msg);
    4378         else
    4379                 yahoo_packet_hash(pkt,14,"");
    4380 
    4381         yahoo_packet_hash(pkt, 65, group);
    4382         yahoo_packet_hash(pkt, 97, "1");
    4383         yahoo_packet_hash(pkt, 1, yd->user);
    4384         yahoo_packet_hash(pkt, 302, "319");
    4385         yahoo_packet_hash(pkt, 300, "319");
    4386         yahoo_packet_hash(pkt, 7, who);
    4387         yahoo_packet_hash(pkt, 334, "0");
    4388         yahoo_packet_hash(pkt, 301, "319");
    4389         yahoo_packet_hash(pkt, 303, "319");
    4390 
    4391 
    43924072        yahoo_send_packet(yid, pkt, 0);
    43934073        yahoo_packet_free(pkt);
     
    44114091        yahoo_send_packet(yid, pkt, 0);
    44124092        yahoo_packet_free(pkt);
    4413 }
    4414 
    4415 void yahoo_accept_buddy_ymsg13(int id,const char* me,const char* who){
    4416         struct yahoo_input_data *yid = find_input_by_id_and_type(id, YAHOO_CONNECTION_PAGER);
    4417         struct yahoo_data *yd;
    4418 
    4419         if(!yid)
    4420                 return;
    4421         yd = yid->yd;
    4422 
    4423         struct yahoo_packet* pkt=NULL;
    4424         pkt= yahoo_packet_new(YAHOO_SERVICE_CONTACT_YMSG13,YAHOO_STATUS_AVAILABLE,0);
    4425 
    4426         yahoo_packet_hash(pkt,1,me ?: yd->user);       
    4427         yahoo_packet_hash(pkt,5,who);
    4428         yahoo_packet_hash(pkt,13,"1");
    4429         yahoo_packet_hash(pkt,334,"0");
    4430         yahoo_send_packet(yid, pkt, 0);
    4431         yahoo_packet_free(pkt);
    4432 }
    4433 
    4434 void yahoo_reject_buddy_ymsg13(int id,const char* me,const char* who,const char* msg){
    4435         struct yahoo_input_data *yid = find_input_by_id_and_type(id, YAHOO_CONNECTION_PAGER);
    4436         struct yahoo_data *yd;
    4437 
    4438         if(!yid)
    4439                 return;
    4440         yd = yid->yd;
    4441 
    4442         struct yahoo_packet* pkt=NULL;
    4443         pkt= yahoo_packet_new(YAHOO_SERVICE_CONTACT_YMSG13,YAHOO_STATUS_AVAILABLE,0);
    4444 
    4445         yahoo_packet_hash(pkt,1,me ?: yd->user);       
    4446         yahoo_packet_hash(pkt,5,who);
    4447 //      yahoo_packet_hash(pkt,241,YAHOO_PROTO_VER);
    4448         yahoo_packet_hash(pkt,13,"2");
    4449         yahoo_packet_hash(pkt,334,"0");
    4450         yahoo_packet_hash(pkt,97,"1");
    4451         yahoo_packet_hash(pkt,14,msg?:"");
    4452 
    4453         yahoo_send_packet(yid, pkt, 0);
    4454         yahoo_packet_free(pkt);
    4455 
    44564093}
    44574094
  • protocols/yahoo/yahoo.c

    r3f81999 rfc34fb5  
    254254static GList *byahoo_away_states( struct im_connection *ic )
    255255{
    256         static GList *m = NULL;
    257 
    258         if( m == NULL )
    259         {
    260                 m = g_list_append( m, "Available" );
    261                 m = g_list_append( m, "Be Right Back" );
    262                 m = g_list_append( m, "Busy" );
    263                 m = g_list_append( m, "Not At Home" );
    264                 m = g_list_append( m, "Not At Desk" );
    265                 m = g_list_append( m, "Not In Office" );
    266                 m = g_list_append( m, "On Phone" );
    267                 m = g_list_append( m, "On Vacation" );
    268                 m = g_list_append( m, "Out To Lunch" );
    269                 m = g_list_append( m, "Stepped Out" );
    270                 m = g_list_append( m, "Invisible" );
    271                 m = g_list_append( m, GAIM_AWAY_CUSTOM );
    272         }
     256        GList *m = NULL;
     257
     258        m = g_list_append( m, "Available" );
     259        m = g_list_append( m, "Be Right Back" );
     260        m = g_list_append( m, "Busy" );
     261        m = g_list_append( m, "Not At Home" );
     262        m = g_list_append( m, "Not At Desk" );
     263        m = g_list_append( m, "Not In Office" );
     264        m = g_list_append( m, "On Phone" );
     265        m = g_list_append( m, "On Vacation" );
     266        m = g_list_append( m, "Out To Lunch" );
     267        m = g_list_append( m, "Stepped Out" );
     268        m = g_list_append( m, "Invisible" );
     269        m = g_list_append( m, GAIM_AWAY_CUSTOM );
    273270       
    274271        return m;
     
    349346       
    350347        return c;
    351 }
    352 
    353 static void byahoo_auth_allow( struct im_connection *ic, const char *who )
    354 {
    355         struct byahoo_data *yd = (struct byahoo_data *) ic->proto_data;
    356        
    357         yahoo_accept_buddy_ymsg13( yd->y2_id, NULL, who );
    358 }
    359 
    360 static void byahoo_auth_deny( struct im_connection *ic, const char *who )
    361 {
    362         struct byahoo_data *yd = (struct byahoo_data *) ic->proto_data;
    363        
    364         yahoo_reject_buddy_ymsg13( yd->y2_id, NULL, who, NULL );
    365348}
    366349
     
    391374        ret->handle_cmp = g_strcasecmp;
    392375       
    393         ret->auth_allow = byahoo_auth_allow;
    394         ret->auth_deny = byahoo_auth_deny;
    395        
    396376        register_protocol(ret);
    397377}
     
    473453        struct byahoo_write_ready_data *d = data;
    474454       
    475         return yahoo_write_ready( d->id, d->fd, d->data );
     455        yahoo_write_ready( d->id, d->fd, d->data );
     456       
     457        return FALSE;
    476458}
    477459
     
    941923}
    942924
    943 void ext_yahoo_contact_auth_request( int id, const char *myid, const char *who, const char *msg )
    944 {
    945         struct im_connection *ic = byahoo_get_ic_by_id( id );
    946        
    947         imcb_ask_auth( ic, who, NULL );
    948 }
    949 
    950925void ext_yahoo_contact_added( int id, const char *myid, const char *who, const char *msg )
    951926{
    952         struct im_connection *ic = byahoo_get_ic_by_id( id );
    953        
    954         imcb_add_buddy( ic, (char*) who, NULL );
     927        /* Groups schmoups. If I want to handle groups properly I can get the
     928           buddy data from some internal libyahoo2 structure. */
     929        imcb_add_buddy( byahoo_get_ic_by_id( id ), (char*) who, NULL );
    955930}
    956931
  • protocols/yahoo/yahoo2.h

    r3f81999 rfc34fb5  
    217217void yahoo_buddyicon_request(int id, const char *who);
    218218
    219 void yahoo_accept_buddy_ymsg13(int,const char*,const char*);
    220 void yahoo_reject_buddy_ymsg13(int,const char*,const char*,const char*);
    221 
    222219#include "yahoo_httplib.h"
    223220
  • protocols/yahoo/yahoo2_callbacks.h

    r3f81999 rfc34fb5  
    361361
    362362/*
    363  * Name: ext_yahoo_contact_auth_request
    364  *      Called when a contact wants to add you to his/her contact list
    365  * Params:
    366  *      id   - the id that identifies the server connection
    367  *      myid - the identity s/he added
    368  *      who  - who did it
    369  *      msg  - any message sent
    370  */
    371 void YAHOO_CALLBACK_TYPE(ext_yahoo_contact_auth_request)(int id, const char *myid, const char *who, const char *msg);
    372 
    373 
    374 /*
    375363 * Name: ext_yahoo_contact_added
    376364 *      Called when a contact is added to your list
  • protocols/yahoo/yahoo2_types.h

    r3f81999 rfc34fb5  
    5757        YAHOO_LOGIN_LOCK = 14,
    5858        YAHOO_LOGIN_DUPL = 99,
    59         YAHOO_LOGIN_SOCK = -1,
    60 };
    61 
    62 enum ypacket_status {
    63         YPACKET_STATUS_DISCONNECTED = -1,
    64         YPACKET_STATUS_DEFAULT = 0,
    65         YPACKET_STATUS_SERVERACK = 1,
    66         YPACKET_STATUS_GAME     = 0x2,
    67         YPACKET_STATUS_AWAY     = 0x4,
    68         YPACKET_STATUS_CONTINUED = 0x5,
    69         YPACKET_STATUS_INVISIBLE = 12,
    70         YPACKET_STATUS_NOTIFY = 0x16, /* TYPING */
    71         YPACKET_STATUS_WEBLOGIN = 0x5a55aa55,
    72         YPACKET_STATUS_OFFLINE = 0x5a55aa56
     59        YAHOO_LOGIN_SOCK = -1
    7360};
    7461
     
    9885};
    9986
    100 #define YAHOO_PROTO_VER 0x0010
     87#define YAHOO_PROTO_VER 0x000b
    10188
    10289/* Yahoo style/color directives */
     
    128115        YAHOO_CONNECTION_WEBCAM,
    129116        YAHOO_CONNECTION_CHATCAT,
    130         YAHOO_CONNECTION_SEARCH,
    131         YAHOO_CONNECTION_AUTH,
     117        YAHOO_CONNECTION_SEARCH
    132118};
    133119
     
    145131/* chat member attribs */
    146132#define YAHOO_CHAT_MALE 0x8000
     133#define YAHOO_CHAT_FEMALE 0x10000
    147134#define YAHOO_CHAT_FEMALE 0x10000
    148135#define YAHOO_CHAT_DUNNO 0x400
  • root_commands.c

    r3f81999 rfc34fb5  
    310310                int st;
    311311               
    312                 if( s && checkflags && checkflags( irc, s ) == 0 )
     312                if( checkflags && checkflags( irc, s ) == 0 )
    313313                        return 0;
    314314               
     
    10791079        else if( g_strcasecmp( cmd[1], "set" ) == 0 )
    10801080        {
    1081                 MIN_ARGS( 2 );
    1082                
    10831081                cmd_set_real( irc, cmd + 1, cmd_chat_set_findhead, NULL );
    10841082        }
Note: See TracChangeset for help on using the changeset viewer.