/* * A plugin for Miranda IM which displays web page text in a window Copyright * (C) 2005 Vincent Joyce. * * Miranda IM: the free icq client for MS Windows Copyright (C) 2000-2 * Richard Hughes, Roland Rabien & Tristan Van de Vreede * * This program is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License as published by the Free * Software Foundation; either version 2 of the License, or (at your option) * any later version. * * This program is distributed in the hope that it will be useful, but * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License * for more details. * * You should have received a copy of the GNU General Public License along * with this program; if not, write to the Free Software Foundation, Inc., 59 * Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ #include "stdafx.h" #include "webview.h" // /////////////////////// // characters and symbols// // /////////////////////// #define AMOUNT3 164 char*CharacterCodes[AMOUNT3] = { """, "&", "<", ">", " ", "¡", "¢", "£", "¤", "¥", "¦", "§", "¨", "©", "ª", "«", "¬", "­", "®", "¯", "°", "±", "²", "³", "´", "µ", "¶", "·", "¸", "¹", "º", "»", "¼", "½", "¾", "¿", "À", "Á", "Â", "Ã", "Ä", "Å", "Æ", "Ç", "È", "É", "Ê", "Ë", "Ì", "Í", "Î", "Ï", "Ð", "Ñ", "Ò", "Ó", "Ô", "Õ", "Ö", "×", "Ø", "Ù", "Ú", "Û", "Ü", "Ý", "Þ", "ß", "à", "á", "â", "ã", "ä", "å", "æ", "ç", "è", "é", "ê", "ë", "ì", "í", "î", "ï", "ð", "ñ", "ò", "ó", "ô", "õ", "ö", "÷", "ø", "ù", "ú", "û", "ü", "ý", "þ", "&yumil;", "Œ", // greater that 255, extra latin characters "œ", "Š", "š", "Ÿ", "ƒ", "ˆ", "˜", "Œ", "œ", "Š", "š", "Ÿ", "ƒ", "ˆ", "˜", "–", // Misc other characters "—", "‘", "’", "‚", "“", "”", "„", "†", "‡", "•", "…", "‰", "‹", "›", "€", "ℑ", "ℜ", "™", "–", "—", "‘", "’", "‚", "“", "”", "„", "†", "‡", "•", "…", "‰", "‹", "›", "€", "ℑ", "ℜ", "™", " ", " ", " ", " ", " ", " ", "õ", // symbols without numeric code "¿", "¦", "¯"}; char Characters[AMOUNT3] = { '\"', '&', '<', '>', ' ', '¡', '¢', '£', '¤', '¥', '¦', '§', '¨', '©', 'ª', '«', '¬', '­', '®', '¯', '°', '±', '²', '³', '´', 'µ', '¶', '·', '¸', '¹', 'º', '»', '¼', '½', '¾', '¿', 'À', 'Á', 'Â', 'Ã', 'Ä', 'Å', 'Æ', 'Ç', 'È', 'É', 'Ê', 'Ë', 'Ì', 'Í', 'Î', 'Ï', 'Ð', 'Ñ', 'Ò', 'Ó', 'Ô', 'Õ', 'Ö', '×', 'Ø', 'Ù', 'Ú', 'Û', 'Ü', 'Ý', 'Þ', 'ß', 'à', 'á', 'â', 'ã', 'ä', 'å', 'æ', 'ç', 'è', 'é', 'ê', 'ë', 'ì', 'í', 'î', 'ï', 'ð', 'ñ', 'ò', 'ó', 'ô', 'õ', 'ö', '÷', 'ø', 'ù', 'ú', 'û', 'ü', 'ý', 'þ', 'ÿ', 'Œ', // greater than 255 extra latin characters 'œ', 'Š', 'š', 'Ÿ', 'ƒ', 'ˆ', '˜', 'Œ', 'œ', 'Š', 'š', 'Ÿ', 'ƒ', 'ˆ', '˜', '–', '—', // misc other characters '‘', '’', '‚', '“', '”', '„', '†', '‡', '•', '…', '‰', '‹', '›', '€', 'I', 'R', '™', '–', '—', '‘', '’', '‚', '“', '”', '„', '†', '‡', '•', '…', '‰', '‹', '›', '€', 'I', 'R', '™', ' ', ' ', ' ', ' ', ' ', ' ', 'õ', '¿', '¦', '¯'}; /*****************************************************************************/ void CodetoSymbol(char *truncated) { int counter = 0; int position = 0, recpos = 0; static char *stringfrompos; for (int n = 0; n < AMOUNT3; n++) { while (true) { // loop forever Sleep(1); // avoid 100% CPU if ( strstr(truncated, CharacterCodes[n]) != nullptr) { // does character code exist? if (strstr(truncated, CharacterCodes[n]) != nullptr) stringfrompos = strstr(truncated, CharacterCodes[n]); position = stringfrompos - truncated; counter = 0; while (counter != mir_strlen(CharacterCodes[n])) { truncated[position + counter] = ' '; counter++; } truncated[(position + counter) - 1] = Characters[n]; strncpy(&truncated[position], &truncated[position + mir_strlen(CharacterCodes[n])] - 1, mir_strlen(&truncated[position]) - 1); } // end does character code exist? if (recpos == position) break; // break out of loop if doesn't find new character code recpos = position; } // end loop forever } // for } /*****************************************************************************/ void EraseBlock(char *truncated) { int counter = 0; int positionStart = 0, positionEnd = 0; char *stringfrompos; int BlockLength = 0; char* tempraw = (char*)malloc(MAXSIZE1); if (truncated) strncpy(tempraw, truncated, MAXSIZE1); // /////////////////////////// while (true) { Sleep(1); // avoid 100% CPU // /get start and end of block if (strstr(tempraw, "") != nullptr) // does tag exist? { stringfrompos = strstr(tempraw, "-->"); positionEnd = stringfrompos - tempraw; } BlockLength = (positionEnd - positionStart) + 3; if ((strstr(tempraw, "") == nullptr)) break; ///////////////////////////////////////// if (strstr(tempraw, "