Warning, /sdk/kompare/tests/cvsdiff/normalm.diff is written in an unsupported language. File is not indexed.

0001 Index: client/dcop.cpp
0002 ===================================================================
0003 RCS file: /home/kde/kdelibs/dcop/client/dcop.cpp,v
0004 retrieving revision 1.26
0005 diff -r1.26 dcop.cpp
0006 23c23,26
0007 < #include <qvariant.h>
0008 ---
0009 > #include <ctype.h>
0010 > #include <stdio.h>
0011 > #include <stdlib.h>
0012 > 
0013 25c28,39
0014 < #include "../kdatastream.h"
0015 ---
0016 > #include <qdir.h>
0017 > #include <qfile.h>
0018 > #include <qfileinfo.h>
0019 > #include <qmap.h>
0020 > #include <qstringlist.h>
0021 > #include <qtextstream.h>
0022 > #include <qvariant.h>
0023 > 
0024 > // putenv() is not available on all platforms, so make sure the emulation
0025 > // wrapper is available in those cases by loading config.h!
0026 > #include <config.h>
0027 > 
0028 28,30c42
0029 < #include <stdlib.h>
0030 < #include <stdio.h>
0031 < #include <ctype.h>
0032 ---
0033 > #include "../kdatastream.h"
0034 33a46,47
0035 > typedef QMap<QString, QString> UserList;
0036 > 
0037 35a50,63
0038 > static QTextStream cout( stdout, IO_WriteOnly );
0039 > static QTextStream cerr( stderr, IO_WriteOnly );
0040 > 
0041 > /**
0042 >  * Session to send call to
0043 >  * DefaultSession - current session. Current KDE session when called without
0044 >  *                  --user or --all-users option. Otherwise this value ignores
0045 >  *                  all users with more than one active session.
0046 >  * AllSessions    - Send to all sessions found. requires --user or --all-users.
0047 >  * QuerySessions  - Don't call DCOP, return a list of available sessions.
0048 >  * CustomSession  - Use the specified session
0049 >  */
0050 > enum Session { DefaultSession = 0, AllSessions, QuerySessions, CustomSession };
0051 > 
0052 121c149
0053 < void callFunction( const char* app, const char* obj, const char* func, int argc, char** args )
0054 ---
0055 > void callFunction( const char* app, const char* obj, const char* func, const QCStringList args )
0056 123d150
0057 < 
0058 139c166
0059 <       if ( !ok && argc == 0 )
0060 ---
0061 >       if ( !ok && args.isEmpty() )
0062 156,157c183,184
0063 <               int a = (*it).contains(',');
0064 <               if ( ( a == 0 && argc == 0) || ( a > 0 && a + 1 == argc ) )
0065 ---
0066 >               uint a = (*it).contains(',');
0067 >               if ( ( a == 0 && args.isEmpty() ) || ( a > 0 && a + 1 == args.count() ) )
0068 164c191,192
0069 <             exit(1);
0070 ---
0071 > //            exit(1);
0072 >           return;
0073 246,250c274,279
0074 <     int i = 0;
0075 <     for ( QStringList::Iterator it = types.begin(); it != types.end(); ++it ) {
0076 <         marshall(arg, argc, args, i, *it);
0077 <     }
0078 <     if ( i != argc ) {
0079 ---
0080 >     uint i = 0;
0081 >     for( QStringList::Iterator it = types.begin(); it != types.end(); ++it )
0082 >         marshall( arg, args, i, *it );
0083 > 
0084 >     if ( i != args.count() )
0085 >     {
0086 268a298,324
0087 > /**
0088 >  * Show command-line help and exit
0089 >  */
0090 > void showHelp( int exitCode = 0 )
0091 > {
0092 >     cout << "Usage: dcop [options] [application [object [function [arg1] [arg2] ... ] ] ]" << endl
0093 >        << "" << endl
0094 >        << "Console DCOP client" << endl
0095 >        << "" << endl
0096 >        << "Generic options:" << endl
0097 >        << "  --help          Show help about options" << endl
0098 >        << "" << endl
0099 >        << "Options:" << endl
0100 >        << "  --pipe          Call DCOP for each line read from stdin" << endl
0101 >        << "  --user <user>   Connect to the given user's DCOP server. This option will" << endl
0102 >        << "                  ignore the values of the environment vars $DCOPSERVER and" << endl
0103 >        << "                  $ICEAUTHORITY, even if they are set." << endl
0104 >        << "                  If the user has more than one open session, you must also" << endl
0105 >        << "                  use one of the --list-sessions, --session or --als-sessions" << endl
0106 >        << "                  command-line options." << endl
0107 >        << "  --all-users     Send the same DCOP call to all users with a running DCOP" << endl
0108 >        << "                  server. Only failed calls to existing DCOP servers will"
0109 >        << "                  generate an error message. If no DCOP server is available" << endl
0110 >        << "                  at all, no error will be generated." << endl;
0111 >     
0112 >     exit( exitCode );
0113 > }
0114 270,271c326,330
0115 < 
0116 < int main( int argc, char** argv )
0117 ---
0118 > /**
0119 >  * Return a list of all users and their home directories.
0120 >  * Returns an empty list if /etc/passwd cannot be read for some reason.
0121 >  */
0122 > static UserList userList()
0123 272a332,340
0124 >     UserList result;
0125 >     
0126 >     QFile f( "/etc/passwd" );
0127 > 
0128 >     if( !f.open( IO_ReadOnly ) )
0129 >     {
0130 >       cerr << "Can't open /etc/passwd for reading!" << endl;
0131 >       return result;
0132 >     }
0133 274,276c342,347
0134 <     if ( argc > 1 && argv[1][0] == '-' ) {
0135 <       fprintf( stderr, "Usage: dcop [ application [object [function [arg1] [arg2] [arg3] ... ] ] ] \n" );
0136 <       exit(0);
0137 ---
0138 >     QStringList l( QStringList::split( '\n', f.readAll() ) );
0139 > 
0140 >     for( QStringList::ConstIterator it( l.begin() ); it != l.end(); ++it )
0141 >     {
0142 >       QStringList userInfo( QStringList::split( ':', *it, true ) );
0143 >       result[ userInfo[ 0 ] ] = userInfo[ 5 ];
0144 279,281c350,391
0145 <     DCOPClient client;
0146 <     client.attach();
0147 <     dcop = &client;
0148 ---
0149 >     return result;
0150 > }
0151 > 
0152 > /**
0153 >  * Return a list of available DCOP sessions for the specified user
0154 >  * An empty list means no sessions are available, or an error occurred.
0155 >  */
0156 > QStringList dcopSessionList( const QString &user, const QString &home )
0157 > {
0158 >     if( home.isEmpty() )
0159 >     {
0160 >       cerr << "WARNING: Cannot determine home directory for user "
0161 >            << user << "!" << endl
0162 >            << "Please check permissions or set the $DCOPSERVER variable manually before" << endl
0163 >            << "calling dcop." << endl;
0164 >       return QStringList();
0165 >     }
0166 > 
0167 >     QStringList result;
0168 >     QFileInfo dirInfo( home );
0169 >     if( !dirInfo.exists() || !dirInfo.isReadable() )
0170 >       return result;
0171 > 
0172 >     QDir d( home );
0173 >     d.setFilter( QDir::Files | QDir::Hidden | QDir::NoSymLinks );
0174 >     d.setNameFilter( ".DCOPserver*" );
0175 > 
0176 >     const QFileInfoList *list = d.entryInfoList();
0177 >     if( !list )
0178 >       return result;
0179 > 
0180 >     QFileInfoListIterator it( *list );
0181 >     QFileInfo *fi;
0182 > 
0183 >     while ( ( fi = it.current() ) != 0 )
0184 >     {
0185 >       if( fi->isReadable() )
0186 >           result.append( fi->fileName() );
0187 >       ++it;
0188 >     }
0189 >     return result;
0190 > }
0191 282a393,398
0192 > /**
0193 >  * Do the actual DCOP call
0194 >  */
0195 > void runDCOP( QCStringList args, UserList users, Session session,
0196 >               const QString sessionName, bool readStdin )
0197 > {
0198 286,287c402,404
0199 <     char **args = 0;
0200 <     if ((argc > 1) && (strncmp(argv[1], "DCOPRef(", 8)) == 0)
0201 ---
0202 >     QCStringList params;
0203 >     DCOPClient *client = 0L;
0204 >     if ( !args.isEmpty() && args[ 0 ].find( "DCOPRef(" ) == 0 )
0205 289,304c406,429
0206 <        char *delim = strchr(argv[1], ',');
0207 <        if (!delim)
0208 <        {
0209 <           fprintf(stderr, "Error: '%s' is not a valid DCOP reference.\n", argv[1]);
0210 <           return 1;
0211 <        }
0212 <        *delim = 0;
0213 <        app = argv[1] + 8;
0214 <        delim++;
0215 <        delim[strlen(delim)-1] = 0;
0216 <        objid = delim;
0217 <        if (argc > 2)
0218 <           function = argv[2];
0219 <        if (argc > 3)
0220 <           args = &argv[3];
0221 <        argc++;
0222 ---
0223 >       // WARNING: This part (until the closing '}') could very
0224 >       // well be broken now. As I don't know how to trigger and test
0225 >       // dcoprefs this code is *not* tested. It compiles and it looks
0226 >       // ok to me, but that's all I can say - Martijn (2001/12/24)
0227 >       int delimPos = args[ 0 ].findRev( ',' );
0228 >       if( delimPos == -1 )
0229 >         {
0230 >           cerr << "Error: '" << args[ 0 ]
0231 >                << "' is not a valid DCOP reference." << endl;
0232 >           exit( -1 );
0233 >         }
0234 >         args[ 0 ][ delimPos ] = 0;
0235 >         app = args[ 0 ].mid( 8 );
0236 >         delimPos++;
0237 >         args[ 0 ][ args[ 0 ].length() - 1 ] = 0;
0238 >         objid = args[ 0 ].mid( delimPos );
0239 >         if( args.count() > 1 )
0240 >           function = args[ 1 ];
0241 >       if( args.count() > 2 )
0242 >       {
0243 >           params = args;
0244 >           params.remove( params.begin() );
0245 >           params.remove( params.begin() );
0246 >       }
0247 308,338c433,516
0248 <        if (argc > 1)
0249 <           app = argv[1];
0250 <        if (argc > 2)
0251 <           objid = argv[2];
0252 <        if (argc > 3)
0253 <           function = argv[3];
0254 <        if (argc > 4)
0255 <           args = &argv[4];
0256 <     }
0257 < 
0258 <     switch ( argc ) {
0259 <     case 0:
0260 <     case 1:
0261 <       queryApplications("");
0262 <       break;
0263 <     case 2:
0264 <         if (endsWith(app, '*'))
0265 <            queryApplications(app);
0266 <         else
0267 <            queryObjects( app, "" );
0268 <       break;
0269 <     case 3:
0270 <         if (endsWith(objid, '*'))
0271 <            queryObjects(app, objid);
0272 <         else
0273 <            queryFunctions( app, objid );
0274 <       break;
0275 <     case 4:
0276 <     default:
0277 <       callFunction( app, objid, function, argc - 4, args );
0278 <       break;
0279 ---
0280 >         if( !args.isEmpty() )
0281 >           app = args[ 0 ];
0282 >         if( args.count() > 1 )
0283 >           objid = args[ 1 ];
0284 >         if( args.count() > 2 )
0285 >           function = args[ 2 ];
0286 >         if( args.count() > 3)
0287 >       {
0288 >           params = args;
0289 >           params.remove( params.begin() );
0290 >           params.remove( params.begin() );
0291 >           params.remove( params.begin() );
0292 >       }
0293 >     }
0294 > 
0295 >     bool firstRun = true;
0296 >     UserList::Iterator it;
0297 >     QStringList sessions;
0298 >     bool presetDCOPServer = false;
0299 > //    char *dcopStr = 0L;
0300 >     QString dcopServer;
0301 >     
0302 >     for( it = users.begin(); it != users.end() || firstRun; it++ )
0303 >     {
0304 >       firstRun = false;
0305 > 
0306 >       //cout << "Iterating '" << it.key() << "'" << endl;
0307 > 
0308 >       if( session == QuerySessions )
0309 >       {
0310 >           QStringList sessions = dcopSessionList( it.key(), it.data() );
0311 >           if( sessions.isEmpty() )
0312 >           {
0313 >               cout << "No active sessions";
0314 >               if( !( *it ).isEmpty() )
0315 >                   cout << " for user " << *it;
0316 >               cout << endl;
0317 >           }
0318 >           else
0319 >           {
0320 >               cout << "Active sessions ";
0321 >               if( !( *it ).isEmpty() )
0322 >                   cout << "for user " << *it << " ";
0323 >               cout << ":" << endl;
0324 >               
0325 >               QStringList::Iterator sIt;
0326 >               for( sIt = sessions.begin(); sIt != sessions.end(); sIt++ )
0327 >                   cout << "  " << *sIt << endl;
0328 > 
0329 >               cout << endl;
0330 >           }
0331 >           continue;
0332 >       }
0333 > 
0334 >       if( getenv( "DCOPSERVER" ) )
0335 >       {
0336 >           sessions.append( getenv( "DCOPSERVER" ) );
0337 >           presetDCOPServer = true;
0338 >       }
0339 > 
0340 >       if( users.count() > 1 || ( users.count() == 1 &&
0341 >           ( getenv( "DCOPSERVER" ) == 0 /*&& getenv( "DISPLAY" ) == 0*/ ) ) )
0342 >       {
0343 >           sessions = dcopSessionList( it.key(), it.data() );
0344 >           if( sessions.isEmpty() )
0345 >           {
0346 >               if( users.count() > 1 )
0347 >                   continue;
0348 >               else
0349 >               {
0350 >                   cerr << "ERROR: No active KDE sessions!" << endl
0351 >                        << "If you are sure there is one, please set the $DCOPSERVER variable manually" << endl
0352 >                        << "before calling dcop." << endl;
0353 >                   exit( -1 );
0354 >               }
0355 >           }
0356 >           else if( sessions.count() > 1 && session != AllSessions )
0357 >           {
0358 >               cerr << "ERROR: Multiple available KDE sessions!" << endl
0359 >                    << "Please specify the correct session to use with --session or use the" << endl
0360 >                    << "--all-sessions option to broadcast to all sessions." << endl;
0361 >               exit( -1 );
0362 >           }
0363 >       }
0364 339a518,660
0365 >       if( users.count() > 1 || ( users.count() == 1 &&
0366 >           ( getenv( "ICEAUTHORITY" ) == 0 || getenv( "DISPLAY" ) == 0 ) ) )
0367 >       {
0368 >           // Check for ICE authority file and if the file can be read by us
0369 >           QString home = it.data();
0370 >           QString iceFile = it.data() + "/.ICEauthority";
0371 >           QFileInfo fi( iceFile );
0372 >           if( iceFile.isEmpty() )
0373 >           {
0374 >               cerr << "WARNING: Cannot determine home directory for user "
0375 >                    << it.key() << "!" << endl
0376 >                    << "Please check permissions or set the $ICEAUTHORITY variable manually before" << endl
0377 >                    << "calling dcop." << endl;
0378 >           }
0379 >           else if( fi.exists() )
0380 >           {
0381 >               if( fi.isReadable() )
0382 >               {
0383 >                   char *envStr = strdup( ( "ICEAUTHORITY=" + iceFile ).ascii() );
0384 >                   putenv( envStr );
0385 >                   //cerr << "ice: " << envStr << endl;
0386 >               }
0387 >               else
0388 >               {
0389 >                   cerr << "WARNING: ICE authority file " << iceFile
0390 >                        << "is not readable by you!" << endl
0391 >                        << "Please check permissions or set the $ICEAUTHORITY variable manually before" << endl
0392 >                        << "calling dcop." << endl;
0393 >               }
0394 >           }
0395 >           else
0396 >           {
0397 >               if( users.count() > 1 )
0398 >                   continue;
0399 >               else
0400 >               {
0401 >                   cerr << "WARNING: Cannot find ICE authority file "
0402 >                        << iceFile << "!" << endl
0403 >                        << "Please check permissions or set the $ICEAUTHORITY"
0404 >                        << " variable manually before" << endl
0405 >                        << "calling dcop." << endl;
0406 >               }
0407 >           }
0408 >       }
0409 > 
0410 >       // Main loop
0411 >       // If users is an empty list we're calling for the currently logged
0412 >       // in user. In this case we don't have a session, but still want
0413 >       // to iterate the loop once.
0414 >       QStringList::Iterator sIt = sessions.begin();
0415 >       for( ; sIt != sessions.end() || users.isEmpty(); sIt++ )
0416 >       {
0417 >           if( !presetDCOPServer && !users.isEmpty() )
0418 >           {
0419 >               QString dcopFile = it.data() + "/" + *sIt;
0420 >               QFile f( dcopFile );
0421 >               if( !f.open( IO_ReadOnly ) )
0422 >               {
0423 >                   cerr << "Can't open " << dcopFile << " for reading!" << endl;
0424 >                   exit( -1 );
0425 >               }
0426 > 
0427 >               QStringList l( QStringList::split( '\n', f.readAll() ) );
0428 >               dcopServer = l.first();
0429 > 
0430 >               if( dcopServer.isEmpty() )
0431 >               {
0432 >                   cerr << "WARNING: Unable to determine DCOP server for session "
0433 >                        << *sIt << "!" << endl
0434 >                        << "Please check permissions or set the $DCOPSERVER variable manually before" << endl
0435 >                        << "calling dcop." << endl;
0436 >                   exit( -1 );
0437 >               }
0438 >           }
0439 >           
0440 >           delete client;
0441 >           client = new DCOPClient;
0442 >           if( !dcopServer.isEmpty() )
0443 >               client->setServerAddress( dcopServer.ascii() );
0444 >           bool success = client->attach();
0445 >           if( !success )
0446 >           {
0447 >               cerr << "ERROR: Couldn't attach to DCOP server!" << endl;
0448 >               continue;
0449 >           }
0450 >           dcop = client;
0451 > 
0452 >           switch ( args.count() )
0453 >           {
0454 >           case 0:
0455 >               queryApplications("");
0456 >               break;
0457 >           case 1:
0458 >               if (endsWith(app, '*'))
0459 >                  queryApplications(app);
0460 >               else
0461 >                  queryObjects( app, "" );
0462 >               break;
0463 >           case 2:
0464 >               if (endsWith(objid, '*'))
0465 >                  queryObjects(app, objid);
0466 >               else
0467 >                  queryFunctions( app, objid );
0468 >               break;
0469 >           case 3:
0470 >           default:
0471 >               if( readStdin )
0472 >               {
0473 >                   QCStringList::Iterator replaceArg = args.end();
0474 >                  
0475 >                   QCStringList::Iterator it;
0476 >                   for( it = args.begin(); it != args.end(); it++ )
0477 >                       if( *it == "%1" )
0478 >                           replaceArg = it;
0479 >                   
0480 >                   // Read from stdin until EOF and call function for each line read
0481 >                   char *buf = new char[ 1000 ];
0482 >                   while ( !feof( stdin ) )
0483 >                   {
0484 >                       fgets( buf, 1000, stdin );
0485 >               
0486 >                       if( replaceArg != args.end() )
0487 >                           *replaceArg = buf;
0488 > 
0489 >                       callFunction( app, objid, function, params );
0490 >                   }
0491 >               }
0492 >               else
0493 >               {
0494 >                   // Just call function
0495 > //                cout << "call " << app << ", " << objid << ", " << function << ", (params)" << endl;
0496 >                   callFunction( app, objid, function, params );
0497 >               }
0498 >               break;
0499 >           }
0500 >           // Another sIt++ would make the loop infinite...
0501 >           if( users.isEmpty() )
0502 >               break;
0503 >       }
0504 >       
0505 >       // Another it++ would make the loop infinite...
0506 >       if( it == users.end() )
0507 >           break;
0508 340a662,767
0509 > }
0510 > 
0511 > 
0512 > int main( int argc, char** argv )
0513 > {
0514 >     bool readStdin = false;
0515 >     int numOptions = 0;
0516 >     QString user;
0517 >     Session session = DefaultSession;
0518 >     QString sessionName;
0519 >     
0520 >     // Scan for command-line options first
0521 >     for( int pos = 1 ; pos <= argc - 1 ; pos++ )
0522 >     {
0523 >       if( strcmp( argv[ pos ], "--help" ) == 0 )
0524 >           showHelp( 0 );
0525 >       else if( strcmp( argv[ pos ], "--pipe" ) == 0 )
0526 >       {
0527 >           readStdin = true;
0528 >           numOptions++;
0529 >       }
0530 >       else if( strcmp( argv[ pos ], "--user" ) == 0 )
0531 >       {
0532 >           if( pos <= argc - 2 )
0533 >           {
0534 >               user = QString::fromLocal8Bit( argv[ pos + 1] );
0535 >               numOptions +=2;
0536 >               pos++;
0537 >           }
0538 >           else
0539 >           {
0540 >               cerr << "Missing username for '--user' option!" << endl << endl;
0541 >               showHelp( -1 );
0542 >           }
0543 >       }
0544 >       else if( strcmp( argv[ pos ], "--all-users" ) == 0 )
0545 >       {
0546 >           user = "*";
0547 >           numOptions ++;
0548 >       }
0549 >       else if( strcmp( argv[ pos ], "--list-sessions" ) == 0 )
0550 >       {
0551 >           session = QuerySessions;
0552 >           numOptions ++;
0553 >       }
0554 >       else if( strcmp( argv[ pos ], "--all-sessions" ) == 0 )
0555 >       {
0556 >           session = AllSessions;
0557 >           numOptions ++;
0558 >       }
0559 >       else if( argv[ pos ][ 0 ] == '-' )
0560 >       {
0561 >           cerr << "Unknown command-line option '" << argv[ pos ]
0562 >                << "'." << endl << endl;
0563 >           showHelp( -1 );
0564 >       }
0565 >       else
0566 >           break;      // End of options
0567 >     }
0568 > 
0569 >     argc -= numOptions;
0570 > 
0571 >     QCStringList args;
0572 >     for( int i = numOptions; i < argc + numOptions - 1; i++ )
0573 >       args.append( argv[ i + 1 ] );
0574 >     
0575 >     if( readStdin && args.count() < 3 )
0576 >     {
0577 >       cerr << "--pipe option only supported for function calls!" << endl << endl;
0578 >       showHelp( -1 );
0579 >     }
0580 >     
0581 >     if( user == "*" && args.count() < 3 && session != QuerySessions )
0582 >     {
0583 >       cerr << "ERROR: The --all-users option is only supported for function calls!" << endl << endl;
0584 >       showHelp( -1 );
0585 >     }
0586 >     
0587 >     if( session == QuerySessions && !args.isEmpty() )
0588 >     {
0589 >       cerr << "ERROR: The --list-sessions option cannot be used for actual DCOP calls!" << endl << endl;
0590 >       showHelp( -1 );
0591 >     }
0592 >     
0593 >     if( session == QuerySessions && user.isEmpty() )
0594 >     {
0595 >       cerr << "ERROR: The --list-sessions option can only be used with the --user or" << endl
0596 >            << "--all-users options!" << endl << endl;
0597 >       showHelp( -1 );
0598 >     }
0599 >     
0600 >     if( session != DefaultSession && session != QuerySessions &&
0601 >         args.count() < 3 )
0602 >     {
0603 >       cerr << "ERROR: The --session and --all-sessions options are only supported for function" << endl
0604 >            << "calls!" << endl << endl;
0605 >       showHelp( -1 );
0606 >     }
0607 >     
0608 >     UserList users;
0609 >     if( user == "*" )
0610 >       users = userList();
0611 >     else if( !user.isEmpty() )
0612 >       users[ user ] = userList()[ user ];
0613 > 
0614 >     runDCOP( args, users, session, sessionName, readStdin );
0615 343a771,773
0616 > 
0617 > // vim: set ts=8 sts=4 sw=4 noet:
0618 > 
0619 Index: client/dcopfind.cpp
0620 ===================================================================
0621 RCS file: /home/kde/kdelibs/dcop/client/dcopfind.cpp,v
0622 retrieving revision 1.2
0623 diff -r1.2 dcopfind.cpp
0624 39c39
0625 < bool findObject( const char* app, const char* obj, const char* func, int argc, char** args )
0626 ---
0627 > bool findObject( const char* app, const char* obj, const char* func, QCStringList args )
0628 121c121
0629 <     if ( (int) types.count() != argc ) {
0630 ---
0631 >     if ( types.count() != args.count() ) {
0632 131c131
0633 <         marshall(arg, argc, args, i, *it);
0634 ---
0635 >         marshall(arg, args, i, *it);
0636 133c133
0637 <     if ( (int) i != argc ) {
0638 ---
0639 >     if ( (uint) i != args.count() ) {
0640 224c224,228
0641 <     findObject( app, objid, function, argc, args );
0642 ---
0643 >     QCStringList params;
0644 >     for( int i = 0; i < argc; i++ )
0645 >           params.append( args[ i ] );
0646 >     
0647 >     findObject( app, objid, function, params );
0648 Index: client/marshall.cpp
0649 ===================================================================
0650 RCS file: /home/kde/kdelibs/dcop/client/marshall.cpp,v
0651 retrieving revision 1.3
0652 diff -r1.3 marshall.cpp
0653 245c245
0654 < void  marshall(QDataStream &arg, int argc, char **argv, int &i, QString type)
0655 ---
0656 > void marshall( QDataStream &arg, QCStringList args, uint &i, QString type )
0657 247,317c247,256
0658 <       if (type == "QStringList")
0659 <            type = "QValueList<QString>";
0660 <       if (type == "QCStringList")
0661 <            type = "QValueList<QCString>";
0662 <       if (i >= argc)
0663 <       {
0664 <           qWarning("Not enough arguments.");
0665 <             exit(1);
0666 <         }       
0667 <         QString s = QString::fromLocal8Bit(argv[i]);
0668 <  
0669 <       if ( type == "int" )
0670 <           arg << s.toInt();
0671 <       else if ( type == "uint" )
0672 <           arg << s.toUInt();
0673 <       else if ( type == "unsigned" )
0674 <           arg << s.toUInt();
0675 <       else if ( type == "unsigned int" )
0676 <           arg << s.toUInt();
0677 <       else if ( type == "long" )
0678 <           arg << s.toLong();
0679 <       else if ( type == "long int" )
0680 <           arg << s.toLong();
0681 <       else if ( type == "unsigned long" )
0682 <           arg << s.toULong();
0683 <       else if ( type == "unsigned long int" )
0684 <           arg << s.toULong();
0685 <       else if ( type == "float" )
0686 <           arg << s.toFloat();
0687 <       else if ( type == "double" )
0688 <           arg << s.toDouble();
0689 <       else if ( type == "bool" )
0690 <           arg << mkBool( s );
0691 <       else if ( type == "QString" )
0692 <           arg << s;
0693 <       else if ( type == "QCString" )
0694 <           arg << QCString( argv[i] );
0695 <       else if ( type == "QColor" )
0696 <           arg << mkColor( s );
0697 <       else if ( type == "QPoint" )
0698 <           arg << mkPoint( s );
0699 <       else if ( type == "QSize" )
0700 <           arg << mkSize( s );
0701 <       else if ( type == "QRect" )
0702 <           arg << mkRect( s );
0703 <       else if ( type == "QVariant" ) {
0704 <           if ( s == "true" || s == "false" )
0705 <               arg << QVariant( mkBool( s ), 42 );
0706 <           else if ( s.left( 4 ) == "int(" )
0707 <               arg << QVariant( s.mid(4, s.length()-5).toInt() );
0708 <           else if ( s.left( 7 ) == "QPoint(" )
0709 <               arg << QVariant( mkPoint( s.mid(7, s.length()-8) ) );
0710 <           else if ( s.left( 6 ) == "QSize(" )
0711 <               arg << QVariant( mkSize( s.mid(6, s.length()-7) ) );
0712 <           else if ( s.left( 6 ) == "QRect(" )
0713 <               arg << QVariant( mkRect( s.mid(6, s.length()-7) ) );
0714 <           else if ( s.left( 7 ) == "QColor(" )
0715 <               arg << QVariant( mkColor( s.mid(7, s.length()-8) ) );
0716 <           else
0717 <               arg << QVariant( s );
0718 <       } else if ( type.startsWith("QValueList<")) {
0719 <             type = type.mid(11, type.length() - 12);
0720 <             QStringList list;
0721 <           QString delim = s;
0722 <             if (delim == "[")
0723 <                delim = "]";
0724 <             if (delim == "(")
0725 <                delim = ")";
0726 <             i++;
0727 <           QByteArray dummy_data;
0728 <             QDataStream dummy_arg(dummy_data, IO_WriteOnly);
0729 ---
0730 >     if (type == "QStringList")
0731 >        type = "QValueList<QString>";
0732 >     if (type == "QCStringList")
0733 >        type = "QValueList<QCString>";
0734 >     if( i > args.count() )
0735 >     {
0736 >       qWarning("Not enough arguments.");
0737 >       exit(1);
0738 >     }       
0739 >     QString s = QString::fromLocal8Bit( args[ i ] );
0740 319,346c258,314
0741 <             int j = i;
0742 <             int count = 0;
0743 <             // Parse list to get the count
0744 <             while (true) {
0745 <               if (j >= argc)
0746 <               {
0747 <                   qWarning("List end-delimiter '%s' not found.", delim.latin1());
0748 <                   exit(1);
0749 <               }
0750 <                 if (argv[j] == delim) break;
0751 <                 marshall(dummy_arg, argc, argv, j, type);
0752 <                 count++;
0753 <             }
0754 <             arg << (Q_UINT32) count;
0755 <             // Parse the list for real
0756 <             while (true) {
0757 <               if (i >= argc)
0758 <               {
0759 <                   qWarning("List end-delimiter '%s' not found.", delim.latin1());
0760 <                   exit(1);
0761 <               }
0762 <                 if (argv[i] == delim) break;
0763 <                 marshall(arg, argc, argv, i, type);
0764 <             }
0765 <       } else {
0766 <           qWarning( "cannot handle datatype '%s'", type.latin1() );
0767 <           exit(1);
0768 <       }
0769 ---
0770 >     if ( type == "int" )
0771 >       arg << s.toInt();
0772 >     else if ( type == "uint" )
0773 >       arg << s.toUInt();
0774 >     else if ( type == "unsigned" )
0775 >       arg << s.toUInt();
0776 >     else if ( type == "unsigned int" )
0777 >       arg << s.toUInt();
0778 >     else if ( type == "long" )
0779 >       arg << s.toLong();
0780 >     else if ( type == "long int" )
0781 >       arg << s.toLong();
0782 >     else if ( type == "unsigned long" )
0783 >       arg << s.toULong();
0784 >     else if ( type == "unsigned long int" )
0785 >       arg << s.toULong();
0786 >     else if ( type == "float" )
0787 >       arg << s.toFloat();
0788 >     else if ( type == "double" )
0789 >       arg << s.toDouble();
0790 >     else if ( type == "bool" )
0791 >       arg << mkBool( s );
0792 >     else if ( type == "QString" )
0793 >       arg << s;
0794 >     else if ( type == "QCString" )
0795 >       arg << QCString( args[ i ] );
0796 >     else if ( type == "QColor" )
0797 >       arg << mkColor( s );
0798 >     else if ( type == "QPoint" )
0799 >       arg << mkPoint( s );
0800 >     else if ( type == "QSize" )
0801 >       arg << mkSize( s );
0802 >     else if ( type == "QRect" )
0803 >       arg << mkRect( s );
0804 >     else if ( type == "QVariant" ) {
0805 >       if ( s == "true" || s == "false" )
0806 >           arg << QVariant( mkBool( s ), 42 );
0807 >       else if ( s.left( 4 ) == "int(" )
0808 >           arg << QVariant( s.mid(4, s.length()-5).toInt() );
0809 >       else if ( s.left( 7 ) == "QPoint(" )
0810 >           arg << QVariant( mkPoint( s.mid(7, s.length()-8) ) );
0811 >       else if ( s.left( 6 ) == "QSize(" )
0812 >           arg << QVariant( mkSize( s.mid(6, s.length()-7) ) );
0813 >       else if ( s.left( 6 ) == "QRect(" )
0814 >           arg << QVariant( mkRect( s.mid(6, s.length()-7) ) );
0815 >       else if ( s.left( 7 ) == "QColor(" )
0816 >           arg << QVariant( mkColor( s.mid(7, s.length()-8) ) );
0817 >       else
0818 >           arg << QVariant( s );
0819 >     } else if ( type.startsWith("QValueList<")) {
0820 >       type = type.mid(11, type.length() - 12);
0821 >       QStringList list;
0822 >       QString delim = s;
0823 >       if (delim == "[")
0824 >          delim = "]";
0825 >       if (delim == "(")
0826 >          delim = ")";
0827 347a316,349
0828 >       QByteArray dummy_data;
0829 >       QDataStream dummy_arg(dummy_data, IO_WriteOnly);
0830 > 
0831 >       uint j = i;
0832 >       uint count = 0;
0833 >       // Parse list to get the count
0834 >       while (true) {
0835 >           if( j > args.count() )
0836 >           {
0837 >               qWarning("List end-delimiter '%s' not found.", delim.latin1());
0838 >               exit(1);
0839 >           }
0840 >           if( QString::fromLocal8Bit( args[ j ] ) == delim )
0841 >               break;
0842 >           marshall( dummy_arg, args, j, type );
0843 >           count++;
0844 >       }
0845 >       arg << (Q_UINT32) count;
0846 >       // Parse the list for real
0847 >       while (true) {
0848 >           if( i > args.count() )
0849 >           {
0850 >               qWarning("List end-delimiter '%s' not found.", delim.latin1());
0851 >               exit(1);
0852 >           }
0853 >           if( QString::fromLocal8Bit( args[ i ] ) == delim )
0854 >               break;
0855 >           marshall( arg, args, i, type );
0856 >       }
0857 >     } else {
0858 >       qWarning( "cannot handle datatype '%s'", type.latin1() );
0859 >       exit(1);
0860 >     }
0861 >     i++;