ayttm-commits
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Ayttm-commits] CVS: ayttm/modules/utility Makefile.am,1.2,1.3 autotran


From: Philip S Tellis <address@hidden>
Subject: [Ayttm-commits] CVS: ayttm/modules/utility Makefile.am,1.2,1.3 autotrans.c,1.4,1.5 middle.c,1.2,1.3 notes.c,1.3,1.4 rainbow.c,1.3,1.4
Date: Thu, 16 Jan 2003 04:51:06 -0500

Update of /cvsroot/ayttm/ayttm/modules/utility
In directory subversions:/tmp/cvs-serv15316/modules/utility

Modified Files:
        Makefile.am autotrans.c middle.c notes.c rainbow.c 
Log Message:
changed code almost everywhere.  removed gtk dependencies in some places, 
changed gdk_input_* to eb_input_*, etc... see the ChangeLog.

Index: Makefile.am
===================================================================
RCS file: /cvsroot/ayttm/ayttm/modules/utility/Makefile.am,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- Makefile.am 13 Jan 2003 15:25:29 -0000      1.2
+++ Makefile.am 16 Jan 2003 09:51:03 -0000      1.3
@@ -1,6 +1,6 @@
 libdir = $(datadir)/yattm/modules
 
-CFLAGS = @CFLAGS@ @GTK_CFLAGS@ -I$(top_srcdir)/src
+CFLAGS = @CFLAGS@ $(GLIB_CFLAGS) -I$(top_srcdir)/src
 
 EXTRA_DIST = 
 

Index: autotrans.c
===================================================================
RCS file: /cvsroot/ayttm/ayttm/modules/utility/autotrans.c,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -r1.4 -r1.5
--- autotrans.c 11 Jan 2003 14:52:16 -0000      1.4
+++ autotrans.c 16 Jan 2003 09:51:03 -0000      1.5
@@ -20,30 +20,24 @@
  */
 
 #include <stdio.h>
-#include <stdlib.h>
 #include <string.h>
-#include <errno.h>
-#include <sys/stat.h>
-#include <sys/types.h>
-#include <unistd.h>
 #include <glib.h>
-#include <gtk/gtk.h>
+#include <stdlib.h>
 #include <ctype.h>
-
-#ifdef __MINGW32__
-#define __IN_PLUGIN__
-#endif
-#include "input_list.h"
-#include "chat_window.h"
+#include "externs.h"
 #include "plugin_api.h"
+#include "browser.h"
 #include "prefs.h"
 #include "util.h"
 #include "intl.h"
-#include "dialog.h"
 
-/*************************************************************************************
+/* already declared in dialog.h - but that uses gtk */
+void do_error_dialog(char *message, char *title);
+void do_list_dialog( gchar * message, gchar * title, char **list, void 
(*action)(char * text, gpointer data), gpointer data );
+
+/*******************************************************************************
  *                             Begin Module Code
- 
************************************************************************************/
+ 
******************************************************************************/
 /*  Module defines */
 #define plugin_info autotrans_LTX_plugin_info
 #define plugin_init autotrans_LTX_plugin_init
@@ -120,14 +114,14 @@
 
   il->widget.checkbox.value = &doTrans;
   il->widget.checkbox.name = "doTrans";
-  il->widget.checkbox.label = strdup(_("Enable automatic translation"));
+  il->widget.checkbox.label = g_strdup(_("Enable automatic translation"));
   il->type=EB_INPUT_CHECKBOX;
 
   il->next=g_new0(input_list, 1);
   il=il->next;
   il->widget.entry.value = myLanguage;
   il->widget.entry.name = "myLanguage";
-  il->widget.entry.label = strdup(_("My language code:"));
+  il->widget.entry.label = g_strdup(_("My language code:"));
   il->type=EB_INPUT_ENTRY;
 
   eb_debug(DBG_MOD, "Auto-trans initialised\n");
@@ -138,13 +132,13 @@
   /* the following is adapted from notes.c */
 
        if((tag1=eb_add_menu_item(_("Set Language"), EB_CHAT_WINDOW_MENU, 
language_select, ebmCONTACTDATA, NULL))==NULL) {
-               eb_debug(DBG_MOD,"Error!  Unable to add Language menu to chat 
window menu\n");
+               eb_debug(DBG_MOD, "Error!  Unable to add Language menu to chat 
window menu\n");
                return(-1);
        }
 
         if((tag2=eb_add_menu_item(_("Set Language"), EB_CONTACT_MENU, 
language_select, ebmCONTACTDATA, NULL))==NULL) {
                eb_remove_menu_item(EB_CHAT_WINDOW_MENU, tag1);
-               eb_debug(DBG_MOD,"Error!  Unable to add Language menu to 
contact menu\n");
+               eb_debug(DBG_MOD, "Error!  Unable to add Language menu to 
contact menu\n");
                return(-1);
        }
 
@@ -155,7 +149,7 @@
 {
        int result=0;
 
-  eb_debug(DBG_MOD,"Auto-trans shutting down\n");
+  eb_debug(DBG_MOD, "Auto-trans shutting down\n");
   outgoing_message_filters=g_list_remove(outgoing_message_filters, 
&translate_out);
   incoming_message_filters=g_list_remove(incoming_message_filters, 
&translate_in);
 
@@ -175,9 +169,9 @@
   return 0;
 }
 
-/*************************************************************************************
+/*******************************************************************************
  *                             End Module Code
- 
************************************************************************************/
+ 
******************************************************************************/
 void language_select(ebmCallbackData *data)
 {
   ebmContactData *ecd=(ebmContactData *)data;
@@ -189,16 +183,16 @@
   languages=(char **)malloc(15 * sizeof(char *));
   // Colin - when you translate this: the important thing is that the first 
two characters
   // are the language code. The rest is ignored, so you can translate it as 
you see fit
-  languages[0]=strdup("en (English)");
-  languages[1]=strdup("fr (French)");
-  languages[2]=strdup("de (German)");
-  languages[3]=strdup("it (Italian)");
-  languages[4]=strdup("pt (Portuguese)");
-  languages[5]=strdup("es (Spanish)");
-  languages[6]=strdup("ru (Russian)");
-  languages[7]=strdup("ko (Korean)");
-  languages[8]=strdup("ja (Japanese)");
-  languages[9]=strdup("zh (Chinese)");
+  languages[0]=g_strdup("en (English)");
+  languages[1]=g_strdup("fr (French)");
+  languages[2]=g_strdup("de (German)");
+  languages[3]=g_strdup("it (Italian)");
+  languages[4]=g_strdup("pt (Portuguese)");
+  languages[5]=g_strdup("es (Spanish)");
+  languages[6]=g_strdup("ru (Russian)");
+  languages[7]=g_strdup("ko (Korean)");
+  languages[8]=g_strdup("ja (Japanese)");
+  languages[9]=g_strdup("zh (Chinese)");
   languages[10]=NULL;
 
   cont=find_contact_by_nick(ecd->contact);
@@ -229,24 +223,29 @@
 
 gchar * translate_out(eb_local_account * local, eb_account * remote, struct 
contact * contact, gchar * s)
 {
+  gchar *p;
   if(!doTrans) { return s; }
 
   if(contact->language[0]=='\0') { return s; } // no translation
 
   if(!strcmp(contact->language, myLanguage)) { return s; } // speak same 
language
 
-  return doTranslate(s, myLanguage, contact->language);
+  p = doTranslate(s, myLanguage, contact->language);
+  eb_debug(DBG_MOD, "%s translated to %s\n",s,p);
+  return p;
 }
 
 gchar * translate_in(eb_local_account * local, eb_account * remote, struct 
contact * contact, gchar * s)
 {
+  gchar *p;
   if(!doTrans) { return s; }
 
   if(contact->language[0]=='\0') { return s; } // no translation
 
   if(!strcmp(contact->language, myLanguage)) { return s; } // speak same 
language
 
-  return doTranslate(s, contact->language, myLanguage);
+  p = doTranslate(s, contact->language, myLanguage);
+  return p;
 }
 
 gchar * doTranslate(gchar * ostring, gchar * from, gchar * to)
@@ -264,22 +263,22 @@
   g_snprintf(buf, 2048, "rm /tmp/.eb.%s.translator -f ; wget -O 
/tmp/.eb.%s.translator 
'http://world.altavista.com/sites/gben/pos/babelfish/tr?tt=urltext&lp=%s_%s&urltext=%s'",
     getenv("USER"), getenv("USER"), from, to, string);
 
-  eb_debug(DBG_MOD,"Running command line:\n%s\n", buf);
+  eb_debug(DBG_MOD, "Running command line:\n%s\n", buf);
 
   if(system(buf)!=0)
   {
-    eb_debug(DBG_MOD,"COULD NOT TRANSLATE: %s\n", ostring);
+    eb_debug(DBG_MOD, "COULD NOT TRANSLATE: %s\n", ostring);
     free(string);
-    return strdup(ostring);
+    return g_strdup(ostring);
   }
 
   g_snprintf(buf, 2048, "/tmp/.eb.%s.translator", getenv("USER"));
 
   if((dat=fopen(buf, "r"))==NULL)
   {
-    eb_debug(DBG_MOD,"COULD NOT TRANSLATE: %s\n", ostring);
+    eb_debug(DBG_MOD, "COULD NOT TRANSLATE: %s\n", ostring);
     free(string);
-    return strdup(ostring);
+    return g_strdup(ostring);
   }
 
   pos=0;
@@ -300,7 +299,7 @@
 
     if(!strcmp(lastfew, "</TE"))
     {
-      eb_debug(DBG_MOD,"Found end\n");
+      eb_debug(DBG_MOD, "Found end\n");
       if (pos >= 5) {
         buf[pos-4]='\0';
         printing++;
@@ -316,7 +315,7 @@
     if(!strcmp(lastfew, "UAL>") || !strcmp(lastfew, "AL\">"))
     {
       printing=1;
-      eb_debug(DBG_MOD,"Found start\n");
+      eb_debug(DBG_MOD, "Found start\n");
     }
   }
 
@@ -324,17 +323,17 @@
 
   if(printing<2)
   {
-    eb_debug(DBG_MOD,"TRANSLATION FAILED: %s, printing=%d\n", ostring, 
printing);
+    eb_debug(DBG_MOD, "TRANSLATION FAILED: %s, printing=%d\n", ostring, 
printing);
     free(string);
-    return strdup(ostring);
+    return g_strdup(ostring);
   }
 
-  eb_debug(DBG_MOD,"Translated %s to %s\n", string, buf);
+  eb_debug(DBG_MOD, "Translated %s to %s\n", string, buf);
 
   free(string);
 
   result = Utf8ToStr(buf);
-  eb_debug(DBG_MOD,"%s\n", result);
+  eb_debug(DBG_MOD, "%s\n", result);
   return result;
 }
 

Index: middle.c
===================================================================
RCS file: /cvsroot/ayttm/ayttm/modules/utility/middle.c,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- middle.c    27 Dec 2002 16:46:52 -0000      1.2
+++ middle.c    16 Jan 2003 09:51:03 -0000      1.3
@@ -19,34 +19,23 @@
  *
  */
 
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include <errno.h>
-#include <sys/stat.h>
-#include <sys/types.h>
-#include <unistd.h>
 #include <glib.h>
-#include <gtk/gtk.h>
 #ifdef __MINGW32__
 #define __IN_PLUGIN__
 #endif
-#include "input_list.h"
-#include "chat_window.h"
+#include "externs.h"
 #include "plugin_api.h"
-#include "dialog.h"
 #include "intl.h"
 
-/*************************************************************************************
+/*******************************************************************************
  *                             Begin Module Code
- 
************************************************************************************/
+ 
******************************************************************************/
 /*  Module defines */
 #define plugin_info middle_LTX_plugin_info
 #define plugin_init middle_LTX_plugin_init
 #define plugin_finish middle_LTX_plugin_finish
 
 /* Function Prototypes */
-/* ebmCallbackData is a parent struct, the child of which will be an 
ebmContactData */
 gchar * plstripHTML(eb_local_account * local, eb_account * remote, struct 
contact * contact, gchar * s);
 int middle_init();
 int middle_finish();
@@ -76,10 +65,10 @@
 
   il->widget.checkbox.value = &doLeet;
   il->widget.checkbox.name = "doLeet";
-  il->widget.entry.label = strdup(_("Enable L33t-speak conversion"));
+  il->widget.entry.label = g_strdup(_("Enable L33t-speak conversion"));
   il->type=EB_INPUT_CHECKBOX;
 
-  eb_debug(DBG_MOD,"L33tSp33k initialised\n");
+  eb_debug(DBG_MOD, "L33tSp33k initialised\n");
 
   outgoing_message_filters=g_list_append(outgoing_message_filters, 
&plstripHTML);
   incoming_message_filters=g_list_append(incoming_message_filters, 
&plstripHTML);
@@ -89,16 +78,16 @@
 
 int middle_finish()
 {
-  eb_debug(DBG_MOD,"L33tSp33k shutting down\n");
+  eb_debug(DBG_MOD, "L33tSp33k shutting down\n");
   outgoing_message_filters=g_list_remove(outgoing_message_filters, 
&plstripHTML);
-  incoming_message_filters=g_list_remove(outgoing_message_filters, 
&plstripHTML);
+  incoming_message_filters=g_list_remove(incoming_message_filters, 
&plstripHTML);
 
   return 0;
 }
 
-/*************************************************************************************
+/*******************************************************************************
  *                             End Module Code
- 
************************************************************************************/
+ 
******************************************************************************/
 gchar * plstripHTML(eb_local_account * local, eb_account * remote, struct 
contact * contact, gchar * s)
 {
   int pos=0;

Index: notes.c
===================================================================
RCS file: /cvsroot/ayttm/ayttm/modules/utility/notes.c,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- notes.c     3 Jan 2003 23:26:07 -0000       1.3
+++ notes.c     16 Jan 2003 09:51:03 -0000      1.4
@@ -20,27 +20,19 @@
  */
 
 #include "intl.h"
-#include <stdio.h>
 #include <stdlib.h>
-#include <string.h>
-#include <errno.h>
+#include <glib.h>
 #include <sys/stat.h>
 #include <sys/types.h>
 #include <unistd.h>
-#include <glib.h>
-#include <gtk/gtk.h>
-
 #ifdef __MINGW32__
 #define __IN_PLUGIN__
 #endif
-#include "input_list.h"
 #include "plugin_api.h"
 #include "prefs.h"
-
 #ifndef NAME_MAX
 #define NAME_MAX 512
 #endif
-
 #ifdef __MINGW32__
 #define mkdir(a,b) _mkdir(a)
 #endif
@@ -53,9 +45,9 @@
 char notes_editor[MAX_PREF_LEN]="xedit";
 #endif
 
-/*************************************************************************************
+/*******************************************************************************
  *                             Begin Module Code
- 
************************************************************************************/
+ 
******************************************************************************/
 /*  Module defines */
 #define plugin_info notes_LTX_plugin_info
 #define plugin_init notes_LTX_plugin_init
@@ -91,16 +83,16 @@
        input_list * il = g_new0(input_list, 1);
        int result=0;
 
-       eb_debug(DBG_MOD,"notes init\n");
+       eb_debug(DBG_MOD, "notes init\n");
        notes_tag1=eb_add_menu_item("Notes", EB_CHAT_WINDOW_MENU, 
notes_feature, ebmCONTACTDATA, NULL);
        if(!notes_tag1) {
-               eb_debug(DBG_MOD,"Error!  Unable to add Notes menu to chat 
window menu\n");
+               eb_debug(DBG_MOD, "Error!  Unable to add Notes menu to chat 
window menu\n");
                return(-1);
        }
        notes_tag2=eb_add_menu_item("Notes", EB_CONTACT_MENU, notes_feature, 
ebmCONTACTDATA, NULL);
        if(!notes_tag2) {
                result=eb_remove_menu_item(EB_CHAT_WINDOW_MENU, notes_tag1);
-               eb_debug(DBG_MOD,"Error!  Unable to add Notes menu to contact 
menu\n");
+               eb_debug(DBG_MOD, "Error!  Unable to add Notes menu to contact 
menu\n");
                return(-1);
        }
        g_snprintf(notes_dir, NAME_MAX, "%s/notes", eb_config_dir());
@@ -131,9 +123,9 @@
        return(0);
 }
 
-/*************************************************************************************
+/*******************************************************************************
  *                             End Module Code
- 
************************************************************************************/
+ 
******************************************************************************/
 
 /* We're really going to get back an ebmContactData object */
 void notes_feature(ebmCallbackData *data)
@@ -141,19 +133,22 @@
        ebmContactData *ecd=NULL;
        char buff[256];
        char cmd_buff[1024];
+#ifndef __MINGW32__
        pid_t pid;
+#endif
 
        eb_debug(DBG_MOD, ">\n");
        if(IS_ebmContactData(data))
                ecd=(ebmContactData *)data;
        else {  /* This should never happen, unless something is horribly wrong 
*/
-               eb_debug(DBG_MOD,"*** Warning *** Unexpected ebmCallbackData 
type returned!\n");
+               eb_debug(DBG_MOD, "*** Warning *** Unexpected ebmCallbackData 
type returned!\n");
                return;
        }
        eb_debug(DBG_MOD, "contact: %s remote_account: %s\n", ecd->contact, 
ecd->remote_account);
-       sprintf(buff, "Notes on %s", ecd->contact);
-       sprintf(cmd_buff, "%s/%s", notes_dir, ecd->contact);
+       g_snprintf(buff, 255, "Notes on %s", ecd->contact);
+       g_snprintf(cmd_buff, 1023, "%s/%s", notes_dir, ecd->contact);
 
+#ifndef __MINGW32__
        pid = fork();
        if (pid == 0) {
                char *args[3];
@@ -167,5 +162,6 @@
                g_free(args[1]);
                _exit(0);
        }
+#endif
        eb_debug(DBG_MOD, "<\n");
 }

Index: rainbow.c
===================================================================
RCS file: /cvsroot/ayttm/ayttm/modules/utility/rainbow.c,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- rainbow.c   3 Jan 2003 23:26:07 -0000       1.3
+++ rainbow.c   16 Jan 2003 09:51:03 -0000      1.4
@@ -19,28 +19,20 @@
  *
  */
 
-#include <stdio.h>
+#include <glib.h>
 #include <stdlib.h>
 #include <string.h>
-#include <errno.h>
-#include <sys/stat.h>
-#include <sys/types.h>
-#include <unistd.h>
-#include <glib.h>
-#include <gtk/gtk.h>
-
 #ifdef __MINGW32__
 #define __IN_PLUGIN__
 #endif
-#include "input_list.h"
-#include "chat_window.h"
+#include "externs.h"
 #include "plugin_api.h"
 #include "prefs.h"
 #include "intl.h"
 
-/*************************************************************************************
+/*******************************************************************************
  *                             Begin Module Code
- 
************************************************************************************/
+ 
******************************************************************************/
 /*  Module defines */
 #define plugin_info rainbow_LTX_plugin_info
 #define plugin_init rainbow_LTX_plugin_init
@@ -88,48 +80,48 @@
 
   il->widget.checkbox.value = &doRainbow;
   il->widget.checkbox.name = "doRainbow";
-  il->widget.checkbox.label = strdup(_("Enable rainbow conversion"));
+  il->widget.checkbox.label = g_strdup(_("Enable rainbow conversion"));
   il->type=EB_INPUT_CHECKBOX;
 
   il->next=g_new0(input_list, 1);
   il=il->next;
   il->widget.entry.value = sstart_r;
   il->widget.entry.name = "sstart_r";
-  il->widget.entry.label = strdup(_("Starting R value"));
+  il->widget.entry.label = g_strdup(_("Starting R value"));
   il->type=EB_INPUT_ENTRY;
   il->next=g_new0(input_list, 1);
   il=il->next;
   il->widget.entry.value = sstart_g;
   il->widget.entry.name = "sstart_g";
-  il->widget.entry.label = strdup(_("Starting G value"));
+  il->widget.entry.label = g_strdup(_("Starting G value"));
   il->type=EB_INPUT_ENTRY;
   il->next=g_new0(input_list, 1);
   il=il->next;
   il->widget.entry.value = sstart_b;
   il->widget.entry.name = "sstart_b";
-  il->widget.entry.label = strdup(_("Starting B value"));
+  il->widget.entry.label = g_strdup(_("Starting B value"));
   il->type=EB_INPUT_ENTRY;
 
   il->next=g_new0(input_list, 1);
   il=il->next;
   il->widget.entry.value = send_r;
   il->widget.entry.name = "send_r";
-  il->widget.entry.label = strdup(_("Ending R value"));
+  il->widget.entry.label = g_strdup(_("Ending R value"));
   il->type=EB_INPUT_ENTRY;
   il->next=g_new0(input_list, 1);
   il=il->next;
   il->widget.entry.value = send_g;
   il->widget.entry.name = "send_g";
-  il->widget.entry.label = strdup(_("Ending G value"));
+  il->widget.entry.label = g_strdup(_("Ending G value"));
   il->type=EB_INPUT_ENTRY;
   il->next=g_new0(input_list, 1);
   il=il->next;
   il->widget.entry.value = send_b;
   il->widget.entry.name = "send_b";
-  il->widget.entry.label = strdup(_("Ending B value"));
+  il->widget.entry.label = g_strdup(_("Ending B value"));
   il->type=EB_INPUT_ENTRY;
 
-  eb_debug (DBG_MOD, "Rainbow initialised\n");
+  eb_debug(DBG_MOD, "Rainbow initialised\n");
 
   outgoing_message_filters=g_list_append(outgoing_message_filters, &dorainbow);
 
@@ -138,15 +130,15 @@
 
 int rainbow_finish()
 {
-  eb_debug (DBG_MOD,"Rainbow shutting down\n");
+  eb_debug(DBG_MOD, "Rainbow shutting down\n");
   outgoing_message_filters=g_list_remove(outgoing_message_filters, &dorainbow);
 
   return 0;
 }
 
-/*************************************************************************************
+/*******************************************************************************
  *                             End Module Code
- 
************************************************************************************/
+ 
******************************************************************************/
 gchar * dorainbow(eb_local_account * local, eb_account * remote, struct 
contact * contact, gchar * s)
 {
   gchar * retval;
@@ -169,7 +161,7 @@
   if(end_g>255 || end_g<0) { end_g=0; }
   if(end_b>255 || end_b<0) { end_b=0; }
 
-  wptr=retval=(gchar *)malloc(23*len*sizeof(gchar));
+  wptr=retval=malloc(23*len*sizeof(gchar));
 
   while(s[pos]!='\0')
   {





reply via email to

[Prev in Thread] Current Thread [Next in Thread]