Changeset 3429b58


Ignore:
Timestamp:
2010-05-13T22:05:13Z (14 years ago)
Author:
Wilmer van der Gaast <wilmer@…>
Branches:
master
Children:
704dd38
Parents:
58f5ef7 (diff), 3742fb6 (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the (diff) links above to see all the changes relative to each parent.
Message:

Mainline merge.

Files:
4 edited

Legend:

Unmodified
Added
Removed
  • lib/xmltree.c

    r58f5ef7 r3429b58  
    449449        while( node )
    450450        {
    451                 if( g_strcasecmp( node->name, name ) == 0 )
     451                char *colon;
     452               
     453                if( g_strcasecmp( node->name, name ) == 0 ||
     454                    ( ( colon = strchr( node->name, ':' ) ) &&
     455                      g_strcasecmp( colon + 1, name ) == 0 ) )
    452456                        break;
    453457               
     
    461465{
    462466        int i;
     467        char *colon;
    463468       
    464469        if( !node )
     
    468473                if( g_strcasecmp( node->attr[i].key, key ) == 0 )
    469474                        break;
     475       
     476        /* This is an awful hack that only takes care of namespace prefixes
     477           inside a tag. Since IMHO excessive namespace usage in XMPP is
     478           massive overkill anyway (this code exists for almost four years
     479           now and never really missed it): Meh. */
     480        if( !node->attr[i].key && strcmp( key, "xmlns" ) == 0 &&
     481            ( colon = strchr( node->name, ':' ) ) )
     482        {
     483                *colon = '\0';
     484                for( i = 0; node->attr[i].key; i ++ )
     485                        if( strncmp( node->attr[i].key, "xmlns:", 6 ) == 0 &&
     486                            strcmp( node->attr[i].key + 6, node->name ) == 0 )
     487                                break;
     488                *colon = ':';
     489        }
    470490       
    471491        return node->attr[i].value;
  • protocols/jabber/conference.c

    r58f5ef7 r3429b58  
    274274                }
    275275               
    276                 if( bud != jc->me )
    277                 {
     276                if( bud != jc->me && bud->flags & JBFLAG_IS_ANONYMOUS )
     277                {
     278                        /* If JIDs are anonymized, add them to the local
     279                           list for the duration of this chat. */
    278280                        imcb_add_buddy( ic, bud->ext_jid, NULL );
    279281                        imcb_buddy_nick_hint( ic, bud->ext_jid, bud->resource );
  • protocols/msn/sb.c

    r58f5ef7 r3429b58  
    340340        struct msn_data *md = ic->proto_data;
    341341       
    342         if( msn_handler( sb->handler ) == -1 )
     342        if( msn_handler( sb->handler ) != -1 )
     343                return TRUE;
     344       
     345        if( sb->msgq != NULL )
    343346        {
    344347                time_t now = time( NULL );
     348                char buf[1024];
    345349               
    346350                if( now - md->first_sb_failure > 600 )
     
    359363                                      "There might be problems delivering your messages." );
    360364               
    361                 if( sb->msgq != NULL )
    362                 {
    363                         char buf[1024];
    364                        
    365                         if( md->msgq == NULL )
    366                         {
    367                                 md->msgq = sb->msgq;
    368                         }
    369                         else
    370                         {
    371                                 GSList *l;
    372                                
    373                                 for( l = md->msgq; l->next; l = l->next );
    374                                 l->next = sb->msgq;
    375                         }
    376                         sb->msgq = NULL;
    377                        
    378                         debug( "Moved queued messages back to the main queue, creating a new switchboard to retry." );
    379                         g_snprintf( buf, sizeof( buf ), "XFR %d SB\r\n", ++md->trId );
    380                         if( !msn_write( ic, buf, strlen( buf ) ) )
    381                                 return FALSE;
    382                 }
    383                
    384                 msn_sb_destroy( sb );
    385                
    386                 return FALSE;
    387         }
    388         else
    389         {
    390                 return TRUE;
    391         }
     365                if( md->msgq == NULL )
     366                {
     367                        md->msgq = sb->msgq;
     368                }
     369                else
     370                {
     371                        GSList *l;
     372                       
     373                        for( l = md->msgq; l->next; l = l->next );
     374                        l->next = sb->msgq;
     375                }
     376                sb->msgq = NULL;
     377               
     378                debug( "Moved queued messages back to the main queue, "
     379                       "creating a new switchboard to retry." );
     380                g_snprintf( buf, sizeof( buf ), "XFR %d SB\r\n", ++md->trId );
     381                if( !msn_write( ic, buf, strlen( buf ) ) )
     382                        return FALSE;
     383        }
     384       
     385        msn_sb_destroy( sb );
     386        return FALSE;
    392387}
    393388
  • protocols/oscar/oscar.c

    r58f5ef7 r3429b58  
    205205static int gaim_icbm_param_info  (aim_session_t *, aim_frame_t *, ...);
    206206static int gaim_parse_genericerr (aim_session_t *, aim_frame_t *, ...);
    207 static int gaim_memrequest       (aim_session_t *, aim_frame_t *, ...);
    208207static int gaim_selfinfo         (aim_session_t *, aim_frame_t *, ...);
    209208static int gaim_offlinemsg       (aim_session_t *, aim_frame_t *, ...);
     
    568567        aim_conn_addhandler(sess, bosconn, AIM_CB_FAM_BUD, AIM_CB_BUD_ERROR, gaim_parse_genericerr, 0);
    569568        aim_conn_addhandler(sess, bosconn, AIM_CB_FAM_BOS, AIM_CB_BOS_ERROR, gaim_parse_genericerr, 0);
    570         aim_conn_addhandler(sess, bosconn, AIM_CB_FAM_GEN, 0x1f, gaim_memrequest, 0);
    571569        aim_conn_addhandler(sess, bosconn, AIM_CB_FAM_GEN, AIM_CB_GEN_SELFINFO, gaim_selfinfo, 0);
    572570        aim_conn_addhandler(sess, bosconn, AIM_CB_FAM_ICQ, AIM_CB_ICQ_OFFLINEMSG, gaim_offlinemsg, 0);
     
    602600}
    603601
    604 struct pieceofcrap {
    605         struct im_connection *ic;
    606         unsigned long offset;
    607         unsigned long len;
    608         char *modname;
    609         int fd;
    610         aim_conn_t *conn;
    611         unsigned int inpa;
    612 };
    613 
    614 static gboolean damn_you(gpointer data, gint source, b_input_condition c)
    615 {
    616         struct pieceofcrap *pos = data;
    617         struct oscar_data *od = pos->ic->proto_data;
    618         char in = '\0';
    619         int x = 0;
    620         unsigned char m[17];
    621 
    622         while (read(pos->fd, &in, 1) == 1) {
    623                 if (in == '\n')
    624                         x++;
    625                 else if (in != '\r')
    626                         x = 0;
    627                 if (x == 2)
    628                         break;
    629                 in = '\0';
    630         }
    631         if (in != '\n') {
    632                 imcb_error(pos->ic, "Gaim was unable to get a valid hash for logging into AIM."
    633                                 " You may be disconnected shortly.");
    634                 b_event_remove(pos->inpa);
    635                 closesocket(pos->fd);
    636                 g_free(pos);
    637                 return FALSE;
    638         }
    639         /* [WvG] Wheeeee! Who needs error checking anyway? ;-) */
    640         read(pos->fd, m, 16);
    641         m[16] = '\0';
    642         b_event_remove(pos->inpa);
    643         closesocket(pos->fd);
    644         aim_sendmemblock(od->sess, pos->conn, 0, 16, m, AIM_SENDMEMBLOCK_FLAG_ISHASH);
    645         g_free(pos);
    646        
    647         return FALSE;
    648 }
    649 
    650 static gboolean straight_to_hell(gpointer data, gint source, b_input_condition cond) {
    651         struct pieceofcrap *pos = data;
    652         char buf[BUF_LONG];
    653 
    654         if (source < 0) {
    655                 imcb_error(pos->ic, "Gaim was unable to get a valid hash for logging into AIM."
    656                                 " You may be disconnected shortly.");
    657                 if (pos->modname)
    658                         g_free(pos->modname);
    659                 g_free(pos);
    660                 return FALSE;
    661         }
    662 
    663         g_snprintf(buf, sizeof(buf), "GET " AIMHASHDATA
    664                         "?offset=%ld&len=%ld&modname=%s HTTP/1.0\n\n",
    665                         pos->offset, pos->len, pos->modname ? pos->modname : "");
    666         write(pos->fd, buf, strlen(buf));
    667         if (pos->modname)
    668                 g_free(pos->modname);
    669         pos->inpa = b_input_add(pos->fd, GAIM_INPUT_READ, damn_you, pos);
    670         return FALSE;
    671 }
    672 
    673602/* size of icbmui.ocm, the largest module in AIM 3.5 */
    674603#define AIM_MAX_FILE_SIZE 98304
    675 
    676 int gaim_memrequest(aim_session_t *sess, aim_frame_t *fr, ...) {
    677         va_list ap;
    678         struct pieceofcrap *pos;
    679         guint32 offset, len;
    680         char *modname;
    681         int fd;
    682 
    683         va_start(ap, fr);
    684         offset = (guint32)va_arg(ap, unsigned long);
    685         len = (guint32)va_arg(ap, unsigned long);
    686         modname = va_arg(ap, char *);
    687         va_end(ap);
    688 
    689         if (len == 0) {
    690                 aim_sendmemblock(sess, fr->conn, offset, len, NULL,
    691                                 AIM_SENDMEMBLOCK_FLAG_ISREQUEST);
    692                 return 1;
    693         }
    694         /* uncomment this when you're convinced it's right. remember, it's been wrong before.
    695         if (offset > AIM_MAX_FILE_SIZE || len > AIM_MAX_FILE_SIZE) {
    696                 char *buf;
    697                 int i = 8;
    698                 if (modname)
    699                         i += strlen(modname);
    700                 buf = g_malloc(i);
    701                 i = 0;
    702                 if (modname) {
    703                         memcpy(buf, modname, strlen(modname));
    704                         i += strlen(modname);
    705                 }
    706                 buf[i++] = offset & 0xff;
    707                 buf[i++] = (offset >> 8) & 0xff;
    708                 buf[i++] = (offset >> 16) & 0xff;
    709                 buf[i++] = (offset >> 24) & 0xff;
    710                 buf[i++] = len & 0xff;
    711                 buf[i++] = (len >> 8) & 0xff;
    712                 buf[i++] = (len >> 16) & 0xff;
    713                 buf[i++] = (len >> 24) & 0xff;
    714                 aim_sendmemblock(sess, command->conn, offset, i, buf, AIM_SENDMEMBLOCK_FLAG_ISREQUEST);
    715                 g_free(buf);
    716                 return 1;
    717         }
    718         */
    719 
    720         pos = g_new0(struct pieceofcrap, 1);
    721         pos->ic = sess->aux_data;
    722         pos->conn = fr->conn;
    723 
    724         pos->offset = offset;
    725         pos->len = len;
    726         pos->modname = modname ? g_strdup(modname) : NULL;
    727 
    728         fd = proxy_connect("gaim.sourceforge.net", 80, straight_to_hell, pos);
    729         if (fd < 0) {
    730                 if (pos->modname)
    731                         g_free(pos->modname);
    732                 g_free(pos);
    733                 imcb_error(sess->aux_data, "Gaim was unable to get a valid hash for logging into AIM."
    734                                 " You may be disconnected shortly.");
    735         }
    736         pos->fd = fd;
    737 
    738         return 1;
    739 }
    740604
    741605static int gaim_parse_login(aim_session_t *sess, aim_frame_t *fr, ...) {
Note: See TracChangeset for help on using the changeset viewer.