Complete.Org: Mailing Lists: Archives: freeciv-dev: September 2005:
[Freeciv-Dev] (PR#13834) remove notify_conn
Home

[Freeciv-Dev] (PR#13834) remove notify_conn

[Top] [All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
Subject: [Freeciv-Dev] (PR#13834) remove notify_conn
From: "Jason Short" <jdorje@xxxxxxxxxxxxxxxxxxxxx>
Date: Thu, 1 Sep 2005 20:36:26 -0700
Reply-to: bugs@xxxxxxxxxxx

<URL: http://bugs.freeciv.org/Ticket/Display.html?id=13834 >

This patch removes notify_conn.  All users are changed to use 
notify_conn_ex which takes a tile (almost always NULL in this case) and 
an event type.

The next step of course is to rename notify_conn_ex as notify_conn (and 
vnotify_conn_ex as vnotify_conn).

-jason

Index: ai/ailog.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/ai/ailog.c,v
retrieving revision 1.30
diff -p -u -r1.30 ailog.c
--- ai/ailog.c  24 Aug 2005 16:49:26 -0000      1.30
+++ ai/ailog.c  2 Sep 2005 03:35:07 -0000
@@ -69,7 +69,7 @@ void TECH_LOG(int level, struct player *
 
   cat_snprintf(buffer, sizeof(buffer), buffer2);
   if (BV_ISSET(pplayer->debug, PLAYER_DEBUG_TECH)) {
-    notify_conn(NULL, buffer);
+    notify_conn(NULL, NULL, E_AI_DEBUG, "%s", buffer);
   }
   freelog(minlevel, buffer);
 }
@@ -109,7 +109,7 @@ void DIPLO_LOG(int level, struct player 
 
   cat_snprintf(buffer, sizeof(buffer), buffer2);
   if (BV_ISSET(pplayer->debug, PLAYER_DEBUG_DIPLOMACY)) {
-    notify_conn(NULL, buffer);
+    notify_conn(NULL, NULL, E_AI_DEBUG, "%s", buffer);
   }
   freelog(minlevel, buffer);
 }
@@ -143,7 +143,7 @@ void CITY_LOG(int level, struct city *pc
 
   cat_snprintf(buffer, sizeof(buffer), buffer2);
   if (pcity->debug) {
-    notify_conn(NULL, buffer);
+    notify_conn(NULL, NULL, E_AI_DEBUG, "%s", buffer);
   }
   freelog(minlevel, buffer);
 }
@@ -202,7 +202,7 @@ void UNIT_LOG(int level, struct unit *pu
 
   cat_snprintf(buffer, sizeof(buffer), buffer2);
   if (punit->debug || messwin) {
-    notify_conn(NULL, buffer);
+    notify_conn(NULL, NULL, E_AI_DEBUG, "%s", buffer);
   }
   freelog(minlevel, buffer);
 }
@@ -254,7 +254,7 @@ void BODYGUARD_LOG(int level, const stru
              s, id, charge_x, charge_y);
   cat_snprintf(buffer, sizeof(buffer), msg);
   if (punit->debug) {
-    notify_conn(NULL, buffer);
+    notify_conn(NULL, NULL, E_AI_DEBUG, "%s", buffer);
   }
   freelog(minlevel, buffer);
 }
@@ -307,10 +307,10 @@ void TIMING_RESULTS(void)
            read_timer_seconds(aitimer[which][0]),                        \
            read_timer_seconds(aitimer[which][1]));                       \
   freelog(LOG_NORMAL, buf);                                              \
-  notify_conn(NULL, buf);
+  notify_conn(NULL, NULL, E_AI_DEBUG, "%s", buf);
 
   freelog(LOG_NORMAL, "  --- AI timing results ---");
-  notify_conn(NULL, "  --- AI timing results ---");
+  notify_conn(NULL, NULL, E_AI_DEBUG, "  --- AI timing results ---");
   OUT("Total AI time", AIT_ALL);
   OUT("Movemap", AIT_MOVEMAP);
   OUT("Units", AIT_UNITS);
Index: client/options.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/client/options.c,v
retrieving revision 1.142
diff -p -u -r1.142 options.c
--- client/options.c    31 Aug 2005 20:18:52 -0000      1.142
+++ client/options.c    2 Sep 2005 03:35:07 -0000
@@ -322,9 +322,9 @@ void message_options_init(void)
     E_UNIT_LOST_ATT, E_UNIT_WIN_ATT, E_GAME_START,
     E_NATION_SELECTED, E_CITY_BUILD, E_NEXT_YEAR,
     E_CITY_PRODUCTION_CHANGED,
-    E_CITY_MAY_SOON_GROW, E_WORKLIST
+    E_CITY_MAY_SOON_GROW, E_WORKLIST, E_AI_DEBUG
   };
-  int out_only[] = {E_CHAT_MSG, E_CHAT_ERROR, E_SETTING};
+  int out_only[] = {E_CHAT_MSG, E_CHAT_ERROR, E_SETTING, E_CONNECTION};
   int all[] = {E_MESSAGE_WALL, E_TUTORIAL};
   int i;
 
Index: common/events.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/common/events.c,v
retrieving revision 1.3
diff -p -u -r1.3 events.c
--- common/events.c     25 Aug 2005 19:12:23 -0000      1.3
+++ common/events.c     2 Sep 2005 03:35:07 -0000
@@ -137,6 +137,8 @@ static struct {
   GEN_EV(N_("Server settings changed"), E_SETTING),
   GEN_EV(N_("Chat messages"), E_CHAT_MSG),
   GEN_EV(N_("Chat error messages"), E_CHAT_ERROR),
+  GEN_EV(N_("Connect/disconnect messages"), E_CONNECTION),
+  GEN_EV(N_("AI Debug messages"), E_AI_DEBUG),
   GEN_EV_TERMINATOR
 };
 
Index: common/events.h
===================================================================
RCS file: /home/freeciv/CVS/freeciv/common/events.h,v
retrieving revision 1.30
diff -p -u -r1.30 events.h
--- common/events.h     25 Aug 2005 19:12:23 -0000      1.30
+++ common/events.h     2 Sep 2005 03:35:07 -0000
@@ -66,7 +66,6 @@ enum event_type {
   E_BROADCAST_REPORT,
   E_GAME_END,
   E_GAME_START,
-  E_MESSAGE_WALL,
   E_NATION_SELECTED,
   E_DESTROYED,
   E_REPORT,
@@ -114,7 +113,10 @@ enum event_type {
   E_BAD_COMMAND,  /* Illegal command sent from client. */
   E_SETTING, /* Messages for changed server settings */
   E_CHAT_MSG, /* Chatline messages */
+  E_MESSAGE_WALL,
   E_CHAT_ERROR, /* Chatline errors (bad syntax, etc.) */
+  E_CONNECTION, /* Messages about acquired or lost connections */
+  E_AI_DEBUG, /* AI debugging messages */
   /* 
    * Note: If you add a new event, make sure you make a similar change
    * to the events array in client/options.c using GEN_EV and to
Index: server/connecthand.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/server/connecthand.c,v
retrieving revision 1.53
diff -p -u -r1.53 connecthand.c
--- server/connecthand.c        8 Aug 2005 16:30:24 -0000       1.53
+++ server/connecthand.c        2 Sep 2005 03:35:08 -0000
@@ -93,10 +93,12 @@ static void establish_new_connection(str
 
   /* introduce the server to the connection */
   if (my_gethostname(hostname, sizeof(hostname)) == 0) {
-    notify_conn(dest, _("Welcome to the %s Server running at %s port %d."),
+    notify_conn(dest, NULL, E_CONNECTION,
+               _("Welcome to the %s Server running at %s port %d."),
                 freeciv_name_version(), hostname, srvarg.port);
   } else {
-    notify_conn(dest, _("Welcome to the %s Server at port %d."),
+    notify_conn(dest, NULL, E_CONNECTION,
+               _("Welcome to the %s Server at port %d."),
                 freeciv_name_version(), srvarg.port);
   }
 
@@ -108,7 +110,8 @@ static void establish_new_connection(str
           pconn->username, pconn->addr);
   conn_list_iterate(game.est_connections, aconn) {
     if (aconn != pconn) {
-      notify_conn(aconn->self, _("Server: %s has connected from %s."),
+      notify_conn(aconn->self, NULL, E_CONNECTION,
+                 _("Server: %s has connected from %s."),
                   pconn->username, pconn->addr);
     }
   } conn_list_iterate_end;
@@ -143,7 +146,8 @@ static void establish_new_connection(str
 
   } else if (server_state == PRE_GAME_STATE && game.info.is_new_game) {
     if (!attach_connection_to_player(pconn, NULL)) {
-      notify_conn(dest, _("Couldn't attach your connection to new player."));
+      notify_conn(dest, NULL, E_CONNECTION,
+                 _("Couldn't attach your connection to new player."));
       freelog(LOG_VERBOSE, "%s is not attached to a player", pconn->username);
     } else {
       sz_strlcpy(pconn->player->name, pconn->username);
@@ -152,14 +156,17 @@ static void establish_new_connection(str
 
   /* remind the connection who he is */
   if (!pconn->player) {
-    notify_conn(dest, _("You are logged in as '%s' connected to no player."),
+    notify_conn(dest, NULL, E_CONNECTION,
+               _("You are logged in as '%s' connected to no player."),
                 pconn->username);
   } else if (strcmp(pconn->player->name, ANON_PLAYER_NAME) == 0) {
-    notify_conn(dest, _("You are logged in as '%s' connected to an "
-                        "anonymous player."),
+    notify_conn(dest, NULL, E_CONNECTION,
+               _("You are logged in as '%s' connected to an "
+                 "anonymous player."),
                pconn->username);
   } else {
-    notify_conn(dest, _("You are logged in as '%s' connected to %s."),
+    notify_conn(dest, NULL, E_CONNECTION,
+               _("You are logged in as '%s' connected to %s."),
                 pconn->username, pconn->player->name);
   }
 
@@ -170,8 +177,9 @@ static void establish_new_connection(str
           && !cplayer->ai.control
           && !cplayer->phase_done
           && cplayer != pconn->player) {  /* skip current player */
-        notify_conn(dest, _("Turn-blocking game play: "
-                            "waiting on %s to finish turn..."),
+        notify_conn(dest, NULL, E_CONNECTION,
+                   _("Turn-blocking game play: "
+                     "waiting on %s to finish turn..."),
                     cplayer->name);
       }
     } players_iterate_end;
@@ -294,8 +302,9 @@ bool handle_login_request(struct connect
         get_unique_guest_name(req->username);
 
         if (strncmp(old_guest_name, req->username, MAX_LEN_NAME) != 0) {
-          notify_conn(pconn->self, _("Warning: the guest name '%s' has been "
-                                      "taken, renaming to user '%s'."),
+          notify_conn(pconn->self, NULL, E_CONNECTION,
+                     _("Warning: the guest name '%s' has been "
+                       "taken, renaming to user '%s'."),
                       old_guest_name, req->username);
         }
       } else {
@@ -319,9 +328,10 @@ bool handle_login_request(struct connect
           sz_strlcpy(pconn->username, tmpname);
 
           freelog(LOG_ERROR, "Error reading database; connection -> guest");
-          notify_conn(pconn->self, _("There was an error reading the user "
-                                      "database, logging in as guest "
-                                      "connection '%s'."), pconn->username);
+          notify_conn(pconn->self, NULL, E_CONNECTION,
+                     _("There was an error reading the user "
+                       "database, logging in as guest "
+                       "connection '%s'."), pconn->username);
           establish_new_connection(pconn);
         } else {
           reject_new_connection(_("There was an error reading the user "
@@ -413,9 +423,10 @@ bool handle_authentication_reply(struct 
     case USER_DB_SUCCESS:
       break;
     case USER_DB_ERROR:
-      notify_conn(pconn->self, _("Warning: There was an error in saving "
-                                  "to the database. Continuing, but your "
-                                  "stats will not be saved."));
+      notify_conn(pconn->self, NULL, E_CONNECTION,
+                 _("Warning: There was an error in saving "
+                   "to the database. Continuing, but your "
+                   "stats will not be saved."));
       freelog(LOG_ERROR, "Error writing to database for %s", pconn->username);
       break;
     default:
@@ -552,7 +563,8 @@ void lost_connection_to_client(struct co
    * Safe to unlink even if not in list: */
   conn_list_unlink(game.est_connections, pconn);
   delayed_disconnect++;
-  notify_conn(game.est_connections, _("Lost connection: %s."), desc);
+  notify_conn(game.est_connections, NULL, E_CONNECTION,
+             _("Lost connection: %s."), desc);
 
   if (!pplayer) {
     delayed_disconnect--;
Index: server/plrhand.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/server/plrhand.c,v
retrieving revision 1.418
diff -p -u -r1.418 plrhand.c
--- server/plrhand.c    1 Sep 2005 02:32:41 -0000       1.418
+++ server/plrhand.c    2 Sep 2005 03:35:08 -0000
@@ -735,17 +735,6 @@ void notify_conn_ex(struct conn_list *de
 }
 
 /**************************************************************************
-  See vnotify_conn_ex - this is varargs, and cannot specify (x,y), event.
-**************************************************************************/
-void notify_conn(struct conn_list *dest, const char *format, ...) 
-{
-  va_list args;
-  va_start(args, format);
-  vnotify_conn_ex(dest, NULL, E_NOEVENT, format, args);
-  va_end(args);
-}
-
-/**************************************************************************
   Similar to vnotify_conn_ex (see also), but takes player as "destination".
   If player != NULL, sends to all connections for that player.
   If player == NULL, sends to all game connections, to support
@@ -1115,10 +1104,10 @@ void server_remove_player(struct player 
   }
 
   freelog(LOG_NORMAL, _("Removing player %s."), pplayer->name);
-  notify_conn(pplayer->connections,
+  notify_conn(pplayer->connections, NULL, E_CONNECTION,
              _("You've been removed from the game!"));
 
-  notify_conn(game.est_connections,
+  notify_conn(game.est_connections, NULL, E_CONNECTION,
              _("%s has been removed from the game."), pplayer->name);
   
   dlsend_packet_player_remove(game.game_connections, pplayer->player_no);
@@ -1417,7 +1406,7 @@ struct player *create_global_observer(vo
    * a slot available to create one.  Observers are taken from the slots of
    * normal civs (barbarians are reserved separately). */
   if (game.info.nplayers - game.info.nbarbarians >= MAX_NUM_PLAYERS) {
-    notify_conn(NULL,
+    notify_conn(NULL, NULL, E_CONNECTION,
                _("A global observer cannot be created: too "
                  "many regular players."));
     return NULL;
@@ -1425,7 +1414,7 @@ struct player *create_global_observer(vo
 
   nation = pick_observer_nation();
   if (nation == NO_NATION_SELECTED) {
-    notify_conn(NULL,
+    notify_conn(NULL, NULL, E_CONNECTION,
                _("A global observer cannot be created: there's "
                  "no observer nation in the ruleset."));
     return NULL;
@@ -1467,7 +1456,7 @@ struct player *create_global_observer(vo
   /* tell everyone that game.info.nplayers has been updated */
   send_game_info(NULL);
   send_player_info(pplayer, NULL);
-  notify_conn(NULL,
+  notify_conn(NULL, NULL, E_CONNECTION,
              _("A global observer has been created"));
 
   return pplayer;
Index: server/plrhand.h
===================================================================
RCS file: /home/freeciv/CVS/freeciv/server/plrhand.h,v
retrieving revision 1.83
diff -p -u -r1.83 plrhand.h
--- server/plrhand.h    1 Sep 2005 02:32:41 -0000       1.83
+++ server/plrhand.h    2 Sep 2005 03:35:08 -0000
@@ -52,8 +52,7 @@ void notify_conn_ex(struct conn_list *de
 void vnotify_conn_ex(struct conn_list *dest, struct tile *ptile,
                     enum event_type event, const char *format,
                     va_list vargs);
-void notify_conn(struct conn_list *dest, const char *format, ...) 
-                 fc__attribute((format (printf, 2, 3)));
+#define notify_conn notify_conn_ex
 void notify_player(const struct player *pplayer, struct tile *ptile,
                   enum event_type event, const char *format, ...)
                    fc__attribute((format (printf, 4, 5)));
Index: server/srv_main.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/server/srv_main.c,v
retrieving revision 1.288
diff -p -u -r1.288 srv_main.c
--- server/srv_main.c   26 Aug 2005 19:40:26 -0000      1.288
+++ server/srv_main.c   2 Sep 2005 03:35:08 -0000
@@ -799,8 +799,10 @@ void start_game(void)
   /* Remove ALLOW_CTRL from whoever has it (gotten from 'first'). */
   conn_list_iterate(game.game_connections, pconn) {
     if (pconn->access_level == ALLOW_CTRL) {
-      notify_conn(game.game_connections, _("%s lost control cmdlevel on "
-                  "game start.  Use voting from now on."), pconn->username);
+      notify_conn(game.game_connections, NULL, E_SETTING,
+                 _("%s lost control cmdlevel on "
+                   "game start.  Use voting from now on."),
+                 pconn->username);
       pconn->access_level = ALLOW_INFO;
     }
   } conn_list_iterate_end;
@@ -848,7 +850,8 @@ void handle_report_req(struct connection
     return;
   }
 
-  notify_conn(dest, _("request for unknown report (type %d)"), type);
+  notify_conn(dest, NULL, E_BAD_COMMAND,
+             _("request for unknown report (type %d)"), type);
 }
 
 /**************************************************************************
@@ -1341,11 +1344,13 @@ void handle_player_ready(struct player *
       }
     } players_iterate_end;
     if (num_unready > 0) {
-      notify_conn(NULL, _("Waiting to start game: %d out of %d players "
-                         "are ready to start."),
+      notify_conn(NULL, NULL, E_SETTING,
+                 _("Waiting to start game: %d out of %d players "
+                   "are ready to start."),
                  num_ready, num_ready + num_unready);
     } else {
-      notify_conn(NULL, _("All players are ready; starting game."));
+      notify_conn(NULL, NULL, E_SETTING,
+                 _("All players are ready; starting game."));
       start_game();
     }
   }
@@ -1402,7 +1407,7 @@ void aifill(int amount)
            _("%s has been added as %s level AI-controlled player."),
             pplayer->name,
            name_of_skill_level(pplayer->ai.skill_level));
-    notify_conn(NULL,
+    notify_conn(NULL, NULL, E_SETTING,
                _("%s has been added as %s level AI-controlled player."),
                pplayer->name,
                name_of_skill_level(pplayer->ai.skill_level));
Index: server/stdinhand.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/server/stdinhand.c,v
retrieving revision 1.433
diff -p -u -r1.433 stdinhand.c
--- server/stdinhand.c  1 Sep 2005 02:50:24 -0000       1.433
+++ server/stdinhand.c  2 Sep 2005 03:35:10 -0000
@@ -233,14 +233,16 @@ static void check_vote(struct voting *vo
     }
     if (vote->yes > num_voters / 2) {
       /* Do it! */
-      notify_conn(NULL, _("Vote \"%s\" is passed %d to %d with %d "
-                         "abstentions."),
+      notify_conn(NULL, NULL, E_SETTING,
+                 _("Vote \"%s\" is passed %d to %d with %d "
+                   "abstentions."),
                  vote->command, vote->yes, vote->no,
                  num_voters - vote->yes - vote->no);
       handle_stdin_input((struct connection *)NULL, vote->command, FALSE);
     } else {
-      notify_conn(NULL, _("Vote \"%s\" failed with %d against, %d for "
-                         "and %d abstentions."),
+      notify_conn(NULL, NULL, E_SETTING,
+                 _("Vote \"%s\" failed with %d against, %d for "
+                   "and %d abstentions."),
                  vote->command, vote->no, vote->yes, 
                  num_voters - vote->yes - vote->no);
     }
@@ -353,7 +355,8 @@ static void cmd_reply_line(enum command_
                        "(?!?)";  /* this case is a bug! */
 
   if (caller) {
-    notify_conn(caller->self, "/%s: %s%s", cmdname, prefix, line);
+    notify_conn(caller->self, NULL, E_SETTING,
+               "/%s: %s%s", cmdname, prefix, line);
     /* cc: to the console - testing has proved it's too verbose - rp
     con_write(rfc_status, "%s/%s: %s%s", caller->name, cmdname, prefix, line);
     */
@@ -365,7 +368,8 @@ static void cmd_reply_line(enum command_
     conn_list_iterate(game.est_connections, pconn) {
       /* Do not tell caller, since he was told above! */
       if (caller != pconn) {
-        notify_conn(pconn->self, "%s", line);
+        notify_conn(pconn->self, NULL, E_SETTING,
+                   "%s", line);
       }
     } conn_list_iterate_end;
   }
@@ -503,7 +507,8 @@ static void open_metaserver_connection(s
 {
   server_open_meta();
   if (send_server_info_to_metaserver(META_INFO)) {
-    notify_conn(NULL, _("Open metaserver connection to [%s]."),
+    notify_conn(NULL, NULL, E_CONNECTION,
+               _("Open metaserver connection to [%s]."),
                meta_addr_port());
   }
 }
@@ -515,7 +520,8 @@ static void close_metaserver_connection(
 {
   if (send_server_info_to_metaserver(META_GOODBYE)) {
     server_close_meta();
-    notify_conn(NULL, _("Close metaserver connection to [%s]."),
+    notify_conn(NULL, NULL, E_CONNECTION,
+               _("Close metaserver connection to [%s]."),
                meta_addr_port());
   }
 }
@@ -579,10 +585,12 @@ static bool metapatches_command(struct c
 
   if (is_metaserver_open()) {
     send_server_info_to_metaserver(META_INFO);
-    notify_conn(NULL, _("Metaserver patches string set to '%s'."), arg);
+    notify_conn(NULL, NULL, E_SETTING,
+               _("Metaserver patches string set to '%s'."), arg);
   } else {
-    notify_conn(NULL, _("Metaserver patches string set to '%s', "
-                       "not reporting to metaserver."), arg);
+    notify_conn(NULL, NULL, E_SETTING,
+               _("Metaserver patches string set to '%s', "
+                 "not reporting to metaserver."), arg);
   }
 
   return TRUE;
@@ -600,10 +608,12 @@ static bool metatopic_command(struct con
   set_meta_topic_string(arg);
   if (is_metaserver_open()) {
     send_server_info_to_metaserver(META_INFO);
-    notify_conn(NULL, _("Metaserver topic string set to '%s'."), arg);
+    notify_conn(NULL, NULL, E_SETTING,
+               _("Metaserver topic string set to '%s'."), arg);
   } else {
-    notify_conn(NULL, _("Metaserver topic string set to '%s', "
-                          "not reporting to metaserver."), arg);
+    notify_conn(NULL, NULL, E_SETTING,
+               _("Metaserver topic string set to '%s', "
+                 "not reporting to metaserver."), arg);
   }
 
   return TRUE;
@@ -622,10 +632,12 @@ static bool metamessage_command(struct c
   set_meta_message_string(arg);
   if (is_metaserver_open()) {
     send_server_info_to_metaserver(META_INFO);
-    notify_conn(NULL, _("Metaserver message string set to '%s'."), arg);
+    notify_conn(NULL, NULL, E_SETTING,
+               _("Metaserver message string set to '%s'."), arg);
   } else {
-    notify_conn(NULL, _("Metaserver message string set to '%s', "
-                       "not reporting to metaserver."), arg);
+    notify_conn(NULL, NULL, E_SETTING,
+               _("Metaserver message string set to '%s', "
+                 "not reporting to metaserver."), arg);
   }
 
   return TRUE;
@@ -644,7 +656,7 @@ static bool metaserver_command(struct co
 
   sz_strlcpy(srvarg.metaserver_addr, arg);
 
-  notify_conn(NULL, _("Metaserver is now [%s]."),
+  notify_conn(NULL, NULL, E_SETTING, _("Metaserver is now [%s]."),
              meta_addr_port());
   return TRUE;
 }
@@ -904,7 +916,8 @@ static bool create_ai_player(struct conn
 
   game.info.nplayers++;
 
-  notify_conn(NULL, _("%s has been added as an AI-controlled player."),
+  notify_conn(NULL, NULL, E_SETTING,
+             _("%s has been added as an AI-controlled player."),
              arg);
 
   pplayer = find_player_by_name(arg);
@@ -1177,8 +1190,9 @@ void notify_if_first_access_level_is_ava
 {
   if (first_access_level > default_access_level
       && !first_access_level_is_taken()) {
-    notify_conn(NULL, _("Anyone can now become game organizer "
-                       "'%s' by issuing the 'first' command."),
+    notify_conn(NULL, NULL, E_SETTING,
+               _("Anyone can now become game organizer "
+                 "'%s' by issuing the 'first' command."),
                cmdlevel_name(first_access_level));
   }
 }
@@ -1787,21 +1801,24 @@ static bool set_away(struct connection *
     cmd_reply(CMD_AWAY, caller, C_FAIL, _("This command is client only."));
     return FALSE;
   } else if (name && strlen(name) > 0) {
-    notify_conn(caller->self, _("Usage: away"));
+    notify_conn(caller->self, NULL, E_SETTING, _("Usage: away"));
     return FALSE;
   } else if (!caller->player || caller->observer) {
     /* This happens for detached or observer connections. */
-    notify_conn(caller->self, _("Only players may use the away command."));
+    notify_conn(caller->self, NULL, E_SETTING,
+               _("Only players may use the away command."));
     return FALSE;
   } else if (!caller->player->ai.control && !check) {
-    notify_conn(game.est_connections, _("%s set to away mode."), 
+    notify_conn(game.est_connections, NULL, E_SETTING,
+               _("%s set to away mode."), 
                 caller->player->name);
     send_player_info(caller->player, NULL);
     set_ai_level_directer(caller->player, 1);
     caller->player->ai.control = TRUE;
     cancel_all_meetings(caller->player);
   } else if (!check) {
-    notify_conn(game.est_connections, _("%s returned to game."), 
+    notify_conn(game.est_connections, NULL, E_SETTING,
+               _("%s returned to game."), 
                 caller->player->name);
     caller->player->ai.control = FALSE;
     /* We have to do it, because the client doesn't display 
@@ -2267,8 +2284,9 @@ static bool debug_command(struct connect
     } players_iterate_end;
     freelog(LOG_NORMAL, "players=%d cities=%d citizens=%d units=%d",
             players, cities, citizens, units);
-    notify_conn(game.est_connections, "players=%d cities=%d citizens=%d "
-                "units=%d", players, cities, citizens, units);
+    notify_conn(game.est_connections, NULL, E_AI_DEBUG,
+               "players=%d cities=%d citizens=%d units=%d",
+               players, cities, citizens, units);
   } else if (strcmp(arg[0], "city") == 0) {
     int x, y;
     struct tile *ptile;
@@ -2499,7 +2517,7 @@ static bool set_command(struct connectio
   }
 
   if (!check && strlen(buffer) > 0 && sset_is_to_client(cmd)) {
-    notify_conn(NULL, "%s", buffer);
+    notify_conn(NULL, NULL, E_SETTING, "%s", buffer);
   }
 
   if (!check && do_update) {
@@ -2858,7 +2876,8 @@ static bool take_command(struct connecti
        send_rulesets(aconn->self);
        send_server_settings(aconn->self);
       }
-      notify_conn(aconn->self, _("being detached from %s."), pplayer->name);
+      notify_conn(aconn->self, NULL, E_CONNECTION,
+                 _("being detached from %s."), pplayer->name);
       unattach_connection_from_player(aconn);
       send_conn_info(aconn->self, game.est_connections);
     }
@@ -3018,7 +3037,8 @@ static bool detach_command(struct connec
       if (aconn->observer) {
         unattach_connection_from_player(aconn);
         send_conn_info(aconn->self, game.est_connections);
-        notify_conn(aconn->self, _("detaching from %s."), pplayer->name);
+        notify_conn(aconn->self, NULL, E_CONNECTION,
+                   _("detaching from %s."), pplayer->name);
       }
     } conn_list_iterate_end;
 
@@ -3335,7 +3355,8 @@ bool handle_stdin_input(struct connectio
     /* Check if the vote command would succeed. */
     if (handle_stdin_input(caller, full_command, TRUE)) {
       last_vote++;
-      notify_conn(NULL, _("New vote (number %d) by %s: %s."), last_vote, 
+      notify_conn(NULL, NULL, E_SETTING,
+                 _("New vote (number %d) by %s: %s."), last_vote, 
                  caller->player->name, full_command);
       sz_strlcpy(votes[idx].command, full_command);
       votes[idx].vote_no = last_vote;
@@ -3378,7 +3399,7 @@ bool handle_stdin_input(struct connectio
      * use command,arg instead of str because of the trailing
      * newline in str when it comes from the server command line
      */
-    notify_conn(NULL, "%s: '%s %s'",
+    notify_conn(NULL, NULL, E_SETTING, "%s: '%s %s'",
       caller ? caller->username : _("(server prompt)"), command, arg);
   }
 

[Prev in Thread] Current Thread [Next in Thread]
  • [Freeciv-Dev] (PR#13834) remove notify_conn, Jason Short <=