OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #ifndef JINGLE_NOTIFIER_LISTENER_NOTIFICATION_DEFINES_H_ | 5 #ifndef JINGLE_NOTIFIER_LISTENER_NOTIFICATION_DEFINES_H_ |
6 #define JINGLE_NOTIFIER_LISTENER_NOTIFICATION_DEFINES_H_ | 6 #define JINGLE_NOTIFIER_LISTENER_NOTIFICATION_DEFINES_H_ |
7 | 7 |
8 #include <string> | 8 #include <string> |
9 #include <vector> | 9 #include <vector> |
10 | 10 |
11 namespace notifier { | 11 namespace notifier { |
12 | 12 |
13 struct Subscription { | 13 struct Subscription { |
| 14 Subscription(); |
| 15 ~Subscription(); |
| 16 bool Equals(const Subscription& other) const; |
| 17 |
14 // The name of the channel to subscribe to; usually but not always | 18 // The name of the channel to subscribe to; usually but not always |
15 // a URL. | 19 // a URL. |
16 std::string channel; | 20 std::string channel; |
17 // A sender, which could be a domain or a bare JID, from which we | 21 // A sender, which could be a domain or a bare JID, from which we |
18 // will accept pushes. | 22 // will accept pushes. |
19 std::string from; | 23 std::string from; |
20 }; | 24 }; |
21 | 25 |
22 typedef std::vector<Subscription> SubscriptionList; | 26 typedef std::vector<Subscription> SubscriptionList; |
23 | 27 |
| 28 bool SubscriptionListsEqual(const SubscriptionList& subscriptions1, |
| 29 const SubscriptionList& subscriptions2); |
| 30 |
24 // A structure representing a <recipient/> block within a push message. | 31 // A structure representing a <recipient/> block within a push message. |
25 struct Recipient { | 32 struct Recipient { |
| 33 Recipient(); |
| 34 ~Recipient(); |
| 35 bool Equals(const Recipient& other) const; |
| 36 |
26 // The bare jid of the recipient. | 37 // The bare jid of the recipient. |
27 std::string to; | 38 std::string to; |
28 // User-specific data for the recipient. | 39 // User-specific data for the recipient. |
29 std::string user_specific_data; | 40 std::string user_specific_data; |
30 }; | 41 }; |
31 | 42 |
32 typedef std::vector<Recipient> RecipientList; | 43 typedef std::vector<Recipient> RecipientList; |
33 | 44 |
| 45 bool RecipientListsEqual(const RecipientList& recipients1, |
| 46 const RecipientList& recipients2); |
| 47 |
34 struct Notification { | 48 struct Notification { |
35 Notification(); | 49 Notification(); |
36 ~Notification(); | 50 ~Notification(); |
37 | 51 |
38 // The channel the notification is coming in on. | 52 // The channel the notification is coming in on. |
39 std::string channel; | 53 std::string channel; |
40 // Recipients for this notification (may be empty). | 54 // Recipients for this notification (may be empty). |
41 RecipientList recipients; | 55 RecipientList recipients; |
42 // The notification data payload. | 56 // The notification data payload. |
43 std::string data; | 57 std::string data; |
44 | 58 |
| 59 bool Equals(const Notification& other) const; |
45 std::string ToString() const; | 60 std::string ToString() const; |
46 }; | 61 }; |
47 | 62 |
48 } // namespace notifier | 63 } // namespace notifier |
49 | 64 |
50 #endif // JINGLE_NOTIFIER_LISTENER_NOTIFICATION_DEFINES_H_ | 65 #endif // JINGLE_NOTIFIER_LISTENER_NOTIFICATION_DEFINES_H_ |
OLD | NEW |