1041 PRINT ( _L("Enter CCsSession::HandleNewConversationEventL") ); |
1041 PRINT ( _L("Enter CCsSession::HandleNewConversationEventL") ); |
1042 |
1042 |
1043 if (!iConversationChangeObserver) |
1043 if (!iConversationChangeObserver) |
1044 return; |
1044 return; |
1045 |
1045 |
1046 if ((aClientConversation->GetContactId() |
1046 //this is check to send notif to clients for a new message |
1047 != iMonitoredConversation->GetContactId()) && |
1047 //1. if the client is subscribed with contact id ==> then send |
1048 (aClientConversation->GetConversationEntryId() |
1048 //2. if the client is subscribed with conv id ---> then send |
1049 != iMonitoredConversation->GetConversationEntryId()) |
1049 // else dont send |
1050 ) |
1050 |
1051 return; |
1051 if ((aClientConversation->GetContactId() == |
1052 |
1052 iMonitoredConversation->GetContactId() && |
1053 if (! (iNotifyHandling)) |
1053 aClientConversation->GetContactId() != -1) |
1054 { |
1054 ||(aClientConversation->GetConversationEntryId() == |
1055 //append in notify list |
1055 iMonitoredConversation->GetConversationEntryId())) |
1056 CCsConversationEvent* conversationEvent = CCsConversationEvent::NewL(); |
1056 { |
1057 CleanupStack::PushL(conversationEvent); |
1057 |
1058 conversationEvent->SetClientConversationL(*aClientConversation); |
1058 if (! (iNotifyHandling)) |
1059 conversationEvent->SetEvent(KConversationEventNew); |
1059 { |
1060 iEventList->AppendL(conversationEvent); |
1060 //append in notify list |
1061 CleanupStack::Pop(conversationEvent); |
1061 CCsConversationEvent* conversationEvent = CCsConversationEvent::NewL(); |
1062 } |
1062 CleanupStack::PushL(conversationEvent); |
1063 else |
1063 conversationEvent->SetClientConversationL(*aClientConversation); |
1064 { |
1064 conversationEvent->SetEvent(KConversationEventNew); |
1065 // create a new buffer for writing into stream |
1065 iEventList->AppendL(conversationEvent); |
1066 CBufFlat* buf = CBufFlat::NewL(KBigBuffer); |
1066 CleanupStack::Pop(conversationEvent); |
1067 CleanupStack::PushL(buf); |
1067 } |
1068 |
1068 else |
1069 RBufWriteStream writeStream(*buf); |
1069 { |
1070 writeStream.PushL(); |
1070 // create a new buffer for writing into stream |
1071 |
1071 CBufFlat* buf = CBufFlat::NewL(KBigBuffer); |
1072 //externalize ClientConversation |
1072 CleanupStack::PushL(buf); |
1073 aClientConversation->ExternalizeL(writeStream); |
1073 |
1074 |
1074 RBufWriteStream writeStream(*buf); |
1075 // Results are already packed in the stream |
1075 writeStream.PushL(); |
1076 writeStream.CommitL(); |
1076 |
1077 // -------------------------------------------------------------- |
1077 //externalize ClientConversation |
1078 |
1078 aClientConversation->ExternalizeL(writeStream); |
1079 // Create a heap descriptor from the buffer |
1079 |
1080 HBufC8* des = HBufC8::NewLC(buf->Size()); |
1080 // Results are already packed in the stream |
1081 CleanupStack::Pop(des); |
1081 writeStream.CommitL(); |
1082 TPtr8 ptr(des->Des()); |
1082 // -------------------------------------------------------------- |
1083 buf->Read(0, ptr, buf->Size()); |
1083 |
1084 |
1084 // Create a heap descriptor from the buffer |
1085 CleanupStack::PopAndDestroy(2, buf); // writestream, buf |
1085 HBufC8* des = HBufC8::NewLC(buf->Size()); |
1086 |
1086 CleanupStack::Pop(des); |
1087 iAsyncReqRMessage.Write(1, *des); |
1087 TPtr8 ptr(des->Des()); |
1088 iAsyncReqRMessage.Complete(EAddConversationEvent); |
1088 buf->Read(0, ptr, buf->Size()); |
1089 delete des; |
1089 |
1090 iNotifyHandling = EFalse; |
1090 CleanupStack::PopAndDestroy(2, buf); // writestream, buf |
1091 } |
1091 |
1092 |
1092 iAsyncReqRMessage.Write(1, *des); |
|
1093 iAsyncReqRMessage.Complete(EAddConversationEvent); |
|
1094 delete des; |
|
1095 iNotifyHandling = EFalse; |
|
1096 } |
|
1097 } |
1093 PRINT ( _L("End CCsSession::HandleNewConversationEventL") ); |
1098 PRINT ( _L("End CCsSession::HandleNewConversationEventL") ); |
1094 } |
1099 } |
1095 |
1100 |
1096 // ---------------------------------------------------------------------------- |
1101 // ---------------------------------------------------------------------------- |
1097 // CCsSession::HandleDeleteConversationEventL |
1102 // CCsSession::HandleDeleteConversationEventL |
1167 PRINT ( _L("Enter CCsSession::HandleModifyConversationEventL") ); |
1172 PRINT ( _L("Enter CCsSession::HandleModifyConversationEventL") ); |
1168 |
1173 |
1169 if (!iConversationChangeObserver) |
1174 if (!iConversationChangeObserver) |
1170 return; |
1175 return; |
1171 |
1176 |
1172 if ((aClientConversation->GetContactId() |
1177 //this is check to send notif to clients for a new message |
1173 != iMonitoredConversation->GetContactId()) && |
1178 //1. if the client is subscribed with contact id ==> then send |
1174 (aClientConversation->GetConversationEntryId() |
1179 //2. if the client is subscribed with conv id ---> then send |
1175 != iMonitoredConversation->GetConversationEntryId()) |
1180 // else dont send |
1176 ) |
1181 |
1177 return; |
1182 if ((aClientConversation->GetContactId() == |
1178 |
1183 iMonitoredConversation->GetContactId() && |
1179 if (! (iNotifyHandling)) |
1184 aClientConversation->GetContactId() != -1) |
1180 { |
1185 ||(aClientConversation->GetConversationEntryId() == |
1181 //append in notify list |
1186 iMonitoredConversation->GetConversationEntryId())) |
1182 CCsConversationEvent* conversationEvent = CCsConversationEvent::NewL(); |
1187 { |
1183 CleanupStack::PushL(conversationEvent); |
1188 |
1184 conversationEvent->SetClientConversationL(*aClientConversation); |
1189 if (! (iNotifyHandling)) |
1185 conversationEvent->SetEvent(KConversationEventUpdate); |
1190 { |
1186 iEventList->AppendL(conversationEvent); |
1191 //append in notify list |
1187 CleanupStack::Pop(conversationEvent); |
1192 CCsConversationEvent* conversationEvent = CCsConversationEvent::NewL(); |
1188 } |
1193 CleanupStack::PushL(conversationEvent); |
1189 else |
1194 conversationEvent->SetClientConversationL(*aClientConversation); |
1190 { |
1195 conversationEvent->SetEvent(KConversationEventUpdate); |
1191 // create a new buffer for writing into stream |
1196 iEventList->AppendL(conversationEvent); |
1192 CBufFlat* buf = CBufFlat::NewL(KBigBuffer); |
1197 CleanupStack::Pop(conversationEvent); |
1193 CleanupStack::PushL(buf); |
1198 } |
1194 |
1199 else |
1195 RBufWriteStream writeStream(*buf); |
1200 { |
1196 writeStream.PushL(); |
1201 // create a new buffer for writing into stream |
1197 |
1202 CBufFlat* buf = CBufFlat::NewL(KBigBuffer); |
1198 //externalize ClientConversation |
1203 CleanupStack::PushL(buf); |
1199 aClientConversation->ExternalizeL(writeStream); |
1204 |
1200 |
1205 RBufWriteStream writeStream(*buf); |
1201 // Results are already packed in the stream |
1206 writeStream.PushL(); |
1202 writeStream.CommitL(); |
1207 |
1203 // -------------------------------------------------------------- |
1208 //externalize ClientConversation |
1204 |
1209 aClientConversation->ExternalizeL(writeStream); |
1205 // Create a heap descriptor from the buffer |
1210 |
1206 HBufC8* des = HBufC8::NewLC(buf->Size()); |
1211 // Results are already packed in the stream |
1207 CleanupStack::Pop(des); |
1212 writeStream.CommitL(); |
1208 TPtr8 ptr(des->Des()); |
1213 // -------------------------------------------------------------- |
1209 buf->Read(0, ptr, buf->Size()); |
1214 |
1210 |
1215 // Create a heap descriptor from the buffer |
1211 CleanupStack::PopAndDestroy(2, buf); // writestream, buf |
1216 HBufC8* des = HBufC8::NewLC(buf->Size()); |
1212 |
1217 CleanupStack::Pop(des); |
1213 iAsyncReqRMessage.Write(1, *des); |
1218 TPtr8 ptr(des->Des()); |
1214 iAsyncReqRMessage.Complete(EModifyConversationEvent); |
1219 buf->Read(0, ptr, buf->Size()); |
1215 delete des; |
1220 |
1216 iNotifyHandling = EFalse; |
1221 CleanupStack::PopAndDestroy(2, buf); // writestream, buf |
1217 } |
1222 |
1218 |
1223 iAsyncReqRMessage.Write(1, *des); |
|
1224 iAsyncReqRMessage.Complete(EModifyConversationEvent); |
|
1225 delete des; |
|
1226 iNotifyHandling = EFalse; |
|
1227 } |
|
1228 } |
1219 PRINT ( _L("End CCsSession::HandleModifyConversationEventL") ); |
1229 PRINT ( _L("End CCsSession::HandleModifyConversationEventL") ); |
1220 } |
1230 } |
1221 |
1231 |
1222 // ---------------------------------------------------------------------------- |
1232 // ---------------------------------------------------------------------------- |
1223 // CCsSession::NotifyClient |
1233 // CCsSession::NotifyClient |