本文整理汇总了Java中org.kontalk.crypto.Coder.Error方法的典型用法代码示例。如果您正苦于以下问题:Java Coder.Error方法的具体用法?Java Coder.Error怎么用?Java Coder.Error使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.kontalk.crypto.Coder
的用法示例。
在下文中一共展示了Coder.Error方法的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: showSecurityErrors
import org.kontalk.crypto.Coder; //导入方法依赖的package包/类
void showSecurityErrors(KonMessage message) {
//TODO too intrusive for user, but use the explanation for message view
if (true) return;
String errorText = "<html>";
boolean isOut = !message.isInMessage();
errorText += isOut ? Tr.tr("Encryption error") : Tr.tr("Decryption error");
errorText += ":";
for (Coder.Error error : message.getCoderStatus().getErrors()) {
errorText += "<br>";
switch (error) {
case UNKNOWN_ERROR:
errorText += Tr.tr("Unknown error");
break;
case KEY_UNAVAILABLE:
errorText += Tr.tr("Public key for receiver not found.");
break;
case INVALID_PRIVATE_KEY:
errorText += Tr.tr("This message was encrypted with an old or invalid public key");
break;
default:
errorText += Tr.tr("Unusual coder error")+": " + error.toString();
}
}
errorText += "</html>";
NotificationManager.showNotification(mWindow, errorText);
}
示例2: setSecurityErrors
import org.kontalk.crypto.Coder; //导入方法依赖的package包/类
public void setSecurityErrors(EnumSet<Coder.Error> errors) {
if (mCoderStatus.getErrors().equals(errors))
return;
mCoderStatus.setSecurityErrors(errors);
this.save();
this.changed(ViewChange.STATUS);
}
示例3: CoderStatus
import org.kontalk.crypto.Coder; //导入方法依赖的package包/类
public CoderStatus(Coder.Encryption encryption,
Coder.Signing signing,
EnumSet<Coder.Error> errors) {
this.mEncryption = encryption;
this.mSigning = signing;
this.mErrors = errors;
}
示例4: fromJSON
import org.kontalk.crypto.Coder; //导入方法依赖的package包/类
private static InAttachment fromJSON(Map<?, ?> map) {
URI url = URI.create(EncodingUtils.getJSONString(map, JSON_URL));
String filename = EncodingUtils.getJSONString(map, JSON_FILENAME);
Number enc = (Number) map.get(JSON_ENCRYPTION);
Coder.Encryption encryption = Coder.Encryption.values()[enc.intValue()];
Number sig = (Number) map.get(JSON_SIGNING);
Coder.Signing signing = Coder.Signing.values()[sig.intValue()];
Number err = ((Number) map.get(JSON_CODER_ERRORS));
EnumSet<Coder.Error> errors = EncodingUtils.intToEnumSet(Coder.Error.class, err.intValue());
return new InAttachment(url, filename, new CoderStatus(encryption, signing, errors));
}
示例5: onEncryptionErrors
import org.kontalk.crypto.Coder; //导入方法依赖的package包/类
public void onEncryptionErrors(KonMessage message, Contact contact) {
EnumSet<Coder.Error> errors = message.getCoderStatus().getErrors();
if (errors.contains(Coder.Error.KEY_UNAVAILABLE) ||
errors.contains(Coder.Error.INVALID_SIGNATURE) ||
errors.contains(Coder.Error.INVALID_SENDER)) {
// maybe there is something wrong with the senders key
this.sendKeyRequest(contact);
}
this.onSecurityErrors(message);
}
示例6: load
import org.kontalk.crypto.Coder; //导入方法依赖的package包/类
public static KonMessage load(ResultSet messageRS, Chat chat,
Map<Integer, Contact> contactMap) throws SQLException {
int id = messageRS.getInt("_id");
String xmppID = Database.getString(messageRS, KonMessage.COL_XMPP_ID);
Date date = new Date(messageRS.getLong(KonMessage.COL_DATE));
int statusIndex = messageRS.getInt(KonMessage.COL_STATUS);
KonMessage.Status status = KonMessage.Status.values()[statusIndex];
String jsonContent = messageRS.getString(KonMessage.COL_CONTENT);
MessageContent content = MessageContent.fromJSONString(jsonContent);
int encryptionIndex = messageRS.getInt(KonMessage.COL_ENCR_STAT);
Coder.Encryption encryption = Coder.Encryption.values()[encryptionIndex];
int signingIndex = messageRS.getInt(KonMessage.COL_SIGN_STAT);
Coder.Signing signing = Coder.Signing.values()[signingIndex];
int errorFlags = messageRS.getInt(KonMessage.COL_COD_ERR);
EnumSet<Coder.Error> coderErrors = EncodingUtils.intToEnumSet(
Coder.Error.class, errorFlags);
CoderStatus coderStatus = new CoderStatus(encryption, signing, coderErrors);
String jsonServerError = messageRS.getString(KonMessage.COL_SERV_ERR);
KonMessage.ServerError serverError =
KonMessage.ServerError.fromJSON(jsonServerError);
long sDate = messageRS.getLong(KonMessage.COL_SERV_DATE);
Date serverDate = sDate == 0 ? null : new Date(sDate);
KonMessage.Builder builder = new KonMessage.Builder(id, chat, status, date, content);
builder.transmissions(Transmission.load(id, contactMap));
builder.xmppID(xmppID);
if (serverDate != null)
builder.serverDate(serverDate);
builder.coderStatus(coderStatus);
builder.serverError(serverError);
return builder.build();
}
示例7: getErrors
import org.kontalk.crypto.Coder; //导入方法依赖的package包/类
public EnumSet<Coder.Error> getErrors() {
// better return a copy
return mErrors.clone();
}
示例8: setSecurityErrors
import org.kontalk.crypto.Coder; //导入方法依赖的package包/类
public void setSecurityErrors(EnumSet<Coder.Error> errors) {
mErrors.clear();
mErrors.addAll(errors);
}
示例9: setSecurityErrors
import org.kontalk.crypto.Coder; //导入方法依赖的package包/类
@Override
public void setSecurityErrors(EnumSet<Coder.Error> errors) {
mCoderStatus.setSecurityErrors(errors);
}
示例10: setErrors
import org.kontalk.crypto.Coder; //导入方法依赖的package包/类
public void setErrors(EnumSet<Coder.Error> errors) {
mCoderStatus.setSecurityErrors(errors);
}
示例11: setSecurityErrors
import org.kontalk.crypto.Coder; //导入方法依赖的package包/类
void setSecurityErrors(EnumSet<Coder.Error> errors);