gnome-mud r777 - in trunk: . src



Author: lharris
Date: Sun Mar  1 11:51:49 2009
New Revision: 777
URL: http://svn.gnome.org/viewvc/gnome-mud?rev=777&view=rev

Log:
Logger now scrolls to newest item, Property fix, Logging added.


Modified:
   trunk/ChangeLog
   trunk/src/debug-logger.c
   trunk/src/gnome-mud.c
   trunk/src/mud-telnet-handlers.c
   trunk/src/mud-telnet-msp.c
   trunk/src/mud-telnet-zmp.c
   trunk/src/mud-telnet.c

Modified: trunk/src/debug-logger.c
==============================================================================
--- trunk/src/debug-logger.c	(original)
+++ trunk/src/debug-logger.c	Sun Mar  1 11:51:49 2009
@@ -618,6 +618,7 @@
     GtkTreeIter iter;
     GtkListStore *store;
     GString *color, *type;
+    GtkTreePath *path;
 
     DomainHandler *handler =
         debug_logger_get_handler_by_name(logger, log_domain);
@@ -675,6 +676,10 @@
                 MSG_COLUMN, message,
                 -1);
 
+    path = gtk_tree_model_get_path(GTK_TREE_MODEL(store), &iter);
+    gtk_tree_view_scroll_to_cell(handler->view, path, NULL, FALSE, 0, 0);
+    gtk_tree_path_free(path);
+
     g_string_free(type, TRUE);
     g_string_free(color, TRUE);
 

Modified: trunk/src/gnome-mud.c
==============================================================================
--- trunk/src/gnome-mud.c	(original)
+++ trunk/src/gnome-mud.c	Sun Mar  1 11:51:49 2009
@@ -107,7 +107,7 @@
     debug_logger_add_domain(logger, "Telnet", FALSE);
 
     /* Turn on colored output in logger */
-    g_object_set(logger, "use_color", TRUE, NULL);
+    g_object_set(logger, "use-color", TRUE, NULL);
 
     g_critical("Foobar");
     g_warning("Barfoo");

Modified: trunk/src/mud-telnet-handlers.c
==============================================================================
--- trunk/src/mud-telnet-handlers.c	(original)
+++ trunk/src/mud-telnet-handlers.c	Sun Mar  1 11:51:49 2009
@@ -294,6 +294,10 @@
     argv = g_strsplit(args->str, "|gmud_sep|", -1);
     argc = g_strv_length(argv);
 
+    g_log("Telnet", G_LOG_LEVEL_MESSAGE, "Received: ZMP Command: %s", command_buf);
+    for(count = 0; count < argc - 1; ++count)
+        g_log("Telnet", G_LOG_LEVEL_MESSAGE, "\t%s", argv[count]);
+
     if(mud_zmp_has_command(telnet, command_buf))
     {
         zmp_handler = mud_zmp_get_function(telnet, command_buf);

Modified: trunk/src/mud-telnet-msp.c
==============================================================================
--- trunk/src/mud-telnet-msp.c	(original)
+++ trunk/src/mud-telnet-msp.c	Sun Mar  1 11:51:49 2009
@@ -526,22 +526,31 @@
 static void
 mud_telnet_msp_process_command(MudTelnet *telnet, MudMSPCommand *command)
 {
-    /*g_message("MSP Command Parse Results");
-    g_print("Type: %s\n", (command->type == MSP_TYPE_SOUND) ? "Sound" :
+    g_log("Telnet", G_LOG_LEVEL_INFO, "MSP Command Parse Results");
+    g_log("Telnet", G_LOG_LEVEL_INFO, 
+            "Type: %s", (command->type == MSP_TYPE_SOUND) ? "Sound" :
             "Music" );
-    g_print("Filename: %s\n", (command->fName != NULL) ? command->fName :
+    g_log("Telnet", G_LOG_LEVEL_INFO,
+            "Filename: %s", (command->fName != NULL) ? command->fName :
             "<null>");
-    g_print("V: %s\n", (command->V != NULL) ? command->V : "<null>");
-    g_print("L: %s\n", (command->L != NULL) ? command->L : "<null>");
-    g_print("C: %s\n", (command->C != NULL) ? command->C : "<null>");
-    g_print("T: %s\n", (command->T != NULL) ? command->T : "<null>");
-    g_print("U: %s\n", (command->U != NULL) ? command->U : "<null>");
-    g_print("P: %s\n", (command->P != NULL) ? command->P : "<null>");
-    g_print("Sfx Type: %s Volume: %d  Priority: %d  Repeat %d times. %s %s\n",
+    g_log("Telnet", G_LOG_LEVEL_INFO,
+            "V: %s", (command->V != NULL) ? command->V : "<null>");
+    g_log("Telnet", G_LOG_LEVEL_INFO,
+            "L: %s", (command->L != NULL) ? command->L : "<null>");
+    g_log("Telnet", G_LOG_LEVEL_INFO,
+            "C: %s", (command->C != NULL) ? command->C : "<null>");
+    g_log("Telnet", G_LOG_LEVEL_INFO, 
+            "T: %s", (command->T != NULL) ? command->T : "<null>");
+    g_log("Telnet", G_LOG_LEVEL_INFO,
+            "U: %s", (command->U != NULL) ? command->U : "<null>");
+    g_log("Telnet", G_LOG_LEVEL_INFO,
+            "P: %s", (command->P != NULL) ? command->P : "<null>");
+    g_log("Telnet", G_LOG_LEVEL_INFO,
+            "Sfx Type: %s Volume: %d  Priority: %d  Repeat %d times. %s %s",
             (command->sfx_type) ? command->sfx_type:"None", command->volume,
             command->priority, command->initial_repeat_count, (command->loop) ?
             "Looping" : "Not Looping",
-            (command->cont) ? "Continue" : "Stop");*/
+            (command->cont) ? "Continue" : "Stop");
 
     if(command->fName && strcmp(command->fName, "Off") == 0)
     {

Modified: trunk/src/mud-telnet-zmp.c
==============================================================================
--- trunk/src/mud-telnet-zmp.c	(original)
+++ trunk/src/mud-telnet-zmp.c	Sun Mar  1 11:51:49 2009
@@ -127,6 +127,8 @@
     va_start(va, count);
     gchar *arg;
 
+    g_log("Telnet", G_LOG_LEVEL_DEBUG, "Sending ZMP Command:");
+
     gnet_conn_write(telnet->conn, (gchar *)&byte, 1);
     byte = (guchar)TEL_SB;
     gnet_conn_write(telnet->conn, (gchar *)&byte, 1);
@@ -137,6 +139,8 @@
     {
         arg = (gchar *)va_arg(va, gchar *);
 
+        g_log("Telnet", G_LOG_LEVEL_DEBUG, "\t%s", arg);
+
         for(j = 0; j < strlen(arg); ++j)
         {
             byte = (guchar)arg[j];

Modified: trunk/src/mud-telnet.c
==============================================================================
--- trunk/src/mud-telnet.c	(original)
+++ trunk/src/mud-telnet.c	Sun Mar  1 11:51:49 2009
@@ -778,6 +778,8 @@
     if(!encoding)
 	return;
 
+    g_log("Telnet", G_LOG_LEVEL_DEBUG, "Sending Charset Accepted SubReq");
+
     /* Writes IAC SB CHARSET ACCEPTED <charset> IAC SE to server */
     byte = (guchar)TEL_IAC;
 
@@ -812,6 +814,8 @@
     va_list va;
     va_start(va, count);
 
+    g_log("Telnet", G_LOG_LEVEL_DEBUG, "Sending Subreq...");
+    
     byte = (guchar)TEL_IAC;
 
     gnet_conn_write(telnet->conn, (gchar *)&byte, 1);
@@ -950,6 +954,7 @@
 {
     const guint bitshift = him ? 4 : 0;
     guchar * opt = &(telnet->telopt_states[opt_no]);
+    gchar *tel_string, *opt_string;
 
     switch (mud_telnet_get_telopt_state(opt, bitshift))
     {
@@ -960,11 +965,25 @@
 	// FIXME: What to do in the opposite "him" gint value case?
 	if (mud_telnet_isenabled(telnet, opt_no, him))
 	{
+            tel_string = mud_telnet_get_telnet_string(affirmative);
+            opt_string = mud_telnet_get_telopt_string(opt_no);
+            g_log("Telnet", G_LOG_LEVEL_DEBUG, "Sent: %s %s",
+                    tel_string, opt_string );
+            g_free(tel_string);
+            g_free(opt_string);
+
 	    mud_telnet_set_telopt_state(opt, TELOPT_STATE_YES, bitshift);
 	    mud_telnet_send_iac(telnet, affirmative, opt_no);
 	    mud_telnet_on_enable_opt(telnet, opt_no, him);
 	    return TRUE;
 	} else {
+            tel_string = mud_telnet_get_telnet_string(negative);
+            opt_string = mud_telnet_get_telopt_string(opt_no);
+            g_log("Telnet", G_LOG_LEVEL_DEBUG, "Sent: %s %s",
+                    tel_string, opt_string );
+            g_free(tel_string);
+            g_free(opt_string);
+
 	    mud_telnet_send_iac(telnet, negative, opt_no);
 	    return FALSE;
 	}
@@ -991,11 +1010,25 @@
     case TELOPT_STATE_WANTYES:
 	if (mud_telnet_get_telopt_queue(opt, bitshift) == TELOPT_STATE_QUEUE_EMPTY)
 	{
+            tel_string = mud_telnet_get_telnet_string(affirmative);
+            opt_string = mud_telnet_get_telopt_string(opt_no);
+            g_log("Telnet", G_LOG_LEVEL_DEBUG, "Sent: %s %s",
+                    tel_string, opt_string );
+            g_free(tel_string);
+            g_free(opt_string);
+
 	    mud_telnet_set_telopt_state(opt, TELOPT_STATE_YES, bitshift);
 	    mud_telnet_send_iac(telnet, affirmative, opt_no);
 	    mud_telnet_on_enable_opt(telnet, opt_no, him);
 	    return TRUE;
 	} else { // The opposite is queued
+            tel_string = mud_telnet_get_telnet_string(negative);
+            opt_string = mud_telnet_get_telopt_string(opt_no);
+            g_log("Telnet", G_LOG_LEVEL_DEBUG, "Sent: %s %s",
+                    tel_string, opt_string );
+            g_free(tel_string);
+            g_free(opt_string);
+
 	    mud_telnet_set_telopt_state(opt, TELOPT_STATE_WANTNO, bitshift);
 	    mud_telnet_set_telopt_queue(opt, TELOPT_STATE_QUEUE_EMPTY, bitshift);
 	    mud_telnet_send_iac(telnet, negative, opt_no);
@@ -1016,6 +1049,7 @@
 {
     const guint bitshift = him ? 4 : 0;
     guchar * opt = &(telnet->telopt_states[opt_no]);
+    gchar *opt_string, *tel_string;
 
     switch (mud_telnet_get_telopt_state(opt, bitshift))
     {
@@ -1024,23 +1058,37 @@
 	return FALSE;
 
     case TELOPT_STATE_YES:
+        tel_string = mud_telnet_get_telnet_string(negative);
+        opt_string = mud_telnet_get_telopt_string(opt_no);
+        g_log("Telnet", G_LOG_LEVEL_DEBUG, "Sent: %s %s",
+            tel_string, opt_string );
+        g_free(tel_string);
+        g_free(opt_string);
+
 	mud_telnet_set_telopt_state(opt, TELOPT_STATE_NO, bitshift);
 	mud_telnet_send_iac(telnet, negative, opt_no);
 	mud_telnet_on_disable_opt(telnet, opt_no, him);
 	return TRUE;
 
     case TELOPT_STATE_WANTNO:
-	if (mud_telnet_get_telopt_queue(opt, bitshift) == TELOPT_STATE_QUEUE_EMPTY)
-	{
-	    mud_telnet_set_telopt_state(opt, TELOPT_STATE_NO, bitshift);
-	    return FALSE;
-	} else {
-	    mud_telnet_set_telopt_state(opt, TELOPT_STATE_WANTYES, bitshift);
-	    mud_telnet_set_telopt_queue(opt, TELOPT_STATE_QUEUE_EMPTY, bitshift);
-	    mud_telnet_send_iac(telnet, affirmative, opt_no);
-	    mud_telnet_on_enable_opt(telnet, opt_no, him); // FIXME: Is this correct?
-	    return TRUE;
-	}
+        if (mud_telnet_get_telopt_queue(opt, bitshift) == TELOPT_STATE_QUEUE_EMPTY)
+        {
+            mud_telnet_set_telopt_state(opt, TELOPT_STATE_NO, bitshift);
+            return FALSE;
+        } else {
+            tel_string = mud_telnet_get_telnet_string(affirmative);
+            opt_string = mud_telnet_get_telopt_string(opt_no);
+            g_log("Telnet", G_LOG_LEVEL_DEBUG, "Sent: %s %s",
+                    tel_string, opt_string );
+            g_free(tel_string);
+            g_free(opt_string);
+
+            mud_telnet_set_telopt_state(opt, TELOPT_STATE_WANTYES, bitshift);
+            mud_telnet_set_telopt_queue(opt, TELOPT_STATE_QUEUE_EMPTY, bitshift);
+            mud_telnet_send_iac(telnet, affirmative, opt_no);
+            mud_telnet_on_enable_opt(telnet, opt_no, him); // FIXME: Is this correct?
+            return TRUE;
+        }
 
     case TELOPT_STATE_WANTYES:
 	if (mud_telnet_get_telopt_queue(opt, bitshift) == TELOPT_STATE_QUEUE_EMPTY)



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