Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Added experimental support for local avatars.

Put png files in data/local_avatars rather than load them from a
web service.
  • Loading branch information...
commit 478f1cafc7a6345fdcbb29d46cdf0a2e2b5806a2 1 parent 7ab9e9b
@fbk-zz fbk-zz authored committed
View
8 COPYING
@@ -1,3 +1,11 @@
+The code in this project is licensed under the GPLv3, reproduced below unless
+otherwise specified, e.g. Pair.java which is released by Sun under the GPLv2
+only.
+
+The image: data/local_avatars/default.png is copyright by Everaldo Coelho
+and is part of his Crystal icon set, and is licensed under the LGPL.
+
+
GNU GENERAL PUBLIC LICENSE
Version 3, 29 June 2007
View
7 bin/config.template
@@ -33,3 +33,10 @@ IsInputSorted=true
# Uncomment to not use avatars
#AvatarFetcher=NoAvatar
+
+# To use local avatars, uncomment this line:
+#AvatarFetcher=LocalAvatar
+
+# then place png files named after the usernames of committers in
+# the data/local_avatars directory
+# data/local_avatars/default.png is used by default
View
BIN  data/local_avatars/default.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View
4 defaults/code_swarm.config
@@ -111,3 +111,7 @@ GravatarFallback=identicon
#Size in pixels of the width and height of avatar images
AvatarSize=40
+
+# Used by the LocalAvatar fetcher
+LocalAvatarDirectory=data/local_avatars/
+LocalAvatarDefaultPic=default.png
View
21 src/LocalAvatar.java
@@ -0,0 +1,21 @@
+import java.io.File;
+
+public class LocalAvatar extends AvatarFetcher {
+ public String dir = "";
+ public String empty_pic = null;
+
+ public LocalAvatar(CodeSwarmConfig cfg) {
+ super(cfg);
+ dir = cfg.getStringProperty("LocalAvatarDirectory");
+ empty_pic = cfg.getStringProperty("LocalAvatarDefaultPic");
+ }
+
+ public String fetchUserImage(String username) {
+ String filename = dir+username+".png";
+ File f = new File(filename);
+ if(f.exists()) return filename;
+ return dir+empty_pic;
+ }
+
+
+}
Please sign in to comment.
Something went wrong with that request. Please try again.