Mercurial > pidgin
annotate src/protocols/msn/state.c @ 13545:cfc2f7fcb3dd
[gaim-migrate @ 15922]
Way more changes that I initially thought I was going to make. I apologize
for the commit message spam. These changes bring a lot of consistency to
our capitalization and punctuation, especially of words like "e-mail".
For reference, I've used these rules (after discussing in #gaim):
e-mail, a case of two words joined:
"e-mail" - in the middle of a sentence caps context
"E-mail" - start of text in a sentence caps context
"E-Mail" - in a header (title) caps context
re-enable, a single word, would be:
"re-enable", "Re-enable", and "Re-enable" (respectively)
The reason this changeset exploded is that, as I went through and verified
these changes, I realized we were using improper capitalization (e.g. header
instead of sentence) in a number of dialogs. I fixed a number of these
cases before, and this corrects another pile.
This looks like I've made a LOT of work for the translators, but the impact
is significantly mitigated by three factors: 1) Many of these changes use
strings that already exist, or change one string in many places. 2) I've
used sed to correct the .po files where possible. 3) The actual changes
are extremely trivial.
committer: Tailor Script <tailor@pidgin.im>
| author | Richard Laager <rlaager@wiktel.com> |
|---|---|
| date | Tue, 21 Mar 2006 04:32:45 +0000 |
| parents | c824e39db0e7 |
| children | 23258253c7a0 |
| rev | line source |
|---|---|
| 5361 | 1 /** |
| 2 * @file state.c State functions and definitions | |
| 3 * | |
| 4 * gaim | |
| 5 * | |
|
9198
ab6636c5a136
[gaim-migrate @ 9993]
Christian Hammond <chipx86@chipx86.com>
parents:
9193
diff
changeset
|
6 * Gaim is the legal property of its developers, whose names are too numerous |
|
ab6636c5a136
[gaim-migrate @ 9993]
Christian Hammond <chipx86@chipx86.com>
parents:
9193
diff
changeset
|
7 * to list here. Please refer to the COPYRIGHT file distributed with this |
|
ab6636c5a136
[gaim-migrate @ 9993]
Christian Hammond <chipx86@chipx86.com>
parents:
9193
diff
changeset
|
8 * source distribution. |
|
6701
b7e113a59b51
[gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents:
5824
diff
changeset
|
9 * |
| 5361 | 10 * This program is free software; you can redistribute it and/or modify |
| 11 * it under the terms of the GNU General Public License as published by | |
| 12 * the Free Software Foundation; either version 2 of the License, or | |
| 13 * (at your option) any later version. | |
| 14 * | |
| 15 * This program is distributed in the hope that it will be useful, | |
| 16 * but WITHOUT ANY WARRANTY; without even the implied warranty of | |
| 17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
| 18 * GNU General Public License for more details. | |
| 19 * | |
| 20 * You should have received a copy of the GNU General Public License | |
| 21 * along with this program; if not, write to the Free Software | |
| 22 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | |
| 23 */ | |
| 24 #include "msn.h" | |
| 25 #include "state.h" | |
| 26 | |
| 27 static const char *away_text[] = | |
| 28 { | |
| 29 N_("Available"), | |
| 30 N_("Available"), | |
| 31 N_("Busy"), | |
| 32 N_("Idle"), | |
| 33 N_("Be Right Back"), | |
| 34 N_("Away From Computer"), | |
| 35 N_("On The Phone"), | |
| 36 N_("Out To Lunch"), | |
| 37 N_("Available"), | |
| 38 N_("Available") | |
| 39 }; | |
| 40 | |
|
9193
502707ca1836
[gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
8475
diff
changeset
|
41 void |
| 11992 | 42 msn_change_status(MsnSession *session) |
|
9193
502707ca1836
[gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
8475
diff
changeset
|
43 { |
| 11992 | 44 GaimAccount *account = session->account; |
|
9193
502707ca1836
[gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
8475
diff
changeset
|
45 MsnCmdProc *cmdproc; |
|
502707ca1836
[gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
8475
diff
changeset
|
46 MsnUser *user; |
|
502707ca1836
[gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
8475
diff
changeset
|
47 MsnObject *msnobj; |
|
502707ca1836
[gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
8475
diff
changeset
|
48 const char *state_text; |
|
502707ca1836
[gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
8475
diff
changeset
|
49 |
| 10481 | 50 g_return_if_fail(session != NULL); |
| 51 g_return_if_fail(session->notification != NULL); | |
| 52 | |
|
9193
502707ca1836
[gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
8475
diff
changeset
|
53 cmdproc = session->notification->cmdproc; |
|
502707ca1836
[gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
8475
diff
changeset
|
54 user = session->user; |
| 11992 | 55 state_text = msn_state_get_text(msn_state_from_account(account)); |
| 10908 | 56 |
| 57 /* If we're not logged in yet, don't send the status to the server, | |
| 58 * it will be sent when login completes | |
| 59 */ | |
| 60 if (!session->logged_in) | |
| 61 return; | |
|
9193
502707ca1836
[gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
8475
diff
changeset
|
62 |
|
502707ca1836
[gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
8475
diff
changeset
|
63 msnobj = msn_user_get_object(user); |
|
502707ca1836
[gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
8475
diff
changeset
|
64 |
|
502707ca1836
[gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
8475
diff
changeset
|
65 if (msnobj == NULL) |
|
502707ca1836
[gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
8475
diff
changeset
|
66 { |
|
502707ca1836
[gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
8475
diff
changeset
|
67 msn_cmdproc_send(cmdproc, "CHG", "%s %d", state_text, |
|
502707ca1836
[gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
8475
diff
changeset
|
68 MSN_CLIENT_ID); |
|
502707ca1836
[gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
8475
diff
changeset
|
69 } |
|
502707ca1836
[gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
8475
diff
changeset
|
70 else |
|
502707ca1836
[gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
8475
diff
changeset
|
71 { |
|
502707ca1836
[gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
8475
diff
changeset
|
72 char *msnobj_str; |
|
502707ca1836
[gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
8475
diff
changeset
|
73 |
|
502707ca1836
[gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
8475
diff
changeset
|
74 msnobj_str = msn_object_to_string(msnobj); |
|
502707ca1836
[gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
8475
diff
changeset
|
75 |
|
502707ca1836
[gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
8475
diff
changeset
|
76 msn_cmdproc_send(cmdproc, "CHG", "%s %d %s", state_text, |
|
502707ca1836
[gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
8475
diff
changeset
|
77 MSN_CLIENT_ID, gaim_url_encode(msnobj_str)); |
|
502707ca1836
[gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
8475
diff
changeset
|
78 |
|
502707ca1836
[gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
8475
diff
changeset
|
79 g_free(msnobj_str); |
|
502707ca1836
[gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
8475
diff
changeset
|
80 } |
|
502707ca1836
[gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
8475
diff
changeset
|
81 } |
|
502707ca1836
[gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
8475
diff
changeset
|
82 |
| 5361 | 83 const char * |
| 84 msn_away_get_text(MsnAwayType type) | |
| 85 { | |
| 7631 | 86 g_return_val_if_fail(type <= MSN_HIDDEN, NULL); |
| 5361 | 87 |
| 5824 | 88 return _(away_text[type]); |
| 5361 | 89 } |
|
9193
502707ca1836
[gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
8475
diff
changeset
|
90 |
|
502707ca1836
[gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
8475
diff
changeset
|
91 const char * |
|
502707ca1836
[gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
8475
diff
changeset
|
92 msn_state_get_text(MsnAwayType state) |
|
502707ca1836
[gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
8475
diff
changeset
|
93 { |
|
502707ca1836
[gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
8475
diff
changeset
|
94 static char *status_text[] = |
|
502707ca1836
[gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
8475
diff
changeset
|
95 { "NLN", "NLN", "BSY", "IDL", "BRB", "AWY", "PHN", "LUN", "HDN", "HDN" }; |
|
502707ca1836
[gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
8475
diff
changeset
|
96 |
|
502707ca1836
[gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
8475
diff
changeset
|
97 return status_text[state]; |
|
502707ca1836
[gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
8475
diff
changeset
|
98 } |
| 11992 | 99 |
| 100 MsnAwayType | |
| 101 msn_state_from_account(GaimAccount *account) | |
| 102 { | |
| 103 MsnAwayType msnstatus; | |
| 104 GaimPresence *presence; | |
| 105 GaimStatus *status; | |
| 106 const char *status_id; | |
| 107 | |
| 108 presence = gaim_account_get_presence(account); | |
| 109 status = gaim_presence_get_active_status(presence); | |
| 110 status_id = gaim_status_get_id(status); | |
| 111 | |
| 112 if (!strcmp(status_id, "away")) | |
| 113 msnstatus = MSN_AWAY; | |
| 114 else if (!strcmp(status_id, "brb")) | |
| 115 msnstatus = MSN_BRB; | |
| 116 else if (!strcmp(status_id, "busy")) | |
| 117 msnstatus = MSN_BUSY; | |
| 118 else if (!strcmp(status_id, "phone")) | |
| 119 msnstatus = MSN_PHONE; | |
| 120 else if (!strcmp(status_id, "lunch")) | |
| 121 msnstatus = MSN_LUNCH; | |
| 122 else if (!strcmp(status_id, "invisible")) | |
| 123 msnstatus = MSN_HIDDEN; | |
| 124 else | |
| 125 msnstatus = MSN_ONLINE; | |
| 126 | |
| 127 if ((msnstatus == MSN_ONLINE) && gaim_presence_is_idle(presence)) | |
| 128 msnstatus = MSN_IDLE; | |
| 129 | |
| 130 return msnstatus; | |
| 131 } |
