Changeset 2023

Show
Ignore:
Timestamp:
02/13/2010 10:31:27 AM (6 months ago)
Author:
djb61
Message:

Fix the reporting of position 1 for all users/groups involved in a race. Additionally add a mechanism to allow configuring of the maximum number of users/groups to include in a race complete announce. These fixes have been applied to both sfv and diz based race announces.
See: #267

Location:
trunk/src/plugins
Files:
5 added
2 modified

Legend:

Unmodified
Added
Removed
  • trunk/src/plugins/org.drftpd.plugins.sitebot.announce.zipscript.zip/src/org/drftpd/plugins/sitebot/announce/zipscript/zip/ZipAnnouncer.java

    r1945 r2023  
    192192                                        sayOutput(ReplacerUtils.jprintf(_keyPrefix+".store.complete", env, _bundle), writer); 
    193193 
     194                                        // Find max users/groups to announce 
     195                                        int maxUsers; 
     196                                        int maxGroups; 
     197                                        try { 
     198                                                maxUsers = Integer.valueOf(GlobalContext.getGlobalContext().getPluginsConfig(). 
     199                                                                getPropertiesForPlugin("zipscript.conf").getProperty("irc.zip.maxusers", "10")); 
     200                                        } catch (NumberFormatException e) { 
     201                                                logger.error("Non numeric irc.zip.maxusers setting in zipscript.conf, using default"); 
     202                                                maxUsers = 10; 
     203                                        } 
     204                                        try { 
     205                                                maxGroups = Integer.valueOf(GlobalContext.getGlobalContext().getPluginsConfig(). 
     206                                                                getPropertiesForPlugin("zipscript.conf").getProperty("irc.zip.maxgroups", "10")); 
     207                                        } catch (NumberFormatException e) { 
     208                                                logger.error("Non numeric irc.zip.maxgroups setting in zipscript.conf, using default"); 
     209                                                maxGroups = 10; 
     210                                        } 
     211 
    194212                                        // Add racer stats 
    195213                                        int position = 1; 
     
    245263                                                                                raceuser, GlobalContext.getGlobalContext().getUserManager()))); 
    246264                                                sayOutput(ReplacerUtils.jprintf(_keyPrefix+".store.complete.racer", raceenv, _bundle), writer); 
     265 
     266                                                position++; 
     267                                                if (position > maxUsers) { 
     268                                                        break; 
     269                                                } 
    247270                                        } 
    248271 
     
    265288 
    266289                                                sayOutput(ReplacerUtils.jprintf(_keyPrefix+".store.complete.group", raceenv, _bundle), writer); 
     290 
     291                                                position++; 
     292                                                if (position > maxGroups) { 
     293                                                        break; 
     294                                                } 
    267295                                        } 
    268296                                } 
  • trunk/src/plugins/org.drftpd.plugins.sitebot.announce.zipscript/src/org/drftpd/plugins/sitebot/announce/zipscript/SFVAnnouncer.java

    r1927 r2023  
    197197                                        sayOutput(ReplacerUtils.jprintf(_keyPrefix+".store.complete", env, _bundle), writer); 
    198198 
     199                                        // Find max users/groups to announce 
     200                                        int maxUsers; 
     201                                        int maxGroups; 
     202                                        try { 
     203                                                maxUsers = Integer.valueOf(GlobalContext.getGlobalContext().getPluginsConfig(). 
     204                                                                getPropertiesForPlugin("zipscript.conf").getProperty("irc.sfv.maxusers", "10")); 
     205                                        } catch (NumberFormatException e) { 
     206                                                logger.error("Non numeric irc.sfv.maxusers setting in zipscript.conf, using default"); 
     207                                                maxUsers = 10; 
     208                                        } 
     209                                        try { 
     210                                                maxGroups = Integer.valueOf(GlobalContext.getGlobalContext().getPluginsConfig(). 
     211                                                                getPropertiesForPlugin("zipscript.conf").getProperty("irc.sfv.maxgroups", "10")); 
     212                                        } catch (NumberFormatException e) { 
     213                                                logger.error("Non numeric irc.sfv.maxgroups setting in zipscript.conf, using default"); 
     214                                                maxGroups = 10; 
     215                                        } 
     216                                         
    199217                                        // Add racer stats 
    200218                                        int position = 1; 
     
    250268                                                                                raceuser, GlobalContext.getGlobalContext().getUserManager()))); 
    251269                                                sayOutput(ReplacerUtils.jprintf(_keyPrefix+".store.complete.racer", raceenv, _bundle), writer); 
     270                                                 
     271                                                position++; 
     272                                                if (position > maxUsers) { 
     273                                                        break; 
     274                                                } 
    252275                                        } 
    253276 
     
    270293 
    271294                                                sayOutput(ReplacerUtils.jprintf(_keyPrefix+".store.complete.group", raceenv, _bundle), writer); 
     295                                                 
     296                                                position++; 
     297                                                if (position > maxGroups) { 
     298                                                        break; 
     299                                                } 
    272300                                        } 
    273301                                }