|
1 /** |
|
2 * ==================================================================== |
|
3 * inbox.h |
|
4 * Copyright (c) 2005-2007 Nokia Corporation |
|
5 * |
|
6 * Licensed under the Apache License, Version 2.0 (the "License"); |
|
7 * you may not use this file except in compliance with the License. |
|
8 * You may obtain a copy of the License at |
|
9 * |
|
10 * http://www.apache.org/licenses/LICENSE-2.0 |
|
11 * |
|
12 * Unless required by applicable law or agreed to in writing, software |
|
13 * distributed under the License is distributed on an "AS IS" BASIS, |
|
14 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
|
15 * See the License for the specific language governing permissions and |
|
16 * limitations under the License. |
|
17 * ==================================================================== |
|
18 */ |
|
19 |
|
20 #include "Python.h" |
|
21 |
|
22 #include "symbian_python_ext_util.h" |
|
23 #include <e32std.h> |
|
24 #include <eikenv.h> |
|
25 #include <txtrich.h> |
|
26 |
|
27 #include <mtclbase.h> |
|
28 #include <msvapi.h> |
|
29 #include <mtclreg.h> |
|
30 #include <msvids.h> |
|
31 #include <smut.h> |
|
32 |
|
33 const TInt KMessageBodySize = 512; |
|
34 const TInt KMessageAddressLength = 512; |
|
35 |
|
36 class TPyInbCallBack |
|
37 { |
|
38 public: |
|
39 TInt NewInboxEntryCreated(TInt aArg); |
|
40 public: |
|
41 PyObject* iCb; // Not owned. |
|
42 }; |
|
43 |
|
44 #ifndef EKA2 |
|
45 class CInboxAdapter : public CBase, public MMsvSessionObserver |
|
46 #else |
|
47 NONSHARABLE_CLASS (CInboxAdapter) : public CBase, public MMsvSessionObserver |
|
48 #endif |
|
49 { |
|
50 public: |
|
51 static CInboxAdapter* NewL(TMsvId&); |
|
52 static CInboxAdapter* NewLC(TMsvId&); |
|
53 ~CInboxAdapter(); |
|
54 public: |
|
55 void DeleteMessageL(TMsvId aMessageId); |
|
56 void GetMessageTimeL(TMsvId aMessageId, TTime& aTime); |
|
57 void GetMessageUnreadL(TMsvId aMessageId, TBool& aUnread); |
|
58 void SetMessageUnreadL(TMsvId aMessageId, TBool aStatus); |
|
59 void GetMessageAddressL(TMsvId aMessageId, TDes& aAddress); |
|
60 CArrayFixFlat<TMsvId>* GetMessagesL(); // Passes ownership |
|
61 TBool GetMessageL(TMsvId aMessageId, TDes& aMessage); |
|
62 void SetCallBack(TPyInbCallBack &aCb); |
|
63 private: |
|
64 void ConstructL(); |
|
65 void CompleteConstructL(); |
|
66 private: |
|
67 TPyInbCallBack iCallMe; |
|
68 TInt iErrorState; |
|
69 TBool iCallBackSet; |
|
70 private: // from MMsvSessionObserver |
|
71 void HandleSessionEventL(TMsvSessionEvent aEvent, TAny* aArg1, TAny* aArg2, TAny* aArg3); |
|
72 private: |
|
73 CMsvSession* iSession; // msg server session |
|
74 CBaseMtm* iMtm; // Client MTM |
|
75 CClientMtmRegistry* iMtmReg; // Client MTM registry |
|
76 TMsvId iFolderType; |
|
77 }; |
|
78 |
|
79 //////////////TYPE DEFINITION///////////////// |
|
80 |
|
81 #define INB_type ((PyTypeObject*)SPyGetGlobalString("INBType")) |
|
82 |
|
83 struct INB_object { |
|
84 PyObject_VAR_HEAD |
|
85 CInboxAdapter* inbox; |
|
86 TPyInbCallBack myCallBack; |
|
87 TBool callBackSet; |
|
88 }; |