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