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 | |
18 // The name of the channel to subscribe to; usually but not always | 14 // The name of the channel to subscribe to; usually but not always |
19 // a URL. | 15 // a URL. |
20 std::string channel; | 16 std::string channel; |
21 // A sender, which could be a domain or a bare JID, from which we | 17 // A sender, which could be a domain or a bare JID, from which we |
22 // will accept pushes. | 18 // will accept pushes. |
23 std::string from; | 19 std::string from; |
24 }; | 20 }; |
25 | 21 |
26 typedef std::vector<Subscription> SubscriptionList; | 22 typedef std::vector<Subscription> SubscriptionList; |
27 | 23 |
28 bool SubscriptionListsEqual(const SubscriptionList& subscriptions1, | |
29 const SubscriptionList& subscriptions2); | |
30 | |
31 // A structure representing a <recipient/> block within a push message. | 24 // A structure representing a <recipient/> block within a push message. |
32 struct Recipient { | 25 struct Recipient { |
33 Recipient(); | |
34 ~Recipient(); | |
35 bool Equals(const Recipient& other) const; | |
36 | |
37 // The bare jid of the recipient. | 26 // The bare jid of the recipient. |
38 std::string to; | 27 std::string to; |
39 // User-specific data for the recipient. | 28 // User-specific data for the recipient. |
40 std::string user_specific_data; | 29 std::string user_specific_data; |
41 }; | 30 }; |
42 | 31 |
43 typedef std::vector<Recipient> RecipientList; | 32 typedef std::vector<Recipient> RecipientList; |
44 | 33 |
45 bool RecipientListsEqual(const RecipientList& recipients1, | |
46 const RecipientList& recipients2); | |
47 | |
48 struct Notification { | 34 struct Notification { |
49 Notification(); | 35 Notification(); |
50 ~Notification(); | 36 ~Notification(); |
51 | 37 |
52 // The channel the notification is coming in on. | 38 // The channel the notification is coming in on. |
53 std::string channel; | 39 std::string channel; |
54 // Recipients for this notification (may be empty). | 40 // Recipients for this notification (may be empty). |
55 RecipientList recipients; | 41 RecipientList recipients; |
56 // The notification data payload. | 42 // The notification data payload. |
57 std::string data; | 43 std::string data; |
58 | 44 |
59 bool Equals(const Notification& other) const; | |
60 std::string ToString() const; | 45 std::string ToString() const; |
61 }; | 46 }; |
62 | 47 |
63 } // namespace notifier | 48 } // namespace notifier |
64 | 49 |
65 #endif // JINGLE_NOTIFIER_LISTENER_NOTIFICATION_DEFINES_H_ | 50 #endif // JINGLE_NOTIFIER_LISTENER_NOTIFICATION_DEFINES_H_ |
OLD | NEW |