~ubuntu-branches/ubuntu/edgy/kopete/edgy-proposed

« back to all changes in this revision

Viewing changes to kopete/protocols/yahoo/libkyahoo/messagereceivertask.cpp

  • Committer: Bazaar Package Importer
  • Author(s): Anthony Mercatante
  • Date: 2006-10-09 14:55:32 UTC
  • mfrom: (1.1.3 upstream)
  • Revision ID: james.westby@ubuntu.com-20061009145532-91lvzoe1hag8d6hq
Tags: 4:3.5.5+kopete0.12.3-0ubuntu1
* New upstream release
* Removed obsolete kubuntu_02_hostname_for_freenode.diff

Show diffs side-by-side

added added

removed removed

Lines of Context:
75
75
{
76
76
        kdDebug(YAHOO_RAW_DEBUG) << k_funcinfo << endl;
77
77
 
78
 
        QString to = t->firstParam( 5 );
79
 
        QString timestamp = t->firstParam( 15 );
80
 
        QString utf8 = t->firstParam( 97 );
81
 
        QString from = t->firstParam( 1 ).isEmpty() ? t->firstParam( 4 ) : t->firstParam( 1 );
82
 
        QString msg = t->firstParam( 14 );
83
 
        QString sysmsg = t->firstParam( 16 );
84
 
 
85
 
        if( !sysmsg.isEmpty() )
86
 
        {
87
 
                client()->notifyError( "Server message received: ", sysmsg, Client::Error );
88
 
                return;
89
 
        }
90
 
 
91
 
        if( msg.isEmpty() )
92
 
        {
93
 
                kdDebug(YAHOO_RAW_DEBUG) << k_funcinfo << "Got a empty message. Dropped." << endl;
94
 
                return;
95
 
        }
96
 
 
97
 
        if( utf8.startsWith( "1" ) )
98
 
                msg = QString::fromUtf8( msg.latin1() );
99
 
 
100
 
        if( t->service() == Yahoo::ServiceSysMessage )
101
 
                emit systemMessage( sysmsg );
102
 
        else
103
 
        {       
104
 
                if( msg.startsWith( "<ding>" ) )
105
 
                        emit gotBuzz( from, timestamp.toLong() );
 
78
        int cnt = t->paramCount( 5 );
 
79
        for( int i = 0; i < cnt; ++i )
 
80
        {
 
81
                QString to = t->nthParam( 5, i );
 
82
                QString timestamp = t->nthParamSeparated( 15, i, 5 );
 
83
                QString utf8 = t->nthParamSeparated( 97, i, 5 );
 
84
                QString from = t->nthParamSeparated( 1, i, 5 ).isEmpty() ? t->nthParamSeparated( 4, i, 5 ) : t->nthParamSeparated( 1, i, 5 );
 
85
                QString msg = t->nthParamSeparated( 14, i, 5 );
 
86
                QString sysmsg = t->nthParamSeparated( 16, i, 5 );
 
87
 
 
88
                // The arrangement of the key->value pairs is different when there is only one message in the packet.
 
89
                // Separating by key "5" (sender) doesn't work in that case, because the "1" and "4" keys are sent before the "5" key
 
90
                if( cnt == 1 )
 
91
                        from = t->firstParam( 1 ).isEmpty() ? t->firstParam( 4 ) : t->firstParam( 1 );
 
92
        
 
93
                if( !sysmsg.isEmpty() )
 
94
                {
 
95
                        client()->notifyError( "Server message received: ", sysmsg, Client::Error );
 
96
                        continue;
 
97
                }
 
98
        
 
99
                if( msg.isEmpty() )
 
100
                {
 
101
                        kdDebug(YAHOO_RAW_DEBUG) << k_funcinfo << "Got a empty message. Dropped." << endl;
 
102
                        continue;
 
103
                }
 
104
        
 
105
                if( utf8.startsWith( "1" ) )
 
106
                        msg = QString::fromUtf8( msg.latin1() );
 
107
        
 
108
                if( t->service() == Yahoo::ServiceSysMessage )
 
109
                        emit systemMessage( sysmsg );
106
110
                else
107
 
                        emit gotIm( from, msg, timestamp.toLong(), 0);
 
111
                {       
 
112
                        if( msg.startsWith( "<ding>" ) )
 
113
                                emit gotBuzz( from, timestamp.toLong() );
 
114
                        else
 
115
                                emit gotIm( from, msg, timestamp.toLong(), 0);
 
116
                }
108
117
        }
109
118
}
110
119