[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-bugs-dist
Subject:    [Bug 73901] long nicknames are cut off
From:       Olivier Goffart <ogoffart () tiscalinet ! be>
Date:       2004-06-09 14:49:15
Message-ID: 20040609144915.6692.qmail () ktown ! kde ! org
[Download RAW message or body]

------- You are receiving this mail because: -------
You are on the CC list for the bug, or are watching someone who is.
      
http://bugs.kde.org/show_bug.cgi?id=73901      
ogoffart tiscalinet be changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
         Resolution|                            |FIXED



------- Additional Comments From ogoffart tiscalinet be  2004-06-09 16:49 -------
CVS commit by ogoffart: 

Better escaping of nickname

CCMAIL: 73901-done bugs kde org

thanks to Chia-Lin Kao 


  M +2 -2      msnnotifysocket.cpp   1.139
  M +40 -6     msnsocket.cpp   1.87


--- kdenetwork/kopete/protocols/msn/msnnotifysocket.cpp  #1.138:1.139
 @ -591,5 +591,5  @ void MSNNotifySocket::slotAuthJobDone ( 
                 QString authURL = "https://" + m_sid + "/ppsecure/post.srf?lc=" + \
                rx.cap( 1 ) + "&id=" +
                         rx.cap( 2 ) + "&tw=" + rx.cap( 3 ) + "&cbid=" + rx.cap( 2 ) \
                + "&da=passport.com&login=" +
-                        m_account->accountId() + "&domain=passport.com&passwd=";
+                        KURL::encode_string( m_account->accountId()) + \
"&domain=passport.com&passwd=";  
                 kdDebug( 14140 ) << "MSNNotifySocket::slotAuthJobDone: " << authURL \
<< "(*******)" << endl;  @ -599,5 +599,5  @ void MSNNotifySocket::slotAuthJobDone ( 
                 if(m_kv.isNull()) m_kv="";
 
-                authURL += escape( m_password );
+                authURL += KURL::encode_string( m_password ) ;
                 job = KIO::get( KURL( authURL ), false, false );
                 job->addMetaData("cookies", "manual");

--- kdenetwork/kopete/protocols/msn/msnsocket.cpp  #1.86:1.87
 @ -494,5 +493,40  @ void MSNSocket::slotReadyWrite()
 QString MSNSocket::escape( const QString &str )
 {
-        return ( KURL::encode_string( str, 106 ) );
+        //return ( KURL::encode_string( str, 106 ) );
+        //It's not needed to encode everything. The official msn client only encode \
spaces and % +        //If we encode more, the size can be longer than excepted.
+
+        int old_length= str.length();
+        QChar *new_segment = new QChar[ old_length * 3 + 1 ];
+        int new_length = 0;
+
+        for     ( int i = 0; i < old_length; i++ )
+        {
+                unsigned char character = str[i];
+                
+                 /*character == ' '  || character == '%' || character == '\t' 
+                        || characters == '\n' || character == '\r'*/
+                /*      || character == '<' || character == '>' ||  character == \
'\\' +                        || character == '^' || character == '&' || character == \
'*'*/  +                
+                if( character <= 32 || character == '%' )
+                {
+                        new_segment[ new_length++ ] = '%';
+
+                        unsigned int c = character / 16;
+                        c += (c > 9) ? ('A' - 10) : '0';
+                        new_segment[ new_length++ ] = c;
+
+                        c = character % 16;
+                        c += (c > 9) ? ('A' - 10) : '0';
+                        new_segment[ new_length++ ] = c;
+                }
+                else
+                        new_segment[ new_length++ ] = str[i];
+        }
+
+        QString result = QString(new_segment, new_length);
+        delete [] new_segment;
+        return result;
 }


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic