Skip to content

Commit 6c129a6

Browse files
committed
1 解决冲突
1 parent 1bf44c7 commit 6c129a6

File tree

5 files changed

+38
-99
lines changed

5 files changed

+38
-99
lines changed

wechaty/src/main/kotlin/io/github/wechaty/Wechaty.kt

Lines changed: 20 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ class Wechaty private constructor(private var wechatyOptions: WechatyOptions) :
4444
val roomInvitationManager = RoomInvitationManager(this)
4545
val imageManager = ImageManager(this)
4646

47-
val friendShipManager = FriendShipManager(this)
47+
val friendShipManager = FriendshipManager(this)
4848
init {
4949
if (wechatyOptions.memory == null) {
5050
this.memory = MemoryCard(wechatyOptions.name)
@@ -121,11 +121,6 @@ class Wechaty private constructor(private var wechatyOptions: WechatyOptions) :
121121
return wechatyOptions.name
122122
}
123123

124-
fun say(something: Any): Future<Void> {
125-
val msgId: String?
126-
this.userSelf().say(something)
127-
return CompletableFuture.completedFuture(null)
128-
}
129124
fun onLogin(listener: LoginListener):Wechaty{
130125
return on(EventEnum.LOGIN,listener)
131126
}
@@ -512,25 +507,25 @@ class Wechaty private constructor(private var wechatyOptions: WechatyOptions) :
512507
}, "StartMain-shutdown-hook"))
513508
}
514509

515-
override fun toString(): String {
516-
if (this.wechatyOptions == null) {
517-
return "default"
518-
}
519-
val first = if (this.wechatyOptions != null && this.puppet != null) {
520-
this.wechatyOptions.puppet
521-
}
522-
else {
523-
"puppet"
524-
}
525-
526-
val second = if (this.memory != null) {
527-
this.memory!!.getName()
528-
}
529-
else {
530-
"default"
531-
}
532-
return "Wechaty#<${first}><${second}>"
533-
}
510+
// override fun toString(): String {
511+
// if (this.wechatyOptions == null) {
512+
// return "default"
513+
// }
514+
// val first = if (this.wechatyOptions != null && this.puppet != null) {
515+
// this.wechatyOptions.puppet
516+
// }
517+
// else {
518+
// "puppet"
519+
// }
520+
//
521+
// val second = if (this.memory != null) {
522+
// this.memory!!.getName()
523+
// }
524+
// else {
525+
// "default"
526+
// }
527+
// return "Wechaty#<${first}><${second}>"
528+
// }
534529
}
535530

536531

wechaty/src/main/kotlin/io/github/wechaty/user/Contact.kt

Lines changed: 1 addition & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -94,38 +94,18 @@ open class Contact(wechaty: Wechaty,val id:String) : Sayable, Accessory(wechaty)
9494
return (payload != null && StringUtils.isNotEmpty(payload!!.name))
9595
}
9696

97-
fun friend(): Boolean {
98-
return payload?.friend ?: false
99-
}
100-
10197
fun name():String {
10298
return payload?.name ?: ""
10399
}
104100

105-
fun type(): ContactType {
106-
return payload?.type ?: ContactType.Unknown
107-
}
108-
109-
fun gender(): ContactGender {
110-
return payload?.gender ?: ContactGender.Unknown
111-
}
112-
113101
fun address(): String {
114102
return this.payload?.address ?: ""
115103
}
116104

117-
fun province(): String {
118-
return this.payload?.province ?: ""
119-
}
120-
121105
fun signature(): String {
122106
return this.payload?.signature ?: ""
123107
}
124108

125-
fun city(): String {
126-
return this.payload?.city ?: ""
127-
}
128-
129109
fun star(): Boolean {
130110
return this.payload?.star ?: false
131111
}
@@ -134,12 +114,6 @@ open class Contact(wechaty: Wechaty,val id:String) : Sayable, Accessory(wechaty)
134114
return this.payload?.weixin ?: ""
135115
}
136116

137-
fun self(): Boolean {
138-
val userId = this.puppet.selfId() ?: return false
139-
140-
return this.id === userId
141-
}
142-
143117
fun setAlias(newAlias:String){
144118
if(payload == null){
145119
throw Exception("no payload")
@@ -208,7 +182,7 @@ open class Contact(wechaty: Wechaty,val id:String) : Sayable, Accessory(wechaty)
208182
}
209183
}
210184

211-
fun self():Boolean{
185+
fun self():Boolean {
212186
val userId = puppet.selfId()
213187
if(StringUtils.isEmpty(userId)){
214188
return false

wechaty/src/main/kotlin/io/github/wechaty/user/ContactSelf.kt

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -67,22 +67,22 @@ class ContactSelf(wechaty: Wechaty, id: String) : Contact(wechaty, id) {
6767
return null
6868
}
6969

70-
fun signature (signature: String): Future<Void> {
71-
log.debug("ContactSelf, signature()")
72-
73-
val puppetId = try {
74-
this.puppet.selfId()
75-
}
76-
catch (e: Exception) {
77-
throw Exception("Can not get qrcode, user might be either not logged in or already logged out")
78-
}
79-
80-
if (this.id !== puppetId) {
81-
throw Exception("only can get qrcode for the login userself")
82-
}
83-
// maybe
84-
return this.puppet.contactSelfSignature(signature)
85-
}
70+
// fun signature (signature: String): Future<Void> {
71+
// log.debug("ContactSelf, signature()")
72+
//
73+
// val puppetId = try {
74+
// this.puppet.selfId()
75+
// }
76+
// catch (e: Exception) {
77+
// throw Exception("Can not get qrcode, user might be either not logged in or already logged out")
78+
// }
79+
//
80+
// if (this.id !== puppetId) {
81+
// throw Exception("only can get qrcode for the login userself")
82+
// }
83+
// // maybe
84+
// return this.puppet.contactSelfSignature(signature)
85+
// }
8686

8787
companion object {
8888
private val log = LoggerFactory.getLogger(ContactSelf::class.java)

wechaty/src/main/kotlin/io/github/wechaty/user/Friendship.kt

Lines changed: 1 addition & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -14,11 +14,6 @@ class Friendship (wechaty: Wechaty,val id:String):Accessory(wechaty){
1414

1515
private var payload:FriendshipPayload? = null
1616

17-
fun load(id:String):Friendship {
18-
this.id = id
19-
return this
20-
}
21-
2217
fun search(queryFilter: FriendshipSearchCondition):Contact?{
2318
val contactId = wechaty.getPuppet().friendshipSearch(queryFilter).get();
2419
if(StringUtils.isEmpty(contactId)){
@@ -29,20 +24,12 @@ class Friendship (wechaty: Wechaty,val id:String):Accessory(wechaty){
2924
return contact
3025
}
3126

32-
fun hello(): String {
33-
if (this.payload == null) {
34-
throw Exception("no payload")
35-
}
36-
37-
return this.payload!!.hello ?: ""
38-
}
39-
4027
// 这个应该是静态方法吧
4128
fun add(contact: Contact, hello:String){
4229
log.debug("add contact: {} hello: {}",contact,hello)
4330
wechaty.getPuppet().friendshipAdd(contact.id!!,hello).get()
4431
}
45-
32+
4633
fun isReady():Boolean{
4734
return payload != null
4835
}

wechaty/src/main/kotlin/io/github/wechaty/user/Room.kt

Lines changed: 0 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -404,23 +404,6 @@ class Room(wechaty: Wechaty, val id: String) : Accessory(wechaty), Sayable {
404404
return roomMemberPayload?.roomAlias
405405
}
406406

407-
408-
fun owner(): Contact? {
409-
log.debug("Room, owner()")
410-
val ownerId = if (this.payload != null && this.payload!!.ownerId != null) {
411-
this.payload?.ownerId
412-
}
413-
else {
414-
return null
415-
}
416-
return ownerId?.let { wechaty.contactManager.load(it) }
417-
}
418-
419-
fun avatar(): Future<FileBox> {
420-
log.debug("Room, acatar()")
421-
return this.puppet.roomAvatar(this.id)
422-
}
423-
424407
fun has(contact: Contact): Boolean {
425408
val memberIdList = puppet.roomMemberList(id).get()
426409
if (memberIdList.isEmpty()) {

0 commit comments

Comments
 (0)