pushmtm/Plugins/PushContentHandler/CSLContentHandler.cpp
branchRCL_3
changeset 48 5c11946e75b3
parent 32 92a061761a7b
equal deleted inserted replaced
46:5dedbccec665 48:5c11946e75b3
    40 #include <nw_dom_document.h>
    40 #include <nw_dom_document.h>
    41 #include <nw_dom_element.h>
    41 #include <nw_dom_element.h>
    42 #include <nw_dom_text.h>
    42 #include <nw_dom_text.h>
    43 #include <nw_wbxml_dictionary.h>
    43 #include <nw_wbxml_dictionary.h>
    44 #include <nw_string_char.h>
    44 #include <nw_string_char.h>
       
    45 #include "PushMtmPrivateCRKeys.h"
       
    46 #include <centralrepository.h> 
    45 
    47 
    46 // CONSTANTS
    48 // CONSTANTS
    47 
    49 
    48 // sl attributes / elements
    50 // sl attributes / elements
    49 _LIT8( KSl,      "sl" );
    51 _LIT8( KSl,      "sl" );
   117 // ---------------------------------------------------------
   119 // ---------------------------------------------------------
   118 //
   120 //
   119 void CSLContentHandler::ConstructL()
   121 void CSLContentHandler::ConstructL()
   120 	{
   122 	{
   121     PUSHLOG_ENTERFN("CSLContentHandler::ConstructL")
   123     PUSHLOG_ENTERFN("CSLContentHandler::ConstructL")
   122 
   124     
       
   125     CRepository* PushSL = CRepository::NewL( KCRUidPushMtm );
       
   126     CleanupStack::PushL( PushSL );
       
   127     User::LeaveIfError( PushSL->Get( KPushMtmServiceEnabled , iPushSLEnabled ) );
       
   128     CleanupStack::PopAndDestroy( PushSL ); 
       
   129     
   123     CPushContentHandlerBase::ConstructL();
   130     CPushContentHandlerBase::ConstructL();
   124     // Added to Active Scheduler.
   131     // Added to Active Scheduler.
   125 
       
   126     PUSHLOG_LEAVEFN("CSLContentHandler::ConstructL")
   132     PUSHLOG_LEAVEFN("CSLContentHandler::ConstructL")
   127     }
   133     }
   128 
   134 
   129 // ---------------------------------------------------------
   135 // ---------------------------------------------------------
   130 // CSLContentHandler::CollectGarbageL
   136 // CSLContentHandler::CollectGarbageL
   134 	{
   140 	{
   135     PUSHLOG_ENTERFN("CSLContentHandler::CollectGarbageL")
   141     PUSHLOG_ENTERFN("CSLContentHandler::CollectGarbageL")
   136 
   142 
   137     DoCollectGarbageL();
   143     DoCollectGarbageL();
   138 
   144 
   139 #ifdef __SERIES60_PUSH_SL
   145 	if(iPushSLEnabled)
   140 	iState = EFilteringAndParsing;
   146 	    iState = EFilteringAndParsing;
   141 #else // __SERIES60_PUSH_SL
   147 	else
   142     // Do nothing - message is discarded.
   148 	    iState = EDone;
   143 	iState = EDone;
   149 	
   144 #endif // __SERIES60_PUSH_SL
       
   145 	IdleComplete();
   150 	IdleComplete();
   146 
   151 
   147     PUSHLOG_LEAVEFN("CSLContentHandler::CollectGarbageL")
   152     PUSHLOG_LEAVEFN("CSLContentHandler::CollectGarbageL")
   148     }
   153     }
   149 
   154 
   150 #ifdef __SERIES60_PUSH_SL
       
   151 
   155 
   152 // ---------------------------------------------------------
   156 // ---------------------------------------------------------
   153 // CSLContentHandler::ParsePushMsgL
   157 // CSLContentHandler::ParsePushMsgL
   154 // Note that cXML parser dosn't do any validation!
   158 // Note that cXML parser dosn't do any validation!
   155 // ---------------------------------------------------------
   159 // ---------------------------------------------------------
  1013 	CleanupStack::PopAndDestroy( slEntry ); // slEntry
  1017 	CleanupStack::PopAndDestroy( slEntry ); // slEntry
  1014 
  1018 
  1015     PUSHLOG_LEAVEFN("CSLContentHandler::StoreSLMessageL")
  1019     PUSHLOG_LEAVEFN("CSLContentHandler::StoreSLMessageL")
  1016 	}
  1020 	}
  1017 
  1021 
  1018 #endif // __SERIES60_PUSH_SL
       
  1019 
  1022 
  1020 // ---------------------------------------------------------
  1023 // ---------------------------------------------------------
  1021 // CSLContentHandler::HandleMessageL
  1024 // CSLContentHandler::HandleMessageL
  1022 // ---------------------------------------------------------
  1025 // ---------------------------------------------------------
  1023 //
  1026 //
  1125             {
  1128             {
  1126 		    CollectGarbageL();
  1129 		    CollectGarbageL();
  1127 		    break;
  1130 		    break;
  1128             }
  1131             }
  1129 
  1132 
  1130 #ifdef __SERIES60_PUSH_SL
       
  1131 
  1133 
  1132         case EFilteringAndParsing:
  1134         case EFilteringAndParsing:
  1133             {
  1135             {
  1134             if ( !FilterPushMsgL() )
  1136             if(iPushSLEnabled)
  1135                 {
  1137                 {
  1136                 // It did not pass the filter. Done.
  1138                 if ( !FilterPushMsgL() )
  1137 	            iState = EDone;
  1139                     {
  1138 	            IdleComplete();
  1140                     // It did not pass the filter. Done.
  1139                 }
  1141                     iState = EDone;
  1140             else
  1142                     IdleComplete();
  1141                 {
  1143                     }
  1142                 // Continue.
  1144                 else
  1143 		        TInt ret = KErrNone;
  1145                     {
  1144 				PUSHLOG_WRITE("CSLContentHandler::RunL : before trapping parsing.")
  1146                     // Continue.
  1145 				TRAP(ret, ParsePushMsgL());
  1147                     TInt ret = KErrNone;
  1146 				PUSHLOG_WRITE_FORMAT("CSLContentHandler::RunL : after trapping parsing. ret = %d", ret)
  1148                     PUSHLOG_WRITE("CSLContentHandler::RunL : before trapping parsing.")
  1147 				if ( ret != KErrNone)
  1149                     TRAP(ret, ParsePushMsgL());
  1148 					{
  1150                     PUSHLOG_WRITE_FORMAT("CSLContentHandler::RunL : after trapping parsing. ret = %d", ret)
  1149 					PUSHLOG_WRITE("CSLContentHandler::RunL : Parsing failed. discarding message.")
  1151                     if ( ret != KErrNone)
  1150 					iState = EDone;
  1152                         {
  1151 					IdleComplete();
  1153                         PUSHLOG_WRITE("CSLContentHandler::RunL : Parsing failed. discarding message.")
  1152 					}
  1154                         iState = EDone;
       
  1155                         IdleComplete();
       
  1156                         }
       
  1157                     }
  1153                 }
  1158                 }
  1154 			break;
  1159 			break;
  1155             }
  1160             }
  1156 
  1161 
  1157         case EProcessing:
  1162         case EProcessing:
  1158             {
  1163             {
       
  1164             if(iPushSLEnabled)
  1159 			ProcessingPushMsgEntryL();
  1165 			ProcessingPushMsgEntryL();
  1160 			break;
  1166 			break;
  1161             }
  1167             }
  1162 
  1168 
  1163 		case EFetching:
  1169 		case EFetching:
  1164             {
  1170             {
       
  1171             if(iPushSLEnabled)
  1165 			FetchPushMsgEntryL();
  1172 			FetchPushMsgEntryL();
  1166 			break;
  1173 			break;
  1167             }
  1174             }
  1168 
  1175 
  1169 		case EFetchCompleted:
  1176 		case EFetchCompleted:
  1170             {
  1177             {
       
  1178             if(iPushSLEnabled)
  1171 			FetchCompletedL();
  1179 			FetchCompletedL();
  1172 			break;
  1180 			break;
  1173             }
  1181             }
  1174 
  1182 
  1175 		case ESavePushMsgEntry:
  1183 		case ESavePushMsgEntry:
  1176             {
  1184             {
       
  1185             if(iPushSLEnabled)
  1177 			SavePushMsgEntryL();
  1186 			SavePushMsgEntryL();
  1178 			break;
  1187 			break;
  1179             }
  1188             }
  1180 
  1189 
  1181 #endif // __SERIES60_PUSH_SL
       
  1182 
  1190 
  1183         case EDone:
  1191         case EDone:
  1184             {
  1192             {
  1185             PUSHLOG_WRITE("CSLContentHandler EDone")
  1193             PUSHLOG_WRITE("CSLContentHandler EDone")
  1186 			Complete( KErrNone );
  1194 			Complete( KErrNone );