aboutsummaryrefslogtreecommitdiffstats
path: root/src/eu/siacs/conversations/xmpp/pep/Avatar.java
blob: 196c876c74ead75605a3f40ac09da655bd4344d5 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
package eu.siacs.conversations.xmpp.pep;

import android.util.Base64;

public class Avatar {
	public String type;
	public String sha1sum;
	public String image;
	public byte[] getImageAsBytes() {
		return Base64.decode(image, Base64.DEFAULT);
	}
	public String getFilename() {
		if (type==null) {
			return sha1sum;
		} else if (type.equalsIgnoreCase("image/webp")) {
			return sha1sum+".webp";
		} else if (type.equalsIgnoreCase("image/png")) {
			return sha1sum+".png";
		} else {
			return sha1sum;
		}
	}
}