package ui0; import android.database.Cursor; import com.tencent.mm.app.y0; import com.tencent.mm.modelavatar.u; import com.tencent.mm.pointers.PBool; import com.tencent.mm.sdk.platformtools.Log; import com.tencent.mm.sdk.platformtools.Util; import com.tencent.mm.storage.f4; import com.tencent.mm.storage.g4; import com.tencent.mm.storage.h2; import com.tencent.mm.storage.i2; import com.tencent.mm.storage.z1; import ek4.d0; import java.net.URLDecoder; import java.util.ArrayList; import java.util.List; import jh2.k0; import kh4.l; import lh4.m; import lh4.o; import mi.j7; import sb0.d; import si0.f; import si0.g; import si0.h; import si0.p; import si0.q; import ti0.k; import ti0.n; import ti0.r; import ti0.x; import ti0.z; import wg4.b0; import yz3.e; import yz3.j; import zg0.f0; import zg0.g0; @zz3.b(onProcess = {y0.MATCH_MM}) public final class n0 extends e implements h { public static final class a implements h.a { /* renamed from: a reason: collision with root package name */ public final /* synthetic */ p f318362a; /* renamed from: b reason: collision with root package name */ public final /* synthetic */ h.a f318363b; public a(p pVar, h.a aVar) { this.f318362a = pVar; this.f318363b = aVar; } @Override // si0.h.a public void a(q qVar) { f fVar; String str = null; if (qVar != null) { fVar = qVar.f301755d; } else { fVar = null; } Object[] objArr = new Object[3]; p pVar = this.f318362a; objArr[0] = pVar.f301746c; objArr[1] = pVar.f301745b; if (fVar != null) { str = fVar.U1(); } objArr[2] = str; Log.i("MicroMsg.OpenIMKefuService", "alvinluo fetchContact username: %s, url: %s, contact: %s", objArr); h.a aVar = this.f318363b; if (aVar != null) { aVar.a(qVar); } } @Override // si0.h.a public void b(String str) { Log.i("MicroMsg.OpenIMKefuService", "alvinluo fetchContact onTryFetch: %s", str); h.a aVar = this.f318363b; if (aVar != null) { aVar.b(str); } } } public static final class b extends o implements l<String, b0> { /* renamed from: d reason: collision with root package name */ public final /* synthetic */ String f318364d; /* renamed from: e reason: collision with root package name */ public final /* synthetic */ n0 f318365e; /* JADX INFO: super call moved to the top of the method (can break code semantics) */ public b(String str, n0 n0Var) { super(1); this.f318364d = str; this.f318365e = n0Var; } /* Return type fixed from 'java.lang.Object' to match base method */ /* JADX DEBUG: Method arguments types fixed to match base method, original types: [java.lang.Object] */ @Override // kh4.l public b0 invoke(String str) { boolean z15; String str2 = str; if (str2 == null || str2.length() == 0) { z15 = true; } else { z15 = false; } if (z15) { Log.e("MicroMsg.OpenIMKefuService", "alvinluo sendOpenImKfCard getShareCardContent failed"); } else { List<String> X = d0.X(this.f318364d, new String[]{","}, false, 0, 6, null); n0 n0Var = this.f318365e; for (String str3 : X) { n0Var.VN0(str3, str2); } } return b0.f332794a; } } @Override // si0.h public void Bf0() { ti0.q qVar = ti0.q.f312146a; r YN0 = ((ri0.b) j.c(ri0.b.class)).YN0(); if (YN0 != null) { YN0.f312152d.delete("OpenIMKefuContact", "", new String[0]); } ((d) ti0.q.f312148c.f312131a).clear(); ((d) ti0.q.f312149d).clear(); } @Override // si0.h public void D30(si0.r rVar) { m.g(rVar, "request"); z zVar = z.f312171d; rVar.f301759b = 1; z.f312171d.d(rVar); } @Override // si0.h public void F(String str) { boolean z15; Long l15; boolean z16; if (str == null || str.length() == 0) { z15 = true; } else { z15 = false; } if (!z15 && z1.y5(str)) { z zVar = z.f312171d; k b15 = ti0.q.b(str); if (!(b15 == null || b15.Z == 0)) { String str2 = b15.field_username; if (str2 == null || str2.length() == 0) { z16 = true; } else { z16 = false; } if (!z16) { b15.field_type &= -513; ti0.q.c(b15); ((g) j.c(g.class)).F(str); return; } } Object[] objArr = new Object[2]; objArr[0] = str; if (b15 != null) { l15 = Long.valueOf(b15.Z); } else { l15 = null; } objArr[1] = l15; Log.e("MicroMsg.OpenIMKefuService", "alvinluo unSetMute contact invalid username: %s, contactId: %s", objArr); } } @Override // si0.h public void G(String str) { boolean z15; Long l15; boolean z16; if (str == null || str.length() == 0) { z15 = true; } else { z15 = false; } if (!z15 && z1.y5(str)) { z zVar = z.f312171d; k b15 = ti0.q.b(str); if (!(b15 == null || b15.Z == 0)) { String str2 = b15.field_username; if (str2 == null || str2.length() == 0) { z16 = true; } else { z16 = false; } if (!z16) { b15.field_type |= 512; ti0.q.c(b15); ((g) j.c(g.class)).G(str); return; } } Object[] objArr = new Object[2]; objArr[0] = str; if (b15 != null) { l15 = Long.valueOf(b15.Z); } else { l15 = null; } objArr[1] = l15; Log.e("MicroMsg.OpenIMKefuService", "alvinluo setMute contact invalid username: %s, contactId: %s", objArr); } } @Override // si0.h public void Tw() { z zVar = z.f312171d; d60.z.d().a(4010, zVar); d60.z.d().a(6849, zVar); d60.z.d().a(5997, zVar); } public void VN0(String str, String str2) { String str3; if (str2 != null) { String decode = URLDecoder.decode(str2, "UTF-8"); if (str == null) { str3 = ""; } else { str3 = str; } if (g0.a(str3)) { f0.f c15 = f0.c(str, null, 2, null); c15.g(decode); c15.l(67); c15.f352546e = 1; f0.f.e(c15, null, 1, null); return; } f0.f c16 = f0.c(str, null, 2, null); c16.k(str); c16.g(decode); c16.l(67); c16.f352546e = 1; c16.f352549h = 5; c16.a().a(); } } @Override // si0.h public void XQ(String str, h.a aVar) { p pVar = new p(0, str, null); pVar.f301747d = true; z.a(pVar, aVar); } @Override // si0.h public n aq(String str) { return ti0.q.a(str); } @Override // si0.h public j7 dy(String str) { z zVar = z.f312171d; return ti0.q.b(str); } @Override // si0.h public void ek0(String str) { boolean z15; if (str == null) { str = ""; } x xVar = x.f312164a; h2 d15 = xVar.d(); if (d15 != null) { if (!str.equals(d15.getUsername())) { Log.i("MicroMsg.OpenIMKefuConversationLogic", "alvinluo updateOpenImKfServiceConversation %s not the last conversation and ignore", str); return; } h2 j15 = ((i2) ((k0) d60.z.q(k0.class)).SM()).j("opencustomerservicemsg"); f4 GY = ((g4) ((k0) d60.z.q(k0.class)).WU()).GY(d15.getUsername()); if (GY != null) { if (GY.getMsgId() > 0) { z15 = true; if (z15 && j15 != null) { Log.i("MicroMsg.OpenIMKefuConversationLogic", "alvinluo updateOpenImKfServiceConversation username: %s, lastMsg talker: %s", str, GY.i()); String username = j15.getUsername(); m.f(username, "parentConv.username"); xVar.b(username, GY, j15); ((i2) ((k0) d60.z.q(k0.class)).SM()).l0(j15, "opencustomerservicemsg"); return; } } } z15 = false; if (z15) { } } } @Override // si0.h public void gr(p pVar, h.a aVar) { if (pVar != null) { z.b(pVar, new a(pVar, aVar)); } } @Override // si0.h public void l() { z zVar = z.f312171d; d60.z.d().p(4010, zVar); d60.z.d().p(6849, zVar); d60.z.d().p(5997, zVar); } @Override // si0.h public void oD0(String str, h.b bVar) { z zVar = z.f312171d; Log.i("MicroMsg.OpenIMKefuGetContactService", "alvinluo closeContact username: " + str); if (str == null) { str = ""; } si0.r rVar = new si0.r(str); rVar.f301759b = 2; rVar.f301761d = bVar; z.f312171d.d(rVar); } @Override // si0.h public boolean s() { Cursor I = ((i2) ((k0) d60.z.q(k0.class)).SM()).I(6, new ArrayList(), "opencustomerservicemsg", 1); if (I == null || I.getCount() <= 0) { return false; } return true; } @Override // si0.h public boolean sd0(z1 z1Var) { if (z1Var == null) { return false; } ti0.q qVar = ti0.q.f312146a; if (Util.nowSecond() - ((long) z1Var.T0) > gj0.b.f220869a) { return true; } return false; } @Override // si0.h public void tq0(h2 h2Var) { h2 j15 = ((i2) ((k0) d60.z.q(k0.class)).SM()).j("opencustomerservicemsg"); if (j15 == null) { Log.i("MicroMsg.OpenIMKefuConversationLogic", "create openim kefu service conversation"); h2 h2Var2 = new h2("opencustomerservicemsg"); h2Var2.s3(); x.f312164a.c(h2Var, h2Var2); ((i2) ((k0) d60.z.q(k0.class)).SM()).W(h2Var2); return; } Log.i("MicroMsg.OpenIMKefuConversationLogic", "openim kefu service conversation has created"); j15.i3(null); x.f312164a.c(h2Var, j15); ((i2) ((k0) d60.z.q(k0.class)).SM()).l0(j15, "opencustomerservicemsg"); } @Override // si0.h public boolean uu(String str, String str2) { boolean z15 = true; Log.i("MicroMsg.OpenIMKefuService", "alvinluo sendOpenImkfCard toUsername: %s, cardSendingUsername: %s", str, str2); if (!(str == null || str.length() == 0)) { if (!(str2 == null || str2.length() == 0)) { z15 = false; } if (!z15) { b bVar = new b(str, this); m.g(str2, "toSendUsername"); p pVar = new p(0, str2, null); pVar.f301747d = false; PBool pBool = new PBool(); ((h) j.c(h.class)).wC0(pVar, new ti0.m(pBool, bVar, "<msg bigheadimgurl=\"%s\" smallheadimgurl=\"%s\" username=\"%s\" nickname=\"%s\" openimappid=\"%s\" openimdesc=\"%s\" openimdescicon=\"%s\"/>", str2)); return pBool.value; } } return false; } @Override // si0.h public void wC0(p pVar, h.a aVar) { z.a(pVar, aVar); } @Override // si0.h public void zD(String str, boolean z15) { Object[] objArr; int i15; Log.i("MicroMsg.OpenIMKefuService", "alvinluo testNameCard %s", str); if (str == null || str.length() == 0) { objArr = 1; } else { objArr = null; } if (objArr == null) { f4 f4Var = new f4(); f4Var.i3(str); f4Var.Z2(!z15 ? 1 : 0); if (z15) { i15 = 3; } else { i15 = 2; } f4Var.c(i15); f4Var.setType(67); f4Var.S2(nf0.f4.p()); f4Var.R2("<msg" + " username=" + "\"25984993900277866@kefu.openim\"" + " nickname=" + "\"测试用客服\"" + " sex=" + "\"1\"" + " bigheadimgurl=" + "\"https://wwcdn.weixin.qq.com/node/wework/images/avatar4.c4b5b964d6.png\"" + " smallheadimgurl=" + "\"https://wwcdn.weixin.qq.com/node/wework/images/avatar4.c4b5b964d6.png\"" + " openimappid=" + "\"3552365301\"" + " openimdesc=" + "\"腾讯\"" + " openimdescicon=" + "\"https://wwcdn.weixin.qq.com/node/wework/images/uncert21.png\"" + " ticket=" + "\"test_ticket\"" + " />"); Log.i("MicroMsg.OpenIMKefuService", "alvinluo testNameCard xml: %s", f4Var.getContent()); if (z15) { nf0.f4.x(f4Var); } else { VN0(str, f4Var.getContent()); } com.tencent.mm.modelavatar.n nVar = new com.tencent.mm.modelavatar.n(); nVar.f78487a = "25984993900277866@kefu.openim"; nVar.f78488b = 3; nVar.f78492f = 1; nVar.f78491e = "https://wwcdn.weixin.qq.com/node/wework/images/avatar4.c4b5b964d6.png"; nVar.f78490d = "https://wwcdn.weixin.qq.com/node/wework/images/avatar4.c4b5b964d6.png"; nVar.f78495i = -1; u.ZN0().sb(nVar); } } }