libtelepathy/tsrc/src/telepathygabbletestblocks.cpp
changeset 10 59927b2d3b75
parent 0 d0f3a028347a
equal deleted inserted replaced
0:d0f3a028347a 10:59927b2d3b75
     1 /*
       
     2 * Copyright (c) 2008 - 2009 Nokia Corporation and/or its subsidiary(-ies).
       
     3 * All rights reserved.
       
     4 * This component and the accompanying materials are made available
       
     5 * under the terms of the License "Eclipse Public License v1.0"
       
     6 * which accompanies this distribution, and is available
       
     7 * at the URL "http://www.eclipse.org/legal/epl-v10.html".
       
     8 *
       
     9 * Initial Contributors:
       
    10 * Nokia Corporation - initial contribution.
       
    11 *
       
    12 * Contributors:
       
    13 *
       
    14 * Description:    Stif Test Cases Test blocks file.
       
    15 *		 RunMethodL mentions all the test cases that will be run.
       
    16 *
       
    17 */
       
    18 
       
    19 
       
    20 
       
    21 
       
    22 
       
    23 // [INCLUDE FILES] - do not remove
       
    24 #include <e32svr.h>
       
    25 #include <StifParser.h>
       
    26 #include <StifTestInterface.h>
       
    27 #include "telepathygabbletest.h"
       
    28 #include "telepathygabbletestdata.h"
       
    29 //glib related include files
       
    30 #include <glib.h>
       
    31 #include <glib/gprintf.h>           // for g_stpcpy
       
    32 #include <string.h>
       
    33 #include <stdlib.h>
       
    34 
       
    35 #include <glowmem.h>
       
    36 
       
    37 //Login related file
       
    38 #include "telepathygabblelogintest.h"
       
    39 //Send Message related file
       
    40 #include "telepathygabblesendmessage.h"
       
    41 //AddDeleteContact related file
       
    42 #include "telepathygabbleadddeletecontact.h"
       
    43 //FetchContacts related files
       
    44 #include "telepathygabblefetchcontacts.h"
       
    45 //Search related files
       
    46 #include "telepathygabblesearch.h"
       
    47 
       
    48 
       
    49 const TInt KRepeatedMessageCount=4;
       
    50 
       
    51 
       
    52 
       
    53 typedef enum
       
    54 {
       
    55 	RC_OK,
       
    56 	RC_ERROR
       
    57 } RC_Code_t;
       
    58 
       
    59 typedef struct
       
    60 {
       
    61 	gchar *recipient;
       
    62 	gchar *message;
       
    63 } MessageData;
       
    64 
       
    65 typedef struct
       
    66 {
       
    67 	gchar      *proxy_server;
       
    68 	gchar      *proxy_port;	
       
    69 }ProxyData;
       
    70 
       
    71 typedef struct
       
    72 {
       
    73 	gchar      *key;
       
    74 	gchar      *value;	
       
    75 }SearchData;
       
    76 typedef struct
       
    77 {
       
    78 	gchar       *server;
       
    79 	gchar       *username;
       
    80 	gchar       *password;		
       
    81 	gchar       *resource;
       
    82 	MessageData *msg_data;	
       
    83 #ifdef __WINSCW__
       
    84     ProxyData   *proxy_data;
       
    85 #endif
       
    86     gchar       *port;
       
    87     gchar       *ssl_flag; //needed for gizmo and gtalk.
       
    88     SearchData  *search_data;
       
    89 
       
    90 } ConnectData;
       
    91 
       
    92 typedef struct
       
    93 {
       
    94 	ConnectData *connect_data;
       
    95 	GMainLoop   *main_loop;
       
    96 	RC_Code_t   rCode;	
       
    97 } AuthData;
       
    98 
       
    99 typedef struct
       
   100 {
       
   101     GMainLoop *main_loop;
       
   102     RC_Code_t Test_Success;	
       
   103 } HandleData;
       
   104 
       
   105 // Function to read data from the cfg file
       
   106 static RC_Code_t read_data ( ConnectData*& connect_data, 
       
   107                              CStifItemParser& aItem, CStifLogger* aLog );
       
   108                              
       
   109 // Function to free the allocated resources
       
   110 static void free_data ( ConnectData*& connect_data, CStifLogger* aLog);
       
   111                              
       
   112 
       
   113                              
       
   114 // ============================= LOCAL FUNCTIONS ===============================
       
   115 
       
   116 //-----------------------------------------------------------------------------
       
   117 // function_name	: read_data
       
   118 // description     	: Reads data from the CFG file
       
   119 // Returns          : None
       
   120 //-----------------------------------------------------------------------------
       
   121 //
       
   122 static RC_Code_t
       
   123 read_data ( ConnectData*& connect_data, CStifItemParser& aItem, CStifLogger* aLog )
       
   124     {
       
   125 	TPtrC               string;
       
   126 	TBuf8<KMaxFileName> temp;
       
   127 	
       
   128 	//TBuf8<KMaxChar>		temp;
       
   129 	MessageData         *msg_data   = NULL;
       
   130 	
       
   131 	SearchData         *search_data   = NULL;
       
   132 #ifdef __WINSCW__
       
   133 	ProxyData           *proxy_data = NULL;
       
   134 #endif
       
   135 	
       
   136 	connect_data = g_new0 ( ConnectData, 1 );
       
   137 	if ( !connect_data )
       
   138 	    {
       
   139 		return RC_ERROR;
       
   140 	    }
       
   141 	    
       
   142 	msg_data = g_new0 ( MessageData, 1 );
       
   143 	if ( !msg_data )
       
   144 	    {
       
   145 		free_data (connect_data, aLog );
       
   146 		return RC_ERROR;
       
   147 	    }
       
   148 	
       
   149 	connect_data->msg_data = msg_data;
       
   150 	
       
   151 	search_data = g_new0 ( SearchData, 1 );
       
   152 	if ( !search_data )
       
   153 	    {
       
   154 		free_data (connect_data, aLog );
       
   155 		return RC_ERROR;
       
   156 	    }
       
   157 	connect_data->search_data = search_data;	    
       
   158 	
       
   159 #ifdef __WINSCW__
       
   160     proxy_data = g_new0 ( ProxyData, 1 );
       
   161     if ( !proxy_data ) 
       
   162     	{
       
   163     	free_data (connect_data, aLog );
       
   164     	return RC_ERROR;
       
   165     	}
       
   166 	connect_data->proxy_data = proxy_data;
       
   167 #endif
       
   168 
       
   169 	// Read server name
       
   170 	if ( aItem.GetNextString ( string ) == KErrNone )
       
   171 	    {
       
   172 		temp.Copy ( string );
       
   173 		temp.Append ( '\0' );
       
   174 		connect_data->server = g_new0 ( gchar, temp.Length() );
       
   175 		if ( !connect_data->server )
       
   176 		    {			
       
   177 			free_data (connect_data, aLog );
       
   178 			return RC_ERROR;
       
   179 		    }
       
   180 		g_stpcpy ( connect_data->server, ( gchar * ) temp.Ptr() ); 
       
   181 	    }
       
   182 	    
       
   183 	// Read Username
       
   184 	if ( aItem.GetNextString ( string ) == KErrNone )
       
   185 	    {
       
   186 	    temp.Copy ( string );
       
   187 	    temp.Append ( '\0' );
       
   188 	    connect_data->username = g_new0 ( gchar, temp.Length() );
       
   189 	    if ( !connect_data->username )
       
   190 	        {	    	
       
   191 	    	free_data (connect_data, aLog );
       
   192 	    	return RC_ERROR;
       
   193 	        }
       
   194 	    g_stpcpy ( connect_data->username, ( gchar * ) temp.Ptr() );		    
       
   195 	    }
       
   196 	
       
   197 	// Read Password corresponding to Username
       
   198 	if ( aItem.GetNextString ( string ) == KErrNone )
       
   199 	    {
       
   200 	    temp.Copy ( string );
       
   201 	    temp.Append ( '\0' );
       
   202 	    connect_data->password = g_new0 ( gchar, temp.Length () );		    
       
   203 	    if ( !connect_data->password )
       
   204 	        {	    	
       
   205 	    	free_data (connect_data, aLog );
       
   206 	    	return RC_ERROR;
       
   207 	        }
       
   208 	    g_stpcpy ( connect_data->password, ( gchar *) temp.Ptr() );
       
   209 	    }
       
   210 	
       
   211 	// Read recipient
       
   212 	if ( aItem.GetNextString ( string ) == KErrNone )
       
   213 	    {
       
   214 	    temp.Copy ( string );
       
   215 	    temp.Append ( '\0' );
       
   216 	    msg_data->recipient = g_new0 ( gchar, temp.Length() );
       
   217 	    if ( !msg_data->recipient )
       
   218 	        {
       
   219 	    	free_data (connect_data, aLog );
       
   220 	    	return RC_ERROR;
       
   221 	        }
       
   222 	    g_stpcpy ( msg_data->recipient, ( gchar * ) temp.Ptr() );
       
   223 	    }
       
   224 	
       
   225 	// Read Message
       
   226 	if ( aItem.GetNextString ( string ) == KErrNone )
       
   227 	    {
       
   228 	    temp.Copy ( string );
       
   229 	    temp.Append ( '\0' );	    
       
   230 	    msg_data->message = g_new0 ( gchar, temp.Length() );
       
   231 	    if ( !msg_data->message )
       
   232 	        {
       
   233 	    	free_data (connect_data, aLog );
       
   234 	    	return RC_ERROR;
       
   235 	        }
       
   236 	    g_stpcpy ( msg_data->message, ( gchar * ) temp.Ptr() );
       
   237 	    }
       
   238 	
       
   239 	// Read resource identifier
       
   240 	if ( aItem.GetNextString ( string ) == KErrNone )
       
   241 	    {
       
   242 	    temp.Copy ( string );
       
   243 	    temp.Append ( '\0' );
       
   244 	    connect_data->resource = g_new0 ( gchar, temp.Length() );
       
   245 	    if ( !connect_data->resource )
       
   246 	        {
       
   247 	    	free_data (connect_data, aLog );
       
   248 	    	return RC_ERROR;
       
   249 	        }
       
   250 	    g_stpcpy ( connect_data->resource, ( gchar * ) temp.Ptr() );		    
       
   251 	    }
       
   252 	 
       
   253 
       
   254 	// Read proxy server and proxy port
       
   255     if ( aItem.GetNextString ( string ) == KErrNone )
       
   256     	{
       
   257     	temp.Copy ( string );
       
   258     	temp.Append ( '\0' );
       
   259     	#ifdef __WINSCW__
       
   260     	proxy_data->proxy_server = g_new0 ( gchar, temp.Length() );
       
   261     	if ( !proxy_data->proxy_server )
       
   262     		{
       
   263     		free_data (connect_data, aLog );
       
   264     		return RC_ERROR;
       
   265     		}
       
   266     	g_stpcpy ( proxy_data->proxy_server, ( gchar * ) temp.Ptr() );
       
   267     	#endif 
       
   268     	}
       
   269     	
       
   270     if ( aItem.GetNextString ( string ) == KErrNone )
       
   271     	{
       
   272     	temp.Copy ( string );
       
   273     	temp.Append ( '\0' );
       
   274     	#ifdef __WINSCW__
       
   275     	proxy_data->proxy_port = g_new0 ( gchar, temp.Length() );
       
   276     	if ( !proxy_data->proxy_port )
       
   277     		{
       
   278     		free_data (connect_data, aLog );
       
   279     		return RC_ERROR;
       
   280     		}
       
   281     	g_stpcpy ( proxy_data->proxy_port, ( gchar * ) temp.Ptr() );
       
   282     	#endif
       
   283     	}	
       
   284     	
       
   285     	/* if ( aItem.GetNextInt ( proxy_port ) == KErrNone )
       
   286     		{
       
   287     		proxy_data->proxy_port = proxy_port;
       
   288     		}    	 */
       
   289     		
       
   290     		
       
   291 
       
   292 	//Read the port
       
   293 	if ( aItem.GetNextString ( string ) == KErrNone )
       
   294 	{
       
   295 	temp.Copy ( string );
       
   296 	temp.Append ( '\0' );
       
   297 	connect_data->port = g_new0 ( gchar, temp.Length() );
       
   298 	if ( !connect_data->port )
       
   299 		{
       
   300 		free_data (connect_data, aLog );
       
   301 		return RC_ERROR;
       
   302 		}
       
   303 	g_stpcpy ( connect_data->port, ( gchar * ) temp.Ptr() ); 
       
   304 	}
       
   305 
       
   306 	//Read the ssl_flag value
       
   307   	if ( aItem.GetNextString ( string ) == KErrNone )
       
   308     {
       
   309 	temp.Copy ( string );
       
   310 	temp.Append ( '\0' );
       
   311 	connect_data->ssl_flag = g_new0 ( gchar, temp.Length() );
       
   312 	if ( !connect_data->ssl_flag )
       
   313 	    {			
       
   314 		free_data (connect_data, aLog );
       
   315 		return RC_ERROR;
       
   316 	    }
       
   317 	g_stpcpy ( connect_data->ssl_flag, ( gchar * ) temp.Ptr() ); 
       
   318     }
       
   319     
       
   320     // Read key
       
   321 	if ( aItem.GetNextString ( string ) == KErrNone )
       
   322 	    {
       
   323 	    temp.Copy ( string );
       
   324 	    temp.Append ( '\0' );
       
   325 	    search_data->key = g_new0 ( gchar, temp.Length() );
       
   326 	    if ( !search_data->key )
       
   327 	        {
       
   328 	    	free_data (connect_data, aLog );
       
   329 	    	return RC_ERROR;
       
   330 	        }
       
   331 	    g_stpcpy ( search_data->key, ( gchar * ) temp.Ptr() );
       
   332 	    }
       
   333 	
       
   334 	// Read value
       
   335 	if ( aItem.GetNextString ( string ) == KErrNone )
       
   336 	    {
       
   337 	    temp.Copy ( string );
       
   338 	    temp.Append ( '\0' );	    
       
   339 	    search_data->value = g_new0 ( gchar, temp.Length() );
       
   340 	    if ( !search_data->value )
       
   341 	        {
       
   342 	    	free_data (connect_data, aLog );
       
   343 	    	return RC_ERROR;
       
   344 	        }
       
   345 	    g_stpcpy ( search_data->value, ( gchar * ) temp.Ptr() );
       
   346 	    }
       
   347 	
       
   348 	return RC_OK;
       
   349     }
       
   350     
       
   351 
       
   352 
       
   353 //-----------------------------------------------------------------------------
       
   354 // function_name	: free_data
       
   355 // description     	: Deallocates all the data
       
   356 // Returns          : None
       
   357 //-----------------------------------------------------------------------------
       
   358 //
       
   359 static void
       
   360 free_data ( ConnectData*& connect_data, CStifLogger* aLog )
       
   361     {
       
   362     //iLog->Log( _L("free_data\n") );
       
   363 	if ( connect_data )
       
   364 	    {
       
   365 		if ( connect_data->server )
       
   366 		    {
       
   367 		    //iLog->Log( _L("free server\n") );
       
   368 			g_free ( connect_data->server );
       
   369 			connect_data->server = NULL;
       
   370 		    }
       
   371 		
       
   372 		if ( connect_data->username )
       
   373 		    {
       
   374 		    aLog->Log( _L(" free username\n") );
       
   375 			g_free ( connect_data->username );
       
   376 			connect_data->username = NULL;
       
   377 		    }
       
   378 		
       
   379 		if ( connect_data->password )
       
   380 		    {
       
   381 		    aLog->Log( _L(" free password\n") );
       
   382 			g_free ( connect_data->password );
       
   383 			connect_data->password = NULL;
       
   384 		    }
       
   385 		
       
   386 		if ( connect_data->msg_data )
       
   387 		    {
       
   388 			if ( connect_data->msg_data->recipient )
       
   389 			    {
       
   390 			    aLog->Log( _L(" free recipient\n") );
       
   391 				g_free ( connect_data->msg_data->recipient );
       
   392 				connect_data->msg_data->recipient = NULL;
       
   393 			    }
       
   394 			if ( connect_data->msg_data->message )
       
   395 			    {
       
   396 			    aLog->Log( _L(" free message\n") );
       
   397 				g_free ( connect_data->msg_data->message );
       
   398 				connect_data->msg_data->message = NULL;
       
   399 			    }
       
   400 			g_free ( connect_data->msg_data );
       
   401 			connect_data->msg_data = NULL;
       
   402 		    }		
       
   403 		
       
   404 		if ( connect_data->resource )
       
   405 		    {
       
   406 		    aLog->Log( _L(" free resource\n") );
       
   407 			g_free ( connect_data->resource );
       
   408 			connect_data->resource = NULL;
       
   409 		    }
       
   410 		    
       
   411 	#ifdef __WINSCW__
       
   412 	    if ( connect_data->proxy_data )
       
   413 	    	{
       
   414 	    	if ( connect_data->proxy_data->proxy_server )
       
   415 	    		{
       
   416 	    		aLog->Log( _L(" free proxy_server\n") );
       
   417 	    		g_free ( connect_data->proxy_data->proxy_server );
       
   418 	    		connect_data->proxy_data->proxy_server = NULL;
       
   419 	    		}
       
   420     		if ( connect_data->proxy_data->proxy_port )
       
   421 	    		{
       
   422 	    		aLog->Log( _L(" free proxy_port\n") );
       
   423 	    		g_free ( connect_data->proxy_data->proxy_port );
       
   424 	    		connect_data->proxy_data->proxy_port = NULL;
       
   425 	    		}
       
   426 	    	g_free ( connect_data->proxy_data );
       
   427 	    	connect_data->proxy_data = NULL;	
       
   428 	    	}
       
   429 	#endif	 
       
   430 	
       
   431 	    //port free
       
   432 	    if ( connect_data->port )
       
   433 		    {
       
   434 		    aLog->Log( _L(" free port\n") );
       
   435 			g_free ( connect_data->port );
       
   436 			connect_data->port = NULL;
       
   437 		    }
       
   438 		    
       
   439 		//ssl_flag free
       
   440 		if ( connect_data->ssl_flag )
       
   441 		    {
       
   442 		        aLog->Log( _L(" free ssl_flag\n") );
       
   443 				g_free ( connect_data->ssl_flag );
       
   444 				connect_data->ssl_flag = NULL;
       
   445 		    }
       
   446 		    
       
   447 		if ( connect_data->search_data )
       
   448 		    {
       
   449 			if ( connect_data->search_data->key )
       
   450 			    {
       
   451 			    aLog->Log( _L(" free key\n") );
       
   452 				g_free ( connect_data->search_data->key );
       
   453 				connect_data->search_data->key = NULL;
       
   454 			    }
       
   455 			if ( connect_data->search_data->value )
       
   456 			    {
       
   457 			    aLog->Log( _L(" free value\n") );
       
   458 				g_free ( connect_data->search_data->value );
       
   459 				connect_data->search_data->value = NULL;
       
   460 			    }
       
   461 			g_free ( connect_data->search_data );
       
   462 			connect_data->search_data = NULL;
       
   463 		    }
       
   464 		aLog->Log( _L(" free connect_data\n") );		    		    
       
   465 		g_free ( connect_data );
       
   466 		connect_data = NULL;    
       
   467 	    }
       
   468 	    aLog->Log( _L(" free connect_data out\n") );
       
   469     }
       
   470     
       
   471 // ============================ MEMBER FUNCTIONS ===============================
       
   472 
       
   473 // -----------------------------------------------------------------------------
       
   474 // CTelepathyGabbleTest::Delete
       
   475 // Delete here all resources allocated and opened from test methods. 
       
   476 // Called from destructor. 
       
   477 // -----------------------------------------------------------------------------
       
   478 //
       
   479 void CTelepathyGabbleTest::Delete() 
       
   480     {
       
   481     	 iLog->Log( _L("CTelepathyGabbleTest::Delete in\n") );
       
   482 	     if (iLoginObj)
       
   483 	     {
       
   484 	       	iLog->Log( _L("In Delete iLoginObj \n") );
       
   485 	     	delete iLoginObj;
       
   486 	     	iLoginObj = NULL;
       
   487 	     }
       
   488 
       
   489 		 if (iSendMsgObj)
       
   490 		 {
       
   491 		 	delete iSendMsgObj;
       
   492 		 	iSendMsgObj = NULL;
       
   493 		 }
       
   494 		 
       
   495 		 if (iAddDelContactObj)
       
   496 		 {
       
   497 		 	delete iAddDelContactObj;
       
   498 		 	iAddDelContactObj = NULL;
       
   499 		 }
       
   500 		 
       
   501 		 if (iFetchContactObj)
       
   502 		 {
       
   503 		 	delete iFetchContactObj;
       
   504 		 	iFetchContactObj = NULL;
       
   505 		 }
       
   506 		 
       
   507 		 if (iSearchObj)
       
   508 		 {
       
   509 		 	delete iSearchObj;
       
   510 		 	iSearchObj = NULL;
       
   511 		 }
       
   512 		 
       
   513 		 if (iTestData)
       
   514 		 {
       
   515 		    iLog->Log( _L("In Delete iTestData \n") );
       
   516 		 	delete iTestData;
       
   517 		 	iTestData = NULL;
       
   518 		 	
       
   519 		 }
       
   520 		 iLog->Log( _L("CTelepathyGabbleTest::Delete out\n") );
       
   521     }
       
   522 
       
   523 // -----------------------------------------------------------------------------
       
   524 // CTelepathyGabbleTest::RunMethodL
       
   525 // Run specified method. Contains also table of test mothods and their names.
       
   526 // -----------------------------------------------------------------------------
       
   527 //
       
   528 TInt CTelepathyGabbleTest::RunMethodL( 
       
   529     CStifItemParser& aItem ) 
       
   530     {
       
   531     
       
   532     iLog->Log( _L("CTelepathyGabbleTest::RunMethodL in") );
       
   533    
       
   534  
       
   535     static TStifFunctionInfo const KFunctions[] =
       
   536         {  
       
   537         // Copy this line for every implemented function.
       
   538         // First string is the function name used in TestScripter script file.
       
   539         // Second is the actual implementation member function. 
       
   540         //ENTRY( "Example", CTelepathyGabbleTest::ExampleL ),
       
   541         //ADD NEW ENTRY HERE
       
   542         // [test cases entries] - Do not remove
       
   543         
       
   544         //Login - Logout related test cases
       
   545         ENTRY("LoginTest", CTelepathyGabbleTest::LoginTestL ),
       
   546         ENTRY("LogoutTest", CTelepathyGabbleTest::LogoutTestL ),
       
   547         ENTRY("LoginInvalidUseridTest", CTelepathyGabbleTest::LoginInvalidUseridTestL ),
       
   548         ENTRY("LoginInvalidPasswdTest", CTelepathyGabbleTest::LoginInvalidPasswdTestL ),
       
   549         ENTRY("LoginInvalidUseridPasswdTest", CTelepathyGabbleTest::LoginInvalidUseridPasswdTestL ),
       
   550         ENTRY("LoginblankUseridTest", CTelepathyGabbleTest::LoginblankUseridTestL ),
       
   551         ENTRY("LoginblankPasswdTest", CTelepathyGabbleTest::LoginblankPasswdTestL ),
       
   552         ENTRY("LoginblankUseridblankPasswdTest", CTelepathyGabbleTest::LoginblankUseridblankPasswdTestL ),
       
   553         ENTRY("LoginWithMaxLengthUserIDTest", CTelepathyGabbleTest::LoginTestL ),
       
   554         ENTRY("LoginWithMinLengthUserIDTest", CTelepathyGabbleTest::LoginTestL ),
       
   555         ENTRY("LoginUseridWithSplChrsTest", CTelepathyGabbleTest::LoginInvalidUseridTestL ),
       
   556         ENTRY("LoginCancelTest", CTelepathyGabbleTest::LoginCancelTestL ),
       
   557         
       
   558         
       
   559         //Send Message related Test Cases
       
   560         ENTRY("SendMessageTest", CTelepathyGabbleTest::SendMessageTestL ),
       
   561         ENTRY("SendMesasgeToMaxLengthUserIDTest", CTelepathyGabbleTest::SendMessageTestL ),        
       
   562 		ENTRY("SendMesasgetoofflinecontactTest", CTelepathyGabbleTest::SendMessagetoinvalidUseridTestL ),
       
   563         ENTRY("SendMessageWith400Test", CTelepathyGabbleTest::SendMessageWith400TestL ),
       
   564         ENTRY("SendMesasgeBlankTest", CTelepathyGabbleTest::SendMesasgeBlankTestL ),
       
   565         ENTRY("SendMesasgeToBlankUserIdTest", CTelepathyGabbleTest::SendMesasgeToBlankUserIdTestL ),
       
   566         ENTRY("SendMesasgeSplCharsTest", CTelepathyGabbleTest::SendMessageTestL ),
       
   567         ENTRY("SendMesasgeEmoticonsTest", CTelepathyGabbleTest::SendMessageTestL ),        
       
   568         ENTRY("SendMessageRepeatedTest",CTelepathyGabbleTest:: SendMessageRepeatedTestL),        
       
   569         ENTRY("SendMessagetoUserNotInContactListTest",CTelepathyGabbleTest:: SendMessageTestL),
       
   570         ENTRY("SendMessagetoinvalidUseridTest",CTelepathyGabbleTest:: SendMessagetoinvalidUseridTestL),
       
   571         
       
   572         //Receive Message related Test Cases
       
   573         ENTRY("ReceiveMessageTest", CTelepathyGabbleTest::ReceiveMessageTestL ),
       
   574         ENTRY("ReceiveMessageMaxLengthTest", CTelepathyGabbleTest::ReceiveMessageMaxLengthTestL ),
       
   575         ENTRY("ReceiveMessageWithSplChrsTest", CTelepathyGabbleTest::ReceiveMessageTestL ),  
       
   576         ENTRY("ReceiveMessageWithEmoticonsTest", CTelepathyGabbleTest::ReceiveMessageTestL ),                
       
   577         ENTRY("ReceiveMessageBlankTest", CTelepathyGabbleTest::ReceiveMessageBlankTestL ),
       
   578         ENTRY("ReceiveRepeatedMessageTest", CTelepathyGabbleTest::ReceiveRepeatedMessageTestL ),
       
   579         
       
   580         //Add Contact related test cases
       
   581         ENTRY("AddContactTest", CTelepathyGabbleTest::AddContactTestL ),
       
   582         ENTRY("AddContactWithMaxLengthUserIdTest", CTelepathyGabbleTest::AddContactTestL ),
       
   583         ENTRY("AddContactWithBlankUserIdTest", CTelepathyGabbleTest::AddContactWithBlankUserIdTestL ),       
       
   584         ENTRY("AddContactinvalidTest", CTelepathyGabbleTest::AddContactTestL ),
       
   585         ENTRY("AddContactinvalidWithSplCharsTest", CTelepathyGabbleTest::AddContactTestL ),
       
   586         ENTRY("AddContactAlreadyInRosterTest", CTelepathyGabbleTest::AddContactAlreadyInRosterTestL ),
       
   587         
       
   588         
       
   589         //Remove Contact related test cases
       
   590         ENTRY("RemoveContactTest", CTelepathyGabbleTest::RemoveContactTestL ),
       
   591         ENTRY("RemoveInvalidContactTest", CTelepathyGabbleTest::RemoveInvalidContactTestL),
       
   592         ENTRY("RemoveContactAlreadyRemovedTest", CTelepathyGabbleTest::RemoveInvalidContactTestL ),
       
   593         ENTRY("RemoveContactWithMaxLengthUserIDTest", CTelepathyGabbleTest::RemoveContactTestL ),
       
   594         ENTRY("RemoveContactWithBlankUserIdTest", CTelepathyGabbleTest::RemoveContactWithBlankUserIdTestL ),       
       
   595         
       
   596         //Fetch Contact related test cases
       
   597         ENTRY("FetchContactsTest", CTelepathyGabbleTest::FetchContactsTestL ),
       
   598         ENTRY("FetchZeroContactTest", CTelepathyGabbleTest::FetchContactsTestL ),
       
   599        
       
   600         //Search related test cases
       
   601         ENTRY("SearchTest", CTelepathyGabbleTest::SearchTestL ),
       
   602         ENTRY("GetSearchKeysTest", CTelepathyGabbleTest::GetSearchKeysTestL ),
       
   603         ENTRY("SearchInvalidKeyTest", CTelepathyGabbleTest::SearchInvalidKeyTestL ),
       
   604         ENTRY("SearchNoKeyValueTest", CTelepathyGabbleTest::SearchNoKeyValueTestL ),
       
   605         ENTRY("SearchTwoInvalidKeysTest", CTelepathyGabbleTest::SearchTwoInvalidKeysTestL ),        
       
   606         ENTRY("SearchWithAllKeysTest", CTelepathyGabbleTest::SearchWithAllKeysTestL ),
       
   607         ENTRY("SearchBlankStringTest", CTelepathyGabbleTest::SearchBlankStringTestL ),
       
   608         ENTRY("SearchTwiceTest", CTelepathyGabbleTest::SearchTwiceTestL ),
       
   609         ENTRY("SearchTwiceWithDiffStringsTest", CTelepathyGabbleTest::SearchTwiceWithDiffStringsTestL ),
       
   610         ENTRY("SearchFiveTimesTest", CTelepathyGabbleTest::SearchFiveTimesTestL ),        
       
   611         ENTRY("SearchAfterGetSearchKeys", CTelepathyGabbleTest::SearchAfterGetSearchKeysL ),
       
   612         };
       
   613 
       
   614     const TInt count = sizeof( KFunctions ) / 
       
   615                         sizeof( TStifFunctionInfo );
       
   616 
       
   617     return RunInternalL( KFunctions, count, aItem );
       
   618 
       
   619     }
       
   620 
       
   621 // -----------------------------------------------------------------------------
       
   622 // CTelepathyGabbleTest::LoginTestL
       
   623 // Test for login.
       
   624 // -----------------------------------------------------------------------------
       
   625 //
       
   626 
       
   627 TInt CTelepathyGabbleTest::LoginTestL( 
       
   628     CStifItemParser& aItem  )
       
   629 	{
       
   630 		//Pass the parameters to action_login() from the 
       
   631 		//data mentioned in the cfg file.
       
   632 		
       
   633 		iLog->Log( _L("LoginTestL starting") );
       
   634 		
       
   635 		ConnectData  *connect_data = NULL;
       
   636 		
       
   637 		if ( read_data ( connect_data, aItem, iLog) != RC_OK )
       
   638 		{
       
   639 			//iLog->Log( _L("read_data failed") );
       
   640 			free_data (connect_data, iLog );
       
   641 			return KErrGeneral;
       
   642 		}
       
   643 		
       
   644 
       
   645 		char *username, *passwd , *servername , *resource_login, *ssl_flag, *port;
       
   646 		char *proxy_server = NULL;
       
   647 		char *proxy_port = NULL;
       
   648 		
       
   649 		username = 	connect_data->username;
       
   650 		passwd   =  connect_data->password;
       
   651 		servername = 	connect_data->server;
       
   652 		resource_login = connect_data->resource;
       
   653 		ssl_flag = connect_data->ssl_flag;
       
   654 		port = connect_data->port;
       
   655 		#ifdef __WINSCW__
       
   656 	  	proxy_server = connect_data->proxy_data->proxy_server;
       
   657 			proxy_port = connect_data->proxy_data->proxy_port;
       
   658 		#endif
       
   659 		
       
   660 		iTestData = CTestData::NewL(iLog);
       
   661 		
       
   662 		iLog->Log( _L("iTestData created") );
       
   663 	
       
   664 		iLoginObj = CTelepathyGabbleLoginTest::NewL();
       
   665 		
       
   666 		iLog->Log( _L("iLoginObj created") );
       
   667 			
       
   668 		iTestData->SetTestType(CTestData::ELogin) ;
       
   669 		
       
   670 		//action_login will have parameters 
       
   671 		//passed from cfg file
       
   672 		TInt login_status = 
       
   673 			iLoginObj->action_login(username,passwd,servername, resource_login,ssl_flag,
       
   674 																port,proxy_server, proxy_port, iTestData);
       
   675 			
       
   676 		
       
   677 		iLog->Log( _L("after action_login") );
       
   678 		
       
   679 		if (login_status == CTestData::ECONNECTED)
       
   680 		{
       
   681 			//Do the logout so that all the resources are deallocated properly
       
   682 			login_status = iLoginObj->action_logout(iTestData);
       
   683 			
       
   684 			iLog->Log( _L("after action_logout") );
       
   685 			
       
   686 			free_data (connect_data, iLog);
       
   687 			
       
   688 			iLog->Log( _L("after free_data") );
       
   689 			if (login_status != CTestData::EDISCONNECTED)
       
   690 			{
       
   691 			iLog->Log( _L("logout failed") );
       
   692 			return KErrGeneral; 	//logout didnot happen successfully.
       
   693 			}
       
   694 			
       
   695 			//we completed login and logout successfully.
       
   696 			iLog->Log( _L("login-logout test case passed\n") );
       
   697 			
       
   698 			if (iTestData)
       
   699 			 { 	iLog->Log( _L("delete iTestData \n") );
       
   700 			 	delete iTestData;
       
   701 			 	iTestData = NULL;
       
   702 			 	
       
   703 			 }
       
   704 			 if (iLoginObj)
       
   705 		     {
       
   706 		       	iLog->Log( _L("delete iLoginObj \n") );
       
   707 		     	delete iLoginObj;
       
   708 		     	iLoginObj = NULL;
       
   709 		     }
       
   710 			return KErrNone;
       
   711 		}
       
   712 		else
       
   713 		{
       
   714 			//Login didnot happen successfully.
       
   715 			//return from here itself, no need for a logout
       
   716 			free_data (connect_data, iLog );
       
   717 			iLog->Log( _L("login test case failed") );
       
   718 			return KErrGeneral;
       
   719 		
       
   720 		}
       
   721 	
       
   722 	}
       
   723 
       
   724 
       
   725 // -----------------------------------------------------------------------------
       
   726 // CTelepathyGabbleTest::LoginblankUseridblankPasswdTestL
       
   727 // -----------------------------------------------------------------------------		
       
   728 TInt CTelepathyGabbleTest::LoginblankUseridblankPasswdTestL( 
       
   729     CStifItemParser& aItem  )
       
   730 	{
       
   731 		//Pass the parameters to action_login() from the 
       
   732 		//data mentioned in the cfg file.
       
   733 		
       
   734 		ConnectData  *connect_data = NULL;
       
   735 		
       
   736 		if ( read_data ( connect_data, aItem, iLog ) != RC_OK )
       
   737 		{
       
   738 			free_data ( connect_data,iLog );
       
   739 			return KErrGeneral;
       
   740 		}
       
   741 		
       
   742 
       
   743 		char *username, *passwd , *servername , *resource_login, *ssl_flag, *port;
       
   744 		char *proxy_server = NULL;
       
   745 		char *proxy_port = NULL;
       
   746 		
       
   747 		
       
   748 		username = 	""; //make the username as blank
       
   749 		passwd   =  ""; //make the username as blank
       
   750 		servername = 	connect_data->server;
       
   751 		resource_login = connect_data->resource;
       
   752 		ssl_flag = connect_data->ssl_flag;
       
   753 		port = connect_data->port;
       
   754 		#ifdef __WINSCW__
       
   755 	  	proxy_server = connect_data->proxy_data->proxy_server;
       
   756 			proxy_port = connect_data->proxy_data->proxy_port;
       
   757 		#endif
       
   758 		
       
   759 		
       
   760 		iTestData = CTestData::NewL(iLog);
       
   761 	
       
   762 		iLoginObj = CTelepathyGabbleLoginTest::NewL();
       
   763 		
       
   764 		iTestData->SetTestType(CTestData::ELogin) ;
       
   765 			
       
   766 		//action_login will have parameters 
       
   767 		//passed from cfg file
       
   768 		TInt login_status = 
       
   769 			iLoginObj->action_login(username,passwd,servername, resource_login, ssl_flag,
       
   770 															port,proxy_server, proxy_port,iTestData);
       
   771 		
       
   772 		free_data (connect_data, iLog );
       
   773 		
       
   774 		if (login_status == CTestData::EDISCONNECTED)
       
   775 		{
       
   776 			//login_status is disconnected(default state) 
       
   777 			//which is correct since the username was blank.
       
   778 			
       
   779 			return KErrNone;
       
   780 		}
       
   781 		else
       
   782 		{
       
   783 			//There was some error
       
   784 			return KErrGeneral;
       
   785 		}
       
   786 			
       
   787 	}
       
   788 
       
   789 // -----------------------------------------------------------------------------
       
   790 // CTelepathyGabbleTest::LoginblankUseridTestL
       
   791 // -----------------------------------------------------------------------------		
       
   792 TInt CTelepathyGabbleTest::LoginblankUseridTestL( 
       
   793     CStifItemParser& aItem  )
       
   794 	{
       
   795 		//Pass the parameters to action_login() from the 
       
   796 		//data mentioned in the cfg file.
       
   797 		
       
   798 		ConnectData  *connect_data = NULL;
       
   799 		
       
   800 		if ( read_data ( connect_data, aItem, iLog ) != RC_OK )
       
   801 		{
       
   802 			free_data ( connect_data,iLog );
       
   803 			return KErrGeneral;
       
   804 		}
       
   805 		
       
   806 
       
   807 		char *username, *passwd , *servername , *resource_login, *ssl_flag, *port;
       
   808 		char *proxy_server = NULL;
       
   809 		char *proxy_port = NULL;
       
   810 		
       
   811 		
       
   812 		username = 	""; //make the username as blank
       
   813 		passwd   =  connect_data->password;
       
   814 		servername = 	connect_data->server;
       
   815 		resource_login = connect_data->resource;
       
   816 		ssl_flag = connect_data->ssl_flag;
       
   817 		port = connect_data->port;
       
   818 		#ifdef __WINSCW__
       
   819 	  	proxy_server = connect_data->proxy_data->proxy_server;
       
   820 			proxy_port = connect_data->proxy_data->proxy_port;
       
   821 		#endif
       
   822 		
       
   823 		
       
   824 		iTestData = CTestData::NewL(iLog);
       
   825 	
       
   826 		iLoginObj = CTelepathyGabbleLoginTest::NewL();
       
   827 		
       
   828 		iTestData->SetTestType(CTestData::ELogin) ;
       
   829 			
       
   830 		//action_login will have parameters 
       
   831 		//passed from cfg file
       
   832 		TInt login_status = 
       
   833 			iLoginObj->action_login(username,passwd,servername, resource_login, ssl_flag,
       
   834 															port,proxy_server, proxy_port,iTestData);
       
   835 		
       
   836 		free_data (connect_data, iLog );
       
   837 		
       
   838 		if (login_status == CTestData::EDISCONNECTED)
       
   839 		{
       
   840 			//login_status is disconnected(default state) 
       
   841 			//which is correct since the username was blank.
       
   842 			
       
   843 			return KErrNone;
       
   844 		}
       
   845 		else
       
   846 		{
       
   847 			//There was some error
       
   848 			return KErrGeneral;
       
   849 		}
       
   850 			
       
   851 	}
       
   852 
       
   853 // -----------------------------------------------------------------------------
       
   854 // CTelepathyGabbleTest::LoginblankPasswdTestL
       
   855 // -----------------------------------------------------------------------------	
       
   856 TInt CTelepathyGabbleTest::LoginblankPasswdTestL( 
       
   857 CStifItemParser& aItem  )
       
   858 {
       
   859 	//Pass the parameters to action_login() from the 
       
   860 	//data mentioned in the cfg file.
       
   861 	
       
   862 	ConnectData  *connect_data = NULL;
       
   863 	
       
   864 	if ( read_data ( connect_data, aItem, iLog ) != RC_OK )
       
   865 	{
       
   866 		free_data ( connect_data, iLog );
       
   867 		return KErrGeneral;
       
   868 	}
       
   869 
       
   870 	char *username, *passwd , *servername , *resource_login,*ssl_flag, *port;
       
   871 	char *proxy_server = NULL;
       
   872 	char *proxy_port = NULL;
       
   873 		
       
   874 	
       
   875 	username = 	connect_data->username;
       
   876 	passwd   =  ""; //make the passwd as blank.
       
   877 	servername = 	connect_data->server;
       
   878 	resource_login = connect_data->resource;
       
   879 	ssl_flag = connect_data->ssl_flag;
       
   880 	port = connect_data->port;
       
   881 		#ifdef __WINSCW__
       
   882 	  		proxy_server = connect_data->proxy_data->proxy_server;
       
   883 			proxy_port = connect_data->proxy_data->proxy_port;
       
   884 		#endif
       
   885 		
       
   886 	
       
   887 	iTestData = CTestData::NewL(iLog);
       
   888 
       
   889 	iLoginObj = CTelepathyGabbleLoginTest::NewL();
       
   890 	
       
   891 	iTestData->SetTestType(CTestData::ELogin) ;
       
   892 		
       
   893 	//action_login will have parameters 
       
   894 	//passed from cfg file
       
   895 	TInt login_status = 
       
   896 		iLoginObj->action_login(username,passwd,servername, resource_login,ssl_flag,
       
   897 														port,proxy_server, proxy_port,iTestData);
       
   898 	
       
   899 	free_data (connect_data, iLog );
       
   900 	
       
   901 	if (login_status == CTestData::EDISCONNECTED)
       
   902 	{
       
   903 		//the status is disconnected which is correct since the 
       
   904 		//login didnot happen with blank passwd.
       
   905 		return KErrNone;
       
   906 	}
       
   907 	else
       
   908 	{
       
   909 		return KErrGeneral;
       
   910 	
       
   911 	}			
       
   912 }
       
   913 
       
   914 
       
   915 
       
   916 // -----------------------------------------------------------------------------
       
   917 // CTelepathyGabbleTest::LogoutTestL
       
   918 // Test for logout
       
   919 // -----------------------------------------------------------------------------
       
   920 TInt CTelepathyGabbleTest::LogoutTestL( 
       
   921 CStifItemParser& aItem  )
       
   922 {
       
   923 	//Pass the parameters to action_login() from the 
       
   924 	//data mentioned in the cfg file.
       
   925 	
       
   926 	ConnectData  *connect_data = NULL;
       
   927 	
       
   928 	if ( read_data ( connect_data, aItem, iLog ) != RC_OK )
       
   929 	{
       
   930 		free_data ( connect_data, iLog );
       
   931 		return KErrGeneral;
       
   932 	}
       
   933 	
       
   934 
       
   935 	char *username, *passwd , *servername , *resource_login, *ssl_flag, *port;
       
   936 	char *proxy_server = NULL;
       
   937 	char *proxy_port = NULL;
       
   938 		
       
   939 	
       
   940 	username = 	connect_data->username;
       
   941 	passwd   =  connect_data->password;
       
   942 	servername = 	connect_data->server;
       
   943 	resource_login = connect_data->resource;
       
   944 	ssl_flag = connect_data->ssl_flag;
       
   945 	port = connect_data->port;
       
   946 	#ifdef __WINSCW__
       
   947   		proxy_server = connect_data->proxy_data->proxy_server;
       
   948 		proxy_port = connect_data->proxy_data->proxy_port;
       
   949 	#endif
       
   950 		
       
   951 	
       
   952 	iTestData = CTestData::NewL(iLog);
       
   953 	
       
   954 	iLoginObj = CTelepathyGabbleLoginTest::NewL();
       
   955 	
       
   956 	iTestData->SetTestType(CTestData::ELogin);
       
   957 	
       
   958 	//action_login will have parameters 
       
   959 	//passed from cfg file
       
   960 	
       
   961 	TInt login_status = iLoginObj->action_login(username,passwd,servername, resource_login,ssl_flag,
       
   962 																							port,proxy_server, proxy_port,iTestData);
       
   963 	
       
   964 	
       
   965 	if (login_status == CTestData::ECONNECTED)
       
   966 	{
       
   967 		//If the login variable is ECONNECTED
       
   968 		//Do the Logout
       
   969 		login_status = iLoginObj->action_logout(iTestData);
       
   970 		
       
   971 	
       
   972 		if (login_status == CTestData::EDISCONNECTED)
       
   973 		{
       
   974 	
       
   975 			//the logout happened succesfully
       
   976 			free_data ( connect_data, iLog );
       
   977 			return KErrNone;
       
   978 		}
       
   979 		else 
       
   980 		{
       
   981 			//login_status is still connected, there was a problem 
       
   982 			//in logging out.
       
   983 			free_data ( connect_data, iLog );
       
   984 			return KErrGeneral;
       
   985 		}
       
   986 		
       
   987 	}
       
   988 	else
       
   989 	{
       
   990 		//Login itself didnot happen.
       
   991 		free_data ( connect_data, iLog );
       
   992 		return KErrGeneral;
       
   993 	}
       
   994 		
       
   995 }
       
   996 
       
   997 
       
   998 
       
   999 // -----------------------------------------------------------------------------
       
  1000 // CTelepathyGabbleTest::SearchAfterGetSearchKeysL
       
  1001 // -----------------------------------------------------------------------------
       
  1002 
       
  1003 TInt CTelepathyGabbleTest::SearchAfterGetSearchKeysL( CStifItemParser& aItem  )
       
  1004 	{
       
  1005 		TInt return_value = KErrNone;
       
  1006 		//Pass the parameters to action_login() from the 
       
  1007 		//data mentioned in the cfg file.
       
  1008 		
       
  1009 		//step 1: Do the login.
       
  1010 		ConnectData  *connect_data = NULL;
       
  1011 		
       
  1012 		if ( read_data ( connect_data, aItem, iLog ) != RC_OK )
       
  1013 		{
       
  1014 			free_data ( connect_data, iLog );
       
  1015 			return KErrGeneral;
       
  1016 		}
       
  1017 		
       
  1018 
       
  1019 		//for login
       
  1020 		char *username, *passwd , *servername , *resource_login, *ssl_flag, *value, *port;
       
  1021 		char *proxy_server = NULL;
       
  1022 		char *proxy_port = NULL;
       
  1023 		
       
  1024 	
       
  1025 		username = 	connect_data->username;
       
  1026 		passwd   =  connect_data->password;
       
  1027 		servername = 	connect_data->server;
       
  1028 		resource_login = connect_data->resource;
       
  1029 		ssl_flag = connect_data->ssl_flag;
       
  1030 		value = connect_data->msg_data->message;
       
  1031 		port = connect_data->port;
       
  1032 		#ifdef __WINSCW__
       
  1033 	  		proxy_server = connect_data->proxy_data->proxy_server;
       
  1034 			proxy_port = connect_data->proxy_data->proxy_port;
       
  1035 		#endif
       
  1036 		
       
  1037 
       
  1038 		if (iTestData == NULL)
       
  1039 		{
       
  1040 			//Create the iTestData if it is not existing.
       
  1041 			
       
  1042 			iTestData = CTestData::NewL(iLog);
       
  1043 		}
       
  1044 		
       
  1045 		iTestData->SetTestType(CTestData::EGetSearchKeys);
       
  1046 		//Create the login object
       
  1047 		iLoginObj = CTelepathyGabbleLoginTest::NewL();
       
  1048 		
       
  1049 		//action_login will have parameters 
       
  1050 		//passed from cfg file
       
  1051 		
       
  1052 		TInt login_status = 
       
  1053 			iLoginObj->action_login(username,passwd,servername, 
       
  1054 									resource_login,ssl_flag,
       
  1055 									port,proxy_server, proxy_port,
       
  1056 									iTestData );
       
  1057 		
       
  1058 		if (login_status == CTestData::ECONNECTED)
       
  1059 		{
       
  1060 			//login was successful
       
  1061 			//Create the Object of Send Message class
       
  1062 			iSearchObj = CTelepathyGabbleSearch::NewL();
       
  1063 				
       
  1064 			TInt search_state = iSearchObj->GetSearchKeysL( iTestData);
       
  1065 			
       
  1066 			if( search_state == CTestData::ESearchError )
       
  1067 				{
       
  1068 					return_value = KErrGeneral; //Error in finding search keys
       
  1069 				}
       
  1070 			else if( search_state == CTestData::ESearchKeysFound) 
       
  1071 				{
       
  1072 					return_value = KErrNone; 
       
  1073 					
       
  1074 					GHashTable *data_to_search = NULL;				
       
  1075 					data_to_search = g_hash_table_new(g_str_hash,g_str_equal);
       
  1076 					gchar **keys = iTestData->GetSearchKeys();
       
  1077 				
       
  1078 					iTestData->SetTestType(CTestData::ESearch);
       
  1079 					for(TInt i=0; i<8 ; i++ )
       
  1080 						{
       
  1081 							GValue *gvalue = NULL;
       
  1082 							gvalue = g_new0(GValue, 1);	
       
  1083 						
       
  1084 							g_value_init(gvalue, G_TYPE_STRING);
       
  1085 							g_value_set_string (gvalue, g_strdup(value) );
       
  1086 							g_hash_table_insert( data_to_search,keys[i], gvalue);	
       
  1087 							
       
  1088 						}
       
  1089 					
       
  1090 					search_state = iSearchObj->SearchL(data_to_search, iTestData);
       
  1091 			
       
  1092 					if( search_state == CTestData::ESearchError )
       
  1093 						{
       
  1094 							return_value = KErrGeneral; //Error in Searching
       
  1095 						}
       
  1096 					else if( search_state == CTestData::ESearchCompleted) 
       
  1097 						{
       
  1098 							return_value = KErrNone; 
       
  1099 						}
       
  1100 					//Free the hash table itself
       
  1101 					g_hash_table_destroy ( data_to_search );
       
  1102 					
       
  1103 
       
  1104 				}
       
  1105 			iSearchObj->CloseChannel(iTestData);
       
  1106 			//Do the logout
       
  1107 			login_status = iLoginObj->action_logout(iTestData);
       
  1108 
       
  1109 			if (login_status != CTestData::EDISCONNECTED)
       
  1110 				{
       
  1111 					//logout didnot happen successfully
       
  1112 					return_value = KErrGeneral;
       
  1113 				}
       
  1114 			
       
  1115 			//do this later	
       
  1116 		   	/*g_hash_table_foreach_remove ( data_to_search, 
       
  1117 					search_hash_remove, NULL );*/
       
  1118 		
       
  1119 		}
       
  1120 		else
       
  1121 		{
       
  1122 			//Login itself didnot happen.
       
  1123 			return_value =  KErrGeneral;
       
  1124 		}		
       
  1125 		
       
  1126 		free_data ( connect_data, iLog );	
       
  1127 		return return_value;
       
  1128 	}
       
  1129 	
       
  1130 
       
  1131 
       
  1132 // -----------------------------------------------------------------------------
       
  1133 // CTelepathyGabbleTest::SearchWithAllKeysTestL
       
  1134 // -----------------------------------------------------------------------------
       
  1135 
       
  1136 TInt CTelepathyGabbleTest::SearchWithAllKeysTestL( CStifItemParser& aItem  )
       
  1137 	{
       
  1138 		TInt return_value = KErrNone;
       
  1139 		//Pass the parameters to action_login() from the 
       
  1140 		//data mentioned in the cfg file.
       
  1141 		
       
  1142 		//step 1: Do the login.
       
  1143 		ConnectData  *connect_data = NULL;
       
  1144 		
       
  1145 		if ( read_data ( connect_data, aItem, iLog ) != RC_OK )
       
  1146 		{
       
  1147 			free_data ( connect_data, iLog );
       
  1148 			return KErrGeneral;
       
  1149 		}
       
  1150 		
       
  1151 
       
  1152 		//for login
       
  1153 		char *username, *passwd , *servername , *resource_login, *ssl_flag, *value, *port;
       
  1154 		char *proxy_server = NULL;
       
  1155 		char *proxy_port = NULL;
       
  1156 		
       
  1157 	
       
  1158 		username = 	connect_data->username;
       
  1159 		passwd   =  connect_data->password;
       
  1160 		servername = 	connect_data->server;
       
  1161 		resource_login = connect_data->resource;
       
  1162 		ssl_flag = connect_data->ssl_flag;
       
  1163 		value = connect_data->msg_data->message;
       
  1164 		port = connect_data->port;
       
  1165 		#ifdef __WINSCW__
       
  1166 	  		proxy_server = connect_data->proxy_data->proxy_server;
       
  1167 			proxy_port = connect_data->proxy_data->proxy_port;
       
  1168 		#endif
       
  1169 		
       
  1170 
       
  1171 		if (iTestData == NULL)
       
  1172 		{
       
  1173 			//Create the iTestData if it is not existing.
       
  1174 			
       
  1175 			iTestData = CTestData::NewL(iLog);
       
  1176 		}
       
  1177 		iTestData->SetTestType(CTestData::EGetSearchKeys);
       
  1178 		//Create the login object
       
  1179 		iLoginObj = CTelepathyGabbleLoginTest::NewL();
       
  1180 		
       
  1181 		//action_login will have parameters 
       
  1182 		//passed from cfg file
       
  1183 		
       
  1184 		TInt login_status = 
       
  1185 			iLoginObj->action_login(username,passwd,servername, 
       
  1186 									resource_login,ssl_flag,
       
  1187 									port,proxy_server, proxy_port,
       
  1188 									iTestData );
       
  1189 		
       
  1190 		if (login_status == CTestData::ECONNECTED)
       
  1191 		{
       
  1192 			//login was successful
       
  1193 			//Create the Object of Send Message class
       
  1194 			iSearchObj = CTelepathyGabbleSearch::NewL();
       
  1195 				
       
  1196 			TInt search_state = iSearchObj->GetSearchKeysL( iTestData);
       
  1197 			
       
  1198 			if( search_state == CTestData::ESearchError )
       
  1199 				{
       
  1200 					return_value = KErrGeneral; //Error in finding search keys
       
  1201 				}
       
  1202 			else if( search_state == CTestData::ESearchKeysFound) 
       
  1203 				{
       
  1204 					return_value = KErrNone; 
       
  1205 					
       
  1206 					iTestData->SetTestType(CTestData::ESearch);
       
  1207 					GHashTable *data_to_search = NULL;				
       
  1208 					TInt i = 0;			
       
  1209 					data_to_search = g_hash_table_new(g_str_hash,g_str_equal);
       
  1210 					gchar **keys = iTestData->GetSearchKeys();
       
  1211 					
       
  1212 					for( i=0; i<7 ; i++ )
       
  1213 						{
       
  1214 							GValue *gvalue = NULL;
       
  1215 							gvalue = g_new0(GValue, 1);	
       
  1216 						
       
  1217 							g_value_init(gvalue, G_TYPE_STRING);
       
  1218 							g_value_set_string (gvalue, g_strdup(value) );
       
  1219 							g_hash_table_insert( data_to_search, keys[i], gvalue);	
       
  1220 							
       
  1221 						}
       
  1222 						
       
  1223 					GValue *gvalue1 = NULL;
       
  1224 					gvalue1 = g_new0(GValue, 1);	
       
  1225 				
       
  1226 					g_value_init(gvalue1, G_TYPE_STRING);
       
  1227 					g_value_set_string (gvalue1, g_strdup("5") );
       
  1228 					g_hash_table_insert( data_to_search,keys[i], gvalue1);						
       
  1229 					
       
  1230 					search_state = iSearchObj->SearchL(data_to_search, iTestData);
       
  1231 			
       
  1232 					if( search_state == CTestData::ESearchError )
       
  1233 						{
       
  1234 							return_value = KErrGeneral; //Error in Searching
       
  1235 						}
       
  1236 					else if( search_state == CTestData::ESearchCompleted) 
       
  1237 						{
       
  1238 							return_value = KErrNone; 
       
  1239 						}
       
  1240 					//Free the hash table itself
       
  1241 					g_hash_table_destroy ( data_to_search );
       
  1242 					g_free(keys);
       
  1243 
       
  1244 				}
       
  1245 			iSearchObj->CloseChannel(iTestData);
       
  1246 			//Do the logout
       
  1247 			login_status = iLoginObj->action_logout(iTestData);
       
  1248 
       
  1249 			if (login_status != CTestData::EDISCONNECTED)
       
  1250 				{
       
  1251 					//logout didnot happen successfully
       
  1252 					return_value = KErrGeneral;
       
  1253 				}
       
  1254 			
       
  1255 			//do this later	
       
  1256 		   	/*g_hash_table_foreach_remove ( data_to_search, 
       
  1257 					search_hash_remove, NULL );*/
       
  1258 		
       
  1259 		}
       
  1260 		else
       
  1261 		{
       
  1262 			//Login itself didnot happen.
       
  1263 			return_value =  KErrGeneral;
       
  1264 		}		
       
  1265 		
       
  1266 		free_data ( connect_data, iLog );	
       
  1267 		return return_value;
       
  1268 	}
       
  1269 	
       
  1270 
       
  1271 
       
  1272 // -----------------------------------------------------------------------------
       
  1273 // CTelepathyGabbleTest::SearchBlankStringTestL
       
  1274 // -----------------------------------------------------------------------------
       
  1275 
       
  1276 TInt CTelepathyGabbleTest::SearchBlankStringTestL( 
       
  1277     CStifItemParser& aItem  )
       
  1278 	{
       
  1279 		TInt return_value = KErrNone;
       
  1280 		//Pass the parameters to action_login() from the 
       
  1281 		//data mentioned in the cfg file.
       
  1282 		
       
  1283 		//step 1: Do the login.
       
  1284 		ConnectData  *connect_data = NULL;
       
  1285 		
       
  1286 		if ( read_data ( connect_data, aItem, iLog ) != RC_OK )
       
  1287 		{
       
  1288 			free_data ( connect_data, iLog );
       
  1289 			return KErrGeneral;
       
  1290 		}
       
  1291 		
       
  1292 
       
  1293 		//for login
       
  1294 		char *username, *passwd , *servername , *resource_login, *ssl_flag, *port;
       
  1295 		char *proxy_server = NULL;
       
  1296 		char *proxy_port = NULL;
       
  1297 		
       
  1298 	
       
  1299 		username = 	connect_data->username;
       
  1300 		passwd   =  connect_data->password;
       
  1301 		servername = 	connect_data->server;
       
  1302 		resource_login = connect_data->resource;
       
  1303 		ssl_flag = connect_data->ssl_flag;
       
  1304 		port = connect_data->port;
       
  1305 		#ifdef __WINSCW__
       
  1306 	  		proxy_server = connect_data->proxy_data->proxy_server;
       
  1307 			proxy_port = connect_data->proxy_data->proxy_port;
       
  1308 		#endif
       
  1309 		
       
  1310 
       
  1311 		if (iTestData == NULL)
       
  1312 		{
       
  1313 			//Create the iTestData if it is not existing.
       
  1314 			
       
  1315 			iTestData = CTestData::NewL(iLog);
       
  1316 		}
       
  1317 		//Create the login object
       
  1318 		iLoginObj = CTelepathyGabbleLoginTest::NewL();
       
  1319 		
       
  1320 		iTestData->SetTestType(CTestData::ESearch);
       
  1321 		//action_login will have parameters 
       
  1322 		//passed from cfg file
       
  1323 		
       
  1324 		TInt login_status = 
       
  1325 			iLoginObj->action_login(username,passwd,servername, 
       
  1326 									resource_login,ssl_flag,
       
  1327 									port,proxy_server, proxy_port,
       
  1328 									iTestData );
       
  1329 		
       
  1330 		if (login_status == CTestData::ECONNECTED)
       
  1331 		{
       
  1332 			//login was successful
       
  1333 			
       
  1334 			GHashTable *data_to_search = NULL;
       
  1335 			
       
  1336 			GValue *gvalue = NULL;
       
  1337 		
       
  1338 			char *key, *value;
       
  1339 			
       
  1340 			key = connect_data->msg_data->recipient;
       
  1341 			//value = connect_data->msg_data->message;
       
  1342 			//search for blank string
       
  1343 			value = "";
       
  1344 			
       
  1345 			data_to_search = g_hash_table_new(g_str_hash,g_str_equal);	
       
  1346 			
       
  1347 			gvalue = g_new0(GValue, 1);	
       
  1348 		
       
  1349 					 
       
  1350 			g_value_init(gvalue, G_TYPE_STRING);
       
  1351 			g_value_set_string (gvalue, value );
       
  1352 			g_hash_table_insert( data_to_search, key, gvalue);			      
       
  1353 			
       
  1354 		
       
  1355 
       
  1356 			//Create the Object of Send Message class
       
  1357 			iSearchObj = CTelepathyGabbleSearch::NewL();	
       
  1358 			
       
  1359 			//call the SendMessage test case	
       
  1360 			TInt search_state = iSearchObj->SearchL(data_to_search, iTestData);
       
  1361 			
       
  1362 			if( search_state == CTestData::ESearchError )
       
  1363 				{
       
  1364 					return_value = KErrGeneral; //Error in Searching
       
  1365 				}
       
  1366 			else if( search_state == CTestData::ESearchCompleted) 
       
  1367 				{
       
  1368 					return_value = KErrNone; 
       
  1369 				}
       
  1370 			iSearchObj->CloseChannel(iTestData);
       
  1371 			//Do the logout
       
  1372 			login_status = iLoginObj->action_logout(iTestData);
       
  1373 
       
  1374 			if (login_status != CTestData::EDISCONNECTED)
       
  1375 				{
       
  1376 					//logout didnot happen successfully
       
  1377 					return_value = KErrGeneral;
       
  1378 				}
       
  1379 			
       
  1380 			//do this later	
       
  1381 		   	/*g_hash_table_foreach_remove ( data_to_search, 
       
  1382 					search_hash_remove, NULL );*/
       
  1383 		
       
  1384 			//Free the hash table itself
       
  1385 			g_hash_table_destroy ( data_to_search );
       
  1386 		
       
  1387 		}
       
  1388 		else
       
  1389 		{
       
  1390 			//Login itself didnot happen.
       
  1391 			return_value =  KErrGeneral;
       
  1392 		}		
       
  1393 		
       
  1394 		free_data ( connect_data, iLog );	
       
  1395 		return return_value;
       
  1396 	}
       
  1397 	
       
  1398 
       
  1399 
       
  1400 // -----------------------------------------------------------------------------
       
  1401 // CTelepathyGabbleTest::SearchTestL
       
  1402 // -----------------------------------------------------------------------------
       
  1403 
       
  1404 TInt CTelepathyGabbleTest::SearchTestL( 
       
  1405     CStifItemParser& aItem  )
       
  1406 	{
       
  1407 		TInt return_value = KErrNone;
       
  1408 		//Pass the parameters to action_login() from the 
       
  1409 		//data mentioned in the cfg file.
       
  1410 		
       
  1411 		//step 1: Do the login.
       
  1412 		ConnectData  *connect_data = NULL;
       
  1413 		
       
  1414 		if ( read_data ( connect_data, aItem, iLog ) != RC_OK )
       
  1415 		{
       
  1416 			free_data ( connect_data, iLog );
       
  1417 			return KErrGeneral;
       
  1418 		}
       
  1419 		
       
  1420 
       
  1421 		//for login
       
  1422 		char *username, *passwd , *servername , *resource_login, *ssl_flag, *port;
       
  1423 		char *proxy_server = NULL;
       
  1424 		char *proxy_port = NULL;
       
  1425 		
       
  1426 	
       
  1427 		username = 	connect_data->username;
       
  1428 		passwd   =  connect_data->password;
       
  1429 		servername = 	connect_data->server;
       
  1430 		resource_login = connect_data->resource;
       
  1431 		ssl_flag = connect_data->ssl_flag;
       
  1432 		port = connect_data->port;
       
  1433 		#ifdef __WINSCW__
       
  1434 	  		proxy_server = connect_data->proxy_data->proxy_server;
       
  1435 			proxy_port = connect_data->proxy_data->proxy_port;
       
  1436 		#endif
       
  1437 		
       
  1438 
       
  1439 		if (iTestData == NULL)
       
  1440 		{
       
  1441 			//Create the iTestData if it is not existing.
       
  1442 			
       
  1443 			iTestData = CTestData::NewL(iLog);
       
  1444 		}
       
  1445 		iTestData->SetTestType(CTestData::ESearch);
       
  1446 		//Create the login object
       
  1447 		iLoginObj = CTelepathyGabbleLoginTest::NewL();
       
  1448 		
       
  1449 		//action_login will have parameters 
       
  1450 		//passed from cfg file
       
  1451 		
       
  1452 		TInt login_status = 
       
  1453 			iLoginObj->action_login(username,passwd,servername, 
       
  1454 									resource_login,ssl_flag,
       
  1455 									port,proxy_server, proxy_port,
       
  1456 									iTestData );
       
  1457 		
       
  1458 		if (login_status == CTestData::ECONNECTED)
       
  1459 		{
       
  1460 			//login was successful
       
  1461 			
       
  1462 			GHashTable *data_to_search = NULL;
       
  1463 			
       
  1464 			GValue *gvalue = NULL;
       
  1465 		
       
  1466 			char *key, *value;
       
  1467 			
       
  1468 			key = connect_data->msg_data->recipient;
       
  1469 			value = connect_data->msg_data->message;
       
  1470 			
       
  1471 			data_to_search = g_hash_table_new(g_str_hash,g_str_equal);	
       
  1472 			
       
  1473 			gvalue = g_new0(GValue, 1);	
       
  1474 		
       
  1475 					 
       
  1476 			g_value_init(gvalue, G_TYPE_STRING);
       
  1477 			g_value_set_string (gvalue, value );
       
  1478 			g_hash_table_insert( data_to_search, GetSearchLabelL(servername,key), gvalue);			      
       
  1479 			
       
  1480 		
       
  1481 
       
  1482 			//Create the Object of Send Message class
       
  1483 			iSearchObj = CTelepathyGabbleSearch::NewL();	
       
  1484 			
       
  1485 			//call the SendMessage test case	
       
  1486 			TInt search_state = iSearchObj->SearchL(data_to_search, iTestData);
       
  1487 			
       
  1488 			if( search_state == CTestData::ESearchError )
       
  1489 				{
       
  1490 					return_value = KErrGeneral; //Error in Searching
       
  1491 				}
       
  1492 			else if( search_state == CTestData::ESearchCompleted) 
       
  1493 				{
       
  1494 					return_value = KErrNone; 
       
  1495 				}
       
  1496 			
       
  1497 			iSearchObj->CloseChannel(iTestData);
       
  1498 			//Do the logout
       
  1499 			login_status = iLoginObj->action_logout(iTestData);
       
  1500 
       
  1501 			if (login_status != CTestData::EDISCONNECTED)
       
  1502 				{
       
  1503 					//logout didnot happen successfully
       
  1504 					return_value = KErrGeneral;
       
  1505 				}
       
  1506 			
       
  1507 			//do this later	
       
  1508 		   	/*g_hash_table_foreach_remove ( data_to_search, 
       
  1509 					search_hash_remove, NULL );*/
       
  1510 		
       
  1511 			//Free the hash table itself
       
  1512 			g_hash_table_destroy ( data_to_search );
       
  1513 		
       
  1514 		}
       
  1515 		else
       
  1516 		{
       
  1517 			//Login itself didnot happen.
       
  1518 			return_value =  KErrGeneral;
       
  1519 		}		
       
  1520 		
       
  1521 		free_data ( connect_data, iLog );	
       
  1522 		return return_value;
       
  1523 	}
       
  1524 	
       
  1525 
       
  1526 
       
  1527 
       
  1528 // -----------------------------------------------------------------------------
       
  1529 // CTelepathyGabbleTest::SearchTwoInvalidKeysTestL
       
  1530 // -----------------------------------------------------------------------------
       
  1531 
       
  1532 TInt CTelepathyGabbleTest::SearchTwoInvalidKeysTestL( 
       
  1533     CStifItemParser& aItem  )
       
  1534 	{
       
  1535 		TInt return_value = KErrNone;
       
  1536 		//Pass the parameters to action_login() from the 
       
  1537 		//data mentioned in the cfg file.
       
  1538 		
       
  1539 		//step 1: Do the login.
       
  1540 		ConnectData  *connect_data = NULL;
       
  1541 		
       
  1542 		if ( read_data ( connect_data, aItem, iLog ) != RC_OK )
       
  1543 		{
       
  1544 			free_data ( connect_data, iLog );
       
  1545 			return KErrGeneral;
       
  1546 		}
       
  1547 		
       
  1548 
       
  1549 		//for login
       
  1550 		char *username, *passwd , *servername , *resource_login, *ssl_flag, *port;
       
  1551 		char *proxy_server = NULL;
       
  1552 		char *proxy_port = NULL;
       
  1553 		
       
  1554 	
       
  1555 		username = 	connect_data->username;
       
  1556 		passwd   =  connect_data->password;
       
  1557 		servername = 	connect_data->server;
       
  1558 		resource_login = connect_data->resource;
       
  1559 		ssl_flag = connect_data->ssl_flag;
       
  1560 		port = connect_data->port;
       
  1561 		#ifdef __WINSCW__
       
  1562 	  		proxy_server = connect_data->proxy_data->proxy_server;
       
  1563 			proxy_port = connect_data->proxy_data->proxy_port;
       
  1564 		#endif
       
  1565 		
       
  1566 
       
  1567 		if (iTestData == NULL)
       
  1568 		{
       
  1569 			//Create the iTestData if it is not existing.
       
  1570 			
       
  1571 			iTestData = CTestData::NewL(iLog);
       
  1572 		}
       
  1573 		iTestData->SetTestType(CTestData::ESearch);
       
  1574 		//Create the login object
       
  1575 		iLoginObj = CTelepathyGabbleLoginTest::NewL();
       
  1576 		
       
  1577 		//action_login will have parameters 
       
  1578 		//passed from cfg file
       
  1579 		
       
  1580 		TInt login_status = 
       
  1581 			iLoginObj->action_login(username,passwd,servername, 
       
  1582 									resource_login,ssl_flag,
       
  1583 									port,proxy_server, proxy_port,
       
  1584 									iTestData );
       
  1585 		
       
  1586 		if (login_status == CTestData::ECONNECTED)
       
  1587 		{
       
  1588 			//login was successful
       
  1589 			
       
  1590 			GHashTable *data_to_search = NULL;
       
  1591 			
       
  1592 			GValue *gvalue1, *gvalue2 ;
       
  1593 		
       
  1594 			char *key1,*key2, *value1, *value2;
       
  1595 			
       
  1596 			key1 = connect_data->msg_data->recipient;
       
  1597 			value1 = connect_data->msg_data->message;
       
  1598 			
       
  1599 			key2 = connect_data->search_data->key;
       
  1600 			value2 = connect_data->search_data->value;
       
  1601 			
       
  1602 			data_to_search = g_hash_table_new(g_str_hash,g_str_equal);	
       
  1603 			
       
  1604 			gvalue1 = g_new0(GValue, 1);	
       
  1605 			
       
  1606 					 
       
  1607 			g_value_init(gvalue1, G_TYPE_STRING);
       
  1608 			g_value_set_string (gvalue1, value1 );
       
  1609 			g_hash_table_insert( data_to_search, GetSearchLabelL(servername,key1), gvalue1);
       
  1610 			
       
  1611 			gvalue2 = g_new0(GValue, 1);	
       
  1612 			
       
  1613 					 
       
  1614 			g_value_init(gvalue2, G_TYPE_STRING);
       
  1615 			g_value_set_string (gvalue2, value2 );
       
  1616 			g_hash_table_insert( data_to_search, GetSearchLabelL(servername,key2), gvalue2);		
       
  1617 			
       
  1618 			
       
  1619 		
       
  1620 
       
  1621 			//Create the Object of Send Message class
       
  1622 			iSearchObj = CTelepathyGabbleSearch::NewL();	
       
  1623 			
       
  1624 			//call the SendMessage test case	
       
  1625 			TInt search_state = iSearchObj->SearchL(data_to_search, iTestData);
       
  1626 			
       
  1627 			if( search_state == CTestData::ESearchError )
       
  1628 				{
       
  1629 				    //Error in Searching,
       
  1630 				    //as one of the search key passed is wrong
       
  1631 					return_value = KErrNone; 
       
  1632 				}
       
  1633 			else
       
  1634 				{
       
  1635 					return_value = KErrGeneral; 	
       
  1636 				}
       
  1637 			
       
  1638 			iSearchObj->CloseChannel(iTestData);		
       
  1639 			//Do the logout
       
  1640 			login_status = iLoginObj->action_logout(iTestData);
       
  1641 
       
  1642 			if (login_status != CTestData::EDISCONNECTED)
       
  1643 				{
       
  1644 					//logout didnot happen successfully
       
  1645 					return_value = KErrGeneral;
       
  1646 				}
       
  1647 			
       
  1648 			//do this later	
       
  1649 		   	/*g_hash_table_foreach_remove ( data_to_search, 
       
  1650 					search_hash_remove, NULL );*/
       
  1651 		
       
  1652 			//Free the hash table itself
       
  1653 			g_hash_table_destroy ( data_to_search );
       
  1654 		
       
  1655 		}
       
  1656 		else
       
  1657 		{
       
  1658 			//Login itself didnot happen.
       
  1659 			return_value =  KErrGeneral;
       
  1660 		}		
       
  1661 		
       
  1662 		free_data ( connect_data, iLog );	
       
  1663 		return return_value;
       
  1664 	}
       
  1665 	
       
  1666 
       
  1667 
       
  1668 // -----------------------------------------------------------------------------
       
  1669 // CTelepathyGabbleTest::SearchTwiceWithDiffStringsTestL
       
  1670 // -----------------------------------------------------------------------------
       
  1671 
       
  1672 TInt CTelepathyGabbleTest::SearchTwiceWithDiffStringsTestL( 
       
  1673     CStifItemParser& aItem  )
       
  1674 	{
       
  1675 		TInt return_value = KErrNone;
       
  1676 		//Pass the parameters to action_login() from the 
       
  1677 		//data mentioned in the cfg file.
       
  1678 		
       
  1679 		//step 1: Do the login.
       
  1680 		ConnectData  *connect_data = NULL;
       
  1681 		
       
  1682 		if ( read_data ( connect_data, aItem, iLog ) != RC_OK )
       
  1683 		{
       
  1684 			free_data ( connect_data, iLog );
       
  1685 			return KErrGeneral;
       
  1686 		}
       
  1687 		
       
  1688 
       
  1689 		//for login
       
  1690 		char *username, *passwd , *servername , *resource_login, *ssl_flag, *port;
       
  1691 		char *proxy_server = NULL;
       
  1692 		char *proxy_port = NULL;
       
  1693 		
       
  1694 	
       
  1695 		username = 	connect_data->username;
       
  1696 		passwd   =  connect_data->password;
       
  1697 		servername = 	connect_data->server;
       
  1698 		resource_login = connect_data->resource;
       
  1699 		ssl_flag = connect_data->ssl_flag;
       
  1700 		port = connect_data->port;
       
  1701 		#ifdef __WINSCW__
       
  1702 	  		proxy_server = connect_data->proxy_data->proxy_server;
       
  1703 			proxy_port = connect_data->proxy_data->proxy_port;
       
  1704 		#endif
       
  1705 		
       
  1706 
       
  1707 		if (iTestData == NULL)
       
  1708 		{
       
  1709 			//Create the iTestData if it is not existing.
       
  1710 			
       
  1711 			iTestData = CTestData::NewL(iLog);
       
  1712 		}
       
  1713 		iTestData->SetTestType(CTestData::ESearch);
       
  1714 		//Create the login object
       
  1715 		iLoginObj = CTelepathyGabbleLoginTest::NewL();
       
  1716 		
       
  1717 		//action_login will have parameters 
       
  1718 		//passed from cfg file
       
  1719 		
       
  1720 		TInt login_status = 
       
  1721 			iLoginObj->action_login(username,passwd,servername, 
       
  1722 									resource_login,ssl_flag,
       
  1723 									port,proxy_server, proxy_port,
       
  1724 									iTestData );
       
  1725 		
       
  1726 		if (login_status == CTestData::ECONNECTED)
       
  1727 		{
       
  1728 			//login was successful
       
  1729 			
       
  1730 			GHashTable *data_to_search_first = NULL;
       
  1731 			GHashTable *data_to_search_second = NULL;	
       
  1732 			
       
  1733 			GValue *gvalue1, *gvalue2 ;
       
  1734 		
       
  1735 			char *key1,*value1, *key2, *value2;
       
  1736 		
       
  1737 			key1 = connect_data->msg_data->recipient;
       
  1738 			value1 = connect_data->msg_data->message;
       
  1739 			
       
  1740 			key2 = connect_data->search_data->key;
       
  1741 			value2 = connect_data->search_data->value;
       
  1742 			
       
  1743 			data_to_search_first = g_hash_table_new(g_str_hash,g_str_equal);	
       
  1744 			
       
  1745 			data_to_search_second = g_hash_table_new(g_str_hash,g_str_equal);
       
  1746 			
       
  1747 			gvalue1 = g_new0(GValue, 1);	
       
  1748 			g_value_init(gvalue1, G_TYPE_STRING);
       
  1749 			g_value_set_string (gvalue1, value1 );
       
  1750 			g_hash_table_insert( data_to_search_first, GetSearchLabelL(servername,key1), gvalue1);
       
  1751 			
       
  1752 			gvalue2 = g_new0(GValue, 1);
       
  1753 			g_value_init(gvalue2, G_TYPE_STRING);
       
  1754 			g_value_set_string (gvalue2, value2 );
       
  1755 			g_hash_table_insert( data_to_search_second, GetSearchLabelL(servername,key2), gvalue2);		
       
  1756 			
       
  1757 			
       
  1758 		
       
  1759 
       
  1760 			//Create the Object of Send Message class
       
  1761 			iSearchObj = CTelepathyGabbleSearch::NewL();	
       
  1762 			
       
  1763 			//call the SendMessage test case	
       
  1764 			TInt search_state = iSearchObj->SearchL(data_to_search_first, iTestData);
       
  1765 			
       
  1766 			if( search_state == CTestData::ESearchError)
       
  1767 				{
       
  1768 				   return_value = KErrGeneral; 
       
  1769 				}
       
  1770 			else
       
  1771 				{
       
  1772 					search_state = iSearchObj->SearchL(data_to_search_second, iTestData);
       
  1773 					if( search_state == CTestData::ESearchError )
       
  1774 						{
       
  1775 						return_value = KErrGeneral; //Error in Searching	
       
  1776 						}
       
  1777 					
       
  1778 				}
       
  1779 			
       
  1780 			iSearchObj->CloseChannel(iTestData);		
       
  1781 			//Do the logout
       
  1782 			login_status = iLoginObj->action_logout(iTestData);
       
  1783 
       
  1784 			if (login_status != CTestData::EDISCONNECTED)
       
  1785 				{
       
  1786 					//logout didnot happen successfully
       
  1787 					return_value = KErrGeneral;
       
  1788 				}
       
  1789 			
       
  1790 			//do this later	
       
  1791 		   	/*g_hash_table_foreach_remove ( data_to_search, 
       
  1792 					search_hash_remove, NULL );*/
       
  1793 		
       
  1794 			//Free the hash table itself
       
  1795 			g_hash_table_destroy ( data_to_search_first );
       
  1796 			g_hash_table_destroy ( data_to_search_second );	
       
  1797 		
       
  1798 		}
       
  1799 		else
       
  1800 		{
       
  1801 			//Login itself didnot happen.
       
  1802 			return_value =  KErrGeneral;
       
  1803 		}		
       
  1804 		
       
  1805 		free_data ( connect_data, iLog );	
       
  1806 		return return_value;
       
  1807 	}
       
  1808 	
       
  1809 
       
  1810 
       
  1811 
       
  1812 
       
  1813 // -----------------------------------------------------------------------------
       
  1814 // CTelepathyGabbleTest::SearchNoKeyValueTestL
       
  1815 // -----------------------------------------------------------------------------
       
  1816 
       
  1817 TInt CTelepathyGabbleTest::SearchNoKeyValueTestL( 
       
  1818     CStifItemParser& aItem  )
       
  1819 	{
       
  1820 		TInt return_value = KErrNone;
       
  1821 		//Pass the parameters to action_login() from the 
       
  1822 		//data mentioned in the cfg file.
       
  1823 		
       
  1824 		//step 1: Do the login.
       
  1825 		ConnectData  *connect_data = NULL;
       
  1826 		
       
  1827 		if ( read_data ( connect_data, aItem, iLog ) != RC_OK )
       
  1828 		{
       
  1829 			free_data ( connect_data, iLog );
       
  1830 			return KErrGeneral;
       
  1831 		}
       
  1832 		
       
  1833 
       
  1834 		//for login
       
  1835 		char *username, *passwd , *servername , *resource_login, *ssl_flag, *port;
       
  1836 		char *proxy_server = NULL;
       
  1837 		char *proxy_port = NULL;
       
  1838 		
       
  1839 	
       
  1840 		username = 	connect_data->username;
       
  1841 		passwd   =  connect_data->password;
       
  1842 		servername = 	connect_data->server;
       
  1843 		resource_login = connect_data->resource;
       
  1844 		ssl_flag = connect_data->ssl_flag;
       
  1845 		port = connect_data->port;
       
  1846 		#ifdef __WINSCW__
       
  1847 	  		proxy_server = connect_data->proxy_data->proxy_server;
       
  1848 			proxy_port = connect_data->proxy_data->proxy_port;
       
  1849 		#endif
       
  1850 		
       
  1851 
       
  1852 		if (iTestData == NULL)
       
  1853 		{
       
  1854 			//Create the iTestData if it is not existing.
       
  1855 			
       
  1856 			iTestData = CTestData::NewL(iLog);
       
  1857 		}
       
  1858 		iTestData->SetTestType(CTestData::ESearch);
       
  1859 		//Create the login object
       
  1860 		iLoginObj = CTelepathyGabbleLoginTest::NewL();
       
  1861 		
       
  1862 		//action_login will have parameters 
       
  1863 		//passed from cfg file
       
  1864 		
       
  1865 		TInt login_status = 
       
  1866 			iLoginObj->action_login(username,passwd,servername, 
       
  1867 									resource_login,ssl_flag,
       
  1868 									port,proxy_server, proxy_port,
       
  1869 									iTestData );
       
  1870 		
       
  1871 		if (login_status == CTestData::ECONNECTED)
       
  1872 		{
       
  1873 			//login was successful
       
  1874 			
       
  1875 			GHashTable *data_to_search = NULL;
       
  1876 			
       
  1877 			data_to_search = g_hash_table_new(g_str_hash,g_str_equal);	
       
  1878 		
       
  1879 			//Create the Object of Send Message class
       
  1880 			iSearchObj = CTelepathyGabbleSearch::NewL();	
       
  1881 			
       
  1882 			//call the SendMessage test case	
       
  1883 			TInt search_state = iSearchObj->SearchL(data_to_search, iTestData);
       
  1884 			
       
  1885 			if( search_state == CTestData::ESearchError )
       
  1886 				{
       
  1887 				    //Error in Searching,
       
  1888 				    //as one of the search key passed is wrong
       
  1889 					return_value = KErrNone; 
       
  1890 				}
       
  1891 			else
       
  1892 				{
       
  1893 					return_value = KErrGeneral; 	
       
  1894 				}
       
  1895 			iSearchObj->CloseChannel(iTestData);		
       
  1896 			//Do the logout
       
  1897 			login_status = iLoginObj->action_logout(iTestData);
       
  1898 
       
  1899 			if (login_status != CTestData::EDISCONNECTED)
       
  1900 				{
       
  1901 					//logout didnot happen successfully
       
  1902 					return_value = KErrGeneral;
       
  1903 				}
       
  1904 			
       
  1905 			//do this later	
       
  1906 		   	/*g_hash_table_foreach_remove ( data_to_search, 
       
  1907 					search_hash_remove, NULL );*/
       
  1908 		
       
  1909 			//Free the hash table itself
       
  1910 			g_hash_table_destroy ( data_to_search );
       
  1911 		
       
  1912 		}
       
  1913 		else
       
  1914 		{
       
  1915 			//Login itself didnot happen.
       
  1916 			return_value =  KErrGeneral;
       
  1917 		}		
       
  1918 		
       
  1919 		free_data ( connect_data, iLog );	
       
  1920 		return return_value;
       
  1921 	}
       
  1922 
       
  1923 // -----------------------------------------------------------------------------
       
  1924 // CTelepathyGabbleTest::SearchInvalidKeyTest
       
  1925 // -----------------------------------------------------------------------------
       
  1926 
       
  1927 TInt CTelepathyGabbleTest::SearchInvalidKeyTestL( 
       
  1928     CStifItemParser& aItem  )
       
  1929 	{
       
  1930 		TInt return_value = KErrNone;
       
  1931 		//Pass the parameters to action_login() from the 
       
  1932 		//data mentioned in the cfg file.
       
  1933 		
       
  1934 		//step 1: Do the login.
       
  1935 		ConnectData  *connect_data = NULL;
       
  1936 		
       
  1937 		if ( read_data ( connect_data, aItem, iLog ) != RC_OK )
       
  1938 		{
       
  1939 			free_data ( connect_data, iLog );
       
  1940 			return KErrGeneral;
       
  1941 		}
       
  1942 		
       
  1943 
       
  1944 		//for login
       
  1945 		char *username, *passwd , *servername , *resource_login, *ssl_flag, *port;
       
  1946 		char *proxy_server = NULL;
       
  1947 		char *proxy_port = NULL;
       
  1948 		
       
  1949 	
       
  1950 		username = 	connect_data->username;
       
  1951 		passwd   =  connect_data->password;
       
  1952 		servername = 	connect_data->server;
       
  1953 		resource_login = connect_data->resource;
       
  1954 		ssl_flag = connect_data->ssl_flag;
       
  1955 		port = connect_data->port;
       
  1956 		#ifdef __WINSCW__
       
  1957 	  		proxy_server = connect_data->proxy_data->proxy_server;
       
  1958 			proxy_port = connect_data->proxy_data->proxy_port;
       
  1959 		#endif
       
  1960 		
       
  1961 
       
  1962 		if (iTestData == NULL)
       
  1963 		{
       
  1964 			//Create the iTestData if it is not existing.
       
  1965 			
       
  1966 			iTestData = CTestData::NewL(iLog);
       
  1967 		}
       
  1968 		iTestData->SetTestType(CTestData::ESearch);
       
  1969 		//Create the login object
       
  1970 		iLoginObj = CTelepathyGabbleLoginTest::NewL();
       
  1971 		
       
  1972 		//action_login will have parameters 
       
  1973 		//passed from cfg file
       
  1974 		
       
  1975 		TInt login_status = 
       
  1976 			iLoginObj->action_login(username,passwd,servername, 
       
  1977 									resource_login,ssl_flag,
       
  1978 									port,proxy_server, proxy_port,
       
  1979 									iTestData );
       
  1980 		
       
  1981 		if (login_status == CTestData::ECONNECTED)
       
  1982 		{
       
  1983 			//login was successful
       
  1984 			
       
  1985 			GHashTable *data_to_search = NULL;
       
  1986 			
       
  1987 			GValue *gvalue = NULL;
       
  1988 		
       
  1989 			char *key, *value;
       
  1990 			
       
  1991 			key = connect_data->msg_data->recipient;
       
  1992 			value = connect_data->msg_data->message;
       
  1993 			
       
  1994 			data_to_search = g_hash_table_new(g_str_hash,g_str_equal);	
       
  1995 			
       
  1996 			gvalue = g_new0(GValue, 1);	
       
  1997 		
       
  1998 					 
       
  1999 			g_value_init(gvalue, G_TYPE_STRING);
       
  2000 			g_value_set_string (gvalue, value );
       
  2001 			//ivalid search key..label has to be passed so no need to pass label 
       
  2002 			g_hash_table_insert( data_to_search, key, gvalue);	
       
  2003 		
       
  2004 
       
  2005 			//Create the Object of Send Message class
       
  2006 			iSearchObj = CTelepathyGabbleSearch::NewL();	
       
  2007 			
       
  2008 			//call the SendMessage test case	
       
  2009 			TInt search_state = iSearchObj->SearchL(data_to_search, iTestData);
       
  2010 			
       
  2011 			if( search_state == CTestData::ESearchError )
       
  2012 				{
       
  2013 				    //Error in Searching,
       
  2014 				    //as one of the search key passed is wrong
       
  2015 					return_value = KErrNone; 
       
  2016 				}
       
  2017 			else
       
  2018 				{
       
  2019 					return_value = KErrGeneral; 	
       
  2020 				}
       
  2021 			iSearchObj->CloseChannel(iTestData);		
       
  2022 			//Do the logout
       
  2023 			login_status = iLoginObj->action_logout(iTestData);
       
  2024 
       
  2025 			if (login_status != CTestData::EDISCONNECTED)
       
  2026 				{
       
  2027 					//logout didnot happen successfully
       
  2028 					return_value = KErrGeneral;
       
  2029 				}
       
  2030 			
       
  2031 			//do this later	
       
  2032 		   	/*g_hash_table_foreach_remove ( data_to_search, 
       
  2033 					search_hash_remove, NULL );*/
       
  2034 		
       
  2035 			//Free the hash table itself
       
  2036 			g_hash_table_destroy ( data_to_search );
       
  2037 		
       
  2038 		}
       
  2039 		else
       
  2040 		{
       
  2041 			//Login itself didnot happen.
       
  2042 			return_value =  KErrGeneral;
       
  2043 		}		
       
  2044 		
       
  2045 		free_data (connect_data, iLog );	
       
  2046 		return return_value;
       
  2047 	}
       
  2048 	
       
  2049 // -----------------------------------------------------------------------------
       
  2050 // CTelepathyGabbleTest::GetSearchKeysTestL
       
  2051 // -----------------------------------------------------------------------------
       
  2052 
       
  2053 TInt CTelepathyGabbleTest::GetSearchKeysTestL( 
       
  2054     CStifItemParser& aItem  )
       
  2055 	{
       
  2056 		TInt return_value = KErrNone;
       
  2057 		//Pass the parameters to action_login() from the 
       
  2058 		//data mentioned in the cfg file.
       
  2059 		
       
  2060 		//step 1: Do the login.
       
  2061 		ConnectData  *connect_data = NULL;
       
  2062 		
       
  2063 		if ( read_data ( connect_data, aItem, iLog ) != RC_OK )
       
  2064 		{
       
  2065 			free_data (connect_data, iLog );
       
  2066 			return KErrGeneral;
       
  2067 		}
       
  2068 		
       
  2069 
       
  2070 		//for login
       
  2071 		char *username, *passwd , *servername , *resource_login, *ssl_flag, *port;
       
  2072 		char *proxy_server = NULL;
       
  2073 		char *proxy_port = NULL;
       
  2074 		
       
  2075 	
       
  2076 		username = 	connect_data->username;
       
  2077 		passwd   =  connect_data->password;
       
  2078 		servername = 	connect_data->server;
       
  2079 		resource_login = connect_data->resource;
       
  2080 		ssl_flag = connect_data->ssl_flag;
       
  2081 		port = connect_data->port;
       
  2082 		#ifdef __WINSCW__
       
  2083 	  		proxy_server = connect_data->proxy_data->proxy_server;
       
  2084 			proxy_port = connect_data->proxy_data->proxy_port;
       
  2085 		#endif
       
  2086 		
       
  2087 
       
  2088 		if (iTestData == NULL)
       
  2089 			{
       
  2090 			//Create the iTestData if it is not existing.
       
  2091 			
       
  2092 			iTestData = CTestData::NewL(iLog);
       
  2093 			}
       
  2094 		iTestData->SetTestType(CTestData::EGetSearchKeys);
       
  2095 		//Create the login object
       
  2096 		iLoginObj = CTelepathyGabbleLoginTest::NewL();
       
  2097 		
       
  2098 		//action_login will have parameters 
       
  2099 		//passed from cfg file
       
  2100 		
       
  2101 		TInt login_status = 
       
  2102 			iLoginObj->action_login(username,passwd,servername, 
       
  2103 									resource_login,ssl_flag,
       
  2104 									port,proxy_server, proxy_port,
       
  2105 									iTestData );
       
  2106 		
       
  2107 		if (login_status == CTestData::ECONNECTED)
       
  2108 		{
       
  2109 			//login was successful
       
  2110 			
       
  2111 			//Create the Object of Send Message class
       
  2112 			iSearchObj = CTelepathyGabbleSearch::NewL();	
       
  2113 			
       
  2114 			TInt search_state = iSearchObj->GetSearchKeysL( iTestData);
       
  2115 			
       
  2116 			if( search_state == CTestData::ESearchError )
       
  2117 				{
       
  2118 					return_value = KErrGeneral; //Error in Searching
       
  2119 				}
       
  2120 			else if( search_state == CTestData::ESearchKeysFound) 
       
  2121 				{
       
  2122 					return_value = KErrNone; 
       
  2123 				}
       
  2124 			iSearchObj->CloseChannel(iTestData);	
       
  2125 			//Do the logout
       
  2126 			login_status = iLoginObj->action_logout(iTestData);
       
  2127 
       
  2128 			if (login_status != CTestData::EDISCONNECTED)
       
  2129 				{
       
  2130 					//logout didnot happen successfully
       
  2131 					return_value = KErrGeneral;
       
  2132 				}
       
  2133 		
       
  2134 		
       
  2135 		}
       
  2136 		else
       
  2137 		{
       
  2138 			//Login itself didnot happen.
       
  2139 			return_value =  KErrGeneral;
       
  2140 		}		
       
  2141 		
       
  2142 		free_data (connect_data, iLog );	
       
  2143 		return return_value;
       
  2144 	}
       
  2145 	
       
  2146 
       
  2147 // -----------------------------------------------------------------------------
       
  2148 // CTelepathyGabbleTest::SendMessageTestL
       
  2149 // -----------------------------------------------------------------------------
       
  2150 
       
  2151 TInt CTelepathyGabbleTest::SendMessageTestL( 
       
  2152     CStifItemParser& aItem  )
       
  2153 	{
       
  2154 		TInt return_value = KErrNone;
       
  2155 		//Pass the parameters to action_login() from the 
       
  2156 		//data mentioned in the cfg file.
       
  2157 		
       
  2158 		//step 1: Do the login.
       
  2159 		ConnectData  *connect_data = NULL;
       
  2160 		
       
  2161 		if ( read_data ( connect_data, aItem, iLog ) != RC_OK )
       
  2162 		{
       
  2163 			free_data (connect_data, iLog );
       
  2164 			return KErrGeneral;
       
  2165 		}
       
  2166 		
       
  2167 
       
  2168 		//for login
       
  2169 		char *username, *passwd , *servername , *resource_login, *ssl_flag, *port;
       
  2170 		char *proxy_server = NULL;
       
  2171 		char *proxy_port = NULL;
       
  2172 		
       
  2173 	
       
  2174 		username = 	connect_data->username;
       
  2175 		passwd   =  connect_data->password;
       
  2176 		servername = 	connect_data->server;
       
  2177 		resource_login = connect_data->resource;
       
  2178 		ssl_flag = connect_data->ssl_flag;
       
  2179 		port = connect_data->port;
       
  2180 		#ifdef __WINSCW__
       
  2181 	  		proxy_server = connect_data->proxy_data->proxy_server;
       
  2182 			proxy_port = connect_data->proxy_data->proxy_port;
       
  2183 		#endif
       
  2184 		
       
  2185 
       
  2186 		if (iTestData == NULL)
       
  2187 		{
       
  2188 			//Create the iTestData if it is not existing.
       
  2189 			
       
  2190 			iTestData = CTestData::NewL(iLog);
       
  2191 		}
       
  2192 		
       
  2193 		iTestData->SetTestType(CTestData::ESend);
       
  2194 		
       
  2195 		//Create the login object
       
  2196 		iLoginObj = CTelepathyGabbleLoginTest::NewL();
       
  2197 		
       
  2198 		//action_login will have parameters 
       
  2199 		//passed from cfg file
       
  2200 		
       
  2201 		TInt login_status = 
       
  2202 			iLoginObj->action_login(username,passwd,servername, 
       
  2203 									resource_login,ssl_flag,
       
  2204 									port,proxy_server, proxy_port,
       
  2205 									iTestData );
       
  2206 		
       
  2207 		if (login_status == CTestData::ECONNECTED)
       
  2208 		{
       
  2209 			//login was successful
       
  2210 			//Send a message
       
  2211 			
       
  2212 			//for sending a message
       
  2213 			char *recipient_id, *msg;
       
  2214 			
       
  2215 			
       
  2216 			
       
  2217 			recipient_id = connect_data->msg_data->recipient;
       
  2218 			msg = connect_data->msg_data->message;
       
  2219 
       
  2220 			//Create the Object of Send Message class
       
  2221 			iSendMsgObj = CTelepathyGabbleSendRecvMessage::NewL();
       
  2222 			
       
  2223 		
       
  2224 			
       
  2225 			//call the SendMessage test case	
       
  2226 			TInt sendmsg_state = iSendMsgObj->SendMessage(recipient_id,msg,iTestData);
       
  2227 			
       
  2228 			if( sendmsg_state == CTestData::EMessageNotSent )
       
  2229 				{
       
  2230 				return_value = KErrGeneral; //Error in Sending message
       
  2231 				}
       
  2232 			else if( sendmsg_state == CTestData::EMessageSendErr ) 
       
  2233 				{
       
  2234 				    // error was not expected
       
  2235 					return_value = KErrGeneral; 
       
  2236 				}
       
  2237 		    else if( sendmsg_state == CTestData::EMessageSent ) 
       
  2238 				{
       
  2239 					//If message sent to invalid userid or blank userid, state should EMessageSendErr
       
  2240 					// This is used in case of SendMessagetoinvalidUseridTestL
       
  2241 					return_value = KErrNone; 
       
  2242 				}
       
  2243 			
       
  2244 			//Do the logout
       
  2245 			login_status = iLoginObj->action_logout(iTestData);
       
  2246 
       
  2247 			if (login_status != CTestData::EDISCONNECTED)
       
  2248 			{
       
  2249 				//logout didnot happen successfully
       
  2250 				return_value = KErrGeneral;
       
  2251 			}
       
  2252 		
       
  2253 		}
       
  2254 		else
       
  2255 		{
       
  2256 			//Login itself didnot happen.
       
  2257 			return_value =  KErrGeneral;
       
  2258 		}		
       
  2259 		
       
  2260 		free_data (connect_data, iLog );	
       
  2261 		return return_value;
       
  2262 	}
       
  2263 	
       
  2264 
       
  2265 
       
  2266 
       
  2267 // -----------------------------------------------------------------------------
       
  2268 // CTelepathyGabbleTest::SendMessageRepeatedTestL
       
  2269 // -----------------------------------------------------------------------------
       
  2270 
       
  2271 TInt CTelepathyGabbleTest::SendMessageRepeatedTestL( 
       
  2272     CStifItemParser& aItem  )
       
  2273 	{
       
  2274 		TInt return_value = KErrNone;
       
  2275 		//Pass the parameters to action_login() from the 
       
  2276 		//data mentioned in the cfg file.
       
  2277 		
       
  2278 		//step 1: Do the login.
       
  2279 		ConnectData  *connect_data = NULL;
       
  2280 		
       
  2281 		if ( read_data ( connect_data, aItem, iLog ) != RC_OK )
       
  2282 		{
       
  2283 			free_data (connect_data, iLog );
       
  2284 			return KErrGeneral;
       
  2285 		}
       
  2286 		
       
  2287 
       
  2288 		//for login
       
  2289 		char *username, *passwd , *servername , *resource_login, *ssl_flag, *port;
       
  2290 		char *proxy_server = NULL;
       
  2291 		char *proxy_port = NULL;
       
  2292 		
       
  2293 	
       
  2294 		username = 	connect_data->username;
       
  2295 		passwd   =  connect_data->password;
       
  2296 		servername = 	connect_data->server;
       
  2297 		resource_login = connect_data->resource;
       
  2298 		ssl_flag = connect_data->ssl_flag;
       
  2299 		port = connect_data->port;
       
  2300 		#ifdef __WINSCW__
       
  2301 	  		proxy_server = connect_data->proxy_data->proxy_server;
       
  2302 			proxy_port = connect_data->proxy_data->proxy_port;
       
  2303 		#endif
       
  2304 		
       
  2305 
       
  2306 		if (iTestData == NULL)
       
  2307 		{
       
  2308 			//Create the iTestData if it is not existing.
       
  2309 			
       
  2310 			iTestData = CTestData::NewL(iLog);
       
  2311 		}
       
  2312 		
       
  2313 		iTestData->SetTestType(CTestData::ESend);
       
  2314 		
       
  2315 		//Create the login object
       
  2316 		iLoginObj = CTelepathyGabbleLoginTest::NewL();
       
  2317 		
       
  2318 		//action_login will have parameters 
       
  2319 		//passed from cfg file
       
  2320 		
       
  2321 		TInt login_status = 
       
  2322 			iLoginObj->action_login(username,passwd,servername, 
       
  2323 									resource_login,ssl_flag,
       
  2324 									port,proxy_server, proxy_port,
       
  2325 									iTestData );
       
  2326 		
       
  2327 		if (login_status == CTestData::ECONNECTED)
       
  2328 		{
       
  2329 			//login was successful
       
  2330 			//Send a message
       
  2331 			
       
  2332 			//for sending a message
       
  2333 			char *recipient_id, *msg;
       
  2334 			
       
  2335 			recipient_id = connect_data->msg_data->recipient;
       
  2336 			msg = connect_data->msg_data->message;
       
  2337 
       
  2338 			//Create the Object of Send Message class
       
  2339 			iSendMsgObj = CTelepathyGabbleSendRecvMessage::NewL();
       
  2340 			
       
  2341 			//call the SendMessage test case	
       
  2342 			TInt sendmsg_state = CTestData::EMessageNotSent;
       
  2343 		
       
  2344 			for( TInt cnt =0 ; cnt < KRepeatedMessageCount ; cnt++ )
       
  2345 			{
       
  2346 				sendmsg_state = iSendMsgObj->SendMessage(recipient_id,msg,iTestData);	
       
  2347 				
       
  2348 				if( sendmsg_state != CTestData::EMessageSent )
       
  2349 					{
       
  2350 					return_value = KErrGeneral; //Error in Sending message	
       
  2351 					break;
       
  2352 					}
       
  2353 			}
       
  2354 		
       
  2355 				
       
  2356 			//Do the logout
       
  2357 			login_status = iLoginObj->action_logout(iTestData);
       
  2358 
       
  2359 			if (login_status != CTestData::EDISCONNECTED)
       
  2360 			{
       
  2361 				//logout didnot happen successfully
       
  2362 				return_value = KErrGeneral;
       
  2363 			}
       
  2364 		
       
  2365 		}
       
  2366 		else
       
  2367 		{
       
  2368 			//Login itself didnot happen.
       
  2369 			return_value =  KErrGeneral;
       
  2370 		}		
       
  2371 		
       
  2372 		free_data (connect_data, iLog );	
       
  2373 		return return_value;
       
  2374 	}
       
  2375 
       
  2376 
       
  2377 
       
  2378 // -----------------------------------------------------------------------------
       
  2379 // CTelepathyGabbleTest::ReceiveRepeatedMessageTestL
       
  2380 // Test for login.
       
  2381 // -----------------------------------------------------------------------------
       
  2382 	
       
  2383 TInt CTelepathyGabbleTest::ReceiveRepeatedMessageTestL( 
       
  2384     CStifItemParser& aItem  )
       
  2385 	{
       
  2386 		TInt return_value = KErrNone;
       
  2387 		//Pass the parameters to action_login() from the 
       
  2388 		//data mentioned in the cfg file.
       
  2389 		
       
  2390 		//step 1: Do the login.
       
  2391 		ConnectData  *connect_data = NULL;
       
  2392 		
       
  2393 		if ( read_data ( connect_data, aItem, iLog ) != RC_OK )
       
  2394 		{
       
  2395 			free_data (connect_data, iLog );
       
  2396 			return KErrGeneral;
       
  2397 		}
       
  2398 		
       
  2399 
       
  2400 		//for login
       
  2401 		char *username, *passwd , *servername , *resource_login,*ssl_flag, *port;
       
  2402 		char *proxy_server = NULL;
       
  2403 		char *proxy_port = NULL;
       
  2404 		
       
  2405 	
       
  2406 		username = 	connect_data->username;
       
  2407 		passwd   =  connect_data->password;
       
  2408 		servername = 	connect_data->server;
       
  2409 		resource_login = connect_data->resource;
       
  2410 		ssl_flag = connect_data->ssl_flag;
       
  2411 		port = connect_data->port;
       
  2412 		#ifdef __WINSCW__
       
  2413 	  		proxy_server = connect_data->proxy_data->proxy_server;
       
  2414 			proxy_port = connect_data->proxy_data->proxy_port;
       
  2415 		#endif
       
  2416 		
       
  2417 	
       
  2418 		iTestData = CTestData::NewL(iLog);
       
  2419 		
       
  2420 		iTestData->SetTestType(CTestData::EReceive);
       
  2421 	
       
  2422 		//Create the login object
       
  2423 		iLoginObj = CTelepathyGabbleLoginTest::NewL();
       
  2424 		
       
  2425 		//action_login will have parameters 
       
  2426 		//passed from cfg file
       
  2427 		
       
  2428 		TInt login_status = 
       
  2429 			iLoginObj->action_login(username,passwd,
       
  2430 									servername, resource_login,ssl_flag,
       
  2431 									port,proxy_server, proxy_port,
       
  2432 									iTestData);
       
  2433 		
       
  2434 		if (login_status == CTestData::ECONNECTED)
       
  2435 		{
       
  2436 			//Get the contact_id and the message.
       
  2437 			char *recipient_id, *msg;
       
  2438 			
       
  2439 			recipient_id = connect_data->msg_data->recipient;
       
  2440 			msg = connect_data->msg_data->message;
       
  2441 		
       
  2442 		
       
  2443 		  //Do the receive message test case
       
  2444 		  //Create the Object of Send Message class
       
  2445 		  iSendMsgObj = CTelepathyGabbleSendRecvMessage::NewL();
       
  2446 		  
       
  2447 		  TInt recvmsg_state = CTestData::EMessageNotSent;
       
  2448 		
       
  2449 			for( TInt cnt =0 ; cnt < KRepeatedMessageCount ; cnt++ )
       
  2450 			{
       
  2451 				iTestData->SetSendRecvMsgState(CTestData::EMessageNotSent);
       
  2452 				recvmsg_state = iSendMsgObj->ReceiveMessage(recipient_id,msg,iTestData);	
       
  2453 				
       
  2454 				if( recvmsg_state != CTestData::EMessageRecvd )
       
  2455 					{
       
  2456 					return_value = KErrGeneral;	
       
  2457 					break;
       
  2458 					}
       
  2459 			}
       
  2460 		  		  
       
  2461 		  //do the logout and the cleanup
       
  2462 			login_status = iLoginObj->action_logout(iTestData);
       
  2463 			if (login_status != CTestData::EDISCONNECTED)
       
  2464 			{
       
  2465 				//logout didnot happen successfully
       
  2466 				return_value = KErrGeneral;
       
  2467 			}
       
  2468 		  
       
  2469 		}
       
  2470 		else
       
  2471 		{
       
  2472 			//login didnot happen successfully
       
  2473 			return_value = KErrGeneral;
       
  2474 		}
       
  2475 		free_data (connect_data, iLog );
       
  2476 		return return_value;
       
  2477 	}
       
  2478 
       
  2479 // -----------------------------------------------------------------------------
       
  2480 // CTelepathyGabbleTest::ReceiveMessageTestL
       
  2481 // Test for login.
       
  2482 // -----------------------------------------------------------------------------
       
  2483 	
       
  2484 TInt CTelepathyGabbleTest::ReceiveMessageTestL( 
       
  2485     CStifItemParser& aItem  )
       
  2486 	{
       
  2487 		TInt return_value = KErrNone;
       
  2488 		//Pass the parameters to action_login() from the 
       
  2489 		//data mentioned in the cfg file.
       
  2490 		
       
  2491 		//step 1: Do the login.
       
  2492 		ConnectData  *connect_data = NULL;
       
  2493 		
       
  2494 		if ( read_data ( connect_data, aItem, iLog ) != RC_OK )
       
  2495 		{
       
  2496 			free_data (connect_data, iLog );
       
  2497 			return KErrGeneral;
       
  2498 		}
       
  2499 		
       
  2500 
       
  2501 		//for login
       
  2502 		char *username, *passwd , *servername , *resource_login,*ssl_flag, *port;
       
  2503 		char *proxy_server = NULL;
       
  2504 		char *proxy_port = NULL;
       
  2505 		
       
  2506 	
       
  2507 		username = 	connect_data->username;
       
  2508 		passwd   =  connect_data->password;
       
  2509 		servername = 	connect_data->server;
       
  2510 		resource_login = connect_data->resource;
       
  2511 		ssl_flag = connect_data->ssl_flag;
       
  2512 		port = connect_data->port;
       
  2513 		#ifdef __WINSCW__
       
  2514 	  		proxy_server = connect_data->proxy_data->proxy_server;
       
  2515 			proxy_port = connect_data->proxy_data->proxy_port;
       
  2516 		#endif
       
  2517 		
       
  2518 	
       
  2519 		iTestData = CTestData::NewL(iLog);
       
  2520 		
       
  2521 		iTestData->SetTestType(CTestData::EReceive);
       
  2522 	
       
  2523 		//Create the login object
       
  2524 		iLoginObj = CTelepathyGabbleLoginTest::NewL();
       
  2525 		
       
  2526 		//action_login will have parameters 
       
  2527 		//passed from cfg file
       
  2528 		
       
  2529 		TInt login_status = 
       
  2530 			iLoginObj->action_login(username,passwd,
       
  2531 									servername, resource_login,ssl_flag,
       
  2532 									port,proxy_server, proxy_port,
       
  2533 									iTestData);
       
  2534 		
       
  2535 		if (login_status == CTestData::ECONNECTED)
       
  2536 		{
       
  2537 			//Get the contact_id and the message.
       
  2538 			char *recipient_id, *msg;
       
  2539 			
       
  2540 			recipient_id = connect_data->msg_data->recipient;
       
  2541 			msg = connect_data->msg_data->message;
       
  2542 		
       
  2543 		    iLog->Log( _L("ReceiveMessageTestL:: Logged In \n") );
       
  2544 		    
       
  2545 		  //Do the receive message test case
       
  2546 		  //Create the Object of Send Message class
       
  2547 		  iSendMsgObj = CTelepathyGabbleSendRecvMessage::NewL();
       
  2548 		  TInt recvmsg_state = iSendMsgObj->ReceiveMessage(recipient_id,msg,iTestData);	
       
  2549 		  
       
  2550 		  if( recvmsg_state != CTestData::EMessageRecvd )
       
  2551 				{
       
  2552 				iLog->Log( _L("ReceiveMessageTestL:: receive Error \n") );
       
  2553 				return_value = KErrGeneral;	
       
  2554 				}
       
  2555 		  //do the logout and the cleanup
       
  2556 		  login_status = iLoginObj->action_logout(iTestData);
       
  2557 		  if (login_status != CTestData::EDISCONNECTED)
       
  2558 				{
       
  2559 					iLog->Log( _L("ReceiveMessageTestL:: Logout Error \n") );
       
  2560 					//logout didnot happen successfully
       
  2561 					return_value = KErrGeneral;
       
  2562 				}
       
  2563 		  
       
  2564 		}
       
  2565 		else
       
  2566 		{
       
  2567 			//login didnot happen successfully
       
  2568 			return_value = KErrGeneral;
       
  2569 		}
       
  2570 		free_data (connect_data, iLog );
       
  2571 		return return_value;
       
  2572 	}
       
  2573 
       
  2574 
       
  2575 // -----------------------------------------------------------------------------
       
  2576 // CTelepathyGabbleTest::ReceiveMessageBlankTestL
       
  2577 // Test for login.
       
  2578 // -----------------------------------------------------------------------------
       
  2579 	
       
  2580 TInt CTelepathyGabbleTest::ReceiveMessageBlankTestL( 
       
  2581     CStifItemParser& aItem  )
       
  2582 	{
       
  2583 		TInt return_value = KErrNone;
       
  2584 		//Pass the parameters to action_login() from the 
       
  2585 		//data mentioned in the cfg file.
       
  2586 		
       
  2587 		//step 1: Do the login.
       
  2588 		ConnectData  *connect_data = NULL;
       
  2589 		
       
  2590 		if ( read_data ( connect_data, aItem, iLog ) != RC_OK )
       
  2591 		{
       
  2592 			free_data (connect_data, iLog );
       
  2593 			return KErrGeneral;
       
  2594 		}
       
  2595 		
       
  2596 
       
  2597 		//for login
       
  2598 		char *username, *passwd , *servername , *resource_login,*ssl_flag, *port;
       
  2599 		char *proxy_server = NULL;
       
  2600 		char *proxy_port = NULL;
       
  2601 		
       
  2602 	
       
  2603 		username = 	connect_data->username;
       
  2604 		passwd   =  connect_data->password;
       
  2605 		servername = 	connect_data->server;
       
  2606 		resource_login = connect_data->resource;
       
  2607 		ssl_flag = connect_data->ssl_flag;
       
  2608 		port = connect_data->port;
       
  2609 		#ifdef __WINSCW__
       
  2610 	  		proxy_server = connect_data->proxy_data->proxy_server;
       
  2611 			proxy_port = connect_data->proxy_data->proxy_port;
       
  2612 		#endif
       
  2613 		
       
  2614 	
       
  2615 		iTestData = CTestData::NewL(iLog);
       
  2616 	
       
  2617 		iTestData->SetTestType(CTestData::ERecvBlank);
       
  2618 		
       
  2619 		//Create the login object
       
  2620 		iLoginObj = CTelepathyGabbleLoginTest::NewL();
       
  2621 		
       
  2622 		//action_login will have parameters 
       
  2623 		//passed from cfg file
       
  2624 		
       
  2625 		TInt login_status = 
       
  2626 			iLoginObj->action_login(username,passwd,
       
  2627 									servername, resource_login,ssl_flag,
       
  2628 									port,proxy_server, proxy_port,
       
  2629 									iTestData);
       
  2630 		
       
  2631 		if (login_status == CTestData::ECONNECTED)
       
  2632 		{
       
  2633 			iLog->Log( _L("ReceiveMessageBlankTestL:: Logged In \n") );
       
  2634 			//Get the contact_id and the message.
       
  2635 			char *recipient_id, *msg;
       
  2636 			
       
  2637 			recipient_id = connect_data->msg_data->recipient;
       
  2638 			msg = connect_data->msg_data->message;
       
  2639 			
       
  2640 			//Set the message to blamk string
       
  2641 			msg = "";
       
  2642 			
       
  2643 		  //Do the receive message test case
       
  2644 		  //Create the Object of Send Message class
       
  2645 		  iSendMsgObj = CTelepathyGabbleSendRecvMessage::NewL();
       
  2646 		  TInt recvmsg_state = iSendMsgObj->ReceiveMessage(recipient_id,msg,iTestData);	
       
  2647 		  
       
  2648 		  if( recvmsg_state == CTestData::EMessageNotSent  )
       
  2649 				{
       
  2650 				iLog->Log( _L("ReceiveMessageBlankTestL:: EMESSAGE_NOT_SENT \n") );
       
  2651 				return_value = KErrNone; //Error in Sending message
       
  2652 				}
       
  2653 				  
       
  2654 		    iLog->Log( _L("ReceiveMessageBlankTestL:: b4 action_logout \n") );
       
  2655 		   //do the logout and the cleanup
       
  2656 			login_status = iLoginObj->action_logout(iTestData);
       
  2657 			if (login_status != CTestData::EDISCONNECTED)
       
  2658 			{
       
  2659 				iLog->Log( _L("ReceiveMessageBlankTestL:: logout error \n") );
       
  2660 				//logout didnot happen successfully
       
  2661 				return_value = KErrGeneral;
       
  2662 			}
       
  2663 		  
       
  2664 		}
       
  2665 		else
       
  2666 		{
       
  2667 			//login didnot happen successfully
       
  2668 			return_value = KErrGeneral;
       
  2669 		}
       
  2670 		free_data (connect_data, iLog );
       
  2671 		return return_value;
       
  2672 		  
       
  2673 		}
       
  2674 		
       
  2675 
       
  2676 // -----------------------------------------------------------------------------
       
  2677 // CTelepathyGabbleTest::ReceiveMessageMaxLengthTestL
       
  2678 // Test for login.
       
  2679 // -----------------------------------------------------------------------------
       
  2680 	
       
  2681 TInt CTelepathyGabbleTest::ReceiveMessageMaxLengthTestL( 
       
  2682     CStifItemParser& aItem  )
       
  2683 	{
       
  2684 		TInt return_value = KErrNone;
       
  2685 		//Pass the parameters to action_login() from the 
       
  2686 		//data mentioned in the cfg file.
       
  2687 		
       
  2688 		//step 1: Do the login.
       
  2689 		ConnectData  *connect_data = NULL;
       
  2690 		
       
  2691 		if ( read_data ( connect_data, aItem, iLog ) != RC_OK )
       
  2692 		{
       
  2693 			free_data (connect_data, iLog );
       
  2694 			return KErrGeneral;
       
  2695 		}
       
  2696 		
       
  2697 
       
  2698 		//for login
       
  2699 		char *username, *passwd , *servername , *resource_login,*ssl_flag, *port;
       
  2700 		char *proxy_server = NULL;
       
  2701 		char *proxy_port = NULL;
       
  2702 		
       
  2703 	
       
  2704 		username = 	connect_data->username;
       
  2705 		passwd   =  connect_data->password;
       
  2706 		servername = 	connect_data->server;
       
  2707 		resource_login = connect_data->resource;
       
  2708 		ssl_flag = connect_data->ssl_flag;
       
  2709 		port = connect_data->port;
       
  2710 		#ifdef __WINSCW__
       
  2711 	  		proxy_server = connect_data->proxy_data->proxy_server;
       
  2712 			proxy_port = connect_data->proxy_data->proxy_port;
       
  2713 		#endif
       
  2714 		
       
  2715 	
       
  2716 		iTestData = CTestData::NewL(iLog);
       
  2717 		
       
  2718 		iTestData->SetTestType(CTestData::EReceive);
       
  2719 	
       
  2720 		//Create the login object
       
  2721 		iLoginObj = CTelepathyGabbleLoginTest::NewL();
       
  2722 		
       
  2723 		//action_login will have parameters 
       
  2724 		//passed from cfg file
       
  2725 		
       
  2726 		TInt login_status = 
       
  2727 			iLoginObj->action_login(username,passwd,
       
  2728 									servername, resource_login,ssl_flag,
       
  2729 									port,proxy_server, proxy_port,
       
  2730 									iTestData);
       
  2731 		
       
  2732 		if (login_status == CTestData::ECONNECTED)
       
  2733 		{
       
  2734 			//Get the contact_id and the message.
       
  2735 			char *recipient_id;
       
  2736 			//char *msg;
       
  2737 			
       
  2738 			recipient_id = connect_data->msg_data->recipient;
       
  2739 			// msg = connect_data->msg_data->message; //not required
       
  2740 		
       
  2741 		 //Set the message to maxlength string( with 400 chars)
       
  2742 			char *max_len_msg = {"abcdefghijklmnopqrstuvwxyzabcd  \
       
  2743 							abcdefghijklmnopqrstuvwxyzabcd  \
       
  2744 							abcdefghijklmnopqrstuvwxyzabcd  \
       
  2745 							abcdefghijklmnopqrstuvwxyzabcd  \
       
  2746 							abcdefghijklmnopqrstuvwxyzabcd  \
       
  2747 							abcdefghijklmnopqrstuvwxyzabcd  \
       
  2748 							abcdefghijklmnopqrstuvwxyzabcd  \
       
  2749 							abcdefghijklmnopqrstuvwxyzabcd  \
       
  2750 							abcdefghijklmnopqrstuvwxyzabcd  \
       
  2751 							abcdefghijklmnopqrstuvwxyzabcd  \
       
  2752 							abcdefghijklmnopqrstuvwxyzabcd  \
       
  2753 							abcdefghijklmnopqrstuvwxyzabcd  \
       
  2754 							abcdefghijklmnopqrstuvwxyzabcd  \
       
  2755 							abcdefghij"};
       
  2756 									
       
  2757 		  //Do the receive message test case
       
  2758 		  //Create the Object of Send Message class
       
  2759 		  iSendMsgObj = CTelepathyGabbleSendRecvMessage::NewL();
       
  2760 		  
       
  2761 		  TInt recvmsg_state = iSendMsgObj->ReceiveMessage(recipient_id,max_len_msg,iTestData);	
       
  2762 		  
       
  2763 		  if( recvmsg_state != CTestData::EMessageRecvd )
       
  2764 					{
       
  2765 					return_value = KErrGeneral;	
       
  2766 					}
       
  2767 		   //do the logout and the cleanup
       
  2768 			login_status = iLoginObj->action_logout(iTestData);
       
  2769 			if (login_status != CTestData::EDISCONNECTED)
       
  2770 			{
       
  2771 				//logout didnot happen successfully
       
  2772 				return_value = KErrGeneral;
       
  2773 			}
       
  2774 		  
       
  2775 		}
       
  2776 		else
       
  2777 		{
       
  2778 			//login didnot happen successfully
       
  2779 			return_value = KErrGeneral;
       
  2780 		}
       
  2781 		free_data (connect_data, iLog );
       
  2782 		return return_value;
       
  2783 		  
       
  2784 		}
       
  2785 		
       
  2786 // -----------------------------------------------------------------------------
       
  2787 // CTelepathyGabbleTest::LoginCancelTestL
       
  2788 // Test for Cancelling the login.
       
  2789 // -----------------------------------------------------------------------------
       
  2790 	
       
  2791 TInt CTelepathyGabbleTest::LoginCancelTestL( 
       
  2792     CStifItemParser& aItem  )
       
  2793 	{
       
  2794 		//Pass the parameters to action_login() from the 
       
  2795 		//data mentioned in the cfg file.
       
  2796 		
       
  2797 		ConnectData  *connect_data = NULL;
       
  2798 		
       
  2799 		if ( read_data ( connect_data, aItem, iLog ) != RC_OK )
       
  2800 		{
       
  2801 			free_data (connect_data, iLog );
       
  2802 			return KErrGeneral;
       
  2803 		}
       
  2804 		
       
  2805 
       
  2806 		char *username, *passwd , *servername , *resource_login, *ssl_flag, *port;
       
  2807 		char *proxy_server = NULL;
       
  2808 		char *proxy_port = NULL;
       
  2809 		
       
  2810 		
       
  2811 		username = 	connect_data->username;
       
  2812 		passwd   =  connect_data->password;
       
  2813 		servername = 	connect_data->server;
       
  2814 		resource_login = connect_data->resource;
       
  2815 		ssl_flag = connect_data->ssl_flag;
       
  2816 		port = connect_data->port;
       
  2817 		#ifdef __WINSCW__
       
  2818 	  		proxy_server = connect_data->proxy_data->proxy_server;
       
  2819 			proxy_port = connect_data->proxy_data->proxy_port;
       
  2820 		#endif
       
  2821 		
       
  2822 		
       
  2823 		iTestData = CTestData::NewL(iLog);
       
  2824 		
       
  2825 		iLoginObj = CTelepathyGabbleLoginTest::NewL();
       
  2826 			
       
  2827 		//action_login will have parameters 
       
  2828 		//passed from cfg file
       
  2829 		TInt login_status = 
       
  2830 					iLoginObj->action_cancel(username,passwd,
       
  2831 											servername, resource_login,ssl_flag,
       
  2832 											port,proxy_server, proxy_port,
       
  2833 											iTestData );
       
  2834 		
       
  2835 		free_data (connect_data, iLog );
       
  2836 		
       
  2837 		if (login_status == CTestData::EDISCONNECTED )
       
  2838 		{
       
  2839 			//i.e the login didnot happen successfully
       
  2840 			//which is correct, since this is a cancel test case.
       
  2841 			return KErrNone;	
       
  2842 		}
       
  2843 		return KErrGeneral;	 //login status must be disconnceted else an error
       
  2844 	}
       
  2845 
       
  2846 
       
  2847 // -----------------------------------------------------------------------------
       
  2848 // CTelepathyGabbleTest::LoginInvalidUseridTestL
       
  2849 // Test for login.
       
  2850 // -----------------------------------------------------------------------------
       
  2851 	
       
  2852 TInt CTelepathyGabbleTest::LoginInvalidUseridTestL( CStifItemParser& aItem  )
       
  2853 {
       
  2854 		//Pass the parameters to action_login() from the 
       
  2855 		//data mentioned in the cfg file.
       
  2856 		
       
  2857 		ConnectData  *connect_data = NULL;
       
  2858 		
       
  2859 		if ( read_data ( connect_data, aItem, iLog ) != RC_OK )
       
  2860 		{
       
  2861 			free_data (connect_data, iLog );
       
  2862 			return KErrGeneral;
       
  2863 		}
       
  2864 		
       
  2865 
       
  2866 		char *username, *passwd , *servername , *resource_login, *ssl_flag, *port;
       
  2867 		char *proxy_server = NULL;
       
  2868 		char *proxy_port = NULL;
       
  2869 		
       
  2870 		
       
  2871 		username = 	connect_data->username;
       
  2872 		passwd   =  connect_data->password;
       
  2873 		servername = 	connect_data->server;
       
  2874 		resource_login = connect_data->resource;
       
  2875 		ssl_flag = connect_data->ssl_flag;
       
  2876 		port = connect_data->port;
       
  2877 		#ifdef __WINSCW__
       
  2878 	  		proxy_server = connect_data->proxy_data->proxy_server;
       
  2879 			proxy_port = connect_data->proxy_data->proxy_port;
       
  2880 		#endif
       
  2881 		
       
  2882 		
       
  2883 		iTestData = CTestData::NewL(iLog);
       
  2884 		
       
  2885 		iLoginObj = CTelepathyGabbleLoginTest::NewL();
       
  2886 			
       
  2887 		//action_login will have parameters 
       
  2888 		//passed from cfg file
       
  2889 		TInt login_status = 
       
  2890 					iLoginObj->action_login(username,passwd,
       
  2891 											servername, resource_login,ssl_flag,
       
  2892 											port,proxy_server, proxy_port,
       
  2893 											iTestData );
       
  2894 		
       
  2895 		free_data (connect_data, iLog );
       
  2896 		
       
  2897 		if (login_status == CTestData::EDISCONNECTED)
       
  2898 		{
       
  2899 			//i.e. login didnot happen with invalid user-id and passwd
       
  2900 			return KErrNone;
       
  2901 		}
       
  2902 		
       
  2903 		return KErrGeneral;	 //login status must be disconnceted else an error
       
  2904 }
       
  2905 
       
  2906 
       
  2907 // -----------------------------------------------------------------------------
       
  2908 // CTelepathyGabbleTest::LoginInvalidPasswdTestL
       
  2909 // Test for login.
       
  2910 // -----------------------------------------------------------------------------
       
  2911 	
       
  2912 TInt CTelepathyGabbleTest::LoginInvalidPasswdTestL( CStifItemParser& aItem  )
       
  2913 {
       
  2914 		//Pass the parameters to action_login() from the 
       
  2915 		//data mentioned in the cfg file.
       
  2916 		
       
  2917 		ConnectData  *connect_data = NULL;
       
  2918 		
       
  2919 		if ( read_data ( connect_data, aItem, iLog ) != RC_OK )
       
  2920 		{
       
  2921 			free_data (connect_data, iLog );
       
  2922 			return KErrGeneral;
       
  2923 		}
       
  2924 		
       
  2925 
       
  2926 		char *username, *passwd , *servername , *resource_login, *ssl_flag, *port;
       
  2927 		char *proxy_server = NULL;
       
  2928 		char *proxy_port = NULL;
       
  2929 		
       
  2930 		
       
  2931 		username = 	connect_data->username;
       
  2932 		passwd   =  connect_data->password;
       
  2933 		servername = 	connect_data->server;
       
  2934 		resource_login = connect_data->resource;
       
  2935 		ssl_flag = connect_data->ssl_flag;
       
  2936 		port = connect_data->port;
       
  2937 		#ifdef __WINSCW__
       
  2938 	  		proxy_server = connect_data->proxy_data->proxy_server;
       
  2939 			proxy_port = connect_data->proxy_data->proxy_port;
       
  2940 		#endif
       
  2941 		
       
  2942 		
       
  2943 		iTestData = CTestData::NewL(iLog);
       
  2944 		
       
  2945 		iLoginObj = CTelepathyGabbleLoginTest::NewL();
       
  2946 			
       
  2947 		//action_login will have parameters 
       
  2948 		//passed from cfg file
       
  2949 		TInt login_status = 
       
  2950 					iLoginObj->action_login(username,passwd,
       
  2951 											servername, resource_login,ssl_flag,
       
  2952 											port,proxy_server, proxy_port,
       
  2953 											iTestData );
       
  2954 		
       
  2955 		free_data (connect_data, iLog );
       
  2956 		
       
  2957 		if (login_status == CTestData::EDISCONNECTED)
       
  2958 		{
       
  2959 			//i.e. login didnot happen with invalid user-id and passwd
       
  2960 			return (KErrNone);
       
  2961 		}
       
  2962 		
       
  2963 		return KErrGeneral;	 //login status must be disconnceted else an error
       
  2964 }
       
  2965 
       
  2966 // -----------------------------------------------------------------------------
       
  2967 // CTelepathyGabbleTest::LoginInvalidUseridPasswdTestL
       
  2968 // Test for login.
       
  2969 // -----------------------------------------------------------------------------
       
  2970 	
       
  2971 TInt CTelepathyGabbleTest::LoginInvalidUseridPasswdTestL( 
       
  2972     CStifItemParser& aItem  )
       
  2973 {
       
  2974 		//Pass the parameters to action_login() from the 
       
  2975 		//data mentioned in the cfg file.
       
  2976 		
       
  2977 		ConnectData  *connect_data = NULL;
       
  2978 		
       
  2979 		if ( read_data ( connect_data, aItem, iLog ) != RC_OK )
       
  2980 		{
       
  2981 			free_data (connect_data, iLog );
       
  2982 			return KErrGeneral;
       
  2983 		}
       
  2984 		
       
  2985 
       
  2986 		char *username, *passwd , *servername , *resource_login, *ssl_flag, *port;
       
  2987 		char *proxy_server = NULL;
       
  2988 		char *proxy_port = NULL;
       
  2989 		
       
  2990 		
       
  2991 		username = 	connect_data->username;
       
  2992 		passwd   =  connect_data->password;
       
  2993 		servername = 	connect_data->server;
       
  2994 		resource_login = connect_data->resource;
       
  2995 		ssl_flag = connect_data->ssl_flag;
       
  2996 		port = connect_data->port;
       
  2997 		#ifdef __WINSCW__
       
  2998 	  		proxy_server = connect_data->proxy_data->proxy_server;
       
  2999 			proxy_port = connect_data->proxy_data->proxy_port;
       
  3000 		#endif
       
  3001 		
       
  3002 		
       
  3003 		iTestData = CTestData::NewL(iLog);
       
  3004 		
       
  3005 		iLoginObj = CTelepathyGabbleLoginTest::NewL();
       
  3006 			
       
  3007 		//action_login will have parameters 
       
  3008 		//passed from cfg file
       
  3009 		TInt login_status = 
       
  3010 					iLoginObj->action_login(username,passwd,
       
  3011 											servername, resource_login,ssl_flag,
       
  3012 											port,proxy_server, proxy_port,
       
  3013 											iTestData );
       
  3014 		
       
  3015 		free_data (connect_data, iLog );
       
  3016 		
       
  3017 		if (login_status == CTestData::EDISCONNECTED)
       
  3018 		{
       
  3019 			//i.e. login didnot happen with invalid user-id and passwd
       
  3020 			return KErrNone;
       
  3021 		}
       
  3022 		
       
  3023 		return KErrGeneral;	 //login status must be disconnceted else an error
       
  3024 }
       
  3025 
       
  3026 
       
  3027 // -----------------------------------------------------------------------------
       
  3028 // CTelepathyGabbleTest::SendMessageWith400TestL
       
  3029 // Test for login.
       
  3030 // -----------------------------------------------------------------------------
       
  3031 
       
  3032 TInt CTelepathyGabbleTest::SendMessageWith400TestL( 
       
  3033     CStifItemParser& aItem  )
       
  3034 	{
       
  3035 		TInt return_value = KErrNone;
       
  3036 		//Pass the parameters to action_login() from the 
       
  3037 		//data mentioned in the cfg file.
       
  3038 		
       
  3039 		//step 1: Do the login.
       
  3040 		ConnectData  *connect_data = NULL;
       
  3041 		
       
  3042 		if ( read_data ( connect_data, aItem, iLog ) != RC_OK )
       
  3043 		{
       
  3044 			free_data (connect_data, iLog );
       
  3045 			return KErrGeneral;
       
  3046 		}
       
  3047 		
       
  3048 
       
  3049 		//for login
       
  3050 		char *username, *passwd , *servername , *resource_login, *ssl_flag, *port;
       
  3051 		char *proxy_server = NULL;
       
  3052 		char *proxy_port = NULL;
       
  3053 		
       
  3054 	
       
  3055 		username = 	connect_data->username;
       
  3056 		passwd   =  connect_data->password;
       
  3057 		servername = 	connect_data->server;
       
  3058 		resource_login = connect_data->resource;
       
  3059 	    ssl_flag = connect_data->ssl_flag;
       
  3060 	    port = connect_data->port;
       
  3061 		#ifdef __WINSCW__
       
  3062 	  		proxy_server = connect_data->proxy_data->proxy_server;
       
  3063 			proxy_port = connect_data->proxy_data->proxy_port;
       
  3064 		#endif
       
  3065 		
       
  3066 	    
       
  3067 	    iTestData = CTestData::NewL(iLog);
       
  3068 	    
       
  3069 	    iTestData->SetTestType(CTestData::ESend);
       
  3070 	     
       
  3071 		//Create the login object
       
  3072 		iLoginObj = CTelepathyGabbleLoginTest::NewL();
       
  3073 		
       
  3074 		//action_login will have parameters 
       
  3075 		//passed from cfg file
       
  3076 		
       
  3077 		TInt login_status = 
       
  3078 			iLoginObj->action_login( username,passwd,
       
  3079 									servername, resource_login,ssl_flag,
       
  3080 									port,proxy_server, proxy_port,
       
  3081 									iTestData );
       
  3082 		
       
  3083 		if (login_status == CTestData::ECONNECTED)
       
  3084 		{
       
  3085 			//login was successful
       
  3086 			//Send a message
       
  3087 			
       
  3088 			//for sending a message
       
  3089 			char *recipient_id;
       
  3090 			
       
  3091 			recipient_id = connect_data->msg_data->recipient;
       
  3092 			//msg = connect_data->msg_data->message;
       
  3093 			//hardcode the message of 400 characters.
       
  3094 			//Set the message to maxlength string( with 400 chars)
       
  3095 			char *msg = {"abcdefghijklmnopqrstuvwxyzabcd  \
       
  3096 							abcdefghijklmnopqrstuvwxyzabcd  \
       
  3097 							abcdefghijklmnopqrstuvwxyzabcd  \
       
  3098 							abcdefghijklmnopqrstuvwxyzabcd  \
       
  3099 							abcdefghijklmnopqrstuvwxyzabcd  \
       
  3100 							abcdefghijklmnopqrstuvwxyzabcd  \
       
  3101 							abcdefghijklmnopqrstuvwxyzabcd  \
       
  3102 							abcdefghijklmnopqrstuvwxyzabcd  \
       
  3103 							abcdefghijklmnopqrstuvwxyzabcd  \
       
  3104 							abcdefghijklmnopqrstuvwxyzabcd  \
       
  3105 							abcdefghijklmnopqrstuvwxyzabcd  \
       
  3106 							abcdefghijklmnopqrstuvwxyzabcd  \
       
  3107 							abcdefghijklmnopqrstuvwxyzabcd  \
       
  3108 							abcdefghij"};
       
  3109 
       
  3110 			//Create the Object of Send Message class
       
  3111 			iSendMsgObj = CTelepathyGabbleSendRecvMessage::NewL();
       
  3112 			
       
  3113 			//call the SendMessage test case	
       
  3114 			TInt sendmsg_state = iSendMsgObj->SendMessage(recipient_id,msg,iTestData );
       
  3115 			
       
  3116 			if( sendmsg_state == CTestData::EMessageNotSent || 
       
  3117 				sendmsg_state == CTestData::EMessageSendErr  )
       
  3118 				{
       
  3119 				return_value = KErrGeneral; //Error in Sending message
       
  3120 				}
       
  3121 			else if( sendmsg_state == CTestData::EMessageSent ) 
       
  3122 				{
       
  3123 				    // EMessageSent was expected
       
  3124 					return_value = KErrNone; 
       
  3125 				}
       
  3126 		   	
       
  3127 		
       
  3128 			//Do the logout.
       
  3129 			login_status = iLoginObj->action_logout( iTestData );
       
  3130 			if (login_status != CTestData::EDISCONNECTED)
       
  3131 				{
       
  3132 					//logout didnot happen successfully
       
  3133 					return_value = KErrGeneral;
       
  3134 				}					
       
  3135 		}
       
  3136 		else
       
  3137 		{
       
  3138 			//Login itself didnot happen.
       
  3139 			return_value =  KErrGeneral;
       
  3140 		}
       
  3141 		
       
  3142 		
       
  3143 		free_data (connect_data, iLog );	
       
  3144 		return return_value;
       
  3145 	}
       
  3146 
       
  3147 
       
  3148 
       
  3149 // -----------------------------------------------------------------------------
       
  3150 // CTelepathyGabbleTest::SendMesasgeToBlankUserIdTestL
       
  3151 // Test for login.
       
  3152 // -----------------------------------------------------------------------------
       
  3153 TInt CTelepathyGabbleTest::SendMesasgeToBlankUserIdTestL( 
       
  3154     CStifItemParser& aItem  )
       
  3155 	{
       
  3156 		TInt return_value = KErrNone;
       
  3157 		//Pass the parameters to action_login() from the 
       
  3158 		//data mentioned in the cfg file.
       
  3159 		
       
  3160 		//step 1: Do the login.
       
  3161 		ConnectData  *connect_data = NULL;
       
  3162 		
       
  3163 		if ( read_data ( connect_data, aItem, iLog ) != RC_OK )
       
  3164 		{
       
  3165 			free_data (connect_data, iLog );
       
  3166 			return KErrGeneral;
       
  3167 		}
       
  3168 		
       
  3169 
       
  3170 		//for login
       
  3171 		char *username, *passwd , *servername , *resource_login, *ssl_flag, *port;
       
  3172 		char *proxy_server = NULL;
       
  3173 		char *proxy_port = NULL;
       
  3174 		
       
  3175 	
       
  3176 		username = 	connect_data->username;
       
  3177 		passwd   =  connect_data->password;
       
  3178 		servername = 	connect_data->server;
       
  3179 		resource_login = connect_data->resource;
       
  3180 		ssl_flag = connect_data->ssl_flag;
       
  3181 		port = connect_data->port;
       
  3182 		#ifdef __WINSCW__
       
  3183 	  		proxy_server = connect_data->proxy_data->proxy_server;
       
  3184 			proxy_port = connect_data->proxy_data->proxy_port;
       
  3185 		#endif
       
  3186 		
       
  3187 		
       
  3188 		
       
  3189 		iTestData = CTestData::NewL(iLog);
       
  3190 		
       
  3191 		iTestData->SetTestType(CTestData::ESendErr);
       
  3192 		
       
  3193 		//Create the login object
       
  3194 		iLoginObj = CTelepathyGabbleLoginTest::NewL();
       
  3195 		
       
  3196 		//action_login will have parameters 
       
  3197 		//passed from cfg file
       
  3198 		
       
  3199 		TInt login_status = iLoginObj->action_login(username,passwd,
       
  3200 								servername, resource_login,ssl_flag,
       
  3201 								port,proxy_server, proxy_port,
       
  3202 								iTestData );
       
  3203 		
       
  3204 		if (login_status == CTestData::ECONNECTED)
       
  3205 		{
       
  3206 			//login was successful
       
  3207 			//Send a message
       
  3208 			
       
  3209 			//for sending a message
       
  3210 			char *recipient_id, *msg;
       
  3211 			
       
  3212 			recipient_id = "";//hardcode the recipient for blank.
       
  3213 		
       
  3214 			msg = connect_data->msg_data->message;
       
  3215 
       
  3216 			//Create the Object of Send Message class
       
  3217 			iSendMsgObj = CTelepathyGabbleSendRecvMessage::NewL();
       
  3218 			
       
  3219 			
       
  3220 			//call the SendMessage test case	
       
  3221 			TInt sendmsg_state = iSendMsgObj->SendMessage(recipient_id,msg,iTestData);
       
  3222 			
       
  3223 			if( sendmsg_state == CTestData::EMessageNotSent 
       
  3224 				|| sendmsg_state == CTestData::EMessageSent )
       
  3225 				{
       
  3226 				return_value = KErrGeneral; //Error in Sending message
       
  3227 				}
       
  3228 		    else if( sendmsg_state == CTestData::EMessageSendErr ) 
       
  3229 				{
       
  3230 					//If message sent to invalid userid or blank userid, state should EMessageSendErr
       
  3231 					// This is used in case of SendMessagetoinvalidUseridTestL
       
  3232 					return_value = KErrNone; 
       
  3233 				}
       
  3234 				
       
  3235 			//Do the logout.
       
  3236 			login_status = iLoginObj->action_logout(iTestData);
       
  3237 			if (login_status != CTestData::EDISCONNECTED)
       
  3238 				{
       
  3239 					//logout didnot happen successfully
       
  3240 					return_value = KErrGeneral;
       
  3241 				}
       
  3242 				
       
  3243 			
       
  3244 					
       
  3245 		}
       
  3246 		else
       
  3247 		{
       
  3248 			//Login itself didnot happen.
       
  3249 			return_value =  KErrGeneral;
       
  3250 		}
       
  3251 		
       
  3252 		free_data (connect_data, iLog );	
       
  3253 		return return_value;
       
  3254 	}
       
  3255 
       
  3256 
       
  3257 
       
  3258 // -----------------------------------------------------------------------------
       
  3259 // CTelepathyGabbleTest::SendMesasgeBlankTestL
       
  3260 // Test for login.
       
  3261 // -----------------------------------------------------------------------------
       
  3262 TInt CTelepathyGabbleTest::SendMesasgeBlankTestL( 
       
  3263     CStifItemParser& aItem  )
       
  3264 	{
       
  3265 		TInt return_value = KErrNone;
       
  3266 		//Pass the parameters to action_login() from the 
       
  3267 		//data mentioned in the cfg file.
       
  3268 		
       
  3269 		//step 1: Do the login.
       
  3270 		ConnectData  *connect_data = NULL;
       
  3271 		
       
  3272 		if ( read_data ( connect_data, aItem, iLog ) != RC_OK )
       
  3273 		{
       
  3274 			free_data (connect_data, iLog );
       
  3275 			return KErrGeneral;
       
  3276 		}
       
  3277 		
       
  3278 
       
  3279 		//for login
       
  3280 		char *username, *passwd , *servername , *resource_login, *ssl_flag, *port;
       
  3281 		char *proxy_server = NULL;
       
  3282 		char *proxy_port = NULL;
       
  3283 		
       
  3284 	
       
  3285 		username = 	connect_data->username;
       
  3286 		passwd   =  connect_data->password;
       
  3287 		servername = 	connect_data->server;
       
  3288 		resource_login = connect_data->resource;
       
  3289 		ssl_flag = connect_data->ssl_flag;
       
  3290 		port = connect_data->port;
       
  3291 		#ifdef __WINSCW__
       
  3292 	  		proxy_server = connect_data->proxy_data->proxy_server;
       
  3293 			proxy_port = connect_data->proxy_data->proxy_port;
       
  3294 		#endif
       
  3295 		
       
  3296 		
       
  3297 		
       
  3298 		iTestData = CTestData::NewL(iLog);
       
  3299 		
       
  3300 		iTestData->SetTestType(CTestData::ESend);
       
  3301 		
       
  3302 		//Create the login object
       
  3303 		iLoginObj = CTelepathyGabbleLoginTest::NewL();
       
  3304 		
       
  3305 		//action_login will have parameters 
       
  3306 		//passed from cfg file
       
  3307 		
       
  3308 		TInt login_status = iLoginObj->action_login(username,passwd,
       
  3309 								servername, resource_login,ssl_flag,
       
  3310 								port,proxy_server, proxy_port,
       
  3311 								iTestData );
       
  3312 		
       
  3313 		if (login_status == CTestData::ECONNECTED)
       
  3314 		{
       
  3315 			//login was successful
       
  3316 			//Send a message
       
  3317 			
       
  3318 			//for sending a message
       
  3319 			char *recipient_id, *msg;
       
  3320 			
       
  3321 			recipient_id = connect_data->msg_data->recipient;
       
  3322 			//msg = connect_data->msg_data->message;
       
  3323 			//hardcode the message for blank.
       
  3324 			msg = "";
       
  3325 
       
  3326 			//Create the Object of Send Message class
       
  3327 			iSendMsgObj = CTelepathyGabbleSendRecvMessage::NewL();
       
  3328 			
       
  3329 			//call the SendMessage test case	
       
  3330 			TInt sendmsg_state = iSendMsgObj->SendMessage(recipient_id,msg,iTestData);
       
  3331 			if( sendmsg_state != CTestData::EMessageSent )
       
  3332 			{
       
  3333 			//There was some error while sending the message.
       
  3334 			return_value = KErrGeneral;
       
  3335 			}
       
  3336 			
       
  3337 				
       
  3338 			//Do the logout.
       
  3339 			login_status = iLoginObj->action_logout(iTestData);
       
  3340 			if (login_status != CTestData::EDISCONNECTED)
       
  3341 			{
       
  3342 				//logout didnot happen successfully
       
  3343 				return_value = KErrGeneral;
       
  3344 			}
       
  3345 			
       
  3346 			
       
  3347 					
       
  3348 		}
       
  3349 		else
       
  3350 		{
       
  3351 			//Login itself didnot happen.
       
  3352 			return_value =  KErrGeneral;
       
  3353 		}
       
  3354 		
       
  3355 		free_data (connect_data, iLog );	
       
  3356 		return return_value;
       
  3357 	}
       
  3358 	
       
  3359 
       
  3360 
       
  3361 // -----------------------------------------------------------------------------
       
  3362 // CTelepathyGabbleTest::SendMessagetoinvalidUseridTestL
       
  3363 // -----------------------------------------------------------------------------
       
  3364 
       
  3365 TInt CTelepathyGabbleTest::SendMessagetoinvalidUseridTestL( 
       
  3366     CStifItemParser& aItem  )
       
  3367 	{
       
  3368 		TInt return_value = KErrNone;
       
  3369 		//Pass the parameters to action_login() from the 
       
  3370 		//data mentioned in the cfg file.
       
  3371 		
       
  3372 		//step 1: Do the login.
       
  3373 		ConnectData  *connect_data = NULL;
       
  3374 		
       
  3375 		if ( read_data ( connect_data, aItem, iLog ) != RC_OK )
       
  3376 		{
       
  3377 			free_data (connect_data, iLog );
       
  3378 			return KErrGeneral;
       
  3379 		}
       
  3380 		
       
  3381 
       
  3382 		//for login
       
  3383 		char *username, *passwd , *servername , *resource_login, *ssl_flag, *port;
       
  3384 		char *proxy_server = NULL;
       
  3385 		char *proxy_port = NULL;
       
  3386 		
       
  3387 	
       
  3388 		username = 	connect_data->username;
       
  3389 		passwd   =  connect_data->password;
       
  3390 		servername = 	connect_data->server;
       
  3391 		resource_login = connect_data->resource;
       
  3392 		ssl_flag = connect_data->ssl_flag;
       
  3393 		port = connect_data->port;
       
  3394 		#ifdef __WINSCW__
       
  3395 	  		proxy_server = connect_data->proxy_data->proxy_server;
       
  3396 			proxy_port = connect_data->proxy_data->proxy_port;
       
  3397 		#endif
       
  3398 		
       
  3399 
       
  3400 		if (iTestData == NULL)
       
  3401 		{
       
  3402 			//Create the iTestData if it is not existing.
       
  3403 			
       
  3404 			iTestData = CTestData::NewL(iLog);
       
  3405 		}
       
  3406 		
       
  3407 		iTestData->SetTestType(CTestData::ESendErr);
       
  3408 		
       
  3409 		//Create the login object
       
  3410 		iLoginObj = CTelepathyGabbleLoginTest::NewL();
       
  3411 		
       
  3412 		//action_login will have parameters 
       
  3413 		//passed from cfg file
       
  3414 		
       
  3415 		TInt login_status = 
       
  3416 			iLoginObj->action_login(username,passwd,servername, 
       
  3417 									resource_login,ssl_flag,
       
  3418 									port,proxy_server, proxy_port,
       
  3419 									iTestData );
       
  3420 		
       
  3421 		if (login_status == CTestData::ECONNECTED)
       
  3422 		{
       
  3423 			//login was successful
       
  3424 			//Send a message
       
  3425 			
       
  3426 			//for sending a message
       
  3427 			char *recipient_id, *msg;
       
  3428 			
       
  3429 			TInt testType = iTestData->GetTestType();
       
  3430 			
       
  3431 			recipient_id = connect_data->msg_data->recipient;
       
  3432 			msg = connect_data->msg_data->message;
       
  3433 
       
  3434 			//Create the Object of Send Message class
       
  3435 			iSendMsgObj = CTelepathyGabbleSendRecvMessage::NewL();
       
  3436 			
       
  3437 		
       
  3438 			
       
  3439 			//call the SendMessage test case	
       
  3440 			TInt sendmsg_state = iSendMsgObj->SendMessage(recipient_id,msg,iTestData);
       
  3441 			
       
  3442 			if( sendmsg_state == CTestData::EMessageNotSent ||
       
  3443 					sendmsg_state == CTestData::EMessageSent )
       
  3444 				{
       
  3445 				// EMessageSendErr was expected
       
  3446 				return_value = KErrGeneral; //Error in Sending message
       
  3447 				}
       
  3448 		
       
  3449 		    else if( sendmsg_state == CTestData::EMessageSendErr ) 
       
  3450 				{
       
  3451 					//If message sent to invalid userid or blank userid, state should EMessageSendErr
       
  3452 					// This is used in case of SendMessagetoinvalidUseridTestL
       
  3453 					return_value = KErrNone; 
       
  3454 				}
       
  3455 			
       
  3456 			//Do the logout
       
  3457 			login_status = iLoginObj->action_logout(iTestData);
       
  3458 
       
  3459 			if (login_status != CTestData::EDISCONNECTED)
       
  3460 			{
       
  3461 				//logout didnot happen successfully
       
  3462 				return_value = KErrGeneral;
       
  3463 			}
       
  3464 		
       
  3465 		}
       
  3466 		else
       
  3467 		{
       
  3468 			//Login itself didnot happen.
       
  3469 			return_value =  KErrGeneral;
       
  3470 		}		
       
  3471 		
       
  3472 		free_data (connect_data, iLog );	
       
  3473 		return return_value;
       
  3474 	}
       
  3475 	
       
  3476 
       
  3477 
       
  3478 
       
  3479 
       
  3480 // -----------------------------------------------------------------------------
       
  3481 // CTelepathyGabbleTest::RemoveContactWithBlankUserIdTestL
       
  3482 // Test for removing blank userid
       
  3483 // -----------------------------------------------------------------------------
       
  3484 	
       
  3485 TInt CTelepathyGabbleTest::RemoveContactWithBlankUserIdTestL( 
       
  3486     CStifItemParser& aItem  )
       
  3487 {
       
  3488 		TInt return_value = KErrNone;
       
  3489 		//Pass the parameters to action_login() from the 
       
  3490 		//data mentioned in the cfg file.
       
  3491 		
       
  3492 		ConnectData  *connect_data = NULL;
       
  3493 		
       
  3494 		if ( read_data ( connect_data, aItem, iLog ) != RC_OK )
       
  3495 		{
       
  3496 			free_data (connect_data, iLog );
       
  3497 			return KErrGeneral;
       
  3498 		}
       
  3499 		
       
  3500 
       
  3501 		char *username, *passwd , *servername , *resource_login, *ssl_flag, *port;
       
  3502 		char *proxy_server = NULL;
       
  3503 		char *proxy_port = NULL;
       
  3504 		
       
  3505 		
       
  3506 		username = 	connect_data->username;
       
  3507 		passwd   =  connect_data->password;
       
  3508 		servername = 	connect_data->server;
       
  3509 		resource_login = connect_data->resource;
       
  3510 		
       
  3511 		ssl_flag = connect_data->ssl_flag;
       
  3512 		port = connect_data->port;
       
  3513 		#ifdef __WINSCW__
       
  3514 	  		proxy_server = connect_data->proxy_data->proxy_server;
       
  3515 			proxy_port = connect_data->proxy_data->proxy_port;
       
  3516 		#endif
       
  3517 		
       
  3518 		
       
  3519 		iTestData = CTestData::NewL(iLog);
       
  3520 	
       
  3521 		iLoginObj = CTelepathyGabbleLoginTest::NewL();
       
  3522 			
       
  3523 		//action_login will have parameters 
       
  3524 		//passed from cfg file
       
  3525 		TInt login_status = iLoginObj->action_login(username,passwd,
       
  3526 														servername, resource_login,ssl_flag,
       
  3527 														port,proxy_server, proxy_port,
       
  3528 														iTestData);
       
  3529 		
       
  3530 		
       
  3531 		
       
  3532 		if (login_status == CTestData::ECONNECTED)
       
  3533 		{
       
  3534 			//login happened successfully.
       
  3535 			//Create the AddDelete Contact class object.
       
  3536 			
       
  3537 			//iAddDelContactObj = CTelepathyGabbleAddDeleteContact::NewL();
       
  3538 			iAddDelContactObj = CTelepathyGabbleAddDeleteContact::NewL();
       
  3539 			
       
  3540 			
       
  3541 			//Get the contact_id and the message.
       
  3542 			char *contact_id, *msg;
       
  3543 			
       
  3544 			contact_id = ""; //make the contactid as blank
       
  3545 			msg = connect_data->msg_data->message;
       
  3546 			
       
  3547 			TInt contact_status = iAddDelContactObj->remove_contact( contact_id, msg, iTestData );
       
  3548 			
       
  3549 			if( contact_status == CTestData::EDELETE_FAIL )
       
  3550 			{
       
  3551 				return_value = KErrNone;
       
  3552 			}
       
  3553 			
       
  3554 			//Do the logout and then return KErrNone;
       
  3555 			login_status =	iLoginObj->action_logout(iTestData);
       
  3556 			
       
  3557 			if (login_status != CTestData::EDISCONNECTED)
       
  3558 			{
       
  3559 				return_value = KErrGeneral; //logout was not successful
       
  3560 			}
       
  3561 			
       
  3562 			free_data (connect_data, iLog );
       
  3563 			return return_value;
       
  3564 		}
       
  3565 		
       
  3566 		else
       
  3567 		  {
       
  3568 		  	free_data (connect_data, iLog );
       
  3569 		  	return KErrGeneral;//login was not successful
       
  3570 		  }
       
  3571 }
       
  3572 
       
  3573 // -----------------------------------------------------------------------------
       
  3574 // CTelepathyGabbleTest::AddContactWithBlankUserIdTestL
       
  3575 // Test for Adding blank userid
       
  3576 // -----------------------------------------------------------------------------
       
  3577 	
       
  3578 TInt CTelepathyGabbleTest::AddContactWithBlankUserIdTestL( 
       
  3579     CStifItemParser& aItem  )
       
  3580 {
       
  3581 		TInt return_value = KErrNone;
       
  3582 		//Pass the parameters to action_login() from the 
       
  3583 		//data mentioned in the cfg file.
       
  3584 		
       
  3585 		ConnectData  *connect_data = NULL;
       
  3586 		
       
  3587 		if ( read_data ( connect_data, aItem, iLog ) != RC_OK )
       
  3588 		{
       
  3589 			free_data (connect_data, iLog );
       
  3590 			return KErrGeneral;
       
  3591 		}
       
  3592 		
       
  3593 
       
  3594 		char *username, *passwd , *servername , *resource_login, *ssl_flag, *port;
       
  3595 		char *proxy_server = NULL;
       
  3596 		char *proxy_port = NULL;
       
  3597 		
       
  3598 		
       
  3599 		username = 	connect_data->username;
       
  3600 		passwd   =  connect_data->password;
       
  3601 		servername = 	connect_data->server;
       
  3602 		resource_login = connect_data->resource;
       
  3603 		
       
  3604 		ssl_flag = connect_data->ssl_flag;
       
  3605 		port = connect_data->port;
       
  3606 		#ifdef __WINSCW__
       
  3607 	  		proxy_server = connect_data->proxy_data->proxy_server;
       
  3608 			proxy_port = connect_data->proxy_data->proxy_port;
       
  3609 		#endif
       
  3610 		
       
  3611 		
       
  3612 		iTestData = CTestData::NewL(iLog);
       
  3613 	
       
  3614 		iLoginObj = CTelepathyGabbleLoginTest::NewL();
       
  3615 			
       
  3616 		//action_login will have parameters 
       
  3617 		//passed from cfg file
       
  3618 		TInt login_status = iLoginObj->action_login(username,passwd,
       
  3619 														servername, resource_login,ssl_flag,
       
  3620 														port,proxy_server, proxy_port,
       
  3621 														iTestData);
       
  3622 		
       
  3623 		
       
  3624 		
       
  3625 		if (login_status == CTestData::ECONNECTED)
       
  3626 		{
       
  3627 			//login happened successfully.
       
  3628 			//Create the AddDelete Contact class object.
       
  3629 			
       
  3630 			//iAddDelContactObj = CTelepathyGabbleAddDeleteContact::NewL();
       
  3631 			iAddDelContactObj = CTelepathyGabbleAddDeleteContact::NewL();
       
  3632 			
       
  3633 			
       
  3634 			//Get the contact_id and the message.
       
  3635 			char *addcontact_id, *msg;
       
  3636 			
       
  3637 			addcontact_id = ""; //make the contactid as blank
       
  3638 			msg = connect_data->msg_data->message;
       
  3639 			
       
  3640 			TInt addcontact_status = iAddDelContactObj->add_contact(addcontact_id,msg, iTestData );
       
  3641 			
       
  3642 			if( addcontact_status == CTestData::EADD_FAIL )
       
  3643 			{
       
  3644 				return_value = KErrNone;
       
  3645 			}
       
  3646 			
       
  3647 			//Do the logout and then return KErrNone;
       
  3648 			login_status =	iLoginObj->action_logout(iTestData);
       
  3649 			
       
  3650 			if (login_status != CTestData::EDISCONNECTED)
       
  3651 			{
       
  3652 				return_value = KErrGeneral; //logout was not successful
       
  3653 			}
       
  3654 			
       
  3655 			free_data (connect_data, iLog );
       
  3656 			return return_value;
       
  3657 		}
       
  3658 		
       
  3659 		else
       
  3660 		  {
       
  3661 		  	free_data (connect_data, iLog );
       
  3662 		  	return KErrGeneral;//login was not successful
       
  3663 		  }
       
  3664 }
       
  3665 
       
  3666 
       
  3667 // -----------------------------------------------------------------------------
       
  3668 // CTelepathyGabbleTest::AddContactTestL
       
  3669 // Test for Adding Contact
       
  3670 // -----------------------------------------------------------------------------
       
  3671 	
       
  3672 TInt CTelepathyGabbleTest::AddContactTestL( 
       
  3673     CStifItemParser& aItem  )
       
  3674 {
       
  3675 		TInt return_value = KErrNone;
       
  3676 		//Pass the parameters to action_login() from the 
       
  3677 		//data mentioned in the cfg file.
       
  3678 		
       
  3679 		ConnectData  *connect_data = NULL;
       
  3680 		
       
  3681 		if ( read_data ( connect_data, aItem, iLog ) != RC_OK )
       
  3682 		{
       
  3683 			free_data (connect_data, iLog );
       
  3684 			return KErrGeneral;
       
  3685 		}
       
  3686 		
       
  3687 
       
  3688 		char *username, *passwd , *servername , *resource_login, *ssl_flag, *port;
       
  3689 		char *proxy_server = NULL;
       
  3690 		char *proxy_port = NULL;
       
  3691 		
       
  3692 		
       
  3693 		username = 	connect_data->username;
       
  3694 		passwd   =  connect_data->password;
       
  3695 		servername = 	connect_data->server;
       
  3696 		resource_login = connect_data->resource;
       
  3697 		
       
  3698 		ssl_flag = connect_data->ssl_flag;
       
  3699 		port = connect_data->port;
       
  3700 		#ifdef __WINSCW__
       
  3701 	  		proxy_server = connect_data->proxy_data->proxy_server;
       
  3702 			proxy_port = connect_data->proxy_data->proxy_port;
       
  3703 		#endif
       
  3704 		
       
  3705 		
       
  3706 		iTestData = CTestData::NewL(iLog);
       
  3707 	
       
  3708 		iLoginObj = CTelepathyGabbleLoginTest::NewL();
       
  3709 			
       
  3710 		//action_login will have parameters 
       
  3711 		//passed from cfg file
       
  3712 		TInt login_status = iLoginObj->action_login(username,passwd,
       
  3713 														servername, resource_login,ssl_flag,
       
  3714 														port,proxy_server, proxy_port,
       
  3715 														iTestData);
       
  3716 		
       
  3717 		
       
  3718 		
       
  3719 		if (login_status == CTestData::ECONNECTED)
       
  3720 		{
       
  3721 			//login happened successfully.
       
  3722 			//Create the AddDelete Contact class object.
       
  3723 			
       
  3724 			//iAddDelContactObj = CTelepathyGabbleAddDeleteContact::NewL();
       
  3725 			iAddDelContactObj = CTelepathyGabbleAddDeleteContact::NewL();
       
  3726 			
       
  3727 			
       
  3728 			//Get the contact_id and the message.
       
  3729 			char *addcontact_id, *msg;
       
  3730 			
       
  3731 			addcontact_id = connect_data->msg_data->recipient;
       
  3732 			msg = connect_data->msg_data->message;
       
  3733 			
       
  3734 			TInt addcontact_status = iAddDelContactObj->add_contact(addcontact_id,msg, iTestData );
       
  3735 			
       
  3736 			if( addcontact_status != CTestData::EADD_SUCCESS )
       
  3737 			{
       
  3738 				return_value = KErrGeneral;
       
  3739 			}
       
  3740 			
       
  3741 			//Do the logout and then return KErrNone;
       
  3742 			login_status =	iLoginObj->action_logout(iTestData);
       
  3743 			
       
  3744 			if (login_status != CTestData::EDISCONNECTED)
       
  3745 			{
       
  3746 				return_value = KErrGeneral; //logout was not successful
       
  3747 			}
       
  3748 			
       
  3749 			free_data (connect_data, iLog );
       
  3750 			return return_value;
       
  3751 		}
       
  3752 		
       
  3753 		else
       
  3754 		  {
       
  3755 		  	free_data (connect_data, iLog );
       
  3756 		  	return KErrGeneral;//login was not successful
       
  3757 		  }
       
  3758 }
       
  3759 
       
  3760 // -----------------------------------------------------------------------------
       
  3761 // CTelepathyGabbleTest::AddContactAlreadyInRosterTestL
       
  3762 // Test for Adding Contact which is already added
       
  3763 // -----------------------------------------------------------------------------
       
  3764 	
       
  3765 TInt CTelepathyGabbleTest::AddContactAlreadyInRosterTestL( 
       
  3766     CStifItemParser& aItem  )
       
  3767 {
       
  3768 		TInt return_value = KErrNone;
       
  3769 		
       
  3770 		//Pass the parameters to action_login() from the 
       
  3771 		//data mentioned in the cfg file.
       
  3772 		
       
  3773 		ConnectData  *connect_data = NULL;
       
  3774 		
       
  3775 		if ( read_data ( connect_data, aItem, iLog ) != RC_OK )
       
  3776 		{
       
  3777 			free_data (connect_data, iLog );
       
  3778 			return KErrGeneral;
       
  3779 		}
       
  3780 		
       
  3781 
       
  3782 		char *username, *passwd , *servername , *resource_login, *ssl_flag, *port;
       
  3783 		char *proxy_server = NULL;
       
  3784 		char *proxy_port = NULL;
       
  3785 		
       
  3786 		
       
  3787 		username = 	connect_data->username;
       
  3788 		passwd   =  connect_data->password;
       
  3789 		servername = 	connect_data->server;
       
  3790 		resource_login = connect_data->resource;
       
  3791 		
       
  3792 		ssl_flag = connect_data->ssl_flag;
       
  3793 		port = connect_data->port;
       
  3794 		#ifdef __WINSCW__
       
  3795 	  		proxy_server = connect_data->proxy_data->proxy_server;
       
  3796 			proxy_port = connect_data->proxy_data->proxy_port;
       
  3797 		#endif
       
  3798 		
       
  3799 		
       
  3800 		iTestData = CTestData::NewL(iLog);
       
  3801 	
       
  3802 		iLoginObj = CTelepathyGabbleLoginTest::NewL();
       
  3803 			
       
  3804 		//action_login will have parameters 
       
  3805 		//passed from cfg file
       
  3806 		TInt login_status = iLoginObj->action_login(username,passwd,
       
  3807 														servername, resource_login,ssl_flag,
       
  3808 														port,proxy_server, proxy_port,
       
  3809 														iTestData);
       
  3810 		
       
  3811 		
       
  3812 		
       
  3813 		if (login_status == CTestData::ECONNECTED)
       
  3814 		{
       
  3815 			//login happened successfully.
       
  3816 			//Create the AddDelete Contact class object.
       
  3817 						
       
  3818 			iAddDelContactObj = CTelepathyGabbleAddDeleteContact::NewL();
       
  3819 						
       
  3820 			//Get the contact_id and the message.
       
  3821 			char *addcontact_id, *msg;
       
  3822 			
       
  3823 			addcontact_id = connect_data->msg_data->recipient;
       
  3824 			msg = connect_data->msg_data->message;
       
  3825 			
       
  3826 			TInt addcontact_status = iAddDelContactObj->add_contact(addcontact_id,msg, iTestData );
       
  3827 			
       
  3828 			if( addcontact_status != CTestData::EADD_SUCCESS )
       
  3829 			{
       
  3830 				return_value = KErrGeneral;
       
  3831 				login_status = iLoginObj->action_logout(iTestData);
       
  3832 				if (login_status != CTestData::EDISCONNECTED)
       
  3833 					{
       
  3834 					return_value = KErrGeneral;
       
  3835 			  	}
       
  3836 				
       
  3837 			}
       
  3838 			else
       
  3839 			{
       
  3840 				//The function add_contact resets iAddDeleteContactStatus (in CTestData) to EADD_FAIL
       
  3841 				//to check again that adding a contact already added was successful(EADD_SUCCESS)
       
  3842 				//so no need to set here explicitly
       
  3843 
       
  3844 				
       
  3845 				addcontact_status = iAddDelContactObj->add_contact(addcontact_id,msg, iTestData );
       
  3846 				if( addcontact_status != CTestData::EADD_SUCCESS )
       
  3847 					{
       
  3848 					return_value = KErrGeneral;
       
  3849 				  	}
       
  3850 				login_status = iLoginObj->action_logout(iTestData);
       
  3851 				if (login_status != CTestData::EDISCONNECTED)
       
  3852 					{
       
  3853 					return_value = KErrGeneral;
       
  3854 			   		}
       
  3855 			}
       
  3856 			
       
  3857 		free_data (connect_data, iLog );
       
  3858 		return return_value;	
       
  3859 	 }		
       
  3860 	else
       
  3861 		{ 
       
  3862 			free_data (connect_data, iLog ); 
       
  3863 		  return KErrGeneral;	 //login was not successful
       
  3864 		}
       
  3865 	
       
  3866 }
       
  3867 
       
  3868 
       
  3869 
       
  3870 // -----------------------------------------------------------------------------
       
  3871 // CTelepathyGabbleTest::RemoveContactAlreadyRemovedTestL
       
  3872 // Test for removing Contact which is already removed
       
  3873 // -----------------------------------------------------------------------------
       
  3874 	
       
  3875 TInt CTelepathyGabbleTest::RemoveContactAlreadyRemovedTestL( 
       
  3876     CStifItemParser& aItem  )
       
  3877 {
       
  3878 		TInt return_value = KErrNone; 
       
  3879 		
       
  3880 		//Pass the parameters to action_login() from the 
       
  3881 		//data mentioned in the cfg file.
       
  3882 		
       
  3883 		ConnectData  *connect_data = NULL;
       
  3884 		
       
  3885 		if ( read_data ( connect_data, aItem, iLog ) != RC_OK )
       
  3886 		{
       
  3887 			free_data (connect_data, iLog );
       
  3888 			return KErrGeneral;
       
  3889 		}
       
  3890 		
       
  3891 
       
  3892 		char *username, *passwd , *servername , *resource_login, *ssl_flag, *port;
       
  3893 		char *proxy_server = NULL;
       
  3894 		char *proxy_port = NULL;
       
  3895 		
       
  3896 		
       
  3897 		username = 	connect_data->username;
       
  3898 		passwd   =  connect_data->password;
       
  3899 		servername = 	connect_data->server;
       
  3900 		resource_login = connect_data->resource;
       
  3901 		
       
  3902 		ssl_flag = connect_data->ssl_flag;
       
  3903 		port = connect_data->port;
       
  3904 		#ifdef __WINSCW__
       
  3905 	  		proxy_server = connect_data->proxy_data->proxy_server;
       
  3906 			proxy_port = connect_data->proxy_data->proxy_port;
       
  3907 		#endif
       
  3908 		
       
  3909 		
       
  3910 		iTestData = CTestData::NewL(iLog);
       
  3911 	
       
  3912 		iLoginObj = CTelepathyGabbleLoginTest::NewL();
       
  3913 			
       
  3914 		//action_login will have parameters 
       
  3915 		//passed from cfg file
       
  3916 		TInt login_status = iLoginObj->action_login(username,passwd,
       
  3917 														servername, resource_login,ssl_flag,
       
  3918 														port,proxy_server, proxy_port,
       
  3919 														iTestData);
       
  3920 		
       
  3921 		
       
  3922 		
       
  3923 		if (login_status == CTestData::ECONNECTED)
       
  3924 		{
       
  3925 			//login happened successfully.
       
  3926 			//Create the AddDelete Contact class object.
       
  3927 						
       
  3928 			iAddDelContactObj = CTelepathyGabbleAddDeleteContact::NewL();
       
  3929 						
       
  3930 			//Get the contact_id and the message.
       
  3931 			char *contact_id, *msg;
       
  3932 			
       
  3933 			contact_id = connect_data->msg_data->recipient;
       
  3934 			msg = connect_data->msg_data->message;
       
  3935 			
       
  3936 			TInt contact_status = iAddDelContactObj->add_contact( contact_id, msg, iTestData );
       
  3937 			
       
  3938 			if( contact_status != CTestData::EADD_SUCCESS )
       
  3939 			{
       
  3940 				iLog->Log( _L("CTelepathyGabbleTest:: contact not added successfully \n") );
       
  3941 				return_value = KErrGeneral;
       
  3942 				login_status = iLoginObj->action_logout(iTestData);
       
  3943 				if (login_status != CTestData::EDISCONNECTED)
       
  3944 					{
       
  3945 					return_value = KErrGeneral;
       
  3946 			  	}
       
  3947 			  free_data (connect_data, iLog ); 
       
  3948 		    return return_value;	
       
  3949 			}
       
  3950 			
       
  3951 			contact_status = iAddDelContactObj->remove_contact( contact_id, msg, iTestData );
       
  3952 			
       
  3953 			if( contact_status != CTestData::EDELETE_SUCCESS )
       
  3954 			{
       
  3955 				//contact removed first time, so should be removed successfully, otherwise error
       
  3956 				iLog->Log( _L("CTelepathyGabbleTest::First Time  contact not deleted successfully \n") );
       
  3957 				return_value = KErrGeneral;
       
  3958 				login_status = iLoginObj->action_logout(iTestData);
       
  3959 				if (login_status != CTestData::EDISCONNECTED)
       
  3960 					{
       
  3961 					return_value = KErrGeneral;
       
  3962 			  	}
       
  3963 			 }
       
  3964 			else
       
  3965 			{
       
  3966 				//The function remove_contact resets iAddDeleteContactStatus (in CTestData) to EDELETE_FAIL
       
  3967 				//to check again that removing a contact already removed was not successful,
       
  3968 				// so no need to set  here explicitly
       
  3969 				iLog->Log( _L("CTelepathyGabbleTest::First Time  contact deleted successfully \n") );				
       
  3970 				contact_status = iAddDelContactObj->remove_contact(contact_id,msg, iTestData );
       
  3971 				
       
  3972 			
       
  3973 				// because contact to be removed was already deleted, so status should be EDELETE_FAIL
       
  3974 				if( contact_status != CTestData::EDELETE_FAIL )
       
  3975 					{
       
  3976 					iLog->Log( _L("CTelepathyGabbleTest::Second Time deleted successfully, it should give some error \n") );
       
  3977 					return_value = KErrGeneral; 
       
  3978 				  	}
       
  3979 				login_status = iLoginObj->action_logout(iTestData);
       
  3980 				if (login_status != CTestData::EDISCONNECTED)
       
  3981 					{
       
  3982 						iLog->Log( _L("CTelepathyGabbleTest::Error in logout \n") );
       
  3983 					return_value = KErrGeneral;
       
  3984 			  		}
       
  3985 			}
       
  3986 			
       
  3987 		free_data (connect_data, iLog );
       
  3988 		return return_value;	
       
  3989 	 }		
       
  3990 	else
       
  3991 		{ 
       
  3992 			free_data (connect_data, iLog ); 
       
  3993 		  return KErrGeneral;	 //login was not successful
       
  3994 		}
       
  3995 	
       
  3996 }
       
  3997 
       
  3998 // -----------------------------------------------------------------------------
       
  3999 // CTelepathyGabbleTest::RemoveContactTestL
       
  4000 // Test for removing a contact
       
  4001 // -----------------------------------------------------------------------------
       
  4002 
       
  4003 TInt CTelepathyGabbleTest::RemoveContactTestL( 
       
  4004     CStifItemParser& aItem  )
       
  4005 {
       
  4006 		TInt return_value = KErrNone;
       
  4007 		//Pass the parameters to action_login() from the 
       
  4008 		//data mentioned in the cfg file.
       
  4009 		
       
  4010 		ConnectData  *connect_data = NULL;
       
  4011 		
       
  4012 		if ( read_data ( connect_data, aItem, iLog ) != RC_OK )
       
  4013 		{
       
  4014 			free_data (connect_data, iLog );
       
  4015 			return KErrGeneral;
       
  4016 		}
       
  4017 		
       
  4018 
       
  4019 		char *username, *passwd , *servername , *resource_login,*ssl_flag, *port;
       
  4020 		char *proxy_server = NULL;
       
  4021 		char *proxy_port = NULL;
       
  4022 		
       
  4023 		
       
  4024 		username = 	connect_data->username;
       
  4025 		passwd   =  connect_data->password;
       
  4026 		servername = 	connect_data->server;
       
  4027 		resource_login = connect_data->resource;
       
  4028 		ssl_flag = connect_data->ssl_flag;
       
  4029 		port = connect_data->port;
       
  4030 		#ifdef __WINSCW__
       
  4031 	  		proxy_server = connect_data->proxy_data->proxy_server;
       
  4032 			proxy_port = connect_data->proxy_data->proxy_port;
       
  4033 		#endif
       
  4034 		
       
  4035 		
       
  4036 		iTestData = CTestData::NewL(iLog);
       
  4037 	
       
  4038 		iLoginObj = CTelepathyGabbleLoginTest::NewL();
       
  4039 			
       
  4040 		//action_login will have parameters 
       
  4041 		//passed from cfg file
       
  4042 		TInt login_status = iLoginObj->action_login(username,passwd,
       
  4043 											servername, resource_login,ssl_flag,
       
  4044 											port,proxy_server, proxy_port,
       
  4045 											iTestData );
       
  4046 		
       
  4047 		
       
  4048 		
       
  4049 		if (login_status == CTestData::ECONNECTED)
       
  4050 		{
       
  4051 			//login happened successfully.
       
  4052 			//Create the AddDelete Contact class object.
       
  4053 			
       
  4054 			
       
  4055 			iAddDelContactObj = CTelepathyGabbleAddDeleteContact::NewL();
       
  4056 			
       
  4057 			
       
  4058 			//Get the contact_id and the message.
       
  4059 			char *contact_id, *msg;
       
  4060 			
       
  4061 			contact_id = connect_data->msg_data->recipient;
       
  4062 			msg = connect_data->msg_data->message;
       
  4063 			
       
  4064 			TInt removecontact_status = iAddDelContactObj->remove_contact( contact_id, msg,	iTestData);
       
  4065 			
       
  4066 			if( removecontact_status != CTestData::EDELETE_SUCCESS )
       
  4067 			{
       
  4068 				return_value = KErrGeneral;
       
  4069 			}
       
  4070 			
       
  4071 			//Do the logout and then return KErrNone;
       
  4072 			login_status =	iLoginObj->action_logout(iTestData);
       
  4073 			
       
  4074 			if (login_status != CTestData::EDISCONNECTED)
       
  4075 			{
       
  4076 				return_value = KErrGeneral; //logout was not successful
       
  4077 			}
       
  4078 			
       
  4079 			free_data (connect_data, iLog );
       
  4080 			return return_value;
       
  4081 		}
       
  4082 		
       
  4083 		else
       
  4084 		{
       
  4085 			free_data (connect_data, iLog );
       
  4086 			return KErrGeneral;
       
  4087 		}
       
  4088 }
       
  4089 
       
  4090 // -----------------------------------------------------------------------------
       
  4091 // CTelepathyGabbleTest::RemoveInvalidContactTestL
       
  4092 // Test for removing invalid userid
       
  4093 // -----------------------------------------------------------------------------
       
  4094 
       
  4095 TInt CTelepathyGabbleTest::RemoveInvalidContactTestL( 
       
  4096     CStifItemParser& aItem  )
       
  4097     
       
  4098 {	
       
  4099 	TInt err = RemoveContactTestL(aItem);
       
  4100 	if ( err == KErrGeneral
       
  4101 	 				&&	 iTestData->GetAddDeleteContactStatus() == CTestData::EDELETE_FAIL )
       
  4102 	{
       
  4103 		// This is correct, since the contact_id was invalid
       
  4104 		return KErrNone;
       
  4105 	}
       
  4106 	
       
  4107 	return KErrGeneral;
       
  4108 	
       
  4109 }
       
  4110   
       
  4111 // -----------------------------------------------------------------------------
       
  4112 // CTelepathyGabbleTest::FetchContactsTestL
       
  4113 // Test for fetching contacts
       
  4114 // -----------------------------------------------------------------------------
       
  4115 
       
  4116 TInt CTelepathyGabbleTest::FetchContactsTestL( 
       
  4117     CStifItemParser& aItem  )
       
  4118 {
       
  4119 	  TInt return_value = KErrNone;
       
  4120 	  //Pass the parameters to action_login() from the 
       
  4121 		//data mentioned in the cfg file.
       
  4122 		
       
  4123 		ConnectData  *connect_data = NULL;
       
  4124 		
       
  4125 		if ( read_data ( connect_data, aItem, iLog ) != RC_OK )
       
  4126 		{
       
  4127 			free_data (connect_data, iLog );
       
  4128 			return KErrGeneral;
       
  4129 		}
       
  4130 		
       
  4131 
       
  4132 		char *username, *passwd , *servername , *resource_login,*ssl_flag, *port;
       
  4133 		char *proxy_server = NULL;
       
  4134 		char *proxy_port = NULL;
       
  4135 		
       
  4136 		
       
  4137 		username = 	connect_data->username;
       
  4138 		passwd   =  connect_data->password;
       
  4139 		servername = 	connect_data->server;
       
  4140 		resource_login = connect_data->resource;
       
  4141 		ssl_flag = connect_data->ssl_flag;
       
  4142 		port = connect_data->port;
       
  4143 		#ifdef __WINSCW__
       
  4144 	  		proxy_server = connect_data->proxy_data->proxy_server;
       
  4145 			proxy_port = connect_data->proxy_data->proxy_port;
       
  4146 		#endif
       
  4147 		
       
  4148 		
       
  4149 		iTestData = CTestData::NewL(iLog);
       
  4150 	
       
  4151 		iLoginObj = CTelepathyGabbleLoginTest::NewL();
       
  4152 			
       
  4153 		//action_login will have parameters 
       
  4154 		//passed from cfg file
       
  4155 		TInt login_status = 
       
  4156 					iLoginObj->action_login(username,passwd,
       
  4157 											servername, resource_login,ssl_flag,
       
  4158 											port,proxy_server, proxy_port,
       
  4159 											iTestData);
       
  4160 		
       
  4161 		if (login_status == CTestData::ECONNECTED)
       
  4162 		{
       
  4163 		
       
  4164 		  	//if successfully logged in
       
  4165 		  	//fetch the contacts
       
  4166 		  
       
  4167 		  	iFetchContactObj = CTelepathyGabbleFetchContacts::NewL();
       
  4168 		  						
       
  4169 			return_value = iFetchContactObj->test_request_roster( iTestData );
       
  4170 			
       
  4171 			//Do the logout and the cleanup.
       
  4172 			login_status = iLoginObj->action_logout(iTestData);
       
  4173 			if (login_status != CTestData::EDISCONNECTED)
       
  4174 				{
       
  4175 				 	return_value = KErrGeneral; //there was error in logout
       
  4176 				}
       
  4177 		 
       
  4178 		}
       
  4179 		else
       
  4180 		{
       
  4181 			return_value = KErrGeneral; //login didn't happen successfully
       
  4182 		}
       
  4183 		
       
  4184 		free_data (connect_data, iLog );
       
  4185 		return return_value;
       
  4186 			
       
  4187 }
       
  4188 
       
  4189 
       
  4190 // -----------------------------------------------------------------------------
       
  4191 // CTelepathyGabbleTest::SearchTwiceTestL
       
  4192 // -----------------------------------------------------------------------------
       
  4193 
       
  4194 TInt CTelepathyGabbleTest::SearchTwiceTestL( CStifItemParser& aItem  )
       
  4195 	{
       
  4196 		TInt return_value = KErrNone;
       
  4197 		//Pass the parameters to action_login() from the 
       
  4198 		//data mentioned in the cfg file.
       
  4199 		
       
  4200 		//step 1: Do the login.
       
  4201 		ConnectData  *connect_data = NULL;
       
  4202 		
       
  4203 		if ( read_data ( connect_data, aItem, iLog ) != RC_OK )
       
  4204 		{
       
  4205 			free_data ( connect_data, iLog );
       
  4206 			return KErrGeneral;
       
  4207 		}
       
  4208 		
       
  4209 
       
  4210 		//for login
       
  4211 		char *username, *passwd , *servername , *resource_login, *ssl_flag, *port;
       
  4212 		char *proxy_server = NULL;
       
  4213 		char *proxy_port = NULL;
       
  4214 		
       
  4215 	
       
  4216 		username = 	connect_data->username;
       
  4217 		passwd   =  connect_data->password;
       
  4218 		servername = 	connect_data->server;
       
  4219 		resource_login = connect_data->resource;
       
  4220 		ssl_flag = connect_data->ssl_flag;
       
  4221 		port = connect_data->port;
       
  4222 		#ifdef __WINSCW__
       
  4223 	  		proxy_server = connect_data->proxy_data->proxy_server;
       
  4224 			proxy_port = connect_data->proxy_data->proxy_port;
       
  4225 		#endif
       
  4226 		
       
  4227 
       
  4228 		if (iTestData == NULL)
       
  4229 		{
       
  4230 			//Create the iTestData if it is not existing.
       
  4231 			
       
  4232 			iTestData = CTestData::NewL(iLog);
       
  4233 		}
       
  4234 		iTestData->SetTestType(CTestData::ESearch);
       
  4235 		//Create the login object
       
  4236 		iLoginObj = CTelepathyGabbleLoginTest::NewL();
       
  4237 		
       
  4238 		//action_login will have parameters 
       
  4239 		//passed from cfg file
       
  4240 		
       
  4241 		TInt login_status = 
       
  4242 			iLoginObj->action_login(username,passwd,servername, 
       
  4243 									resource_login,ssl_flag,
       
  4244 									port,proxy_server, proxy_port,
       
  4245 									iTestData );
       
  4246 		
       
  4247 		if (login_status == CTestData::ECONNECTED)
       
  4248 		{
       
  4249 			//login was successful
       
  4250 			
       
  4251 			GHashTable *data_to_search = NULL;
       
  4252 			
       
  4253 			GValue *gvalue = NULL;
       
  4254 		
       
  4255 			char *key, *value;
       
  4256 			
       
  4257 			key = connect_data->msg_data->recipient;
       
  4258 			value = connect_data->msg_data->message;
       
  4259 			
       
  4260 			data_to_search = g_hash_table_new(g_str_hash,g_str_equal);	
       
  4261 			
       
  4262 			gvalue = g_new0(GValue, 1);	
       
  4263 		
       
  4264 					 
       
  4265 			g_value_init(gvalue, G_TYPE_STRING);
       
  4266 			g_value_set_string (gvalue, value );
       
  4267 			g_hash_table_insert( data_to_search, GetSearchLabelL(servername,key), gvalue);			      
       
  4268 			
       
  4269 		
       
  4270 
       
  4271 			//Create the Object of Send Message class
       
  4272 			iSearchObj = CTelepathyGabbleSearch::NewL();	
       
  4273 			
       
  4274 					
       
  4275 			//call the SendMessage test case	
       
  4276 			TInt search_state = iSearchObj->SearchL(data_to_search, iTestData);
       
  4277 			
       
  4278 			if( search_state == CTestData::ESearchError )
       
  4279 				{
       
  4280 					return_value = KErrGeneral; //Error in Searching
       
  4281 				}
       
  4282 			else if( search_state == CTestData::ESearchCompleted) 
       
  4283 				{
       
  4284 					search_state = iSearchObj->SearchL(data_to_search, iTestData);
       
  4285 					if( search_state == CTestData::ESearchError )
       
  4286 						{
       
  4287 						return_value = KErrGeneral; //Error in Searching	
       
  4288 						}
       
  4289 					//return_value = KErrNone; 
       
  4290 				}
       
  4291 			
       
  4292 			iSearchObj->CloseChannel(iTestData);
       
  4293 			//Do the logout
       
  4294 			login_status = iLoginObj->action_logout(iTestData);
       
  4295 
       
  4296 			if (login_status != CTestData::EDISCONNECTED)
       
  4297 				{
       
  4298 					//logout didnot happen successfully
       
  4299 					return_value = KErrGeneral;
       
  4300 				}
       
  4301 			
       
  4302 			//do this later	
       
  4303 		   	/*g_hash_table_foreach_remove ( data_to_search, 
       
  4304 					search_hash_remove, NULL );*/
       
  4305 		
       
  4306 			//Free the hash table itself
       
  4307 			g_hash_table_destroy ( data_to_search );
       
  4308 		
       
  4309 		}
       
  4310 		else
       
  4311 		{
       
  4312 			//Login itself didnot happen.
       
  4313 			return_value =  KErrGeneral;
       
  4314 		}		
       
  4315 		
       
  4316 		free_data ( connect_data, iLog );	
       
  4317 		return return_value;
       
  4318 	}
       
  4319 	
       
  4320 
       
  4321 
       
  4322 // -----------------------------------------------------------------------------
       
  4323 // CTelepathyGabbleTest::SearchFiveTimesTestL
       
  4324 // -----------------------------------------------------------------------------
       
  4325 
       
  4326 TInt CTelepathyGabbleTest::SearchFiveTimesTestL( CStifItemParser& aItem  )
       
  4327 	{
       
  4328 		TInt return_value = KErrNone;
       
  4329 		//Pass the parameters to action_login() from the 
       
  4330 		//data mentioned in the cfg file.
       
  4331 		
       
  4332 		//step 1: Do the login.
       
  4333 		ConnectData  *connect_data = NULL;
       
  4334 		
       
  4335 		if ( read_data ( connect_data, aItem, iLog ) != RC_OK )
       
  4336 		{
       
  4337 			free_data ( connect_data, iLog );
       
  4338 			return KErrGeneral;
       
  4339 		}
       
  4340 		
       
  4341 
       
  4342 		//for login
       
  4343 		char *username, *passwd , *servername , *resource_login, *ssl_flag, *port;
       
  4344 		char *proxy_server = NULL;
       
  4345 		char *proxy_port = NULL;
       
  4346 		
       
  4347 	
       
  4348 		username = 	connect_data->username;
       
  4349 		passwd   =  connect_data->password;
       
  4350 		servername = 	connect_data->server;
       
  4351 		resource_login = connect_data->resource;
       
  4352 		ssl_flag = connect_data->ssl_flag;
       
  4353 		port = connect_data->port;
       
  4354 		#ifdef __WINSCW__
       
  4355 	  		proxy_server = connect_data->proxy_data->proxy_server;
       
  4356 			proxy_port = connect_data->proxy_data->proxy_port;
       
  4357 		#endif
       
  4358 		
       
  4359 
       
  4360 		if (iTestData == NULL)
       
  4361 		{
       
  4362 			//Create the iTestData if it is not existing.
       
  4363 			
       
  4364 			iTestData = CTestData::NewL(iLog);
       
  4365 		}
       
  4366 		iTestData->SetTestType(CTestData::ESearch);
       
  4367 		//Create the login object
       
  4368 		iLoginObj = CTelepathyGabbleLoginTest::NewL();
       
  4369 		
       
  4370 		//action_login will have parameters 
       
  4371 		//passed from cfg file
       
  4372 		
       
  4373 		TInt login_status = 
       
  4374 			iLoginObj->action_login(username,passwd,servername, 
       
  4375 									resource_login,ssl_flag,
       
  4376 									port,proxy_server, proxy_port,
       
  4377 									iTestData );
       
  4378 		
       
  4379 		if (login_status == CTestData::ECONNECTED)
       
  4380 		{
       
  4381 			//login was successful
       
  4382 			
       
  4383 			GHashTable *data_to_search = NULL;
       
  4384 			
       
  4385 			GValue *gvalue = NULL;
       
  4386 		
       
  4387 			char *key, *value;
       
  4388 			
       
  4389 			key = connect_data->msg_data->recipient;
       
  4390 			value = connect_data->msg_data->message;
       
  4391 			
       
  4392 			data_to_search = g_hash_table_new(g_str_hash,g_str_equal);	
       
  4393 			
       
  4394 			gvalue = g_new0(GValue, 1);	
       
  4395 		
       
  4396 					 
       
  4397 			g_value_init(gvalue, G_TYPE_STRING);
       
  4398 			g_value_set_string (gvalue, value );
       
  4399 			g_hash_table_insert( data_to_search, GetSearchLabelL(servername,key), gvalue);			      
       
  4400 			
       
  4401 		
       
  4402 
       
  4403 			//Create the Object of Send Message class
       
  4404 			iSearchObj = CTelepathyGabbleSearch::NewL();	
       
  4405 			
       
  4406 			TInt search_state;	
       
  4407 				
       
  4408 			for(TInt i = 0; i<5 ;i++ )
       
  4409 				{
       
  4410 					search_state = iSearchObj->SearchL(data_to_search, iTestData);
       
  4411 					if( search_state == CTestData::ESearchError )
       
  4412 						{
       
  4413 						return_value = KErrGeneral; //Error in Searching
       
  4414 						break;	
       
  4415 						}
       
  4416 				}
       
  4417 			iSearchObj->CloseChannel(iTestData);
       
  4418 			//Do the logout
       
  4419 			login_status = iLoginObj->action_logout(iTestData);
       
  4420 
       
  4421 			if (login_status != CTestData::EDISCONNECTED)
       
  4422 				{
       
  4423 					//logout didnot happen successfully
       
  4424 					return_value = KErrGeneral;
       
  4425 				}
       
  4426 			
       
  4427 			//do this later	
       
  4428 		   	/*g_hash_table_foreach_remove ( data_to_search, 
       
  4429 					search_hash_remove, NULL );*/
       
  4430 		
       
  4431 			//Free the hash table itself
       
  4432 			g_hash_table_destroy ( data_to_search );
       
  4433 		
       
  4434 		}
       
  4435 		else
       
  4436 		{
       
  4437 			//Login itself didnot happen.
       
  4438 			return_value =  KErrGeneral;
       
  4439 		}		
       
  4440 		
       
  4441 		free_data ( connect_data, iLog );	
       
  4442 		return return_value;
       
  4443 	}
       
  4444 	
       
  4445 
       
  4446 
       
  4447 // -----------------------------------------------------------------------------
       
  4448 // CTelepathyGabbleTest::GetSearchLabelForYukonL
       
  4449 // -----------------------------------------------------------------------------
       
  4450 gchar* CTelepathyGabbleTest::GetSearchLabelForYukonL(gchar *search_key)
       
  4451 {
       
  4452 if(strcmp(search_key,"user") == 0)
       
  4453 	{
       
  4454 	gchar* label= "User";
       
  4455 	return label;	
       
  4456 	}
       
  4457 else if(strcmp(search_key,"fn") == 0)
       
  4458 	{
       
  4459 	gchar* label= "Full Name";
       
  4460 	return label;	
       
  4461 	}	
       
  4462 else if(strcmp(search_key,"first") == 0)
       
  4463 	{
       
  4464 	gchar* label= "Name";
       
  4465 	return label;	
       
  4466 	}	
       
  4467 else if(strcmp(search_key,"middle") == 0)
       
  4468 	{
       
  4469 	gchar* label= "Middle Name";
       
  4470 	return label;	
       
  4471 	}		
       
  4472 else if(strcmp(search_key,"last") == 0)
       
  4473 	{
       
  4474 	gchar* label= "Family Name";
       
  4475 	return label;	
       
  4476 	}
       
  4477 else if(strcmp(search_key,"nick") == 0)
       
  4478 	{
       
  4479 	gchar* label= "Nickname";
       
  4480 	return label;	
       
  4481 	}
       
  4482 else if(strcmp(search_key,"email") == 0)
       
  4483 	{
       
  4484 	gchar* label= "Email";
       
  4485 	return label;	
       
  4486 	}	
       
  4487 else if(strcmp(search_key,"bday") == 0)
       
  4488 	{
       
  4489 	gchar* label= "Birthday";
       
  4490 	return label;	
       
  4491 	}	
       
  4492 else if(strcmp(search_key,"ctry") == 0)
       
  4493 	{
       
  4494 	gchar* label= "Country";
       
  4495 	return label;	
       
  4496 	}		
       
  4497 else if(strcmp(search_key,"orgname") == 0)
       
  4498 	{
       
  4499 	gchar* label= "Organization Name";
       
  4500 	return label;	
       
  4501 	}
       
  4502 else if(strcmp(search_key,"locality") == 0)
       
  4503 	{
       
  4504 	gchar* label= "City";
       
  4505 	return label;	
       
  4506 	}
       
  4507 else if(strcmp(search_key,"orgunit") == 0)
       
  4508 	{
       
  4509 	gchar* label= "Organization Unit";
       
  4510 	return label;	
       
  4511 	}			
       
  4512 }
       
  4513 
       
  4514 
       
  4515 // -----------------------------------------------------------------------------
       
  4516 // CTelepathyGabbleTest::GetSearchLabelForGizmoL
       
  4517 // -----------------------------------------------------------------------------
       
  4518 gchar* CTelepathyGabbleTest::GetSearchLabelForGizmoL(gchar *search_key)
       
  4519 {
       
  4520 if(strcmp(search_key,"xmpp_user") == 0)
       
  4521 	{
       
  4522 	gchar* label= "Account Name";
       
  4523 	return label;	
       
  4524 	}
       
  4525 else if(strcmp(search_key,"email_address") == 0)
       
  4526 	{
       
  4527 	gchar* label= "Email Address";
       
  4528 	return label;	
       
  4529 	}	
       
  4530 else if(strcmp(search_key,"first_name") == 0)
       
  4531 	{
       
  4532 	gchar* label= "First Name";
       
  4533 	return label;	
       
  4534 	}	
       
  4535 else if(strcmp(search_key,"last_name") == 0)
       
  4536 	{
       
  4537 	gchar* label= "Family Name";
       
  4538 	return label;	
       
  4539 	}
       
  4540 else if(strcmp(search_key,"country") == 0)
       
  4541 	{
       
  4542 	gchar* label= "Country";
       
  4543 	return label;	
       
  4544 	}		
       
  4545 else if(strcmp(search_key,"state") == 0)
       
  4546 	{
       
  4547 	gchar* label= "State/Province";
       
  4548 	return label;	
       
  4549 	}
       
  4550 else if(strcmp(search_key,"city") == 0)
       
  4551 	{
       
  4552 	gchar* label= "City";
       
  4553 	return label;	
       
  4554 	}
       
  4555 else if(strcmp(search_key,"max_results") == 0)
       
  4556 	{
       
  4557 	gchar* label= "Maximum # of Results";
       
  4558 	return label;	
       
  4559 	}			
       
  4560 }
       
  4561 
       
  4562 // -----------------------------------------------------------------------------
       
  4563 // CTelepathyGabbleTest::GetSearchLabelL
       
  4564 // -----------------------------------------------------------------------------
       
  4565 gchar* CTelepathyGabbleTest::GetSearchLabelL(gchar* aService,gchar* aSearchKey)
       
  4566 {
       
  4567 if(strcmp(aService,"chat.gizmoproject.com") == 0)
       
  4568 	{
       
  4569 	GetSearchLabelForGizmoL(aSearchKey);	
       
  4570 	}
       
  4571 else if(strcmp(aService,"chat.ovi.com") == 0 )
       
  4572 	{
       
  4573 	GetSearchLabelForYukonL(aSearchKey);	
       
  4574 	}
       
  4575 }
       
  4576 	
       
  4577   	
       
  4578 
       
  4579 /** 
       
  4580 * Free function for the  hash key/value pairs
       
  4581 */
       
  4582 /*gboolean search_hash_remove( gpointer key, gpointer value,
       
  4583                       gpointer user_data ) 
       
  4584 	{
       
  4585 
       
  4586 	//Free function for the  hash values
       
  4587 	if ( key ) 
       
  4588 		{
       
  4589 		free( key );
       
  4590 		}
       
  4591 	if ( value ) 
       
  4592 		{
       
  4593 		free ( value );
       
  4594 		}
       
  4595 	
       
  4596 	return TRUE;
       
  4597 	}
       
  4598 */
       
  4599 //End of File