1 | /********************************************************************\ |
---|
2 | * BitlBee -- An IRC to other IM-networks gateway * |
---|
3 | * * |
---|
4 | * Copyright 2002-2010 Wilmer van der Gaast and others * |
---|
5 | \********************************************************************/ |
---|
6 | |
---|
7 | /* MSN module - Some tables with useful data */ |
---|
8 | |
---|
9 | /* |
---|
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 with |
---|
21 | the Debian GNU/Linux distribution in /usr/share/common-licenses/GPL; |
---|
22 | if not, write to the Free Software Foundation, Inc., 51 Franklin St., |
---|
23 | Fifth Floor, Boston, MA 02110-1301 USA |
---|
24 | */ |
---|
25 | |
---|
26 | #include "nogaim.h" |
---|
27 | #include "msn.h" |
---|
28 | |
---|
29 | const struct msn_away_state msn_away_state_list[] = |
---|
30 | { |
---|
31 | { "NLN", "" }, |
---|
32 | { "AWY", "Away" }, |
---|
33 | { "BSY", "Busy" }, |
---|
34 | { "IDL", "Idle" }, |
---|
35 | { "BRB", "Be Right Back" }, |
---|
36 | { "PHN", "On the Phone" }, |
---|
37 | { "LUN", "Out to Lunch" }, |
---|
38 | { "HDN", "Hidden" }, |
---|
39 | { "", "" } |
---|
40 | }; |
---|
41 | |
---|
42 | const struct msn_away_state *msn_away_state_by_code(char *code) |
---|
43 | { |
---|
44 | int i; |
---|
45 | |
---|
46 | for (i = 0; *msn_away_state_list[i].code; i++) { |
---|
47 | if (g_strcasecmp(msn_away_state_list[i].code, code) == 0) { |
---|
48 | return(msn_away_state_list + i); |
---|
49 | } |
---|
50 | } |
---|
51 | |
---|
52 | return NULL; |
---|
53 | } |
---|
54 | |
---|
55 | const struct msn_away_state *msn_away_state_by_name(char *name) |
---|
56 | { |
---|
57 | int i; |
---|
58 | |
---|
59 | for (i = 0; *msn_away_state_list[i].code; i++) { |
---|
60 | if (g_strcasecmp(msn_away_state_list[i].name, name) == 0) { |
---|
61 | return(msn_away_state_list + i); |
---|
62 | } |
---|
63 | } |
---|
64 | |
---|
65 | return NULL; |
---|
66 | } |
---|
67 | |
---|
68 | const struct msn_status_code msn_status_code_list[] = |
---|
69 | { |
---|
70 | { 200, "Invalid syntax", 0 }, |
---|
71 | { 201, "Invalid parameter", 0 }, |
---|
72 | { 205, "Invalid (non-existent) handle", 0 }, |
---|
73 | { 206, "Domain name missing", 0 }, |
---|
74 | { 207, "Already logged in", 0 }, |
---|
75 | { 208, "Invalid handle", STATUS_SB_IM_SPARE }, |
---|
76 | { 209, "Forbidden nickname", 0 }, |
---|
77 | { 210, "Buddy list too long", 0 }, |
---|
78 | { 215, "Handle is already in list", 0 }, |
---|
79 | { 216, "Handle is not in list", STATUS_SB_IM_SPARE }, |
---|
80 | { 217, "Person is off-line or non-existent", STATUS_SB_IM_SPARE }, |
---|
81 | { 218, "Already in that mode", 0 }, |
---|
82 | { 219, "Handle is already in opposite list", 0 }, |
---|
83 | { 223, "Too many groups", 0 }, |
---|
84 | { 224, "Invalid group or already in list", 0 }, |
---|
85 | { 225, "Handle is not in that group", 0 }, |
---|
86 | { 229, "Group name too long", 0 }, |
---|
87 | { 230, "Cannot remove that group", 0 }, |
---|
88 | { 231, "Invalid group", 0 }, |
---|
89 | { 240, "ADL/RML command with corrupted payload", STATUS_FATAL }, |
---|
90 | { 241, "ADL/RML command with invalid modification", 0 }, |
---|
91 | { 280, "Switchboard failed", STATUS_SB_FATAL }, |
---|
92 | { 281, "Transfer to switchboard failed", 0 }, |
---|
93 | |
---|
94 | { 300, "Required field missing", 0 }, |
---|
95 | { 302, "Not logged in", 0 }, |
---|
96 | |
---|
97 | { 500, "Internal server error/Account banned", STATUS_FATAL }, |
---|
98 | { 501, "Database server error", STATUS_FATAL }, |
---|
99 | { 502, "Command disabled", 0 }, |
---|
100 | { 510, "File operation failed", STATUS_FATAL }, |
---|
101 | { 520, "Memory allocation failed", STATUS_FATAL }, |
---|
102 | { 540, "Challenge response invalid", STATUS_FATAL }, |
---|
103 | |
---|
104 | { 600, "Server is busy", STATUS_FATAL }, |
---|
105 | { 601, "Server is unavailable", STATUS_FATAL }, |
---|
106 | { 602, "Peer nameserver is down", STATUS_FATAL }, |
---|
107 | { 603, "Database connection failed", STATUS_FATAL }, |
---|
108 | { 604, "Server is going down", STATUS_FATAL }, |
---|
109 | { 605, "Server is unavailable", STATUS_FATAL }, |
---|
110 | |
---|
111 | { 700, "Could not create connection", STATUS_FATAL }, |
---|
112 | { 710, "Invalid CVR parameters", STATUS_FATAL }, |
---|
113 | { 711, "Write is blocking", STATUS_FATAL }, |
---|
114 | { 712, "Session is overloaded", STATUS_FATAL }, |
---|
115 | { 713, "Calling too rapidly", STATUS_SB_IM_SPARE }, |
---|
116 | { 714, "Too many sessions", STATUS_FATAL }, |
---|
117 | { 715, "Not expected/Invalid argument/action", 0 }, |
---|
118 | { 717, "Bad friend file", STATUS_FATAL }, |
---|
119 | { 731, "Not expected/Invalid argument", 0 }, |
---|
120 | |
---|
121 | { 800, "Changing too rapidly", 0 }, |
---|
122 | |
---|
123 | { 910, "Server is busy", STATUS_FATAL }, |
---|
124 | { 911, "Authentication failed", STATUS_SB_FATAL | STATUS_FATAL }, |
---|
125 | { 912, "Server is busy", STATUS_FATAL }, |
---|
126 | { 913, "Not allowed when hiding", 0 }, |
---|
127 | { 914, "Server is unavailable", STATUS_FATAL }, |
---|
128 | { 915, "Server is unavailable", STATUS_FATAL }, |
---|
129 | { 916, "Server is unavailable", STATUS_FATAL }, |
---|
130 | { 917, "Authentication failed", STATUS_FATAL }, |
---|
131 | { 918, "Server is busy", STATUS_FATAL }, |
---|
132 | { 919, "Server is busy", STATUS_FATAL }, |
---|
133 | { 920, "Not accepting new principals", 0 }, /* When a sb is full? */ |
---|
134 | { 922, "Server is busy", STATUS_FATAL }, |
---|
135 | { 923, "Kids Passport without parental consent", STATUS_FATAL }, |
---|
136 | { 924, "Passport account not yet verified", STATUS_FATAL }, |
---|
137 | { 928, "Bad ticket", STATUS_FATAL }, |
---|
138 | { -1, NULL, 0 } |
---|
139 | }; |
---|
140 | |
---|
141 | const struct msn_status_code *msn_status_by_number(int number) |
---|
142 | { |
---|
143 | static struct msn_status_code *unknown = NULL; |
---|
144 | int i; |
---|
145 | |
---|
146 | for (i = 0; msn_status_code_list[i].number >= 0; i++) { |
---|
147 | if (msn_status_code_list[i].number == number) { |
---|
148 | return(msn_status_code_list + i); |
---|
149 | } |
---|
150 | } |
---|
151 | |
---|
152 | if (unknown == NULL) { |
---|
153 | unknown = g_new0(struct msn_status_code, 1); |
---|
154 | unknown->text = g_new0(char, 128); |
---|
155 | } |
---|
156 | |
---|
157 | unknown->number = number; |
---|
158 | unknown->flags = 0; |
---|
159 | g_snprintf(unknown->text, 128, "Unknown error (%d)", number); |
---|
160 | |
---|
161 | return(unknown); |
---|
162 | } |
---|