pidgin-latex/000755 000765 000024 00000000000 12106702003 013544 5ustar00qjuhstaff000000 000000 pidgin-latex/CHANGELOG000644 000765 000024 00000003531 12106701675 014776 0ustar00qjuhstaff000000 000000 ************* Version 1.5 ************* - fixed a bug where " got escaped to " in LaTeX code - Pidgin-LaTeX now uses foreground and background colors of the conversation for the generated image ************* Version 1.4 ************* - fixed a serious bug in the blacklisting, that made it possible to execute malware on receivers PC ************* Version 1.3 ************* - changed the image type used back to PNG, because we have better antialiasing there - now using dvipng for DVI->PNG conversion instead of dvips and ImageMagick - simplified a lot of calls because of good support by the API - fixed a bug concerning wrong nickname display - fixed a minor bug caused by system() - fixed some Windows-related bugs ************* Version 1.2 ************* - added support for LaTeX in Chats like IRC - minor bugs fixed ************* Version 1.1 ************* - fix STILL_ACTIVE bug on windows - some minor bugs fixed ************* Version 1.0 ************* - changes for the new API of Pidgin applied - added getfilename() - changed tempfile-generation using purple-function - some more blacklist-checking ************* Version 0.4 ************* - windows port - < 1024 bytes image bug corrected ************* Version 0.3 ************* - no more need of tex2im - fix crash bug when no image were created - fix gaim-encryption bug - now use $$ markup (compatibility with KopeteTeX) old markup ([tex] ... [/tex]) will pobably be erased later, so please use new system (if you have any objection, speak from that with me ************* version 0.2 ************* - Work with gaim v1.0.3 - The logs of the conversation now log the original message with the [tex]...[/tex] markup - Now compile easier with a Makefile *********** Version 0.1 *********** - Initial version - site http://sourceforge.net/projects/gaim-latex/ pidgin-latex/COPYING000644 000765 000024 00000043100 11137045516 014611 0ustar00qjuhstaff000000 000000 GNU GENERAL PUBLIC LICENSE Version 2, June 1991 Copyright (C) 1989, 1991 Free Software Foundation, Inc. 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA Everyone is permitted to copy and distribute verbatim copies of this license document, but changing it is not allowed. Preamble The licenses for most software are designed to take away your freedom to share and change it. By contrast, the GNU General Public License is intended to guarantee your freedom to share and change free software--to make sure the software is free for all its users. This General Public License applies to most of the Free Software Foundation's software and to any other program whose authors commit to using it. (Some other Free Software Foundation software is covered by the GNU Library General Public License instead.) You can apply it to your programs, too. When we speak of free software, we are referring to freedom, not price. Our General Public Licenses are designed to make sure that you have the freedom to distribute copies of free software (and charge for this service if you wish), that you receive source code or can get it if you want it, that you can change the software or use pieces of it in new free programs; and that you know you can do these things. To protect your rights, we need to make restrictions that forbid anyone to deny you these rights or to ask you to surrender the rights. These restrictions translate to certain responsibilities for you if you distribute copies of the software, or if you modify it. For example, if you distribute copies of such a program, whether gratis or for a fee, you must give the recipients all the rights that you have. You must make sure that they, too, receive or can get the source code. And you must show them these terms so they know their rights. We protect your rights with two steps: (1) copyright the software, and (2) offer you this license which gives you legal permission to copy, distribute and/or modify the software. Also, for each author's protection and ours, we want to make certain that everyone understands that there is no warranty for this free software. If the software is modified by someone else and passed on, we want its recipients to know that what they have is not the original, so that any problems introduced by others will not reflect on the original authors' reputations. Finally, any free program is threatened constantly by software patents. We wish to avoid the danger that redistributors of a free program will individually obtain patent licenses, in effect making the program proprietary. To prevent this, we have made it clear that any patent must be licensed for everyone's free use or not licensed at all. The precise terms and conditions for copying, distribution and modification follow. GNU GENERAL PUBLIC LICENSE TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION 0. This License applies to any program or other work which contains a notice placed by the copyright holder saying it may be distributed under the terms of this General Public License. The "Program", below, refers to any such program or work, and a "work based on the Program" means either the Program or any derivative work under copyright law: that is to say, a work containing the Program or a portion of it, either verbatim or with modifications and/or translated into another language. (Hereinafter, translation is included without limitation in the term "modification".) Each licensee is addressed as "you". Activities other than copying, distribution and modification are not covered by this License; they are outside its scope. The act of running the Program is not restricted, and the output from the Program is covered only if its contents constitute a work based on the Program (independent of having been made by running the Program). Whether that is true depends on what the Program does. 1. You may copy and distribute verbatim copies of the Program's source code as you receive it, in any medium, provided that you conspicuously and appropriately publish on each copy an appropriate copyright notice and disclaimer of warranty; keep intact all the notices that refer to this License and to the absence of any warranty; and give any other recipients of the Program a copy of this License along with the Program. You may charge a fee for the physical act of transferring a copy, and you may at your option offer warranty protection in exchange for a fee. 2. You may modify your copy or copies of the Program or any portion of it, thus forming a work based on the Program, and copy and distribute such modifications or work under the terms of Section 1 above, provided that you also meet all of these conditions: a) You must cause the modified files to carry prominent notices stating that you changed the files and the date of any change. b) You must cause any work that you distribute or publish, that in whole or in part contains or is derived from the Program or any part thereof, to be licensed as a whole at no charge to all third parties under the terms of this License. c) If the modified program normally reads commands interactively when run, you must cause it, when started running for such interactive use in the most ordinary way, to print or display an announcement including an appropriate copyright notice and a notice that there is no warranty (or else, saying that you provide a warranty) and that users may redistribute the program under these conditions, and telling the user how to view a copy of this License. (Exception: if the Program itself is interactive but does not normally print such an announcement, your work based on the Program is not required to print an announcement.) These requirements apply to the modified work as a whole. If identifiable sections of that work are not derived from the Program, and can be reasonably considered independent and separate works in themselves, then this License, and its terms, do not apply to those sections when you distribute them as separate works. But when you distribute the same sections as part of a whole which is a work based on the Program, the distribution of the whole must be on the terms of this License, whose permissions for other licensees extend to the entire whole, and thus to each and every part regardless of who wrote it. Thus, it is not the intent of this section to claim rights or contest your rights to work written entirely by you; rather, the intent is to exercise the right to control the distribution of derivative or collective works based on the Program. In addition, mere aggregation of another work not based on the Program with the Program (or with a work based on the Program) on a volume of a storage or distribution medium does not bring the other work under the scope of this License. 3. You may copy and distribute the Program (or a work based on it, under Section 2) in object code or executable form under the terms of Sections 1 and 2 above provided that you also do one of the following: a) Accompany it with the complete corresponding machine-readable source code, which must be distributed under the terms of Sections 1 and 2 above on a medium customarily used for software interchange; or, b) Accompany it with a written offer, valid for at least three years, to give any third party, for a charge no more than your cost of physically performing source distribution, a complete machine-readable copy of the corresponding source code, to be distributed under the terms of Sections 1 and 2 above on a medium customarily used for software interchange; or, c) Accompany it with the information you received as to the offer to distribute corresponding source code. (This alternative is allowed only for noncommercial distribution and only if you received the program in object code or executable form with such an offer, in accord with Subsection b above.) The source code for a work means the preferred form of the work for making modifications to it. For an executable work, complete source code means all the source code for all modules it contains, plus any associated interface definition files, plus the scripts used to control compilation and installation of the executable. However, as a special exception, the source code distributed need not include anything that is normally distributed (in either source or binary form) with the major components (compiler, kernel, and so on) of the operating system on which the executable runs, unless that component itself accompanies the executable. If distribution of executable or object code is made by offering access to copy from a designated place, then offering equivalent access to copy the source code from the same place counts as distribution of the source code, even though third parties are not compelled to copy the source along with the object code. 4. You may not copy, modify, sublicense, or distribute the Program except as expressly provided under this License. Any attempt otherwise to copy, modify, sublicense or distribute the Program is void, and will automatically terminate your rights under this License. However, parties who have received copies, or rights, from you under this License will not have their licenses terminated so long as such parties remain in full compliance. 5. You are not required to accept this License, since you have not signed it. However, nothing else grants you permission to modify or distribute the Program or its derivative works. These actions are prohibited by law if you do not accept this License. Therefore, by modifying or distributing the Program (or any work based on the Program), you indicate your acceptance of this License to do so, and all its terms and conditions for copying, distributing or modifying the Program or works based on it. 6. Each time you redistribute the Program (or any work based on the Program), the recipient automatically receives a license from the original licensor to copy, distribute or modify the Program subject to these terms and conditions. You may not impose any further restrictions on the recipients' exercise of the rights granted herein. You are not responsible for enforcing compliance by third parties to this License. 7. If, as a consequence of a court judgment or allegation of patent infringement or for any other reason (not limited to patent issues), conditions are imposed on you (whether by court order, agreement or otherwise) that contradict the conditions of this License, they do not excuse you from the conditions of this License. If you cannot distribute so as to satisfy simultaneously your obligations under this License and any other pertinent obligations, then as a consequence you may not distribute the Program at all. For example, if a patent license would not permit royalty-free redistribution of the Program by all those who receive copies directly or indirectly through you, then the only way you could satisfy both it and this License would be to refrain entirely from distribution of the Program. If any portion of this section is held invalid or unenforceable under any particular circumstance, the balance of the section is intended to apply and the section as a whole is intended to apply in other circumstances. It is not the purpose of this section to induce you to infringe any patents or other property right claims or to contest validity of any such claims; this section has the sole purpose of protecting the integrity of the free software distribution system, which is implemented by public license practices. Many people have made generous contributions to the wide range of software distributed through that system in reliance on consistent application of that system; it is up to the author/donor to decide if he or she is willing to distribute software through any other system and a licensee cannot impose that choice. This section is intended to make thoroughly clear what is believed to be a consequence of the rest of this License. 8. If the distribution and/or use of the Program is restricted in certain countries either by patents or by copyrighted interfaces, the original copyright holder who places the Program under this License may add an explicit geographical distribution limitation excluding those countries, so that distribution is permitted only in or among countries not thus excluded. In such case, this License incorporates the limitation as if written in the body of this License. 9. The Free Software Foundation may publish revised and/or new versions of the General Public License from time to time. Such new versions will be similar in spirit to the present version, but may differ in detail to address new problems or concerns. Each version is given a distinguishing version number. If the Program specifies a version number of this License which applies to it and "any later version", you have the option of following the terms and conditions either of that version or of any later version published by the Free Software Foundation. If the Program does not specify a version number of this License, you may choose any version ever published by the Free Software Foundation. 10. If you wish to incorporate parts of the Program into other free programs whose distribution conditions are different, write to the author to ask for permission. For software which is copyrighted by the Free Software Foundation, write to the Free Software Foundation; we sometimes make exceptions for this. Our decision will be guided by the two goals of preserving the free status of all derivatives of our free software and of promoting the sharing and reuse of software generally. NO WARRANTY 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION. 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. END OF TERMS AND CONDITIONS How to Apply These Terms to Your New Programs If you develop a new program, and you want it to be of the greatest possible use to the public, the best way to achieve this is to make it free software which everyone can redistribute and change under these terms. To do so, attach the following notices to the program. It is safest to attach them to the start of each source file to most effectively convey the exclusion of warranty; and each file should have at least the "copyright" line and a pointer to where the full notice is found. Copyright (C) 19yy 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 Also add information on how to contact you by electronic and paper mail. If the program is interactive, make it output a short notice like this when it starts in an interactive mode: Gnomovision version 69, Copyright (C) 19yy name of author Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'. This is free software, and you are welcome to redistribute it under certain conditions; type `show c' for details. The hypothetical commands `show w' and `show c' should show the appropriate parts of the General Public License. Of course, the commands you use may be called something other than `show w' and `show c'; they could even be mouse-clicks or menu items--whatever suits your program. You should also get your employer (if you work as a programmer) or your school, if any, to sign a "copyright disclaimer" for the program, if necessary. Here is a sample; alter the names: Yoyodyne, Inc., hereby disclaims all copyright interest in the program `Gnomovision' (which makes passes at compilers) written by James Hacker. , 1 April 1989 Ty Coon, President of Vice This General Public License does not permit incorporating your program into proprietary programs. If your program is a subroutine library, you may consider it more useful to permit linking proprietary applications with the library. If this is what you want to do, use the GNU Library General Public License instead of this License. pidgin-latex/LaTeX.c000644 000765 000024 00000057604 12106701675 014717 0ustar00qjuhstaff000000 000000 /* * LaTeX.c * pidgin-latex plugin * * This a plugin for Pidgin to display LaTeX formula in conversation * * PLEASE, send any comment, bug report, etc. to the trackers at sourceforge.net * * Copyright (C) 2006-2011 Benjamin Moll (qjuh@users.sourceforge.net) * some portions : Copyright (C) 2004-2006 Nicolas Schoonbroodt (nicolas@ffsa.be) * Copyright (C) 2004-2006 GRIm@ (thegrima@altern.org). * Copyright (C) 2004-2006 Eric Betts (bettse@onid.orst.edu). * Copyright (C) 2008-2009 Martin Keßler (martin@moegger.de). * Windows port : Copyright (C) 2005-2006 Nicolai Stange (nic-stange@t-online.de) * Other portions heavily inspired and copied from gaim sources * Copyright (C) 1998-2011 Pidgin developers pidgin.im * * 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; This document is under the scope of * the version 2 of the License, or 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 (see COPYING); if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA, 02110-1301, USA * */ #include "LaTeX.h" #include #include #include #include #include #include #ifndef _WIN32 #include #endif #ifndef MAX #define MAX(a,b) ( (a) > (b) ? (a ): (b)) #endif static PurplePlugin *me; static void open_log(PurpleConversation *conv) { conv->logs = g_list_append(NULL, purple_log_new(conv->type == PURPLE_CONV_TYPE_CHAT ? PURPLE_LOG_CHAT : PURPLE_LOG_IM, conv->name, conv->account, conv, time(NULL), NULL)); } #ifdef _WIN32 void win32_purple_notify_error(char *prep) { char *errmsg=NULL; char *finalmsg=NULL; if(!FormatMessage(FORMAT_MESSAGE_ALLOCATE_BUFFER | FORMAT_MESSAGE_FROM_SYSTEM, NULL, GetLastError(), MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT), (void*)&errmsg, 0, NULL)) { purple_notify_error(me, "LaTeX" ,"Can't display error message.", "PidginLaTeX was unable to get the actual error message from Windows."); return; } if(prep) { finalmsg=malloc((strlen(errmsg)+ strlen(prep) + 3)*sizeof(char)); if(!finalmsg) { purple_notify_error(me, "LaTeX", "Can't display error message.", "Not enough memory."); LocalFree(errmsg); /* we can't do anything more for you */ return; } strcpy(finalmsg, prep); strcat(finalmsg, ": "); strcat(finalmsg, errmsg); LocalFree(errmsg); } else { finalmsg = malloc((strlen(errmsg)+1)*sizeof(char)); if(!finalmsg) { purple_notify_error(me, "LaTeX", "Can't display error message.", "Not enough memory."); LocalFree(errmsg); /* we can't do anything more for you */ return; } strcpy(finalmsg, errmsg); LocalFree(errmsg); } purple_notify_error(me, "LaTeX", "Error in execution of PidginLaTex!", finalmsg); free(finalmsg); return; } #endif static char* getdirname(const char const *file) { char *s=NULL; char *r=NULL; s=strrchr(file, G_DIR_SEPARATOR); if(!s) /* just a pure filename without dir? */ { /* Here is no standard-, but GNU-bahaviour of getcwd assumed. Note that msdn.microsoft.com defines the same as GNU. */ return getcwd(NULL,0); } s+=1; /* get the G_DIR_SEPARATOR at the end of directory-string */ r=malloc(s-file+sizeof(char)); if(r) { memcpy(r,file, s-file); r[(s-file)/sizeof(char)]='\0'; } return r; } static char* getfilename(const char const *file) { char *s=NULL; char *r=NULL; s=strrchr(file,G_DIR_SEPARATOR); if(!s) { r=malloc((strlen(file)+1)*sizeof(char)); strcpy(r,file); return r; } s+=1; r=malloc((strlen(file)+1)*sizeof(char)+file-s); if(r) { memcpy(r,s,strlen(file)*sizeof(char)+file-s); r[strlen(file)+(file-s)/sizeof(char)]='\0'; } return r; } char* searchPATH(const char const *file) { char *cmd=NULL; #ifdef _WIN32 DWORD sz=0; DWORD sz2=0; sz=SearchPath(NULL, file, ".exe", 0, cmd, NULL); cmd = malloc((sz+1)*sizeof(TCHAR)); if(cmd) { sz2=SearchPath(NULL, file, ".exe", sz+1, cmd, NULL); if(!sz2) { free(cmd); cmd=NULL; } } #else cmd=malloc((strlen(file)+1)*sizeof(char)); if(cmd) strcpy(cmd, file); #endif return cmd; } #ifdef _WIN32 /* we could take system(), too, but this opens ugly console-windows within IM-Session*/ static DWORD execute(char *cmd, char *opts[], int copts) { int i=0; int len=strlen(cmd) + 4; char *params=NULL; DWORD exitcode=STILL_ACTIVE; for(i=0; i0) { free(opt); if(WIFEXITED(exitstatus)) { exitcode=WEXITSTATUS(exitstatus); purple_debug_info("LaTeX" ,"'%s' ended normally with exitcode '%d'\n", cmd, exitcode); } else purple_debug_error("LaTeX" ,"'%s' ended abnormally via the signal '%d'\n", cmd, WTERMSIG(exitstatus)); } else { purple_debug_error("LaTeX", "while executing '%s' the following error occured: '%s'(%d)\n", cmd, strerror(errno), errno); } return exitcode; } #endif static char* get_latex_cmd() { return searchPATH("latex"); } static char* get_dvips_cmd() { return searchPATH("dvips"); } static char* get_dvipng_cmd() { return searchPATH("dvipng"); } static char* get_convert_cmd() { #ifdef _WIN32 /*open registry*/ DWORD type; DWORD cbData; char *pData=NULL; HKEY hk=NULL; RegOpenKeyEx(HKEY_LOCAL_MACHINE, "SOFTWARE\\ImageMagick\\Current",0,KEY_READ,&hk); RegQueryValueEx(hk, "BinPath", NULL, &type, NULL, &cbData); cbData=cbData + (1+12)*sizeof(char); pData=malloc(cbData); if(pData && RegQueryValueEx(hk, "BinPath", NULL, &type, pData, &cbData)==ERROR_SUCCESS) { CloseHandle(hk); strcat(pData,"\\convert.exe"); return pData; } CloseHandle(hk); free(pData); return searchPATH("convert"); #else return searchPATH("convert"); #endif } static gboolean is_blacklisted(char *message) { char *not_secure[NB_BLACKLIST] = BLACKLIST; int reti; int i; for (i = 0 ; i < NB_BLACKLIST ; i++) { regex_t regex; char *begin_not_secure = malloc((strlen(not_secure[i])+18)*sizeof(char)); strcpy(begin_not_secure,"\\\\begin\\W*{\\W*"); strcat(begin_not_secure,not_secure[i]+0x01); strcat(begin_not_secure,"\\W*}"); reti = regcomp(®ex, begin_not_secure, 0); reti = regexec(®ex, message, 0, NULL, 0); regfree(®ex); if (strstr(message, not_secure[i]) != NULL || reti!=REG_NOMATCH) return TRUE; } return FALSE; } static gboolean latex_to_image(char *latex, char **file_png) { FILE * texfile; char *file_tmp = NULL; char *tmpdir = NULL; char *cmdlatex = NULL; char *cmddvipng = NULL; char *file_tex; char *file_dvi; char *fgcolor, *bgcolor; gboolean exec_ok; // purple_debug_misc("LaTeX", "starting to transcribe part of the message\n"); /* the following is new and related to temporary-filename-generation */ texfile = purple_mkstemp(&file_tmp,TRUE); file_tex=malloc((strlen(file_tmp)+5)*sizeof(char)); file_dvi=malloc((strlen(file_tmp)+5)*sizeof(char)); *file_png=malloc((strlen(file_tmp)+5)*sizeof(char)); fclose(texfile); if(!(file_tmp && file_tex && file_dvi && *file_png)) { unlink(file_tmp); free(file_tmp); free(file_tex); free(file_dvi); free(*file_png); file_tex=file_dvi=*file_png=NULL; purple_notify_error(me, "LaTeX", "Error while running LaTeX!", "Couldn't create temporary files."); return FALSE; } strcpy(file_tex, file_tmp); strcat(file_tex, ".tex"); strcpy(file_dvi, file_tmp); strcat(file_dvi, ".dvi"); strcpy(*file_png, file_tmp); strcat(*file_png, ".png"); unlink(file_tmp); free(file_tmp); fgcolor = (char*)malloc(16*sizeof(char)); if( !strcmp(purple_prefs_get_string("/pidgin/conversations/fgcolor"),"")) { strcpy(fgcolor, "0,0,0"); } else { char const *pidgin_fgcolor; int rgb; pidgin_fgcolor = purple_prefs_get_string("/pidgin/conversations/fgcolor"); purple_debug_info("LaTeX","found foregroundcolor '%s'\n",pidgin_fgcolor); rgb = strtol(pidgin_fgcolor+1,NULL,16); purple_debug_info("LaTeX", "numerical: %d\n", rgb); sprintf(fgcolor,"%d,%d,%d", rgb >> 16, (rgb >> 8) & 0xff, rgb & 0xff); } purple_debug_info("LaTeX", "using '%s' for foreground\n", fgcolor); bgcolor = (char*)malloc(16*sizeof(char)); if( !strcmp(purple_prefs_get_string("/pidgin/conversations/bgcolor"),"")) { strcpy(bgcolor, "255,255,255"); } else { char const *pidgin_bgcolor; int rgb; pidgin_bgcolor = purple_prefs_get_string("/pidgin/conversations/bgcolor"); purple_debug_info("LaTeX","found backgroundcolor '%s'\n",pidgin_bgcolor); rgb = strtol(pidgin_bgcolor+1,NULL,16); purple_debug_info("LaTeX", "numerical: %d\n", rgb); sprintf(bgcolor,"%d,%d,%d", rgb >> 16, (rgb >> 8) & 0xff, rgb & 0xff); } purple_debug_info("LaTeX", "using '%s' for background\n", bgcolor); if (! (texfile = fopen(file_tex, "w"))) return FALSE; fprintf(texfile, HEADER "%s" HEADER_COLOR "%s" HEADER_MATH "%s" FOOTER_MATH FOOTER, fgcolor, bgcolor, latex); fclose (texfile); free(fgcolor); tmpdir=getdirname(file_tex); /* generate commands, also new */ char *latexopts[2]={"--interaction=nonstopmode", file_tex}; char *dvipngopts[8]={"-Q", "10", "-T", "tight", "--follow", "-o", *file_png, file_dvi}; cmdlatex=get_latex_cmd(); cmddvipng=get_dvipng_cmd(); if (!tmpdir || chdir(tmpdir) || !cmdlatex || !cmddvipng ) { if( tmpdir ) free(tmpdir); unlink(file_tex); free(file_tex); free(file_dvi); free(*file_png); file_dvi=*file_png=NULL; free(cmdlatex); free(cmddvipng); purple_notify_error(me, "LaTeX", "Error while trying to transcript LaTeX!", "couldn't find either latex or dvipng"); return FALSE; } free(tmpdir); // purple_debug_misc("LaTeX", "beginning to start latex and dvipng\n"); exec_ok = !(execute(cmdlatex, latexopts, 2) || execute(cmddvipng, dvipngopts, 8)); free(cmdlatex); free(cmddvipng); unlink(file_tex); file_tex[strlen(file_tex)-4]='\0'; strcat(file_tex, ".aux"); unlink(file_tex); file_tex[strlen(file_tex)-4]='\0'; strcat(file_tex, ".log"); unlink(file_tex); unlink(file_dvi); free(file_tex); free(file_dvi); purple_debug_info("LaTeX", "image creation exited with status '%d'\n", !exec_ok); return exec_ok; } static gboolean analyse(char **tmp2, char *startdelim, char *enddelim, gboolean smileys) { int pos1, pos2, idimg, formulas=0; char *ptr1, *ptr2; char *file_png=NULL; PurpleSmiley *the_smiley; purple_debug_misc("LaTeX", "starting to analyse the message: %s\n", *tmp2); ptr1 = strstr(*tmp2, startdelim); while(ptr1 != NULL) { char *tex, *tex2, *message, *filter, *idstring, *shortcut; gchar *filedata; size_t size; GError *error = NULL; pos1 = strlen(*tmp2) - strlen(ptr1); // Have to ignore the first 2 char ("$$") --> & [2] ptr2 = strstr(&ptr1[strlen(startdelim)], enddelim); if (ptr2 == NULL) return FALSE; pos2 = strlen(*tmp2) - strlen(ptr2) + strlen(enddelim); if ((tex = malloc(pos2 - pos1 - strlen(enddelim) - strlen(startdelim) + 1)) == NULL) { // Report the error purple_notify_error(me, "LaTeX" ,"Error while analysing the message!", "Out of memory!"); return FALSE; } strncpy(tex, &ptr1[strlen(startdelim)], pos2 - pos1 - strlen(startdelim)-strlen(enddelim)); tex[pos2-pos1-strlen(startdelim)-strlen(enddelim)] = '\0'; // Replaced. Using official libpurple-function instead /*/ Pidgin transforms & to & and I make the inverse transformation while ( (filter = strstr(tex, FILTER_AND) ) != NULL) strcpy(&tex[strlen(tex) - strlen(filter) + 1], &filter[5]); // Pidgin transforms < to < while ( (filter = strstr(tex, FILTER_LT) ) != NULL) { strcpy(&tex[strlen(tex) - strlen(filter)], "<"); strcpy(&tex[strlen(tex) - strlen(filter) + 1], &filter[4]); } // Pidgin transforms > to > while ( (filter = strstr(tex, FILTER_GT) ) != NULL) { strcpy(&tex[strlen(tex) - strlen(filter)], ">"); strcpy(&tex[strlen(tex) - strlen(filter) + 1], &filter[4]); } //
filter while ( (filter = strstr(tex, FILTER_BR) ) != NULL) strcpy(&tex[strlen(tex) - strlen(filter)], &filter[4]);//*/ tex2 = (char*)malloc((strlen(tex)+1)*sizeof(char)); strcpy(tex2, tex); tex = purple_unescape_html(tex2); purple_debug_misc("LaTeX", "Found LaTeX-Code: %s\n", tex); shortcut = (char*)malloc((strlen(tex2)+5)*sizeof(char)); strcpy(shortcut,"$$"); strcat(shortcut, tex2); strcat(shortcut, "$$"); free(tex2); if (smileys && purple_smileys_find_by_shortcut(shortcut)!=NULL) { free(tex); free(shortcut); ptr1 = strstr(&(*tmp2)[pos2], startdelim); continue; } // Creates the image in file_png if (!latex_to_image(tex, &file_png)) { free(tex); free(shortcut); return FALSE; } free(tex); // loading image if (!g_file_get_contents(file_png, &filedata, &size, &error)) { purple_notify_error(me, "LaTeX", "Error while reading the generated image!", error->message); g_error_free(error); free(shortcut); return FALSE; } unlink(file_png); idimg = purple_imgstore_add_with_id(filedata, MAX(1024,size), getfilename(file_png)); filedata = NULL; free(file_png); if (idimg == 0) { purple_notify_error(me, "LaTeX", "Error while reading the generated image!", "Failed to store image."); free(shortcut); return FALSE; } if (smileys) { the_smiley = purple_smiley_new(purple_imgstore_find_by_id(idimg),shortcut); pidgin_smiley_add_to_list(the_smiley); free(shortcut); // making new message if ((message = malloc (strlen(*tmp2) + 1)) == NULL) { purple_notify_error(me, "LaTeX", "Error while composing the message!", "couldn't make the message."); return FALSE; } ptr1 = strstr(&(*tmp2)[pos2], startdelim); continue; } else { free(shortcut); idstring = malloc(10); sprintf(idstring, "%d\0", idimg); // making new message if ((message = malloc (strlen(*tmp2) - pos2 + pos1 + strlen(idstring) + strlen(IMG_BEGIN) + strlen(IMG_END) + 1)) == NULL) { purple_notify_error(me, "LaTeX", "Error while composing the message!", "couldn't make the message."); free(idstring); return FALSE; } if (pos1 > 0) { strncpy(message, *tmp2, pos1); message[pos1] = '\0'; strcat(message, IMG_BEGIN); } else strcpy(message, IMG_BEGIN); strcat(message, idstring); strcat(message, IMG_END); free(idstring); } if (pos2 < strlen(*tmp2)) strcat(message, &ptr2[strlen(enddelim)]); free(*tmp2); if ((*tmp2 = malloc(strlen(message)+1)) == NULL) { purple_notify_error(me, "LaTeX", "Error while composing the message!", "couldn't split the message."); return FALSE; } strcpy(*tmp2, message); free(message); formulas++; ptr1 = strstr(&(*tmp2)[pos2], startdelim); } if (!smileys && formulas>0) return TRUE; else return FALSE; } static gboolean pidgin_latex_write(PurpleConversation *conv, const char *nom, char *message, PurpleMessageFlags messFlag, char *original) { gboolean logflag; // writing log logflag = purple_conversation_is_logging(conv); if (logflag) { GList *log; if (conv->logs == NULL) open_log(conv); log = conv->logs; while (log != NULL) { if (strcmp(purple_prefs_get_string("/purple/logging/format"), "html") == 0) purple_log_write((PurpleLog *)log->data, messFlag, nom, time(NULL), message); else purple_log_write((PurpleLog *)log->data, messFlag, nom, time(NULL), original); log = log->next; } purple_conversation_set_logging(conv,FALSE); } if(purple_conversation_get_type(conv) == PURPLE_CONV_TYPE_CHAT) purple_conv_chat_write(PURPLE_CONV_CHAT(conv), nom, message, messFlag, time(NULL)); else if(purple_conversation_get_type(conv) == PURPLE_CONV_TYPE_IM) purple_conv_im_write(PURPLE_CONV_IM(conv), nom, message, messFlag, time(NULL)); if (logflag) purple_conversation_set_logging(conv,TRUE); return FALSE; } static void message_send(PurpleConversation *conv, char **buffer) { char *tmp2; gboolean smileys; purple_debug_info("LaTeX", "Sending Message: %s\n", *buffer); // if nothing to do if (strstr(*buffer,KOPETE_TEX) == NULL) { return; } if (is_blacklisted(*buffer)) { purple_debug_info("LaTeX", "message not analysed, because it contained blacklisted code.\n"); return; } if((tmp2 = malloc(strlen(*buffer)+1)) == NULL) { // Notify Error purple_notify_error(me, "LaTeX" ,"Error while analysing the message!", "Out of memory!"); return; } smileys = purple_conversation_get_features(conv) & PURPLE_CONNECTION_ALLOW_CUSTOM_SMILEY; purple_debug_misc("LaTeX", "smiley support: %s\n", smileys ? "yes" : "no"); if (smileys) { strcpy(tmp2,*buffer); if(analyse(&tmp2, KOPETE_TEX, KOPETE_TEX, smileys)) { free(*buffer); *buffer = tmp2; } else { free(tmp2); } } } static void message_send_chat(PurpleAccount *account, char **buffer, int id) { PurpleConnection *conn = purple_account_get_connection(account); message_send(purple_find_chat(conn, id), buffer); } static void message_send_im(PurpleAccount *account, const char *who, char **buffer) { message_send(purple_find_conversation_with_account( PURPLE_CONV_TYPE_IM, who, account), buffer); } static gboolean message_receive(PurpleAccount *account, const char *who, char **buffer, PurpleConversation *conv, PurpleMessageFlags flags) { char *tmp2; // gboolean smileys; purple_debug_info("LaTeX", "Writing Message: %s\n", *buffer); // if nothing to do if (strstr(*buffer,KOPETE_TEX) == NULL) { return FALSE; } if (is_blacklisted(*buffer)) { purple_debug_info("LaTeX", "message not analysed, because it contained blacklisted code.\n"); return FALSE; } if((tmp2 = malloc(strlen(*buffer)+1)) == NULL) { // Notify Error purple_notify_error(me, "LaTeX" ,"Error while analysing the message!", "Out of memory!"); return FALSE; } strcpy(tmp2,*buffer); // smileys = purple_conversation_get_features(conv) & PURPLE_CONNECTION_ALLOW_CUSTOM_SMILEY; // purple_debug_misc("LaTeX", "smiley support: %s\n", smileys ? "yes" : "no"); if (analyse(&tmp2, KOPETE_TEX, KOPETE_TEX, FALSE)) { pidgin_latex_write(conv, who, tmp2, flags, *buffer); free(tmp2); return TRUE; } free(tmp2); return FALSE; } static gboolean plugin_load(PurplePlugin *plugin) { void *conv_handle = purple_conversations_get_handle(); me = plugin; purple_signal_connect(conv_handle, "sending-im-msg", plugin, PURPLE_CALLBACK(message_send_im), NULL); purple_signal_connect(conv_handle, "sending-chat-msg", plugin, PURPLE_CALLBACK(message_send_chat), NULL); purple_signal_connect(conv_handle, "writing-im-msg", plugin, PURPLE_CALLBACK(message_receive), NULL); purple_signal_connect(conv_handle, "writing-chat-msg", plugin, PURPLE_CALLBACK(message_receive), NULL); purple_debug_info("LaTeX", "LaTeX loaded\n"); return TRUE; } static gboolean plugin_unload(PurplePlugin * plugin) { void *conv_handle = purple_conversations_get_handle(); purple_signal_disconnect(conv_handle, "sending-im-msg", plugin, PURPLE_CALLBACK(message_send_im)); purple_signal_disconnect(conv_handle, "sending-chat-msg", plugin, PURPLE_CALLBACK(message_send_chat)); purple_signal_disconnect(conv_handle, "writing-im-msg", plugin, PURPLE_CALLBACK(message_receive)); purple_signal_disconnect(conv_handle, "writing-chat-msg", plugin, PURPLE_CALLBACK(message_receive)); me = NULL; purple_debug_info("LaTeX", "LaTeX unloaded\n"); return TRUE; } static PurplePluginInfo info = { PURPLE_PLUGIN_MAGIC, PURPLE_MAJOR_VERSION, PURPLE_MINOR_VERSION, PURPLE_PLUGIN_STANDARD, /**< type */ PIDGIN_PLUGIN_TYPE, /**< ui_requirement */ 0, /**< flags */ NULL, /**< dependencies */ PURPLE_PRIORITY_DEFAULT, /**< priority */ LATEX_PLUGIN_ID, /**< id */ "LaTeX", /**< name */ "1.4", /**< version */ /** summary */ "To display LaTeX formula into Pidgin conversation.", /** description */ "Put LaTeX-code between $$ ... $$ markup to have it displayed as Picture in your conversation.\nRemember that your contact needs an similar plugin or else he will just see the pure LaTeX-code\nYou must have LaTeX and dvipng installed (in your PATH)", "Benjamin Moll \nNicolas Schoonbroodt \nNicolai Stange ", /**< author */ WEBSITE, /**< homepage */ plugin_load, /**< load */ plugin_unload, /**< unload */ NULL, /**< destroy */ NULL, /**< ui_info */ NULL, /**< extra_info */ NULL, NULL, NULL, NULL, NULL, NULL }; static void init_plugin(PurplePlugin *plugin) { } PURPLE_INIT_PLUGIN(LaTeX, init_plugin, info) pidgin-latex/LaTeX.h000644 000765 000024 00000016077 12106701675 014723 0ustar00qjuhstaff000000 000000 /* * LaTeX.h * pidgin-latex plugin * * This a plugin for Pidgin to display LaTeX formula in conversation * * PLEASE, send any comment, bug report, etc. to the trackers at sourceforge.net * * Copyright (C) 2006-2011 Benjamin Moll (qjuh@users.sourceforge.net) * some portions : Copyright (C) 2004-2006 Nicolas Schoonbroodt (nicolas@ffsa.be) * Copyright (C) 2004-2006 GRIm@ (thegrima@altern.org). * Copyright (C) 2004-2006 Eric Betts (bettse@onid.orst.edu). * Copyright (C) 2008-2009 Martin Keßler (martin@moegger.de). * Windows port : Copyright (C) 2005-2006 Nicolai Stange (nic-stange@t-online.de) * Other portions heavily inspired and copied from gaim sources * Copyright (C) 1998-2011 Pidgin developers pidgin.im * * 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; This document is under the scope of * the version 2 of the License, or 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 (see COPYING); if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA, 02110-1301, USA * */ #ifndef _PIDGIN_LATEX_H_ #define _PIDGIN_LATEX_H_ #ifndef G_GNUC_NULL_TERMINATED # if __GNUC__ >= 4 # define G_GNUC_NULL_TERMINATED __attribute__((__sentinel__)) # else # define G_GNUC_NULL_TERMINATED # endif /* __GNUC__ >= 4 */ #endif /* G_GNUC_NULL_TERMINATED */ #define PURPLE_PLUGINS //include #include #include //#include #include #include #include #include #include #include #include #include #include #ifdef _WIN32 #include #endif // Constant #define IMG_BEGIN "" #define BEG "[tex]" #define END "[/tex]" #define KOPETE_TEX "$$" #define LATEX_PLUGIN_ID "qjuh-LaTeX" #define WEBSITE "http://sourceforge.net/projects/pidgin-latex/" #define HEADER "\\documentclass[12pt]{article}\\usepackage{color}\\usepackage[dvips]{graphicx}\\usepackage{amsmath}\\usepackage{amssymb}\\pagestyle{empty}\\definecolor{fgcolor}{RGB}{" #define HEADER_COLOR "}\\definecolor{bgcolor}{RGB}{" #define HEADER_MATH "}\\begin{document}\\pagecolor{bgcolor}\\begin{gather*}\\color{fgcolor}" #define FOOTER "\\end{document}" #define FOOTER_MATH "\\end{gather*}" #define FILTER_AND "&" #define FILTER_LT "<" #define FILTER_GT ">" #define FILTER_BR "
" /* Yes, this is simply a copy/paste of KopeteTex blacklist. */ /* But too bad in LaTeX and system security to verify all */ /* of this */ #define NB_BLACKLIST (42) #define BLACKLIST {"\\def","\\let","\\futurelet","\\newcommand","\\renewcommand","\\else","\\fi","\\write","\\input","\\include","\\chardef","\\catcode","\\makeatletter","\\noexpand","\\toksdef","\\every","\\errhelp","\\errorstopmode","\\scrollmode","\\nonstopmode","\\batchmode","\\read","\\csname","\\newhelp","\\relax","\\afterground","\\afterassignment","\\expandafter","\\noexpand","\\special","\\command","\\loop","\\repeat","\\toks","\\output","\\line","\\mathcode","\\name","\\item","\\section","\\mbox","\\DeclareRobustCommand"} // prototypes /* Verify Blacklist */ /* return true if one word of the message is blacklisted */ static gboolean is_blacklisted(char *message); /* * latex_to_image creates PNG-image with the LaTeX code pointed by *latex * *latex points to latex-input * **file_png receives filename of temporary generated png-file; file must be deleted and string must be freed by caller * * returns TRUE on success, false otherwise */ static gboolean latex_to_image(char *latex, char **file_png); /* * Transform *tmp2 extracting some *startdelim here *enddelim thing, make png-image from latex-input * and tmp2 becomes 'something' * smileys whether or not to add the formula as a custom smiley * returns TRUE on success, FALSE otherwise */ static gboolean analyse(char **tmp2, char *startdelim, char *enddelim, gboolean smileys); /* * pidgin_latex_write perform the effective write of the latex code in the IM or Chat windows * *conv is a pointer onto the conversation context * *nom is the name of the correspondent * *message is the modified message with the image * *messFlags is Flags related to the messages * *original is the original message unmodified * return TRUE. */ static gboolean pidgin_latex_write(PurpleConversation *conv, const char *nom, char *message, PurpleMessageFlags messFlag, char *original); /* to intercept outgoing messages */ static void message_send(PurpleConversation *conv, char **buffer); /* to intercept ingoing messages */ static gboolean message_receive(PurpleAccount *account, const char *who, char **buffer, PurpleConversation *conv, PurpleMessageFlags flags); /* * getdirname returns the directory's part of a filename. * Parsing is done OS-dependently (with path-separator as defined in glib/gutils.h) * *path is the filename you want to extract a directory-part from * return directory's part on success, NULL otherwise; must be freed with * free()! */ static char* getdirname(const char const *file); /* * get_latex_cmd returns a system()-executable-command for latex * * return the executable command if successfull, NULL otherwise; must be * freed with free() */ static char* get_latex_cmd(); /* * get_dvipng_cmd returns a system()-executable-command for dvipng * * return the executable command if successfull, NULL otherwise; must be * freed with free() */ static char* get_dvipng_cmd(); /* * win32_purple_notify extracts error information of last occured WIN32-Error due to an API-call and asserts it to pidgin via purple_notify_error * Error message will be prepended by *prep: */ void win32_purple_notify_error(char *prep); /* * searchPATH searches the PATH-environment for the specified file. * *file is the name of the executable to search for * returns the right full path, e.g. with the executable's name appended, NULL on failure, must be freed with free() */ char* searchPATH(const char const *file); /* * execute executes the *cmd with opts appended to the commandline. * Advantage to system()-call under win32 ist that no console window pops up. * On systems other than windows this function is forks and makes an execvp()-call. * *cmd is the command to execute * *opts[] is an array of elements to be appended to the commandline * copts is the count of elements within *opts[] * * returns -1 if execution failed, otherwise the return code of the executed program. */ #ifdef _WIN32 static DWORD execute(char *cmd, char *opts[], int copts); #else static int execute(char *cmd, char *opts[], int copts); #endif #endif pidgin-latex/Makefile000644 000765 000024 00000003441 11422055635 015222 0ustar00qjuhstaff000000 000000 # # pidgin-latex Makefile # # Copyright 2004-2009 Edouard Geuten # # Heavily inspired and copied from : # Gaim Extended Preferences Plugin Main Makefile # Copyright 2004-2009 Kevin Stange # # 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 # CC := gcc LIBTOOL := libtool ifeq ($(PREFIX),) LIB_INSTALL_DIR = $(HOME)/.purple/plugins else LIB_INSTALL_DIR = $(PREFIX)/lib/pidgin endif PIDGIN_LATEX = LaTeX PIDGIN_CFLAGS = $(shell pkg-config pidgin --cflags) GTK_CFLAGS = $(shell pkg-config gtk+-2.0 --cflags) PIDGIN_LIBS = $(shell pkg-config pidgin --libs) GTK_LIBS = $(shell pkg-config gtk+-2.0 --libs) PIDGIN_LIBDIR = $(shell pkg-config --variable=libdir pidgin)/pidgin all: $(PIDGIN_LATEX).so install: all mkdir -p $(LIB_INSTALL_DIR) cp $(PIDGIN_LATEX).so $(LIB_INSTALL_DIR) $(PIDGIN_LATEX).so: $(PIDGIN_LATEX).o $(CC) $(LDFLAGS) -shared $(CFLAGS) $< -o $@ $(PIDGIN_LIBS) $(GTK_LIBS) -Wl,--export-dynamic -Wl,-soname $(PIDGIN_LATEX).o:$(PIDGIN_LATEX).c $(PIDGIN_LATEX).h $(CC) $(CFLAGS) -fPIC -c $< -o $@ $(PIDGIN_CFLAGS) $(GTK_CFLAGS) -DHAVE_CONFIG_H clean: rm -rf *.o *.c~ *.h~ *.so *.la .libs pidgin-latex/Makefile.mingw000755 000765 000024 00000004454 11177301231 016343 0ustar00qjuhstaff000000 000000 # # pidgin-latex Makefile # # Copyright 2004-2009 Edouard Geuten # # Heavily inspired and copied from : # Gaim Extended Preferences Plugin Main Makefile # Copyright 2004-2009 Kevin Stange # # 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 # CC := gcc LIBTOOL := libtool # the following is taken from Gaim-1.5.0 Makefile.mingw in src-dir # # PATHS # INCLUDE_DIR := . PIDGIN_TREE_TOP := ../pidgin-2.5.1 include $(PIDGIN_TREE_TOP)/libpurple/win32/global.mak ## ## VARIABLE DEFINITIONS ## # Compiler and Linker Options CFLAGS = DEFINES = LDFLAGS = WINDRES := windres ## ## INCLUDE PATHS ## INCLUDE_PATHS = -I$(PIDGIN_IDLETRACK_TOP) \ -I$(PIDGIN_TREE_TOP) \ -I$(PIDGIN_TOP) \ -I$(PIDGIN_TOP)/win32 \ -I$(GTK_TOP)/include \ -I$(GTK_TOP)/include/gtk-2.0 \ -I$(GTK_TOP)/include/glib-2.0 \ -I$(GTK_TOP)/include/pango-1.0 \ -I$(GTK_TOP)/include/atk-1.0 \ -I$(GTK_TOP)/lib/glib-2.0/include \ -I$(GTK_TOP)/lib/gtk-2.0/include LIB_PATHS = -L$(GTK_TOP)/lib \ -L$(PIDGIN_TOP) \ -L$(PIDGIN_INSTALL_DIR) PIDGIN_LATEX = LaTeX PIDGIN_CFLAGS = -I$(PIDGIN_TOP) GTK_CFLAGS = PIDGIN_LIBS = -lpurple GTK_LIBS = -lgtk-win32-2.0 PIDGIN_LATEX_LIBS = -lintl -lglib-2.0 PIDGIN_LATEX_CFLAGS= all: $(PIDGIN_LATEX).dll $(PIDGIN_LATEX).dll: $(PIDGIN_LATEX).o $(CC) -shared $(CFLAGS) $< -o $@ $(PIDGIN_LIBS) $(GTK_LIBS) $(PIDGIN_LATEX_LIBS) $(LIB_PATHS) -Wl,--export-dynamic -Wl,-soname $(PIDGIN_LATEX).o:$(PIDGIN_LATEX).c $(PIDGIN_LATEX).h $(CC) $(CFLAGS) $(INCLUDE_PATHS) -c $< -o $@ $(PIDGIN_LATEX_CFLAGS) $(PIDGIN_CFLAGS) $(GTK_CFLAGS) clean: rm -rf *.o *.c~ *.dll *.la .libs pidgin-latex/README000644 000765 000024 00000003731 11137045516 014444 0ustar00qjuhstaff000000 000000 ############### # DESCRIPTION # ############### This is a plugin for Pidgin [1] that allows you to display LaTeX [2] output in your IMs or Chats. ################ # REQUIREMENTS # ################ - the pidgin header files (needed to compile the plugin) - a LaTex-Distribution - dvipng [3] ############# # IMPORTANT # ############# this plugin is not compatible with gaim-encryption plugin. If you have this plugin, please be sure not having the 2 working at the same time. (for any other imcompability, please contact qjuh@users.sourceforge.net ) ############################# # BUILDING and INSTALLATION # ############################# To build and install : You can compile the plugin using $ make and install it with $ make install This will install it in ~/.purple/plugins so that only the user who install it can use it. To install it for everybody on your computer, $ make $ su # make install PREFIX="/path/to/pidgin" (this command as root user) generally /path/to/pidgin is /usr or /usr/local. If you don't know the path then you can find out using $ whereis pidgin and look for the part before "/lib/pidgin". ######### # USAGE # ######### put LaTeX code into $$ ... $$ markup, for example $$x \in \mathbb{R}$$ ######## # NOTE # ######## To everyone updating from earlier versions than 1.3: you don't need ImageMagick anymore for this plugin to work. Instead this plugin uses dvipng [3], so please install it, if you don't already have it. ####### # WEB # ####### [1] http://www.pidgin.im/ [2] http://www.latex-project.org/ [3] http://savannah.nongnu.org/projects/dvipng/ ############## # DEVELOPERS # ############## Current: Benjamin Moll (contact me for all infomations or suggestions) Former: Nicolas Schoonbroodt Thanks for help or patch these other developer: Eric Betts GRIm@ Gof Nicolai Stange Martin Keßler pidgin-latex/TODO000644 000765 000024 00000000202 11137045516 014242 0ustar00qjuhstaff000000 000000 Pidgin-LaTeX TODO list * nothing yet website http://sourceforge.net/projects/pidgin-latex/ Author : qjuh@users.sourceforge.net