Mercurial > pidgin
annotate plugins/icq/cyrillic.c @ 1684:89c19002e73d
[gaim-migrate @ 1694]
stop getting booted by gabber people
committer: Tailor Script <tailor@pidgin.im>
| author | Eric Warmenhoven <eric@warmenhoven.org> |
|---|---|
| date | Thu, 05 Apr 2001 01:04:10 +0000 |
| parents | 4c510ca3563f |
| children | 8ed70631ed15 |
| rev | line source |
|---|---|
| 1152 | 1 /* -*- Mode: C; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ |
| 2 /* | |
|
1432
4c510ca3563f
[gaim-migrate @ 1442]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1309
diff
changeset
|
3 $Id: cyrillic.c 1442 2001-01-28 01:52:27Z warmenhoven $ |
| 1152 | 4 $Log$ |
|
1432
4c510ca3563f
[gaim-migrate @ 1442]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1309
diff
changeset
|
5 Revision 1.3 2001/01/28 01:52:27 warmenhoven |
|
4c510ca3563f
[gaim-migrate @ 1442]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1309
diff
changeset
|
6 icqlib 1.1.5 |
| 1152 | 7 |
| 8 Revision 1.7 2000/05/21 17:41:14 denis | |
| 9 Applied patch for russian letters IO and io by | |
| 10 Vladimir Eltchinov <elik@design.ru> | |
| 11 | |
| 12 Revision 1.6 2000/02/07 02:31:37 bills | |
| 13 added icq_RusConv_n | |
| 14 | |
| 15 Revision 1.5 1999/09/29 16:45:26 denis | |
| 16 Cleanups | |
| 17 | |
| 18 Revision 1.4 1999/07/16 12:08:20 denis | |
| 19 Cleaned up. | |
| 20 | |
| 21 Revision 1.3 1999/07/12 15:13:29 cproch | |
| 22 - added definition of ICQLINK to hold session-specific global variabled | |
| 23 applications which have more than one connection are now possible | |
| 24 - changed nearly every function defintion to support ICQLINK parameter | |
| 25 | |
| 26 Revision 1.2 1999/04/14 14:44:30 denis | |
| 27 Switched from icq_Log callback to icq_FmtLog function. | |
| 28 | |
| 29 Revision 1.1 1999/03/24 11:37:35 denis | |
| 30 Underscored files with TCP stuff renamed. | |
| 31 TCP stuff cleaned up | |
| 32 Function names changed to corresponding names. | |
| 33 icqlib.c splitted to many small files by subject. | |
| 34 C++ comments changed to ANSI C comments. | |
| 35 | |
| 36 */ | |
| 37 | |
| 38 #include "icqtypes.h" | |
| 39 #include "icq.h" | |
| 40 #include "icqlib.h" | |
| 41 #include "util.h" | |
| 42 | |
| 43 BYTE kw[] = {128,129,130,131,132,133,134,135,136,137,138,139,140,141,142,143, | |
| 44 144,145,146,147,148,149,150,151,152,153,154,155,156,157,158,159, | |
| 45 160,161,162,184,164,165,166,167,168,169,170,171,172,173,174,175, | |
| 46 176,177,178,168,180,181,182,183,184,185,186,187,188,189,190,191, | |
| 47 254,224,225,246,228,229,244,227,245,232,233,234,235,236,237,238, | |
| 48 239,255,240,241,242,243,230,226,252,251,231,248,253,249,247,250, | |
| 49 222,192,193,214,196,197,212,195,213,200,201,202,203,204,205,206, | |
| 50 207,223,208,209,210,211,198,194,220,219,199,216,221,217,215,218}; | |
| 51 | |
| 52 BYTE wk[] = {128,129,130,131,132,133,134,135,136,137,138,139,140,141,142,143, | |
| 53 144,145,146,147,148,149,150,151,152,153,154,155,156,157,158,159, | |
| 54 160,161,162,163,164,165,166,167,179,169,170,171,172,173,174,175, | |
| 55 176,177,178,179,180,181,182,183,163,185,186,187,188,189,190,191, | |
| 56 225,226,247,231,228,229,246,250,233,234,235,236,237,238,239,240, | |
| 57 242,243,244,245,230,232,227,254,251,253,255,249,248,252,224,241, | |
| 58 193,194,215,199,196,197,214,218,201,202,203,204,205,206,207,208, | |
| 59 210,211,212,213,198,200,195,222,219,221,223,217,216,220,192,209}; | |
| 60 | |
| 61 /******************************************************** | |
| 62 Russian language ICQ fix. | |
| 63 Usual Windows ICQ users do use Windows 1251 encoding but | |
| 64 unix users do use koi8 encoding, so we need to convert it. | |
| 65 This function will convert string from windows 1251 to koi8 | |
| 66 or from koi8 to windows 1251. | |
| 67 Andrew Frolov dron@ilm.net | |
| 68 *********************************************************/ | |
| 69 | |
| 70 extern int icq_Russian; | |
| 71 | |
| 72 void icq_RusConv(const char to[4], char *t_in) | |
| 73 { | |
| 74 BYTE *table; | |
| 75 int i; | |
| 76 | |
| 77 /* 6-17-1998 by Linux_Dude | |
| 78 * Moved initialization of table out front of 'if' block to prevent compiler | |
| 79 * warning. Improved error message, and now return without performing string | |
| 80 * conversion to prevent addressing memory out of range (table pointer would | |
| 81 * previously have remained uninitialized (= bad)). | |
| 82 */ | |
| 83 | |
| 84 table = wk; | |
| 85 if(strcmp(to, "kw") == 0) | |
| 86 table = kw; | |
| 87 else if(strcmp(to, "wk") != 0) | |
| 88 { | |
| 89 icq_FmtLog(NULL, ICQ_LOG_ERROR, "Unknown option in call to Russian Convert\n"); | |
| 90 return; | |
| 91 } | |
| 92 | |
| 93 /* End Linux_Dude's changes ;) */ | |
| 94 | |
| 95 if(icq_Russian) | |
| 96 { | |
| 97 for(i=0;t_in[i]!=0;i++) | |
| 98 { | |
| 99 t_in[i] &= 0377; | |
| 100 if(t_in[i] & 0200) | |
| 101 t_in[i] = table[t_in[i] & 0177]; | |
| 102 } | |
| 103 } | |
| 104 } | |
| 105 | |
| 106 void icq_RusConv_n(const char to[4], char *t_in, int len) | |
| 107 { | |
| 108 BYTE *table; | |
| 109 int i; | |
| 110 | |
| 111 /* 6-17-1998 by Linux_Dude | |
| 112 * Moved initialization of table out front of 'if' block to prevent compiler | |
| 113 * warning. Improved error message, and now return without performing string | |
| 114 * conversion to prevent addressing memory out of range (table pointer would | |
| 115 * previously have remained uninitialized (= bad)). | |
| 116 */ | |
| 117 | |
| 118 table = wk; | |
| 119 if(strcmp(to, "kw") == 0) | |
| 120 table = kw; | |
| 121 else if(strcmp(to, "wk") != 0) | |
| 122 { | |
| 123 icq_FmtLog(NULL, ICQ_LOG_ERROR, "Unknown option in call to Russian Convert\n"); | |
| 124 return; | |
| 125 } | |
| 126 | |
| 127 /* End Linux_Dude's changes ;) */ | |
| 128 | |
| 129 if(icq_Russian) | |
| 130 { | |
| 131 for(i=0;i < len;i++) | |
| 132 { | |
| 133 t_in[i] &= 0377; | |
| 134 if(t_in[i] & 0200) | |
| 135 t_in[i] = table[t_in[i] & 0177]; | |
| 136 } | |
| 137 } | |
| 138 } |
