• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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
3 // found in the LICENSE file.
4 
5 #ifndef JINGLE_NOTIFIER_LISTENER_NOTIFICATION_DEFINES_H_
6 #define JINGLE_NOTIFIER_LISTENER_NOTIFICATION_DEFINES_H_
7 
8 #include <string>
9 #include <vector>
10 
11 namespace notifier {
12 
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
19   // a URL.
20   std::string channel;
21   // A sender, which could be a domain or a bare JID, from which we
22   // will accept pushes.
23   std::string from;
24 };
25 
26 typedef std::vector<Subscription> SubscriptionList;
27 
28 bool SubscriptionListsEqual(const SubscriptionList& subscriptions1,
29                             const SubscriptionList& subscriptions2);
30 
31 // A structure representing a <recipient/> block within a push message.
32 struct Recipient {
33   Recipient();
34   ~Recipient();
35   bool Equals(const Recipient& other) const;
36 
37   // The bare jid of the recipient.
38   std::string to;
39   // User-specific data for the recipient.
40   std::string user_specific_data;
41 };
42 
43 typedef std::vector<Recipient> RecipientList;
44 
45 bool RecipientListsEqual(const RecipientList& recipients1,
46                          const RecipientList& recipients2);
47 
48 struct Notification {
49   Notification();
50   ~Notification();
51 
52   // The channel the notification is coming in on.
53   std::string channel;
54   // Recipients for this notification (may be empty).
55   RecipientList recipients;
56   // The notification data payload.
57   std::string data;
58 
59   bool Equals(const Notification& other) const;
60   std::string ToString() const;
61 };
62 
63 }  // namespace notifier
64 
65 #endif  // JINGLE_NOTIFIER_LISTENER_NOTIFICATION_DEFINES_H_
66