Mercurial > pidgin.yaz
annotate plugins/icq/cyrillic.c @ 1912:8ed70631ed15
[gaim-migrate @ 1922]
new icqlib
committer: Tailor Script <tailor@pidgin.im>
author | Eric Warmenhoven <eric@warmenhoven.org> |
---|---|
date | Tue, 29 May 2001 10:32:53 +0000 |
parents | 4c510ca3563f |
children | 7b3f1eb1ef7d |
rev | line source |
---|---|
1152 | 1 /* -*- Mode: C; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ |
2 | |
1912
8ed70631ed15
[gaim-migrate @ 1922]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1432
diff
changeset
|
3 /* |
8ed70631ed15
[gaim-migrate @ 1922]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1432
diff
changeset
|
4 * Copyright (C) 1998-2001, Denis V. Dmitrienko <denis@null.net> and |
8ed70631ed15
[gaim-migrate @ 1922]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1432
diff
changeset
|
5 * Bill Soudan <soudan@kde.org> |
8ed70631ed15
[gaim-migrate @ 1922]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1432
diff
changeset
|
6 * |
8ed70631ed15
[gaim-migrate @ 1922]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1432
diff
changeset
|
7 * This program is free software; you can redistribute it and/or modify |
8ed70631ed15
[gaim-migrate @ 1922]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1432
diff
changeset
|
8 * it under the terms of the GNU General Public License as published by |
8ed70631ed15
[gaim-migrate @ 1922]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1432
diff
changeset
|
9 * the Free Software Foundation; either version 2 of the License, or |
8ed70631ed15
[gaim-migrate @ 1922]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1432
diff
changeset
|
10 * (at your option) any later version. |
8ed70631ed15
[gaim-migrate @ 1922]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1432
diff
changeset
|
11 * |
8ed70631ed15
[gaim-migrate @ 1922]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1432
diff
changeset
|
12 * This program is distributed in the hope that it will be useful, |
8ed70631ed15
[gaim-migrate @ 1922]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1432
diff
changeset
|
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of |
8ed70631ed15
[gaim-migrate @ 1922]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1432
diff
changeset
|
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
8ed70631ed15
[gaim-migrate @ 1922]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1432
diff
changeset
|
15 * GNU General Public License for more details. |
8ed70631ed15
[gaim-migrate @ 1922]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1432
diff
changeset
|
16 * |
8ed70631ed15
[gaim-migrate @ 1922]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1432
diff
changeset
|
17 * You should have received a copy of the GNU General Public License |
8ed70631ed15
[gaim-migrate @ 1922]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1432
diff
changeset
|
18 * along with this program; if not, write to the Free Software |
8ed70631ed15
[gaim-migrate @ 1922]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1432
diff
changeset
|
19 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. |
8ed70631ed15
[gaim-migrate @ 1922]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1432
diff
changeset
|
20 * |
8ed70631ed15
[gaim-migrate @ 1922]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1432
diff
changeset
|
21 */ |
1152 | 22 |
23 #include "icq.h" | |
24 #include "icqlib.h" | |
25 | |
26 BYTE kw[] = {128,129,130,131,132,133,134,135,136,137,138,139,140,141,142,143, | |
27 144,145,146,147,148,149,150,151,152,153,154,155,156,157,158,159, | |
1912
8ed70631ed15
[gaim-migrate @ 1922]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1432
diff
changeset
|
28 160,161,162,184,186,165,179,191,168,169,170,171,172,180,174,175, |
8ed70631ed15
[gaim-migrate @ 1922]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1432
diff
changeset
|
29 176,177,178,168,170,181,178,175,184,185,170,187,188,165,190,169, |
1152 | 30 254,224,225,246,228,229,244,227,245,232,233,234,235,236,237,238, |
31 239,255,240,241,242,243,230,226,252,251,231,248,253,249,247,250, | |
32 222,192,193,214,196,197,212,195,213,200,201,202,203,204,205,206, | |
33 207,223,208,209,210,211,198,194,220,219,199,216,221,217,215,218}; | |
34 | |
35 BYTE wk[] = {128,129,130,131,132,133,134,135,136,137,138,139,140,141,142,143, | |
36 144,145,146,147,148,149,150,151,152,153,154,155,156,157,158,159, | |
1912
8ed70631ed15
[gaim-migrate @ 1922]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1432
diff
changeset
|
37 160,161,162,163,164,189,166,167,179,191,180,171,172,173,174,183, |
8ed70631ed15
[gaim-migrate @ 1922]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1432
diff
changeset
|
38 176,177,182,166,173,181,182,183,163,185,164,187,188,189,190,167, |
1152 | 39 225,226,247,231,228,229,246,250,233,234,235,236,237,238,239,240, |
40 242,243,244,245,230,232,227,254,251,253,255,249,248,252,224,241, | |
41 193,194,215,199,196,197,214,218,201,202,203,204,205,206,207,208, | |
42 210,211,212,213,198,200,195,222,219,221,223,217,216,220,192,209}; | |
43 | |
44 /******************************************************** | |
45 Russian language ICQ fix. | |
46 Usual Windows ICQ users do use Windows 1251 encoding but | |
47 unix users do use koi8 encoding, so we need to convert it. | |
48 This function will convert string from windows 1251 to koi8 | |
49 or from koi8 to windows 1251. | |
50 Andrew Frolov dron@ilm.net | |
51 *********************************************************/ | |
52 | |
53 extern int icq_Russian; | |
54 | |
55 void icq_RusConv(const char to[4], char *t_in) | |
56 { | |
57 BYTE *table; | |
58 int i; | |
59 | |
60 /* 6-17-1998 by Linux_Dude | |
61 * Moved initialization of table out front of 'if' block to prevent compiler | |
62 * warning. Improved error message, and now return without performing string | |
63 * conversion to prevent addressing memory out of range (table pointer would | |
64 * previously have remained uninitialized (= bad)). | |
65 */ | |
66 | |
67 table = wk; | |
68 if(strcmp(to, "kw") == 0) | |
69 table = kw; | |
70 else if(strcmp(to, "wk") != 0) | |
71 { | |
72 icq_FmtLog(NULL, ICQ_LOG_ERROR, "Unknown option in call to Russian Convert\n"); | |
73 return; | |
74 } | |
75 | |
76 /* End Linux_Dude's changes ;) */ | |
77 | |
78 if(icq_Russian) | |
79 { | |
80 for(i=0;t_in[i]!=0;i++) | |
81 { | |
82 t_in[i] &= 0377; | |
83 if(t_in[i] & 0200) | |
84 t_in[i] = table[t_in[i] & 0177]; | |
85 } | |
86 } | |
87 } | |
88 | |
89 void icq_RusConv_n(const char to[4], char *t_in, int len) | |
90 { | |
91 BYTE *table; | |
92 int i; | |
93 | |
94 /* 6-17-1998 by Linux_Dude | |
95 * Moved initialization of table out front of 'if' block to prevent compiler | |
96 * warning. Improved error message, and now return without performing string | |
97 * conversion to prevent addressing memory out of range (table pointer would | |
98 * previously have remained uninitialized (= bad)). | |
99 */ | |
100 | |
101 table = wk; | |
102 if(strcmp(to, "kw") == 0) | |
103 table = kw; | |
104 else if(strcmp(to, "wk") != 0) | |
105 { | |
106 icq_FmtLog(NULL, ICQ_LOG_ERROR, "Unknown option in call to Russian Convert\n"); | |
107 return; | |
108 } | |
109 | |
110 /* End Linux_Dude's changes ;) */ | |
111 | |
112 if(icq_Russian) | |
113 { | |
114 for(i=0;i < len;i++) | |
115 { | |
116 t_in[i] &= 0377; | |
117 if(t_in[i] & 0200) | |
118 t_in[i] = table[t_in[i] & 0177]; | |
119 } | |
120 } | |
121 } |