Merge lp:~verterok/account-polld/handle-account-created into lp:~ubuntu-push-hackers/account-polld/trunk
- handle-account-created
- Merge into trunk
Status: | Rejected |
---|---|
Rejected by: | Guillermo Gonzalez |
Proposed branch: | lp:~verterok/account-polld/handle-account-created |
Merge into: | lp:~ubuntu-push-hackers/account-polld/trunk |
Diff against target: |
423 lines (+174/-69) 6 files modified
accounts/account-watcher.c (+30/-1) accounts/account-watcher.h (+6/-0) accounts/accounts.c (+2/-1) accounts/accounts.go (+36/-14) cmd/account-polld/main.go (+74/-39) po/account-polld.pot (+26/-14) |
To merge this branch: | bzr merge lp:~verterok/account-polld/handle-account-created |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Sergio Schvezov | Approve | ||
PS Jenkins bot | continuous-integration | Approve | |
Review via email: mp+230686@code.launchpad.net |
Commit message
Send a notification when an account is created, which actions is to open the accounts settings page.
Description of the change
Send a notification when an account is created, which actions is to open the accounts settings page (this will be changed when we can open a specific account page)
To test this on the device you will need an updated push-helper, grab this: http://
PS Jenkins bot (ps-jenkins) wrote : | # |
Sergio Schvezov (sergiusens) wrote : | # |
couple of inline comments added; I will test in a bit as well.
Guillermo Gonzalez (verterok) : | # |
- 57. By Guillermo Gonzalez
-
add missing TRANSLATORS comments
- 58. By Guillermo Gonzalez
-
updated translations
Guillermo Gonzalez (verterok) : | # |
PS Jenkins bot (ps-jenkins) wrote : | # |
PASSED: Continuous integration, rev:58
http://
Executed test runs:
SUCCESS: http://
SUCCESS: http://
deb: http://
SUCCESS: http://
Click here to trigger a rebuild:
http://
Sergio Schvezov (sergiusens) wrote : | # |
if I install this, I don't get updates anymore; only an account creation signal
- 59. By Guillermo Gonzalez
-
move mainloop setup into main
- 60. By Guillermo Gonzalez
-
merge with trunk
Guillermo Gonzalez (verterok) wrote : | # |
inline comments regarding the mainloop change.
PS Jenkins bot (ps-jenkins) wrote : | # |
PASSED: Continuous integration, rev:60
http://
Executed test runs:
SUCCESS: http://
SUCCESS: http://
deb: http://
SUCCESS: http://
Click here to trigger a rebuild:
http://
PS Jenkins bot (ps-jenkins) wrote : | # |
PASSED: Continuous integration, rev:60
http://
Executed test runs:
SUCCESS: http://
SUCCESS: http://
deb: http://
SUCCESS: http://
Click here to trigger a rebuild:
http://
Sergio Schvezov (sergiusens) wrote : | # |
[00:28:32] <sergiusens> I do get the message now, what I don't see working is the actual notifications
[00:28:45] <sergiusens> enabling or disabling the toggle does not trigger the poll loop
and two minor inline comments
Sergio Schvezov (sergiusens) wrote : | # |
once more comment
- 61. By Guillermo Gonzalez
-
start the mainlopp in init()
- 62. By Guillermo Gonzalez
-
update notification body
Guillermo Gonzalez (verterok) wrote : | # |
Thanks for the review.
Fixed & pushed the 3 issues, I'll test it once jenkins finishes with the build.
PS Jenkins bot (ps-jenkins) wrote : | # |
PASSED: Continuous integration, rev:62
http://
Executed test runs:
SUCCESS: http://
SUCCESS: http://
deb: http://
SUCCESS: http://
Click here to trigger a rebuild:
http://
- 63. By Guillermo Gonzalez
-
remove break from the accountCh case
PS Jenkins bot (ps-jenkins) wrote : | # |
PASSED: Continuous integration, rev:63
http://
Executed test runs:
SUCCESS: http://
SUCCESS: http://
deb: http://
SUCCESS: http://
Click here to trigger a rebuild:
http://
Sergio Schvezov (sergiusens) wrote : | # |
tested, works
Unmerged revisions
- 63. By Guillermo Gonzalez
-
remove break from the accountCh case
- 62. By Guillermo Gonzalez
-
update notification body
- 61. By Guillermo Gonzalez
-
start the mainlopp in init()
- 60. By Guillermo Gonzalez
-
merge with trunk
- 59. By Guillermo Gonzalez
-
move mainloop setup into main
- 58. By Guillermo Gonzalez
-
updated translations
- 57. By Guillermo Gonzalez
-
add missing TRANSLATORS comments
- 56. By Guillermo Gonzalez
-
fix the dbus path
- 55. By Guillermo Gonzalez
-
- improve the notification message
- update translations - 54. By Guillermo Gonzalez
-
use the correct url for the accounts settings page
Preview Diff
1 | === modified file 'accounts/account-watcher.c' | |||
2 | --- accounts/account-watcher.c 2014-07-24 05:46:03 +0000 | |||
3 | +++ accounts/account-watcher.c 2014-08-15 19:02:24 +0000 | |||
4 | @@ -22,7 +22,7 @@ | |||
5 | 22 | 22 | ||
6 | 23 | #include "account-watcher.h" | 23 | #include "account-watcher.h" |
7 | 24 | 24 | ||
9 | 25 | /* #define DEBUG */ | 25 | //#define DEBUG |
10 | 26 | #ifdef DEBUG | 26 | #ifdef DEBUG |
11 | 27 | # define trace(...) fprintf(stderr, __VA_ARGS__) | 27 | # define trace(...) fprintf(stderr, __VA_ARGS__) |
12 | 28 | #else | 28 | #else |
13 | @@ -37,9 +37,11 @@ | |||
14 | 37 | GHashTable *services; | 37 | GHashTable *services; |
15 | 38 | 38 | ||
16 | 39 | gulong enabled_event_signal_id; | 39 | gulong enabled_event_signal_id; |
17 | 40 | gulong created_event_signal_id; | ||
18 | 40 | gulong account_deleted_signal_id; | 41 | gulong account_deleted_signal_id; |
19 | 41 | 42 | ||
20 | 42 | AccountEnabledCallback callback; | 43 | AccountEnabledCallback callback; |
21 | 44 | AccountCreatedCallback created_callback; | ||
22 | 43 | void *user_data; | 45 | void *user_data; |
23 | 44 | }; | 46 | }; |
24 | 45 | 47 | ||
25 | @@ -231,6 +233,28 @@ | |||
26 | 231 | g_object_unref(account); | 233 | g_object_unref(account); |
27 | 232 | } | 234 | } |
28 | 233 | 235 | ||
29 | 236 | static void account_watcher_created_event_cb( | ||
30 | 237 | AgManager *manager, AgAccountId account_id, AccountWatcher *watcher) { | ||
31 | 238 | trace("created-event for %u\n", account_id); | ||
32 | 239 | AgAccount *account = ag_manager_get_account(manager, account_id); | ||
33 | 240 | if (account == NULL) { | ||
34 | 241 | /* There was a problem looking up the account */ | ||
35 | 242 | return; | ||
36 | 243 | } | ||
37 | 244 | /* Since our AgManager is restricted to a particular service type, | ||
38 | 245 | * pick the first service for the account. */ | ||
39 | 246 | GList *services = ag_account_list_services(account); | ||
40 | 247 | if (services != NULL) { | ||
41 | 248 | AgService *service = services->data; | ||
42 | 249 | const char *service_name = ag_service_get_name(service); | ||
43 | 250 | watcher->created_callback(watcher, | ||
44 | 251 | account_id, | ||
45 | 252 | service_name); | ||
46 | 253 | } | ||
47 | 254 | ag_service_list_free(services); | ||
48 | 255 | g_object_unref(account); | ||
49 | 256 | } | ||
50 | 257 | |||
51 | 234 | static void account_watcher_account_deleted_cb( | 258 | static void account_watcher_account_deleted_cb( |
52 | 235 | AgManager *manager, AgAccountId account_id, AccountWatcher *watcher) { | 259 | AgManager *manager, AgAccountId account_id, AccountWatcher *watcher) { |
53 | 236 | trace("account-deleted for %u\n", account_id); | 260 | trace("account-deleted for %u\n", account_id); |
54 | @@ -246,6 +270,9 @@ | |||
55 | 246 | watcher->enabled_event_signal_id = g_signal_connect( | 270 | watcher->enabled_event_signal_id = g_signal_connect( |
56 | 247 | watcher->manager, "enabled-event", | 271 | watcher->manager, "enabled-event", |
57 | 248 | G_CALLBACK(account_watcher_enabled_event_cb), watcher); | 272 | G_CALLBACK(account_watcher_enabled_event_cb), watcher); |
58 | 273 | watcher->created_event_signal_id = g_signal_connect( | ||
59 | 274 | watcher->manager, "account-created", | ||
60 | 275 | G_CALLBACK(account_watcher_created_event_cb), watcher); | ||
61 | 249 | watcher->account_deleted_signal_id = g_signal_connect( | 276 | watcher->account_deleted_signal_id = g_signal_connect( |
62 | 250 | watcher->manager, "account-deleted", | 277 | watcher->manager, "account-deleted", |
63 | 251 | G_CALLBACK(account_watcher_account_deleted_cb), watcher); | 278 | G_CALLBACK(account_watcher_account_deleted_cb), watcher); |
64 | @@ -264,6 +291,7 @@ | |||
65 | 264 | 291 | ||
66 | 265 | AccountWatcher *account_watcher_new(const char *service_type, | 292 | AccountWatcher *account_watcher_new(const char *service_type, |
67 | 266 | AccountEnabledCallback callback, | 293 | AccountEnabledCallback callback, |
68 | 294 | AccountCreatedCallback created_callback, | ||
69 | 267 | void *user_data) { | 295 | void *user_data) { |
70 | 268 | AccountWatcher *watcher = g_new0(AccountWatcher, 1); | 296 | AccountWatcher *watcher = g_new0(AccountWatcher, 1); |
71 | 269 | 297 | ||
72 | @@ -271,6 +299,7 @@ | |||
73 | 271 | watcher->services = g_hash_table_new_full( | 299 | watcher->services = g_hash_table_new_full( |
74 | 272 | g_direct_hash, g_direct_equal, NULL, (GDestroyNotify)account_info_free); | 300 | g_direct_hash, g_direct_equal, NULL, (GDestroyNotify)account_info_free); |
75 | 273 | watcher->callback = callback; | 301 | watcher->callback = callback; |
76 | 302 | watcher->created_callback = created_callback; | ||
77 | 274 | watcher->user_data = user_data; | 303 | watcher->user_data = user_data; |
78 | 275 | 304 | ||
79 | 276 | /* Make sure main setup occurs within the mainloop thread */ | 305 | /* Make sure main setup occurs within the mainloop thread */ |
80 | 277 | 306 | ||
81 | === modified file 'accounts/account-watcher.h' | |||
82 | --- accounts/account-watcher.h 2014-07-24 05:06:56 +0000 | |||
83 | +++ accounts/account-watcher.h 2014-08-15 19:02:24 +0000 | |||
84 | @@ -32,10 +32,16 @@ | |||
85 | 32 | const char *token_secret, | 32 | const char *token_secret, |
86 | 33 | void *user_data); | 33 | void *user_data); |
87 | 34 | 34 | ||
88 | 35 | typedef void (*AccountCreatedCallback)(AccountWatcher *watcher, | ||
89 | 36 | unsigned int account_id, | ||
90 | 37 | const char *service_name); | ||
91 | 38 | |||
92 | 35 | AccountWatcher *account_watcher_new(const char *service_type, | 39 | AccountWatcher *account_watcher_new(const char *service_type, |
93 | 36 | AccountEnabledCallback callback, | 40 | AccountEnabledCallback callback, |
94 | 41 | AccountCreatedCallback created_callback, | ||
95 | 37 | void *user_data); | 42 | void *user_data); |
96 | 38 | 43 | ||
97 | 39 | void account_watcher_refresh(AccountWatcher *watcher, unsigned int account_id); | 44 | void account_watcher_refresh(AccountWatcher *watcher, unsigned int account_id); |
98 | 40 | 45 | ||
99 | 46 | |||
100 | 41 | #endif | 47 | #endif |
101 | 42 | 48 | ||
102 | === modified file 'accounts/accounts.c' | |||
103 | --- accounts/accounts.c 2014-07-24 05:06:56 +0000 | |||
104 | +++ accounts/accounts.c 2014-08-15 19:02:24 +0000 | |||
105 | @@ -19,6 +19,7 @@ | |||
106 | 19 | } | 19 | } |
107 | 20 | 20 | ||
108 | 21 | AccountWatcher *watcher = account_watcher_new( | 21 | AccountWatcher *watcher = account_watcher_new( |
110 | 22 | service_type, (AccountEnabledCallback)authCallback, NULL); | 22 | service_type, (AccountEnabledCallback)authCallback, |
111 | 23 | (AccountCreatedCallback)accountCallback, NULL); | ||
112 | 23 | return watcher; | 24 | return watcher; |
113 | 24 | } | 25 | } |
114 | 25 | 26 | ||
115 | === modified file 'accounts/accounts.go' | |||
116 | --- accounts/accounts.go 2014-07-25 20:09:20 +0000 | |||
117 | +++ accounts/accounts.go 2014-08-15 19:02:24 +0000 | |||
118 | @@ -33,8 +33,14 @@ | |||
119 | 33 | ) | 33 | ) |
120 | 34 | 34 | ||
121 | 35 | type Watcher struct { | 35 | type Watcher struct { |
124 | 36 | C <-chan AuthData | 36 | C <-chan AuthData |
125 | 37 | watcher *C.AccountWatcher | 37 | AccountCh <-chan AccountData |
126 | 38 | watcher *C.AccountWatcher | ||
127 | 39 | } | ||
128 | 40 | |||
129 | 41 | type AccountData struct { | ||
130 | 42 | AccountId uint | ||
131 | 43 | ServiceName string | ||
132 | 38 | } | 44 | } |
133 | 39 | 45 | ||
134 | 40 | type AuthData struct { | 46 | type AuthData struct { |
135 | @@ -50,18 +56,12 @@ | |||
136 | 50 | } | 56 | } |
137 | 51 | 57 | ||
138 | 52 | var ( | 58 | var ( |
142 | 53 | mainLoopOnce sync.Once | 59 | authChannels = make(map[*C.AccountWatcher]chan<- AuthData) |
143 | 54 | authChannels = make(map[*C.AccountWatcher]chan<- AuthData) | 60 | authChannelsLock sync.Mutex |
144 | 55 | authChannelsLock sync.Mutex | 61 | accountChannels = make(map[*C.AccountWatcher]chan<- AccountData) |
145 | 62 | accountChannelsLock sync.Mutex | ||
146 | 56 | ) | 63 | ) |
147 | 57 | 64 | ||
148 | 58 | func startMainLoop() { | ||
149 | 59 | mainLoopOnce.Do(func() { | ||
150 | 60 | mainLoop := C.g_main_loop_new(nil, C.gboolean(1)) | ||
151 | 61 | go C.g_main_loop_run(mainLoop) | ||
152 | 62 | }) | ||
153 | 63 | } | ||
154 | 64 | |||
155 | 65 | // NewWatcher creates a new account watcher for the given service names | 65 | // NewWatcher creates a new account watcher for the given service names |
156 | 66 | func NewWatcher(serviceType string) *Watcher { | 66 | func NewWatcher(serviceType string) *Watcher { |
157 | 67 | w := new(Watcher) | 67 | w := new(Watcher) |
158 | @@ -74,8 +74,12 @@ | |||
159 | 74 | authChannelsLock.Lock() | 74 | authChannelsLock.Lock() |
160 | 75 | authChannels[w.watcher] = ch | 75 | authChannels[w.watcher] = ch |
161 | 76 | authChannelsLock.Unlock() | 76 | authChannelsLock.Unlock() |
164 | 77 | 77 | // account stuff | |
165 | 78 | startMainLoop() | 78 | accountCh := make(chan AccountData) |
166 | 79 | w.AccountCh = accountCh | ||
167 | 80 | accountChannelsLock.Lock() | ||
168 | 81 | accountChannels[w.watcher] = accountCh | ||
169 | 82 | accountChannelsLock.Unlock() | ||
170 | 79 | 83 | ||
171 | 80 | return w | 84 | return w |
172 | 81 | } | 85 | } |
173 | @@ -121,3 +125,21 @@ | |||
174 | 121 | } | 125 | } |
175 | 122 | ch <- data | 126 | ch <- data |
176 | 123 | } | 127 | } |
177 | 128 | |||
178 | 129 | //export accountCallback | ||
179 | 130 | func accountCallback(watcher unsafe.Pointer, accountId C.uint, serviceName *C.char) { | ||
180 | 131 | // Ideally the first argument would be of type | ||
181 | 132 | // *C.AccountWatcher, but that fails with Go 1.2. | ||
182 | 133 | accountChannelsLock.Lock() | ||
183 | 134 | ch := accountChannels[(*C.AccountWatcher)(watcher)] | ||
184 | 135 | accountChannelsLock.Unlock() | ||
185 | 136 | if ch == nil { | ||
186 | 137 | // Log the error | ||
187 | 138 | return | ||
188 | 139 | } | ||
189 | 140 | |||
190 | 141 | var data AccountData | ||
191 | 142 | data.AccountId = uint(accountId) | ||
192 | 143 | data.ServiceName = C.GoString(serviceName) | ||
193 | 144 | ch <- data | ||
194 | 145 | } | ||
195 | 124 | 146 | ||
196 | === modified file 'cmd/account-polld/main.go' | |||
197 | --- cmd/account-polld/main.go 2014-08-08 20:11:14 +0000 | |||
198 | +++ cmd/account-polld/main.go 2014-08-15 19:02:24 +0000 | |||
199 | @@ -17,10 +17,17 @@ | |||
200 | 17 | 17 | ||
201 | 18 | package main | 18 | package main |
202 | 19 | 19 | ||
203 | 20 | /* | ||
204 | 21 | #cgo pkg-config: glib-2.0 | ||
205 | 22 | #include <glib.h> | ||
206 | 23 | */ | ||
207 | 24 | import "C" | ||
208 | 20 | import ( | 25 | import ( |
209 | 21 | "encoding/json" | 26 | "encoding/json" |
210 | 22 | "fmt" | 27 | "fmt" |
211 | 23 | "strings" | 28 | "strings" |
212 | 29 | "sync" | ||
213 | 30 | "time" | ||
214 | 24 | 31 | ||
215 | 25 | "log" | 32 | "log" |
216 | 26 | 33 | ||
217 | @@ -52,7 +59,11 @@ | |||
218 | 52 | POSTAL_OBJECT_PATH_PART = "/com/ubuntu/Postal/" | 59 | POSTAL_OBJECT_PATH_PART = "/com/ubuntu/Postal/" |
219 | 53 | ) | 60 | ) |
220 | 54 | 61 | ||
221 | 62 | var mainLoopOnce sync.Once | ||
222 | 63 | var mainLoop *C.GMainLoop | ||
223 | 64 | |||
224 | 55 | func init() { | 65 | func init() { |
225 | 66 | startGlibMainLoop() | ||
226 | 56 | } | 67 | } |
227 | 57 | 68 | ||
228 | 58 | func main() { | 69 | func main() { |
229 | @@ -76,40 +87,61 @@ | |||
230 | 76 | <-done | 87 | <-done |
231 | 77 | } | 88 | } |
232 | 78 | 89 | ||
233 | 90 | func startGlibMainLoop() { | ||
234 | 91 | mainLoopOnce.Do(func() { | ||
235 | 92 | mainLoop = C.g_main_loop_new(nil, C.gboolean(1)) | ||
236 | 93 | go C.g_main_loop_run(mainLoop) | ||
237 | 94 | }) | ||
238 | 95 | } | ||
239 | 96 | |||
240 | 79 | func monitorAccounts(postWatch chan *PostWatch) { | 97 | func monitorAccounts(postWatch chan *PostWatch) { |
241 | 80 | watcher := accounts.NewWatcher(SERVICETYPE_POLL) | 98 | watcher := accounts.NewWatcher(SERVICETYPE_POLL) |
242 | 81 | mgr := make(map[uint]*AccountManager) | 99 | mgr := make(map[uint]*AccountManager) |
243 | 82 | L: | 100 | L: |
274 | 83 | for data := range watcher.C { | 101 | for { |
275 | 84 | if account, ok := mgr[data.AccountId]; ok { | 102 | select { |
276 | 85 | if data.Enabled { | 103 | case data := <-watcher.C: |
277 | 86 | log.Println("New account data for existing account with id", data.AccountId) | 104 | if account, ok := mgr[data.AccountId]; ok { |
278 | 87 | account.updateAuthData(data) | 105 | if data.Enabled { |
279 | 88 | } else { | 106 | log.Println("New account data for existing account with id", data.AccountId) |
280 | 89 | account.Delete() | 107 | account.updateAuthData(data) |
281 | 90 | delete(mgr, data.AccountId) | 108 | } else { |
282 | 91 | } | 109 | account.Delete() |
283 | 92 | } else if data.Enabled { | 110 | delete(mgr, data.AccountId) |
284 | 93 | var plugin plugins.Plugin | 111 | } |
285 | 94 | switch data.ServiceName { | 112 | } else if data.Enabled { |
286 | 95 | case SERVICENAME_GMAIL: | 113 | var plugin plugins.Plugin |
287 | 96 | log.Println("Creating account with id", data.AccountId, "for", data.ServiceName) | 114 | switch data.ServiceName { |
288 | 97 | plugin = gmail.New(data.AccountId) | 115 | case SERVICENAME_GMAIL: |
289 | 98 | case SERVICENAME_FACEBOOK: | 116 | log.Println("Creating account with id", data.AccountId, "for", data.ServiceName) |
290 | 99 | // This is just stubbed until the plugin exists. | 117 | plugin = gmail.New(data.AccountId) |
291 | 100 | log.Println("Creating account with id", data.AccountId, "for", data.ServiceName) | 118 | case SERVICENAME_FACEBOOK: |
292 | 101 | plugin = facebook.New(data.AccountId) | 119 | // This is just stubbed until the plugin exists. |
293 | 102 | case SERVICENAME_TWITTER: | 120 | log.Println("Creating account with id", data.AccountId, "for", data.ServiceName) |
294 | 103 | // This is just stubbed until the plugin exists. | 121 | plugin = facebook.New(data.AccountId) |
295 | 104 | log.Println("Creating account with id", data.AccountId, "for", data.ServiceName) | 122 | case SERVICENAME_TWITTER: |
296 | 105 | plugin = twitter.New() | 123 | // This is just stubbed until the plugin exists. |
297 | 106 | default: | 124 | log.Println("Creating account with id", data.AccountId, "for", data.ServiceName) |
298 | 107 | log.Println("Unhandled account with id", data.AccountId, "for", data.ServiceName) | 125 | plugin = twitter.New() |
299 | 108 | continue L | 126 | default: |
300 | 109 | } | 127 | log.Println("Unhandled account with id", data.AccountId, "for", data.ServiceName) |
301 | 110 | mgr[data.AccountId] = NewAccountManager(watcher, postWatch, plugin) | 128 | break L |
302 | 111 | mgr[data.AccountId].updateAuthData(data) | 129 | } |
303 | 112 | go mgr[data.AccountId].Loop() | 130 | mgr[data.AccountId] = NewAccountManager(watcher, postWatch, plugin) |
304 | 131 | mgr[data.AccountId].updateAuthData(data) | ||
305 | 132 | go mgr[data.AccountId].Loop() | ||
306 | 133 | } | ||
307 | 134 | case data := <-watcher.AccountCh: | ||
308 | 135 | log.Println("New Account:", data.AccountId, "for", data.ServiceName) | ||
309 | 136 | // TRANSLATORS: This is the summary of the notification triggered after creating a new account | ||
310 | 137 | summary := gettext.Gettext("New account created") | ||
311 | 138 | // TRANSLATORS: This is the body of the notification triggered after creating a new account | ||
312 | 139 | body := gettext.Gettext("To enable notifications for this account, toggle Notifications from the account setting") | ||
313 | 140 | epoch := time.Now().Unix() | ||
314 | 141 | action := "settings://personal/online-accounts" | ||
315 | 142 | pushMsg := *plugins.NewStandardPushMessage(summary, body, action, "", epoch) | ||
316 | 143 | msgs := []plugins.PushMessage{pushMsg} | ||
317 | 144 | postWatch <- &PostWatch{messages: msgs, appId: "_ubuntu-system-settings"} | ||
318 | 113 | } | 145 | } |
319 | 114 | } | 146 | } |
320 | 115 | } | 147 | } |
321 | @@ -140,18 +172,21 @@ | |||
322 | 140 | // e.g.; if the APP_ID is com.ubuntu.music", the returned object path | 172 | // e.g.; if the APP_ID is com.ubuntu.music", the returned object path |
323 | 141 | // would be "/com/ubuntu/PushNotifications/com_2eubuntu_2eubuntu_2emusic | 173 | // would be "/com/ubuntu/PushNotifications/com_2eubuntu_2eubuntu_2emusic |
324 | 142 | func pushObjectPath(id plugins.ApplicationId) dbus.ObjectPath { | 174 | func pushObjectPath(id plugins.ApplicationId) dbus.ObjectPath { |
325 | 175 | pkg := POSTAL_OBJECT_PATH_PART | ||
326 | 143 | idParts := strings.Split(string(id), "_") | 176 | idParts := strings.Split(string(id), "_") |
327 | 144 | if len(idParts) < 2 { | 177 | if len(idParts) < 2 { |
328 | 145 | panic(fmt.Sprintf("APP_ID '%s' is not valid", id)) | 178 | panic(fmt.Sprintf("APP_ID '%s' is not valid", id)) |
338 | 146 | } | 179 | } else if strings.HasPrefix(string(id), "_") { |
339 | 147 | 180 | // it's a legacy app! | |
340 | 148 | pkg := POSTAL_OBJECT_PATH_PART | 181 | pkg += "_" |
341 | 149 | for _, c := range idParts[0] { | 182 | } else { |
342 | 150 | switch c { | 183 | for _, c := range idParts[0] { |
343 | 151 | case '+', '.', '-', ':', '~', '_': | 184 | switch c { |
344 | 152 | pkg += fmt.Sprintf("_%x", string(c)) | 185 | case '+', '.', '-', ':', '~', '_': |
345 | 153 | default: | 186 | pkg += fmt.Sprintf("_%x", string(c)) |
346 | 154 | pkg += string(c) | 187 | default: |
347 | 188 | pkg += string(c) | ||
348 | 189 | } | ||
349 | 155 | } | 190 | } |
350 | 156 | } | 191 | } |
351 | 157 | return dbus.ObjectPath(pkg) | 192 | return dbus.ObjectPath(pkg) |
352 | 158 | 193 | ||
353 | === modified file 'po/account-polld.pot' | |||
354 | --- po/account-polld.pot 2014-08-11 18:35:28 +0000 | |||
355 | +++ po/account-polld.pot 2014-08-15 19:02:24 +0000 | |||
356 | @@ -8,7 +8,7 @@ | |||
357 | 8 | msgstr "" | 8 | msgstr "" |
358 | 9 | "Project-Id-Version: account-polld\n" | 9 | "Project-Id-Version: account-polld\n" |
359 | 10 | "Report-Msgid-Bugs-To: \n" | 10 | "Report-Msgid-Bugs-To: \n" |
361 | 11 | "POT-Creation-Date: 2014-08-11 15:35-0300\n" | 11 | "POT-Creation-Date: 2014-08-15 11:06-0300\n" |
362 | 12 | "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" | 12 | "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" |
363 | 13 | "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n" | 13 | "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n" |
364 | 14 | "Language-Team: LANGUAGE <LL@li.org>\n" | 14 | "Language-Team: LANGUAGE <LL@li.org>\n" |
365 | @@ -17,6 +17,31 @@ | |||
366 | 17 | "Content-Type: text/plain; charset=CHARSET\n" | 17 | "Content-Type: text/plain; charset=CHARSET\n" |
367 | 18 | "Content-Transfer-Encoding: 8bit\n" | 18 | "Content-Transfer-Encoding: 8bit\n" |
368 | 19 | 19 | ||
369 | 20 | #. TRANSLATORS: This is the summary of the notification triggered after creating a new account | ||
370 | 21 | #: cmd/account-polld/main.go:137 | ||
371 | 22 | msgid "New account created" | ||
372 | 23 | msgstr "" | ||
373 | 24 | |||
374 | 25 | #. TRANSLATORS: This is the body of the notification triggered after creating a new account | ||
375 | 26 | #: cmd/account-polld/main.go:139 | ||
376 | 27 | msgid "" | ||
377 | 28 | "To enable notifications for this account, toggle Notifications from the " | ||
378 | 29 | "account setting" | ||
379 | 30 | msgstr "" | ||
380 | 31 | |||
381 | 32 | #. TRANSLATORS: This represents a notification summary about more facebook notifications | ||
382 | 33 | #: plugins/facebook/facebook.go:170 | ||
383 | 34 | msgid "Multiple more notifications" | ||
384 | 35 | msgstr "" | ||
385 | 36 | |||
386 | 37 | #. TRANSLATORS: This represents a notification body with the comma separated facebook usernames | ||
387 | 38 | #. TRANSLATORS: This represents a notification body with the comma separated twitter usernames | ||
388 | 39 | #: plugins/facebook/facebook.go:172 plugins/twitter/twitter.go:130 | ||
389 | 40 | #: plugins/twitter/twitter.go:187 | ||
390 | 41 | #, c-format | ||
391 | 42 | msgid "From %s" | ||
392 | 43 | msgstr "" | ||
393 | 44 | |||
394 | 20 | #. TRANSLATORS: The first %s refers to the twitter user's Name, the second %s to the username. | 45 | #. TRANSLATORS: The first %s refers to the twitter user's Name, the second %s to the username. |
395 | 21 | #: plugins/twitter/twitter.go:113 plugins/twitter/twitter.go:170 | 46 | #: plugins/twitter/twitter.go:113 plugins/twitter/twitter.go:170 |
396 | 22 | #, c-format | 47 | #, c-format |
397 | @@ -28,14 +53,6 @@ | |||
398 | 28 | msgid "Multiple more mentions" | 53 | msgid "Multiple more mentions" |
399 | 29 | msgstr "" | 54 | msgstr "" |
400 | 30 | 55 | ||
401 | 31 | #. TRANSLATORS: This represents a notification body with the comma separated twitter usernames | ||
402 | 32 | #. TRANSLATORS: This represents a notification body with the comma separated facebook usernames | ||
403 | 33 | #: plugins/twitter/twitter.go:130 plugins/twitter/twitter.go:187 | ||
404 | 34 | #: plugins/facebook/facebook.go:172 | ||
405 | 35 | #, c-format | ||
406 | 36 | msgid "From %s" | ||
407 | 37 | msgstr "" | ||
408 | 38 | |||
409 | 39 | #. TRANSLATORS: This represents a notification summary about more twitter direct messages available | 56 | #. TRANSLATORS: This represents a notification summary about more twitter direct messages available |
410 | 40 | #: plugins/twitter/twitter.go:185 | 57 | #: plugins/twitter/twitter.go:185 |
411 | 41 | msgid "Multiple direct messages available" | 58 | msgid "Multiple direct messages available" |
412 | @@ -72,11 +89,6 @@ | |||
413 | 72 | msgid "You have an approximate of %d additional unread messages" | 89 | msgid "You have an approximate of %d additional unread messages" |
414 | 73 | msgstr "" | 90 | msgstr "" |
415 | 74 | 91 | ||
416 | 75 | #. TRANSLATORS: This represents a notification summary about more facebook notifications | ||
417 | 76 | #: plugins/facebook/facebook.go:170 | ||
418 | 77 | msgid "Multiple more notifications" | ||
419 | 78 | msgstr "" | ||
420 | 79 | |||
421 | 80 | #: data/account-polld.desktop.tr.h:1 | 92 | #: data/account-polld.desktop.tr.h:1 |
422 | 81 | msgid "Notifications" | 93 | msgid "Notifications" |
423 | 82 | msgstr "" | 94 | msgstr "" |
PASSED: Continuous integration, rev:56 jenkins. qa.ubuntu. com/job/ account- polld-ci/ 63/ jenkins. qa.ubuntu. com/job/ account- polld-utopic- amd64-ci/ 63 jenkins. qa.ubuntu. com/job/ account- polld-utopic- armhf-ci/ 63 jenkins. qa.ubuntu. com/job/ account- polld-utopic- armhf-ci/ 63/artifact/ work/output/ *zip*/output. zip jenkins. qa.ubuntu. com/job/ account- polld-utopic- i386-ci/ 63
http://
Executed test runs:
SUCCESS: http://
SUCCESS: http://
deb: http://
SUCCESS: http://
Click here to trigger a rebuild: s-jenkins. ubuntu- ci:8080/ job/account- polld-ci/ 63/rebuild
http://