PageRenderTime 5ms CodeModel.GetById 3ms app.highlight 6ms RepoModel.GetById 1ms app.codeStats 0ms

/patches/pending_history/history.diff

https://github.com/zet/bombus
diff | 919 lines | 885 code | 34 blank | 0 comment | 0 complexity | 5a839aaab4a71c9eb36e52c7210f8c3e MD5 | raw file
  1Index: trunk/src/Client/Config.java
  2===================================================================
  3--- trunk/src/Client/Config.java	(revision 1209)
  4+++ trunk/src/Client/Config.java	(working copy)
  5@@ -66,7 +66,7 @@
  6     public boolean ghostMotor=getBooleanProperty("moto_e398",false);
  7     public boolean blFlash=!ghostMotor; //true;
  8     
  9-    public boolean msgLog=getBooleanProperty("msg_log",false);
 10+    //public boolean msgLog=getBooleanProperty("msg_log",false);
 11     
 12     public boolean muc119=getBooleanProperty("muc_119",true);	// before muc 1.19 use muc#owner instead of muc#admin
 13     
 14@@ -147,6 +147,14 @@
 15     
 16     public int messageCollapsedLength=512;
 17     
 18+    public String msgPath="";
 19+    public boolean msgLog=false;
 20+    public boolean msgLogPresence=false;
 21+    public boolean msgLogConf=false;
 22+    public boolean msgLogConfPresence=false;
 23+    public boolean cp1251=true;
 24+    public boolean transliterateFilenames=false;
 25+    
 26     // runtime values
 27     public boolean allowMinimize=false;
 28     public int profile=0;
 29@@ -154,6 +162,7 @@
 30     
 31     public boolean istreamWaiting;
 32     
 33+    
 34 
 35     // Singleton
 36     private static Config instance;
 37@@ -287,6 +296,14 @@
 38             eventDelivery=inputStream.readBoolean();
 39             
 40             messageCollapsedLength=inputStream.readInt();
 41+            
 42+            msgPath=inputStream.readUTF();
 43+            msgLog=inputStream.readBoolean();
 44+            msgLogPresence=inputStream.readBoolean();
 45+            msgLogConfPresence=inputStream.readBoolean();
 46+            msgLogConf=inputStream.readBoolean();
 47+            cp1251=inputStream.readBoolean();
 48+            transliterateFilenames=inputStream.readBoolean();
 49 	    
 50 	    inputStream.close();
 51 	} catch (Exception e) {
 52@@ -382,6 +399,14 @@
 53             outputStream.writeBoolean(eventDelivery);
 54             
 55             outputStream.writeInt(messageCollapsedLength);
 56+            
 57+            outputStream.writeUTF(msgPath);
 58+            outputStream.writeBoolean(msgLog);
 59+            outputStream.writeBoolean(msgLogPresence);
 60+            outputStream.writeBoolean(msgLogConfPresence);
 61+            outputStream.writeBoolean(msgLogConf);
 62+            outputStream.writeBoolean(cp1251);
 63+            outputStream.writeBoolean(transliterateFilenames);
 64 	    
 65 	} catch (Exception e) { e.printStackTrace(); }
 66 	
 67Index: trunk/src/Client/Contact.java
 68===================================================================
 69--- trunk/src/Client/Contact.java	(revision 1209)
 70+++ trunk/src/Client/Contact.java	(working copy)
 71@@ -26,6 +26,10 @@
 72  */
 73 
 74 package Client;
 75+//#if FILE_IO && HISTORY
 76+//# import Client.HistoryAppend;
 77+//# import Conference.MucContact;
 78+//#endif
 79 import com.alsutton.jabber.JabberDataBlock;
 80 import images.RosterIcons;
 81 import ui.Colors;
 82@@ -212,13 +216,13 @@
 83         if (m.isPresence()) 
 84             if (msgs.size()==1) 
 85                 if ( ((Msg)msgs.firstElement()).isPresence())
 86-                    if (origin!=ORIGIN_GROUPCHAT) first_replace=true;
 87-//#if USE_SIEMENS_FILES
 88+                    if (origin!=ORIGIN_GROUPCHAT) first_replace=true;       
 89+//#if FILE_IO && HISTORY
 90 //#         Config cf=Config.getInstance();
 91-//# 
 92-//#         if (cf.msgLog && group.index!=Groups.TYPE_TRANSP && group.index!=Groups.TYPE_SEARCH_RESULT)
 93+//#         if (cf.msgLog && cf.msgPath==null) {
 94+//#         } else 
 95+//#             if (cf.msgLog && group.index!=Groups.TYPE_TRANSP && group.index!=Groups.TYPE_SEARCH_RESULT)
 96 //#         {
 97-//#             String histRecord=(nick==null)?getBareJid():nick;
 98 //#             String fromName=StaticData.getInstance().account.getUserName();
 99 //#             if (m.messageType!=Msg.MESSAGE_TYPE_OUT) fromName=toString();
100 //#             boolean allowLog=false;
101@@ -231,8 +235,9 @@
102 //#                     if (origin>=ORIGIN_GROUPCHAT && cf.msgLogConf) allowLog=true;
103 //#                     if (origin<ORIGIN_GROUPCHAT) allowLog=true;
104 //#             }
105+//#             if (origin!=ORIGIN_GROUPCHAT && this instanceof MucContact)
106+//#                  allowLog=false;
107 //#             if (allowLog)
108-//#                 //if (!first_replace || !m.)
109 //#             {
110 //#                 StringBuffer body=new StringBuffer(m.getDayTime());
111 //#                 body.append(" <");
112@@ -244,9 +249,12 @@
113 //#                 }
114 //#                 body.append(m.getBody());
115 //#                 body.append("\r\n");
116-//#                 io.NvStorage.appendFile("Log_"+histRecord, body.toString());
117+//#                 
118+//#                 String histRecord=(nick==null)?getBareJid():nick;
119+//#                 
120+//#                 new HistoryAppend(body, histRecord);
121 //#             }
122-//#         }
123+//#        }
124 //#endif
125         if (first_replace) {
126             msgs.setElementAt(m,0);
127Index: trunk/src/Client/HistoryAppend.java
128===================================================================
129--- trunk/src/Client/HistoryAppend.java	(revision 0)
130+++ trunk/src/Client/HistoryAppend.java	(revision 0)
131@@ -0,0 +1,82 @@
132+/*
133+ * HistoryAppend.java
134+ *
135+ * Created on 19.06.2007, 9:24
136+ * Copyright (c) 2006-2007, Daniel Apatin (ad), http://apatin.net.ru
137+ * This program is free software; you can redistribute it and/or
138+ * modify it under the terms of the GNU General Public License
139+ * as published by the Free Software Foundation; either version 2
140+ * of the License, or (at your option) any later version.
141+ *
142+ * You can also redistribute and/or modify this program under the
143+ * terms of the Psi License, specified in the accompanied COPYING
144+ * file, as published by the Psi Project; either dated January 1st,
145+ * 2005, or (at your option) any later version.
146+ *
147+ * This program is distributed in the hope that it will be useful,
148+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
149+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
150+ * GNU General Public License for more details.
151+ *
152+ * You should have received a copy of the GNU General Public License
153+ * along with this library; if not, write to the Free Software
154+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
155+ *
156+ */
157+
158+package Client;
159+
160+import Client.Config;
161+import io.file.FileIO;
162+import java.io.IOException;
163+import java.io.OutputStream;
164+//#ifdef TRANSLIT
165+//# import util.Translit;
166+//#endif
167+import util.strconv;
168+
169+public class HistoryAppend {
170+    
171+    private Config cf=Config.getInstance();
172+    
173+    
174+//#if FILE_IO    
175+    private int filePos;
176+    private FileIO file;
177+    private OutputStream os;
178+//#endif
179+    
180+    public HistoryAppend(StringBuffer body, String histRecord) {
181+                
182+       byte[] bodyMessage;
183+
184+       if (cf.cp1251) {
185+            bodyMessage=strconv.convUnicodeToCp1251(body.toString()).getBytes();
186+       } else {
187+            bodyMessage=body.toString().getBytes();
188+       }
189+//#ifdef TRANSLIT
190+//#        String filename=cf.msgPath+((cf.transliterateFilenames)?Translit.translit(histRecord):histRecord)+".txt";
191+//#else
192+       String filename=cf.msgPath+histRecord+".txt";
193+//#endif
194+       file=FileIO.createConnection(filename);
195+        try {
196+            os = file.openOutputStream(0);
197+            try {
198+                os.write(bodyMessage);
199+                filePos+=bodyMessage.length;
200+            } catch (IOException ex) { }
201+            os.close();
202+            os.flush();
203+            file.close();
204+        } catch (IOException ex) {
205+            try {
206+                file.close();
207+            } catch (IOException ex2) { }
208+        }
209+        filename=null;
210+        body=null;
211+        bodyMessage=null;
212+    }
213+}
214\ No newline at end of file
215Index: trunk/src/Client/HistoryConfig.java
216===================================================================
217--- trunk/src/Client/HistoryConfig.java	(revision 0)
218+++ trunk/src/Client/HistoryConfig.java	(revision 0)
219@@ -0,0 +1,155 @@
220+/*
221+ * HistoryConfig.java
222+ *
223+ * Created on 18.06.2007., 15:35
224+ * Copyright (c) 2006-2007, Daniel Apatin (ad), http://apatin.net.ru
225+ * This program is free software; you can redistribute it and/or
226+ * modify it under the terms of the GNU General Public License
227+ * as published by the Free Software Foundation; either version 2
228+ * of the License, or (at your option) any later version.
229+ *
230+ * You can also redistribute and/or modify this program under the
231+ * terms of the Psi License, specified in the accompanied COPYING
232+ * file, as published by the Psi Project; either dated January 1st,
233+ * 2005, or (at your option) any later version.
234+ *
235+ * This program is distributed in the hope that it will be useful,
236+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
237+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
238+ * GNU General Public License for more details.
239+ *
240+ * You should have received a copy of the GNU General Public License
241+ * along with this library; if not, write to the Free Software
242+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
243+ *
244+ */
245+
246+package Client;
247+
248+import Client.Config;
249+import Client.StaticData;
250+//#if FILE_IO
251+import io.file.browse.Browser;
252+import io.file.browse.BrowserListener;
253+//#endif
254+import javax.microedition.lcdui.*;
255+import locale.SR;
256+import ui.controls.TextFieldCombo;
257+
258+public class HistoryConfig implements
259+	CommandListener 
260+//#if FILE_IO
261+	,ItemCommandListener
262+        , BrowserListener
263+//#endif
264+{
265+    private Display display;
266+    private Displayable parentView;
267+
268+    Form f;
269+//#if FILE_IO
270+    ChoiceGroup history;
271+    TextField historyFolder;
272+
273+    Command cmdSetHistFolder=new Command(SR.MS_SELECT_PATH, Command.ITEM,11);
274+//#endif
275+    
276+    Command cmdOk=new Command(SR.MS_OK,Command.OK,1);    
277+    Command cmdCancel=new Command(SR.MS_CANCEL, Command.BACK,99);
278+    
279+    Config cf;
280+    boolean his[];
281+    
282+    /** Creates a new instance of ConfigForm */
283+    public HistoryConfig(Display display) {
284+        this.display=display;
285+        parentView=display.getCurrent();
286+        
287+        cf=Config.getInstance();
288+        
289+        f=new Form(SR.MS_HISTORY_SETTINGS);
290+        
291+//#if FILE_IO
292+        history=new ChoiceGroup(SR.MS_HISTORY, Choice.MULTIPLE); //locale
293+        history.append(SR.MS_SAVE_HISTORY, null); //locale
294+        history.append(SR.MS_SAVE_PRESENCES,null);    //locale     
295+        history.append(SR.MS_SAVE_HISTORY_CONF, null); //locale
296+        history.append(SR.MS_SAVE_PRESENCES_CONF, null); //locale
297+        history.append(SR.MS_1251_CORRECTION, null); //locale
298+//#ifdef TRANSLIT
299+//#         history.append(SR.MS_1251_TRANSLITERATE_FILENAMES, null); //locale
300+//#endif
301+        
302+        boolean his[]={
303+            cf.msgLog,
304+            cf.msgLogPresence,
305+            cf.msgLogConf,
306+            cf.msgLogConfPresence,
307+            cf.cp1251
308+//#ifdef TRANSLIT
309+//#             , cf.transliterateFilenames
310+//#endif
311+        };
312+        this.his=his;
313+        
314+        history.setSelectedFlags(his);
315+        f.append(history);
316+        
317+        historyFolder=new TextFieldCombo(SR.MS_HISTORY_PATH, null, 128, 0, "history_path", display);
318+        historyFolder.setString(cf.msgPath);
319+        historyFolder.addCommand(cmdSetHistFolder);
320+        f.append(historyFolder);
321+        historyFolder.setItemCommandListener(this);
322+//#endif
323+
324+        f.addCommand(cmdOk);
325+        f.addCommand(cmdCancel);
326+        
327+        f.setCommandListener(this);
328+       
329+        display.setCurrent(f);
330+    }
331+    
332+    public void commandAction(Command c, Displayable d) {
333+        if (c==cmdOk) {
334+//#if FILE_IO
335+            history.getSelectedFlags(his);
336+            cf.msgLog=his[0];
337+            cf.msgLogPresence=his[1];
338+            cf.msgLogConf=his[2];
339+            cf.msgLogConfPresence=his[3];
340+            cf.cp1251=his[4];
341+//#ifdef TRANSLIT
342+//#             cf.transliterateFilenames=his[5];
343+//#endif
344+            cf.msgPath=historyFolder.getString();
345+//#endif             
346+            
347+            cf.saveToStorage();
348+            
349+            StaticData.getInstance().roster.reEnumRoster();
350+            destroyView();
351+        }
352+        if (c==cmdCancel) destroyView();
353+    }
354+    
355+//#if FILE_IO
356+    public void commandAction(Command command, Item item) {
357+
358+        if (command==cmdSetHistFolder) {
359+            new Browser(null, display, this, true);
360+        }
361+    }
362+//#endif
363+    
364+    public void destroyView(){
365+        if (display!=null)
366+            display.setCurrent(parentView);
367+    }
368+
369+//#if FILE_IO
370+    public void BrowserFilePathNotify(String pathSelected) {
371+        historyFolder.setString(pathSelected);
372+    }
373+//#endif
374+}
375\ No newline at end of file
376Index: trunk/src/Client/RosterToolsMenu.java
377===================================================================
378--- trunk/src/Client/RosterToolsMenu.java	(revision 1209)
379+++ trunk/src/Client/RosterToolsMenu.java	(working copy)
380@@ -56,8 +56,10 @@
381         addItem(SR.MS_ROOT, 4);
382         addItem(SR.MS_FILE_TRANSFERS, 5);
383 //#endif
384+//#if (FILE_IO && HISTORY)
385+//#         addItem(SR.MS_HISTORY_SETTINGS, 6);
386+//#endif
387         
388-        
389         /*addItem("Break connection", 10);*/
390         
391         
392@@ -97,6 +99,11 @@
393                 new io.file.transfer.TransferManager(display);
394                 return;
395 //#endif
396+//#if (FILE_IO && HISTORY)
397+//#             case 6: //history
398+//#                 new HistoryConfig(display);
399+//#                 return;
400+//#endif 
401             
402             //case 10:
403             //    StaticData.getInstance().roster.connectionTerminated(new Exception("Simulated break"));
404Index: trunk/src/io/file/FileComMotorolaIo.java
405===================================================================
406--- trunk/src/io/file/FileComMotorolaIo.java	(revision 1209)
407+++ trunk/src/io/file/FileComMotorolaIo.java	(working copy)
408@@ -61,6 +61,12 @@
409         }
410         return fileConnection.openOutputStream();
411     }
412+    
413+    public OutputStream openOutputStream(long pos_eof) throws IOException {
414+        if (fileConnection==null) openFile();
415+        if (!fileConnection.exists()) fileConnection.create();
416+        return fileConnection.openOutputStream();
417+    }
418 
419     public InputStream openInputStream() throws IOException {
420         if (fileConnection==null) openFile();
421@@ -91,10 +97,14 @@
422         
423         Vector rd=new Vector(list.length + 1);
424         for (int i = 0; i < list.length; i++) {
425-            if (directoriesOnly & !list[i].endsWith("/")) continue;
426-           int st=(list[i].startsWith("/")) ? 1 : 0;
427+			if (directoriesOnly & !list[i].endsWith("/")) continue;
428+            int st=(list[i].startsWith("/")) ? 1 : 0;
429             rd.addElement(list[i].substring(st+fileName.length()));
430         }
431         return rd;
432     }
433+
434+    public void delete() throws IOException{
435+        fileConnection.delete();
436+    }
437 }
438Index: trunk/src/io/file/FileIO.java
439===================================================================
440--- trunk/src/io/file/FileIO.java	(revision 1209)
441+++ trunk/src/io/file/FileIO.java	(working copy)
442@@ -90,8 +90,13 @@
443     
444     public abstract void close() throws IOException;
445     
446+    public abstract void delete() throws IOException;
447+    
448     public abstract long fileSize() throws IOException;
449 
450     protected abstract Vector rootDirs();
451+    
452     protected abstract Vector dirs(boolean directoriesOnly) throws IOException;
453+
454+    public abstract OutputStream openOutputStream(long pos_eof) throws IOException;
455 }
456Index: trunk/src/io/file/FileJSR75.java
457===================================================================
458--- trunk/src/io/file/FileJSR75.java	(revision 1209)
459+++ trunk/src/io/file/FileJSR75.java	(working copy)
460@@ -60,7 +60,19 @@
461         }
462         return fileConnection.openOutputStream();
463     }
464+    
465+    public void delete() throws IOException{
466+        if (fileConnection==null) openFile();
467+        fileConnection.delete();
468+    }
469 
470+    public OutputStream openOutputStream(long pos_eof) throws IOException {
471+        if (fileConnection==null) openFile();
472+        if (!fileConnection.exists()) fileConnection.create();
473+        pos_eof=fileConnection.fileSize();
474+        return fileConnection.openOutputStream(pos_eof);
475+    }
476+
477     public InputStream openInputStream() throws IOException{
478         if (fileConnection==null) openFile();
479         return fileConnection.openInputStream(); 
480Index: trunk/src/io/file/FileSiemens.java
481===================================================================
482--- trunk/src/io/file/FileSiemens.java	(revision 1209)
483+++ trunk/src/io/file/FileSiemens.java	(working copy)
484@@ -34,14 +34,12 @@
485 import java.io.OutputStream;
486 import java.util.Vector;
487 
488-public class FileSiemens extends FileIO{
489+public class FileSiemens extends FileIO {
490     
491     private File f;
492     private int fd;
493 
494     public FileSiemens(String fileName) {
495-        //System.out.println("Siemens fs accessor for "+fileName);
496-        // Siemens requires backslashes
497         this.fileName=fileName=fileName.replace('/', '\\');//.substring(1);
498     }
499     
500@@ -63,9 +61,6 @@
501         //System.out.println("Siemens root");
502         Vector rd = new Vector();
503         rd.addElement("0:/");
504-        rd.addElement("1:/");
505-        rd.addElement("2:/");
506-        rd.addElement("3:/");
507         rd.addElement("4:/");
508         return rd;
509     }
510@@ -89,13 +84,22 @@
511 
512     public OutputStream openOutputStream() throws IOException {
513         openFile();
514-        return new FileSiemensOutputStream(f, fd);
515+        return new FileSiemensOutputStream(f, fd, 0);
516     }
517 
518     public InputStream openInputStream() throws IOException {
519         openFile();
520         return new FileSiemensInputStream(f, fd);
521-    }  
522+    }
523+    
524+    public OutputStream openOutputStream(long pos_eof) throws IOException {
525+        openFile();
526+        return new FileSiemensOutputStream(f, fd, pos_eof);
527+    }
528+    
529+    public void delete() throws IOException{
530+        f.delete(fileName);
531+    }
532 }
533 
534 class FileSiemensInputStream extends InputStream {
535@@ -121,8 +125,14 @@
536     private int fileDescriptor;
537     private File f;
538 
539-    public FileSiemensOutputStream(File f, int fd) {
540-        this.f=f; this.fileDescriptor=fd;
541+    public FileSiemensOutputStream(File f, int fd, long Seek) {
542+        this.f=f;
543+        this.fileDescriptor=fd;
544+        try {
545+            this.f.seek(fd, f.length(fd));
546+        } catch (IOException ex) {
547+            ex.printStackTrace();
548+        }
549     }
550     
551     public void write(int i) throws IOException {
552Index: trunk/src/locale/SR.java
553===================================================================
554--- trunk/src/locale/SR.java	(revision 1209)
555+++ trunk/src/locale/SR.java	(working copy)
556@@ -124,7 +124,7 @@
557     public   static String MS_HEAP_MONITOR = loadString( "heap monitor" );
558     public   static String MS_MESSAGE = loadString( "Message" );
559     public   static String MS_OTHER = loadString( "<Other>" );
560-    public   static String MS_HISTORY = loadString( "history -" );
561+    public   static String MS_HISTORY = loadString( "History" );
562     public   static String MS_APPEND = loadString( "Append" );
563     public   static String MS_ACTIVE_CONTACTS = loadString( "Active Contacts" );
564     public   static String MS_SELECT_NICKNAME = loadString( "Select nickname" );
565@@ -341,6 +341,17 @@
566     public static String MS_SAVE_TO = loadString( "Save to" );
567     public static String MS_SENDER = loadString( "Sender:" );
568     public static String MS_FILE_SIZE = loadString( "size:" );
569+
570+    public static String MS_HISTORY_SETTINGS = loadString( "History settings" );
571+    public static String MS_HISTORY_PATH = loadString( "History path" );
572+    public static String MS_1251_CORRECTION = loadString( "1251 correction" );
573+    public static String MS_SAVE_PRESENCES_CONF = loadString( "save conf presences" );
574+    public static String MS_SAVE_HISTORY_CONF = loadString( "save conf history" );
575+    public static String MS_SAVE_PRESENCES = loadString( "save presences" );
576+    public static String MS_SAVE_HISTORY = loadString( "save history" );
577+    public static String MS_SELECT_PATH = loadString( "Select path" );
578+    public static String MS_1251_TRANSLITERATE_FILENAMES = loadString( "transliterate filenames" );
579+    
580     public static String MS_XMLLANG;
581     public static String MS_IFACELANG;
582 
583Index: trunk/src/util/Translit.java
584===================================================================
585--- trunk/src/util/Translit.java	(revision 0)
586+++ trunk/src/util/Translit.java	(revision 0)
587@@ -0,0 +1,332 @@
588+/*
589+ * Translit.java
590+ *
591+ * Created on 25.04.2007, 10:30
592+ *
593+ * Copyright (c) 2006-2007, Daniel Apatin (ad), http://apatin.net.ru
594+ *
595+ * This program is free software; you can redistribute it and/or
596+ * modify it under the terms of the GNU General Public License
597+ * as published by the Free Software Foundation; either version 2
598+ * of the License, or (at your option) any later version.
599+ *
600+ * You can also redistribute and/or modify this program under the
601+ * terms of the Psi License, specified in the accompanied COPYING
602+ * file, as published by the Psi Project; either dated January 1st,
603+ * 2005, or (at your option) any later version.
604+ *
605+ * This program is distributed in the hope that it will be useful,
606+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
607+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
608+ * GNU General Public License for more details.
609+ *
610+ * You should have received a copy of the GNU General Public License
611+ * along with this library; if not, write to the Free Software
612+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
613+ */
614+
615+package util;
616+
617+public class Translit {
618+
619+    static char Translit_chars[][] = new char[106][6];
620+    static int Translit_count[] = new int[106];
621+    static boolean full=false;
622+    
623+    static void fillarrays()
624+    {
625+        int i = 40;
626+        int j = 0;
627+        Translit_chars[i] = "A".toCharArray();
628+        Translit_count[i] = 1;
629+        j++;
630+        i++;
631+        Translit_chars[i] = "B".toCharArray();
632+        Translit_count[i] = 1;
633+        j++;
634+        i++;
635+        Translit_chars[i] = "V".toCharArray();
636+        Translit_count[i] = 1;
637+        j++;
638+        i++;
639+        Translit_chars[i] = "G".toCharArray();
640+        Translit_count[i] = 1;
641+        j++;
642+        i++;
643+        Translit_chars[i] = "D".toCharArray();
644+        Translit_count[i] = 1;
645+        j++;
646+        i++;
647+        Translit_chars[i] = "E".toCharArray();
648+        Translit_count[i] = 1;
649+        j++;
650+        i++;
651+        Translit_chars[25] = "Yo".toCharArray();
652+        Translit_count[25] = 2;
653+        j++;
654+        Translit_chars[i] = "Zh".toCharArray();
655+        Translit_count[i] = 2;
656+        j++;
657+        i++;
658+        Translit_chars[i] = "Z".toCharArray();
659+        Translit_count[i] = 1;
660+        j++;
661+        i++;
662+        Translit_chars[i] = "I".toCharArray();
663+        Translit_count[i] = 1;
664+        j++;
665+        i++;
666+        Translit_chars[i] = "J".toCharArray();
667+        Translit_count[i] = 1;
668+        j++;
669+        i++;
670+        Translit_chars[i] = "K".toCharArray();
671+        Translit_count[i] = 1;
672+        j++;
673+        i++;
674+        Translit_chars[i] = "L".toCharArray();
675+        Translit_count[i] = 1;
676+        j++;
677+        i++;
678+        Translit_chars[i] = "M".toCharArray();
679+        Translit_count[i] = 1;
680+        j++;
681+        i++;
682+        Translit_chars[i] = "N".toCharArray();
683+        Translit_count[i] = 1;
684+        j++;
685+        i++;
686+        Translit_chars[i] = "O".toCharArray();
687+        Translit_count[i] = 1;
688+        j++;
689+        i++;
690+        Translit_chars[i] = "P".toCharArray();
691+        Translit_count[i] = 1;
692+        j++;
693+        i++;
694+        Translit_chars[i] = "R".toCharArray();
695+        Translit_count[i] = 1;
696+        j++;
697+        i++;
698+        Translit_chars[i] = "S".toCharArray();
699+        Translit_count[i] = 1;
700+        j++;
701+        i++;
702+        Translit_chars[i] = "T".toCharArray();
703+        Translit_count[i] = 1;
704+        j++;
705+        i++;
706+        Translit_chars[i] = "U".toCharArray();
707+        Translit_count[i] = 1;
708+        j++;
709+        i++;
710+        Translit_chars[i] = "F".toCharArray();
711+        Translit_count[i] = 1;
712+        j++;
713+        i++;
714+        Translit_chars[i] = "H".toCharArray();
715+        Translit_count[i] = 1;
716+        j++;
717+        i++;
718+        Translit_chars[i] = "C".toCharArray();
719+        Translit_count[i] = 1;
720+        j++;
721+        i++;
722+        Translit_chars[i] = "Ch".toCharArray();
723+        Translit_count[i] = 2;
724+        j++;
725+        i++;
726+        Translit_chars[i] = "Sh".toCharArray();
727+        Translit_count[i] = 2;
728+        j++;
729+        i++;
730+        Translit_chars[i] = "Sch".toCharArray();
731+        Translit_count[i] = 3;
732+        j++;
733+        i++;
734+        Translit_chars[i] = "\"".toCharArray();
735+        Translit_count[i] = 1;
736+        j++;
737+        i++;
738+        Translit_chars[i] = "Y".toCharArray();
739+        Translit_count[i] = 1;
740+        j++;
741+        i++;
742+        Translit_chars[i] = "'".toCharArray();
743+        Translit_count[i] = 1;
744+        j++;
745+        i++;
746+        Translit_chars[i] = "E".toCharArray();
747+        Translit_count[i] = 1;
748+        j++;
749+        i++;
750+        Translit_chars[i] = "Yu".toCharArray();
751+        Translit_count[i] = 2;
752+        j++;
753+        i++;
754+        Translit_chars[i] = "Ya".toCharArray();
755+        Translit_count[i] = 2;
756+        j++;
757+        i++;
758+        Translit_chars[i] = "a".toCharArray();
759+        Translit_count[i] = 1;
760+        j++;
761+        i++;
762+        Translit_chars[i] = "b".toCharArray();
763+        Translit_count[i] = 1;
764+        j++;
765+        i++;
766+        Translit_chars[i] = "v".toCharArray();
767+        Translit_count[i] = 1;
768+        j++;
769+        i++;
770+        Translit_chars[i] = "g".toCharArray();
771+        Translit_count[i] = 1;
772+        j++;
773+        i++;
774+        Translit_chars[i] = "d".toCharArray();
775+        Translit_count[i] = 1;
776+        j++;
777+        i++;
778+        Translit_chars[i] = "e".toCharArray();
779+        Translit_count[i] = 1;
780+        j++;
781+        i++;
782+        Translit_chars[105] = "yo".toCharArray();
783+        Translit_count[105] = 2;
784+        j++;
785+        Translit_chars[i] = "zh".toCharArray();
786+        Translit_count[i] = 2;
787+        j++;
788+        i++;
789+        Translit_chars[i] = "z".toCharArray();
790+        Translit_count[i] = 1;
791+        j++;
792+        i++;
793+        Translit_chars[i] = "i".toCharArray();
794+        Translit_count[i] = 1;
795+        j++;
796+        i++;
797+        Translit_chars[i] = "j".toCharArray();
798+        Translit_count[i] = 1;
799+        j++;
800+        i++;
801+        Translit_chars[i] = "k".toCharArray();
802+        Translit_count[i] = 1;
803+        j++;
804+        i++;
805+        Translit_chars[i] = "l".toCharArray();
806+        Translit_count[i] = 1;
807+        j++;
808+        i++;
809+        Translit_chars[i] = "m".toCharArray();
810+        Translit_count[i] = 1;
811+        j++;
812+        i++;
813+        Translit_chars[i] = "n".toCharArray();
814+        Translit_count[i] = 1;
815+        j++;
816+        i++;
817+        Translit_chars[i] = "o".toCharArray();
818+        Translit_count[i] = 1;
819+        j++;
820+        i++;
821+        Translit_chars[i] = "p".toCharArray();
822+        Translit_count[i] = 1;
823+        j++;
824+        i++;
825+        Translit_chars[i] = "r".toCharArray();
826+        Translit_count[i] = 1;
827+        j++;
828+        i++;
829+        Translit_chars[i] = "s".toCharArray();
830+        Translit_count[i] = 1;
831+        j++;
832+        i++;
833+        Translit_chars[i] = "t".toCharArray();
834+        Translit_count[i] = 1;
835+        j++;
836+        i++;
837+        Translit_chars[i] = "u".toCharArray();
838+        Translit_count[i] = 1;
839+        j++;
840+        i++;
841+        Translit_chars[i] = "f".toCharArray();
842+        Translit_count[i] = 1;
843+        j++;
844+        i++;
845+        Translit_chars[i] = "h".toCharArray();
846+        Translit_count[i] = 1;
847+        j++;
848+        i++;
849+        Translit_chars[i] = "c".toCharArray();
850+        Translit_count[i] = 1;
851+        j++;
852+        i++;
853+        Translit_chars[i] = "ch".toCharArray();
854+        Translit_count[i] = 2;
855+        j++;
856+        i++;
857+        Translit_chars[i] = "sh".toCharArray();
858+        Translit_count[i] = 2;
859+        j++;
860+        i++;
861+        Translit_chars[i] = "sch".toCharArray();
862+        Translit_count[i] = 3;
863+        j++;
864+        i++;
865+        Translit_chars[i] = "\"".toCharArray();
866+        Translit_count[i] = 1;
867+        j++;
868+        i++;
869+        Translit_chars[i] = "y".toCharArray();
870+        Translit_count[i] = 1;
871+        j++;
872+        i++;
873+        Translit_chars[i] = "'".toCharArray();
874+        Translit_count[i] = 1;
875+        j++;
876+        i++;
877+        Translit_chars[i] = "e".toCharArray();
878+        Translit_count[i] = 1;
879+        j++;
880+        i++;
881+        Translit_chars[i] = "yu".toCharArray();
882+        Translit_count[i] = 2;
883+        j++;
884+        i++;
885+        Translit_chars[i] = "ya".toCharArray();
886+        Translit_count[i] = 2;
887+        j++;
888+        i++;
889+    }
890+    
891+    public static String translit(String s)
892+    {
893+        if (!full) fillarrays();
894+        char ac[] = new char[s.length() * 3];
895+        char ac1[] = s.toCharArray();
896+        int l = -1;
897+        for(int i = 0; i <= s.length() - 1; i++)
898+        {
899+            char c = ac1[i];
900+            if((c >= '\u0410') & (c <= '\u044F') || (c == '\u0401' || c == '\u0451'))
901+            {
902+                int k = c - 1000;
903+                for(int j = 0; j < Translit_count[k]; j++)
904+                {
905+                    l++;
906+                    ac[l] = Translit_chars[c - 1000][j];
907+                }
908+
909+            } else
910+            {
911+                l++;
912+                ac[l] = ac1[i];
913+            }
914+        }
915+
916+        return new String(ac, 0, l + 1);
917+    }
918+    
919+}