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 | { 280, "Switchboard failed", STATUS_SB_FATAL }, |
---|
86 | { 281, "Transfer to switchboard failed", 0 }, |
---|
87 | |
---|
88 | { 300, "Required field missing", 0 }, |
---|
89 | { 302, "Not logged in", 0 }, |
---|
90 | |
---|
91 | { 500, "Internal server error/Account banned", STATUS_FATAL }, |
---|
92 | { 501, "Database server error", STATUS_FATAL }, |
---|
93 | { 502, "Command disabled", 0 }, |
---|
94 | { 510, "File operation failed", STATUS_FATAL }, |
---|
95 | { 520, "Memory allocation failed", STATUS_FATAL }, |
---|
96 | { 540, "Challenge response invalid", STATUS_FATAL }, |
---|
97 | |
---|
98 | { 600, "Server is busy", STATUS_FATAL }, |
---|
99 | { 601, "Server is unavailable", STATUS_FATAL }, |
---|
100 | { 602, "Peer nameserver is down", STATUS_FATAL }, |
---|
101 | { 603, "Database connection failed", STATUS_FATAL }, |
---|
102 | { 604, "Server is going down", STATUS_FATAL }, |
---|
103 | { 605, "Server is unavailable", STATUS_FATAL }, |
---|
104 | |
---|
105 | { 700, "Could not create connection", STATUS_FATAL }, |
---|
106 | { 710, "Invalid CVR parameters", STATUS_FATAL }, |
---|
107 | { 711, "Write is blocking", STATUS_FATAL }, |
---|
108 | { 712, "Session is overloaded", STATUS_FATAL }, |
---|
109 | { 713, "Calling too rapidly", STATUS_SB_IM_SPARE }, |
---|
110 | { 714, "Too many sessions", STATUS_FATAL }, |
---|
111 | { 715, "Not expected/Invalid argument/action", 0 }, |
---|
112 | { 717, "Bad friend file", STATUS_FATAL }, |
---|
113 | { 731, "Not expected/Invalid argument", 0 }, |
---|
114 | |
---|
115 | { 800, "Changing too rapidly", 0 }, |
---|
116 | |
---|
117 | { 910, "Server is busy", STATUS_FATAL }, |
---|
118 | { 911, "Authentication failed", STATUS_SB_FATAL | STATUS_FATAL }, |
---|
119 | { 912, "Server is busy", STATUS_FATAL }, |
---|
120 | { 913, "Not allowed when hiding", 0 }, |
---|
121 | { 914, "Server is unavailable", STATUS_FATAL }, |
---|
122 | { 915, "Server is unavailable", STATUS_FATAL }, |
---|
123 | { 916, "Server is unavailable", STATUS_FATAL }, |
---|
124 | { 917, "Authentication failed", STATUS_FATAL }, |
---|
125 | { 918, "Server is busy", STATUS_FATAL }, |
---|
126 | { 919, "Server is busy", STATUS_FATAL }, |
---|
127 | { 920, "Not accepting new principals", 0 }, /* When a sb is full? */ |
---|
128 | { 922, "Server is busy", STATUS_FATAL }, |
---|
129 | { 923, "Kids Passport without parental consent", STATUS_FATAL }, |
---|
130 | { 924, "Passport account not yet verified", STATUS_FATAL }, |
---|
131 | { 928, "Bad ticket", STATUS_FATAL }, |
---|
132 | { -1, NULL, 0 } |
---|
133 | }; |
---|
134 | |
---|
135 | const struct msn_status_code *msn_status_by_number( int number ) |
---|
136 | { |
---|
137 | static struct msn_status_code *unknown = NULL; |
---|
138 | int i; |
---|
139 | |
---|
140 | for( i = 0; msn_status_code_list[i].number >= 0; i ++ ) |
---|
141 | if( msn_status_code_list[i].number == number ) |
---|
142 | return( msn_status_code_list + i ); |
---|
143 | |
---|
144 | if( unknown == NULL ) |
---|
145 | { |
---|
146 | unknown = g_new0( struct msn_status_code, 1 ); |
---|
147 | unknown->text = g_new0( char, 128 ); |
---|
148 | } |
---|
149 | |
---|
150 | unknown->number = number; |
---|
151 | unknown->flags = 0; |
---|
152 | g_snprintf( unknown->text, 128, "Unknown error (%d)", number ); |
---|
153 | |
---|
154 | return( unknown ); |
---|
155 | } |
---|