This probably shouldn't compile in a sane language. `ag_account_select_service` takes `AgService*`, not a `const char *`

But looking at this code, it's actually explicitly switching *to* the global service before writing. Removing this line and 164 (ag_account_select_service back to non-global in request_password_account_store_cb) should give you the service you want anyway.

This AgAccount comes from a manager for the IM type, so all accounts always have the IM service selected. I believe. You might want to verify this with `ag_account_get_selected_service` before trusting me on it.