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., 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 | { "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 | return NULL; |
---|
51 | } |
---|
52 | |
---|
53 | const struct msn_away_state *msn_away_state_by_name( char *name ) |
---|
54 | { |
---|
55 | int i; |
---|
56 | |
---|
57 | for( i = 0; *msn_away_state_list[i].code; i ++ ) |
---|
58 | if( g_strcasecmp( msn_away_state_list[i].name, name ) == 0 ) |
---|
59 | return( msn_away_state_list + i ); |
---|
60 | |
---|
61 | return NULL; |
---|
62 | } |
---|
63 | |
---|
64 | const struct msn_status_code msn_status_code_list[] = |
---|
65 | { |
---|
66 | { 200, "Invalid syntax", 0 }, |
---|
67 | { 201, "Invalid parameter", 0 }, |
---|
68 | { 205, "Invalid (non-existent) handle", 0 }, |
---|
69 | { 206, "Domain name missing", 0 }, |
---|
70 | { 207, "Already logged in", 0 }, |
---|
71 | { 208, "Invalid handle", STATUS_SB_IM_SPARE }, |
---|
72 | { 209, "Forbidden nickname", 0 }, |
---|
73 | { 210, "Buddy list too long", 0 }, |
---|
74 | { 215, "Handle is already in list", 0 }, |
---|
75 | { 216, "Handle is not in list", STATUS_SB_IM_SPARE }, |
---|
76 | { 217, "Person is off-line or non-existent", STATUS_SB_IM_SPARE }, |
---|
77 | { 218, "Already in that mode", 0 }, |
---|
78 | { 219, "Handle is already in opposite list", 0 }, |
---|
79 | { 223, "Too many groups", 0 }, |
---|
80 | { 224, "Invalid group or already in list", 0 }, |
---|
81 | { 225, "Handle is not in that group", 0 }, |
---|
82 | { 229, "Group name too long", 0 }, |
---|
83 | { 230, "Cannot remove that group", 0 }, |
---|
84 | { 231, "Invalid group", 0 }, |
---|
85 | { 240, "ADL/RML command with corrupted payload", STATUS_FATAL }, |
---|
86 | { 241, "ADL/RML command with invalid modification", STATUS_FATAL }, |
---|
87 | { 280, "Switchboard failed", STATUS_SB_FATAL }, |
---|
88 | { 281, "Transfer to switchboard failed", 0 }, |
---|
89 | |
---|
90 | { 300, "Required field missing", 0 }, |
---|
91 | { 302, "Not logged in", 0 }, |
---|
92 | |
---|
93 | { 500, "Internal server error/Account banned", STATUS_FATAL }, |
---|
94 | { 501, "Database server error", STATUS_FATAL }, |
---|
95 | { 502, "Command disabled", 0 }, |
---|
96 | { 510, "File operation failed", STATUS_FATAL }, |
---|
97 | { 520, "Memory allocation failed", STATUS_FATAL }, |
---|
98 | { 540, "Challenge response invalid", STATUS_FATAL }, |
---|
99 | |
---|
100 | { 600, "Server is busy", STATUS_FATAL }, |
---|
101 | { 601, "Server is unavailable", STATUS_FATAL }, |
---|
102 | { 602, "Peer nameserver is down", STATUS_FATAL }, |
---|
103 | { 603, "Database connection failed", STATUS_FATAL }, |
---|
104 | { 604, "Server is going down", STATUS_FATAL }, |
---|
105 | { 605, "Server is unavailable", STATUS_FATAL }, |
---|
106 | |
---|
107 | { 700, "Could not create connection", STATUS_FATAL }, |
---|
108 | { 710, "Invalid CVR parameters", STATUS_FATAL }, |
---|
109 | { 711, "Write is blocking", STATUS_FATAL }, |
---|
110 | { 712, "Session is overloaded", STATUS_FATAL }, |
---|
111 | { 713, "Calling too rapidly", STATUS_SB_IM_SPARE }, |
---|
112 | { 714, "Too many sessions", STATUS_FATAL }, |
---|
113 | { 715, "Not expected/Invalid argument/action", 0 }, |
---|
114 | { 717, "Bad friend file", STATUS_FATAL }, |
---|
115 | { 731, "Not expected/Invalid argument", 0 }, |
---|
116 | |
---|
117 | { 800, "Changing too rapidly", 0 }, |
---|
118 | |
---|
119 | { 910, "Server is busy", STATUS_FATAL }, |
---|
120 | { 911, "Authentication failed", STATUS_SB_FATAL | STATUS_FATAL }, |
---|
121 | { 912, "Server is busy", STATUS_FATAL }, |
---|
122 | { 913, "Not allowed when hiding", 0 }, |
---|
123 | { 914, "Server is unavailable", STATUS_FATAL }, |
---|
124 | { 915, "Server is unavailable", STATUS_FATAL }, |
---|
125 | { 916, "Server is unavailable", STATUS_FATAL }, |
---|
126 | { 917, "Authentication failed", STATUS_FATAL }, |
---|
127 | { 918, "Server is busy", STATUS_FATAL }, |
---|
128 | { 919, "Server is busy", STATUS_FATAL }, |
---|
129 | { 920, "Not accepting new principals", 0 }, /* When a sb is full? */ |
---|
130 | { 922, "Server is busy", STATUS_FATAL }, |
---|
131 | { 923, "Kids Passport without parental consent", STATUS_FATAL }, |
---|
132 | { 924, "Passport account not yet verified", STATUS_FATAL }, |
---|
133 | { 928, "Bad ticket", STATUS_FATAL }, |
---|
134 | { -1, NULL, 0 } |
---|
135 | }; |
---|
136 | |
---|
137 | const struct msn_status_code *msn_status_by_number( int number ) |
---|
138 | { |
---|
139 | static struct msn_status_code *unknown = NULL; |
---|
140 | int i; |
---|
141 | |
---|
142 | for( i = 0; msn_status_code_list[i].number >= 0; i ++ ) |
---|
143 | if( msn_status_code_list[i].number == number ) |
---|
144 | return( msn_status_code_list + i ); |
---|
145 | |
---|
146 | if( unknown == NULL ) |
---|
147 | { |
---|
148 | unknown = g_new0( struct msn_status_code, 1 ); |
---|
149 | unknown->text = g_new0( char, 128 ); |
---|
150 | } |
---|
151 | |
---|
152 | unknown->number = number; |
---|
153 | unknown->flags = 0; |
---|
154 | g_snprintf( unknown->text, 128, "Unknown error (%d)", number ); |
---|
155 | |
---|
156 | return( unknown ); |
---|
157 | } |
---|