From 9b129ab0ecb30b839595d53e53051befc40c400a Mon Sep 17 00:00:00 2001 From: withchao <993506633@qq.com> Date: Thu, 11 Jan 2024 11:45:27 +0800 Subject: [PATCH 1/4] fix: GroupApplicationAcceptedNotification --- internal/group/notification.go | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/internal/group/notification.go b/internal/group/notification.go index 7ffa00eef..57e805bd5 100644 --- a/internal/group/notification.go +++ b/internal/group/notification.go @@ -66,13 +66,10 @@ func (g *Group) doNotification(ctx context.Context, msg *sdkws.MsgData) error { if err := utils.UnmarshalNotificationElem(msg.Content, &detail); err != nil { return err } - if detail.OpUser.UserID == g.loginUserID { + if msg.SendID == g.loginUserID { return g.SyncAdminGroupApplications(ctx, detail.Group.GroupID) } - if detail.ReceiverAs == 1 { - return g.SyncAdminGroupApplications(ctx, detail.Group.GroupID) - } - return g.SyncGroups(ctx, detail.Group.GroupID) + return g.SyncAllSelfGroupApplication(ctx) case constant.GroupApplicationRejectedNotification: // 1506 var detail sdkws.GroupApplicationRejectedTips if err := utils.UnmarshalNotificationElem(msg.Content, &detail); err != nil { From 78328b2c11c58a2ce2fd21166f34012c235706aa Mon Sep 17 00:00:00 2001 From: withchao <993506633@qq.com> Date: Thu, 11 Jan 2024 16:45:38 +0800 Subject: [PATCH 2/4] fix: GroupApplicationAcceptedNotification --- internal/group/notification.go | 19 ++++++++++++------- 1 file changed, 12 insertions(+), 7 deletions(-) diff --git a/internal/group/notification.go b/internal/group/notification.go index 57e805bd5..79f5b3baf 100644 --- a/internal/group/notification.go +++ b/internal/group/notification.go @@ -66,22 +66,27 @@ func (g *Group) doNotification(ctx context.Context, msg *sdkws.MsgData) error { if err := utils.UnmarshalNotificationElem(msg.Content, &detail); err != nil { return err } - if msg.SendID == g.loginUserID { + switch detail.ReceiverAs { + case 0: + return g.SyncAllSelfGroupApplication(ctx) + case 1: return g.SyncAdminGroupApplications(ctx, detail.Group.GroupID) + default: + return fmt.Errorf("GroupApplicationAcceptedNotification ReceiverAs unknown %d", detail.ReceiverAs) } - return g.SyncAllSelfGroupApplication(ctx) case constant.GroupApplicationRejectedNotification: // 1506 var detail sdkws.GroupApplicationRejectedTips if err := utils.UnmarshalNotificationElem(msg.Content, &detail); err != nil { return err } - if detail.OpUser.UserID == g.loginUserID { + switch detail.ReceiverAs { + case 0: + return g.SyncAllSelfGroupApplication(ctx) + case 1: return g.SyncAdminGroupApplications(ctx, detail.Group.GroupID) + default: + return fmt.Errorf("GroupApplicationRejectedNotification ReceiverAs unknown %d", detail.ReceiverAs) } - if detail.ReceiverAs == 1 { - return g.SyncAdminGroupApplications(ctx, detail.Group.GroupID) - } - return g.SyncSelfGroupApplications(ctx, detail.Group.GroupID) case constant.GroupOwnerTransferredNotification: // 1507 var detail sdkws.GroupOwnerTransferredTips if err := utils.UnmarshalNotificationElem(msg.Content, &detail); err != nil { From b984014982cd82ae2af07266b49088cfdc56f3da Mon Sep 17 00:00:00 2001 From: withchao <993506633@qq.com> Date: Tue, 14 May 2024 16:33:41 +0800 Subject: [PATCH 3/4] package name replacement --- .github/workflows/auto-invite.yml | 2 +- .golangci.yml | 4 +- .goreleaser.yaml | 2 +- CHANGELOG/.chglog/config.yml | 2 +- CHANGELOG/CHANGELOG-1.0.md | 16 ++-- CHANGELOG/CHANGELOG-2.0.md | 30 ++++---- CHANGELOG/CHANGELOG-2.1.md | 2 +- CHANGELOG/CHANGELOG-2.2.md | 2 +- CHANGELOG/CHANGELOG-2.3.md | 6 +- CHANGELOG/CHANGELOG-2.9.md | 14 ++-- CHANGELOG/CHANGELOG-3.0.md | 48 ++++++------ CHANGELOG/CHANGELOG.md | 2 +- CONTRIBUTING.md | 54 ++++++------- Makefile | 4 +- README.md | 52 ++++++------- README_zh-CN.md | 8 +- cmd/gordon_main.go | 2 +- cmd/press_open_im.go | 2 +- cmd/reliability_open_im.go | 2 +- cmd/sk_main.go | 2 +- docs/contrib/git_workflow.md | 6 +- go.mod | 36 ++++----- go.sum | 76 ++++++++++--------- internal/business/business.go | 4 +- internal/common/common.go | 2 +- internal/conversation_msg/conversation.go | 8 +- internal/conversation_msg/conversation_msg.go | 8 +- .../conversation_notification.go | 8 +- internal/conversation_msg/convert.go | 2 +- internal/conversation_msg/create_message.go | 2 +- internal/conversation_msg/delete.go | 6 +- internal/conversation_msg/entering.go | 12 +-- internal/conversation_msg/image.go | 6 +- internal/conversation_msg/message_check.go | 10 +-- .../conversation_msg/message_controller.go | 4 +- internal/conversation_msg/progress.go | 2 +- internal/conversation_msg/read_drawing.go | 10 +-- internal/conversation_msg/revoke.go | 10 +-- internal/conversation_msg/sdk.go | 10 +-- internal/conversation_msg/sync.go | 6 +- internal/file/upload.go | 10 +-- internal/friend/conversion.go | 2 +- internal/friend/friend.go | 4 +- internal/friend/sdk.go | 16 ++-- internal/friend/sync.go | 8 +- internal/full/open_im_sdk_full.go | 4 +- internal/group/conversion.go | 2 +- internal/group/group.go | 14 ++-- internal/group/notification.go | 4 +- internal/group/sdk.go | 54 ++++++++++--- internal/group/sync.go | 12 +-- internal/interaction/context.go | 2 +- internal/interaction/long_conn_mgr.go | 17 ++--- internal/interaction/msg_sync.go | 4 +- internal/interaction/ws_js.go | 2 +- internal/interaction/ws_resp_asyn.go | 2 +- internal/third/log.go | 2 +- internal/third/third.go | 2 +- internal/user/convert.go | 4 +- internal/user/sdk.go | 6 +- internal/user/sync.go | 6 +- internal/user/user.go | 14 ++-- internal/util/post.go | 18 ++--- internal/work_moments/work_moments.go | 2 +- msgtest/message_test.go | 2 +- msgtest/module/api_msg_sender.go | 4 +- msgtest/module/friend_manager.go | 2 +- msgtest/module/group_manager.go | 4 +- msgtest/module/manager.go | 8 +- msgtest/module/msg_sender.go | 6 +- msgtest/module/user_manager.go | 4 +- msgtest/pressure_test.go | 2 +- msgtest/sdk_user_simulator/listener.go | 2 + msgtest/sdk_user_simulator/user.go | 11 +-- open_im_sdk/apicb.go | 10 +-- open_im_sdk/caller.go | 18 ++--- open_im_sdk/em.go | 2 +- open_im_sdk/init_login.go | 7 +- open_im_sdk/userRelated.go | 8 +- open_im_sdk_callback/callback_go_sdk.go | 2 +- pkg/ccontext/context.go | 2 +- pkg/common/trigger_channel.go | 4 +- pkg/constant/server_api_router.go | 1 + pkg/db/chat_log_model_v3.go | 2 +- pkg/db/conversation_model.go | 4 +- pkg/db/db_init.go | 2 +- pkg/db/upload_model.go | 2 +- pkg/sdk_params_callback/friend_sdk_struct.go | 2 +- pkg/sdk_params_callback/group_sdk_struct.go | 6 +- pkg/sdkerrs/error.go | 7 +- pkg/sdkerrs/predefine.go | 2 +- pkg/server_api_params/auth_api_struct.go | 2 +- pkg/server_api_params/friend_api_struct.go | 2 +- pkg/server_api_params/group_api_struct.go | 2 +- pkg/server_api_params/user_api_struct.go | 2 +- pkg/syncer/syncer.go | 2 +- scripts/template/head.md.tmpl | 4 +- sdk_struct/sdk_struct.go | 2 +- test/account.go | 8 +- test/login.go | 2 +- test/reliability.go | 2 +- test/sendMessage.go | 4 +- test/t_conversation_msg.go | 6 +- test/t_friend_sdk.go | 6 +- test/t_group_sdk.go | 2 +- test/t_signaling.go | 2 +- test/work_group_create.go | 4 +- testv2/config.go | 2 +- testv2/empty_test.go | 2 +- testv2/friend_test.go | 4 +- testv2/group_test.go | 6 +- testv2/init.go | 4 +- testv2/listener.go | 2 + testv2/user_test.go | 6 +- wasm/event_listener/caller.go | 2 +- wasm/exec/executor.go | 4 +- 116 files changed, 478 insertions(+), 427 deletions(-) diff --git a/.github/workflows/auto-invite.yml b/.github/workflows/auto-invite.yml index 40433ef5f..f37271f1e 100644 --- a/.github/workflows/auto-invite.yml +++ b/.github/workflows/auto-invite.yml @@ -41,7 +41,7 @@ jobs: + We also have Slack channels for you to communicate and discuss. To join, visit https://slack.com/ and join our [👀 Open-IM-Server slack](https://join.slack.com/t/openimsdk/shared_invite/zt-1tmoj26uf-_FDy3dowVHBiGvLk9e5Xkg) team channel. + Get in touch with us on [Gmail](https://mail.google.com/mail/u/0/?fs=1&tf=cm&to=winxu81@gmail.com). If you have any questions or issues that need resolving, or any suggestions and feedback for our open source projects, please feel free to contact us via email. + Read our [blog](https://doc.rentsoft.cn/). Our blog is a great place to stay up-to-date with Open-IM-Server projects and trends. On the blog, we share our latest developments, tech trends, and other interesting information. - + Add [Wechat](https://github.com/OpenIMSDK/OpenIM-Docs/blob/main/docs/images/WechatIMG20.jpeg) and indicate that you are a user or developer of Open-IM-Server. We will process your request as soon as possible. + + Add [Wechat](https://github.com/openimsdk/OpenIM-Docs/blob/main/docs/images/WechatIMG20.jpeg) and indicate that you are a user or developer of Open-IM-Server. We will process your request as soon as possible. - name: Close Issue uses: peter-evans/close-issue@v3 diff --git a/.golangci.yml b/.golangci.yml index 7d1c82d6d..774fe29ad 100644 --- a/.golangci.yml +++ b/.golangci.yml @@ -176,7 +176,7 @@ linters-settings: # put imports beginning with prefix after 3rd-party packages; # only support one prefix # if not set, use goimports.local-prefixes - prefix: github.com/OpenIMSDK/openim-sdk-core + prefix: github.com/openimsdk/openim-sdk-core gocognit: # minimal code complexity to report, 30 by default (but we recommend 10-20) min-complexity: 30 @@ -333,7 +333,7 @@ linters-settings: goimports: # put imports beginning with prefix after 3rd-party packages; # it's a comma-separated list of prefixes - local-prefixes: github.com/OpenIMSDK/openim-sdk-core + local-prefixes: github.com/openimsdk/openim-sdk-core golint: # minimal confidence for issues, default is 0.8 min-confidence: 0.9 diff --git a/.goreleaser.yaml b/.goreleaser.yaml index 6be41a5d4..3e443f5ce 100644 --- a/.goreleaser.yaml +++ b/.goreleaser.yaml @@ -155,7 +155,7 @@ nfpms: - openIM.wasm # Your app's vendor. vendor: OpenIMSDK - homepage: https://github.com/OpenIMSDK/openim-sdk-core + homepage: https://github.com/openimsdk/openim-sdk-core maintainer: kubbot description: |- Auto sync github labels diff --git a/CHANGELOG/.chglog/config.yml b/CHANGELOG/.chglog/config.yml index c11e987cc..290193082 100644 --- a/CHANGELOG/.chglog/config.yml +++ b/CHANGELOG/.chglog/config.yml @@ -17,7 +17,7 @@ style: github template: CHANGELOG.tpl.md info: title: CHANGELOG - repository_url: https://github.com/OpenIMSDK/openim-sdk-core + repository_url: https://github.com/openimsdk/openim-sdk-core options: tag_filter_pattern: '^v' sort: "date" diff --git a/CHANGELOG/CHANGELOG-1.0.md b/CHANGELOG/CHANGELOG-1.0.md index b8539a901..52983b359 100644 --- a/CHANGELOG/CHANGELOG-1.0.md +++ b/CHANGELOG/CHANGELOG-1.0.md @@ -32,11 +32,11 @@ ## v1.0.0 - 2021-10-28 -[Unreleased]: https://github.com/OpenIMSDK/openim-sdk-core/compare/v1.0.7...HEAD -[v1.0.7]: https://github.com/OpenIMSDK/openim-sdk-core/compare/v1.0.6...v1.0.7 -[v1.0.6]: https://github.com/OpenIMSDK/openim-sdk-core/compare/v1.0.5...v1.0.6 -[v1.0.5]: https://github.com/OpenIMSDK/openim-sdk-core/compare/v1.0.4...v1.0.5 -[v1.0.4]: https://github.com/OpenIMSDK/openim-sdk-core/compare/v1.0.3...v1.0.4 -[v1.0.3]: https://github.com/OpenIMSDK/openim-sdk-core/compare/v1.0.2...v1.0.3 -[v1.0.2]: https://github.com/OpenIMSDK/openim-sdk-core/compare/v1.0.1...v1.0.2 -[v1.0.1]: https://github.com/OpenIMSDK/openim-sdk-core/compare/v1.0.0...v1.0.1 +[Unreleased]: https://github.com/openimsdk/openim-sdk-core/compare/v1.0.7...HEAD +[v1.0.7]: https://github.com/openimsdk/openim-sdk-core/compare/v1.0.6...v1.0.7 +[v1.0.6]: https://github.com/openimsdk/openim-sdk-core/compare/v1.0.5...v1.0.6 +[v1.0.5]: https://github.com/openimsdk/openim-sdk-core/compare/v1.0.4...v1.0.5 +[v1.0.4]: https://github.com/openimsdk/openim-sdk-core/compare/v1.0.3...v1.0.4 +[v1.0.3]: https://github.com/openimsdk/openim-sdk-core/compare/v1.0.2...v1.0.3 +[v1.0.2]: https://github.com/openimsdk/openim-sdk-core/compare/v1.0.1...v1.0.2 +[v1.0.1]: https://github.com/openimsdk/openim-sdk-core/compare/v1.0.0...v1.0.1 diff --git a/CHANGELOG/CHANGELOG-2.0.md b/CHANGELOG/CHANGELOG-2.0.md index 4d9cb747c..76bef9093 100644 --- a/CHANGELOG/CHANGELOG-2.0.md +++ b/CHANGELOG/CHANGELOG-2.0.md @@ -75,18 +75,18 @@ ## v2.0.0 - 2022-02-23 -[Unreleased]: https://github.com/OpenIMSDK/openim-sdk-core/compare/v2.3.3...HEAD -[v2.3.3]: https://github.com/OpenIMSDK/openim-sdk-core/compare/v2.3.2...v2.3.3 -[v2.3.2]: https://github.com/OpenIMSDK/openim-sdk-core/compare/v2.3.0-rc0...v2.3.2 -[v2.3.0-rc0]: https://github.com/OpenIMSDK/openim-sdk-core/compare/v2.2.0...v2.3.0-rc0 -[v2.2.0]: https://github.com/OpenIMSDK/openim-sdk-core/compare/v2.1.0...v2.2.0 -[v2.1.0]: https://github.com/OpenIMSDK/openim-sdk-core/compare/v2.0.9...v2.1.0 -[v2.0.9]: https://github.com/OpenIMSDK/openim-sdk-core/compare/v2.0.8...v2.0.9 -[v2.0.8]: https://github.com/OpenIMSDK/openim-sdk-core/compare/v2.0.7...v2.0.8 -[v2.0.7]: https://github.com/OpenIMSDK/openim-sdk-core/compare/v2.0.6...v2.0.7 -[v2.0.6]: https://github.com/OpenIMSDK/openim-sdk-core/compare/v2.0.5...v2.0.6 -[v2.0.5]: https://github.com/OpenIMSDK/openim-sdk-core/compare/v2.0.4...v2.0.5 -[v2.0.4]: https://github.com/OpenIMSDK/openim-sdk-core/compare/v2.0.3...v2.0.4 -[v2.0.3]: https://github.com/OpenIMSDK/openim-sdk-core/compare/v2.0.2...v2.0.3 -[v2.0.2]: https://github.com/OpenIMSDK/openim-sdk-core/compare/v2.0.1...v2.0.2 -[v2.0.1]: https://github.com/OpenIMSDK/openim-sdk-core/compare/v2.0.0...v2.0.1 +[Unreleased]: https://github.com/openimsdk/openim-sdk-core/compare/v2.3.3...HEAD +[v2.3.3]: https://github.com/openimsdk/openim-sdk-core/compare/v2.3.2...v2.3.3 +[v2.3.2]: https://github.com/openimsdk/openim-sdk-core/compare/v2.3.0-rc0...v2.3.2 +[v2.3.0-rc0]: https://github.com/openimsdk/openim-sdk-core/compare/v2.2.0...v2.3.0-rc0 +[v2.2.0]: https://github.com/openimsdk/openim-sdk-core/compare/v2.1.0...v2.2.0 +[v2.1.0]: https://github.com/openimsdk/openim-sdk-core/compare/v2.0.9...v2.1.0 +[v2.0.9]: https://github.com/openimsdk/openim-sdk-core/compare/v2.0.8...v2.0.9 +[v2.0.8]: https://github.com/openimsdk/openim-sdk-core/compare/v2.0.7...v2.0.8 +[v2.0.7]: https://github.com/openimsdk/openim-sdk-core/compare/v2.0.6...v2.0.7 +[v2.0.6]: https://github.com/openimsdk/openim-sdk-core/compare/v2.0.5...v2.0.6 +[v2.0.5]: https://github.com/openimsdk/openim-sdk-core/compare/v2.0.4...v2.0.5 +[v2.0.4]: https://github.com/openimsdk/openim-sdk-core/compare/v2.0.3...v2.0.4 +[v2.0.3]: https://github.com/openimsdk/openim-sdk-core/compare/v2.0.2...v2.0.3 +[v2.0.2]: https://github.com/openimsdk/openim-sdk-core/compare/v2.0.1...v2.0.2 +[v2.0.1]: https://github.com/openimsdk/openim-sdk-core/compare/v2.0.0...v2.0.1 diff --git a/CHANGELOG/CHANGELOG-2.1.md b/CHANGELOG/CHANGELOG-2.1.md index 9a21ae247..83a4cda9d 100644 --- a/CHANGELOG/CHANGELOG-2.1.md +++ b/CHANGELOG/CHANGELOG-2.1.md @@ -20,4 +20,4 @@ - Merge branch 'tuoyun' -[Unreleased]: https://github.com/OpenIMSDK/openim-sdk-core/compare/v2.1.0...HEAD +[Unreleased]: https://github.com/openimsdk/openim-sdk-core/compare/v2.1.0...HEAD diff --git a/CHANGELOG/CHANGELOG-2.2.md b/CHANGELOG/CHANGELOG-2.2.md index 42a0c8927..7cd31b116 100644 --- a/CHANGELOG/CHANGELOG-2.2.md +++ b/CHANGELOG/CHANGELOG-2.2.md @@ -21,4 +21,4 @@ - Merge branch 'tuoyun' -[Unreleased]: https://github.com/OpenIMSDK/openim-sdk-core/compare/v2.2.0...HEAD +[Unreleased]: https://github.com/openimsdk/openim-sdk-core/compare/v2.2.0...HEAD diff --git a/CHANGELOG/CHANGELOG-2.3.md b/CHANGELOG/CHANGELOG-2.3.md index 9b06d6d0f..77833bf47 100644 --- a/CHANGELOG/CHANGELOG-2.3.md +++ b/CHANGELOG/CHANGELOG-2.3.md @@ -27,6 +27,6 @@ - Merge branch 'tuoyun' -[Unreleased]: https://github.com/OpenIMSDK/openim-sdk-core/compare/v2.3.3...HEAD -[v2.3.3]: https://github.com/OpenIMSDK/openim-sdk-core/compare/v2.3.2...v2.3.3 -[v2.3.2]: https://github.com/OpenIMSDK/openim-sdk-core/compare/v2.3.0-rc0...v2.3.2 +[Unreleased]: https://github.com/openimsdk/openim-sdk-core/compare/v2.3.3...HEAD +[v2.3.3]: https://github.com/openimsdk/openim-sdk-core/compare/v2.3.2...v2.3.3 +[v2.3.2]: https://github.com/openimsdk/openim-sdk-core/compare/v2.3.0-rc0...v2.3.2 diff --git a/CHANGELOG/CHANGELOG-2.9.md b/CHANGELOG/CHANGELOG-2.9.md index b51212ba8..1463f52dc 100644 --- a/CHANGELOG/CHANGELOG-2.9.md +++ b/CHANGELOG/CHANGELOG-2.9.md @@ -38,15 +38,15 @@ ## v2.9.0 - 2023-07-04 ### Reverts -- update etcd to v3.5.2 ([#206](https://github.com/OpenIMSDK/Open-IM-Server/issues/206)) +- update etcd to v3.5.2 ([#206](https://github.com/openimsdk/Open-IM-Server/issues/206)) ### Pull Requests - Merge branch 'tuoyun' -[Unreleased]: https://github.com/OpenIMSDK/Open-IM-Server/compare/v2.9.0+1.839643f...HEAD -[v2.9.0+1.839643f]: https://github.com/OpenIMSDK/Open-IM-Server/compare/v2.9.0+2.35f07fe...v2.9.0+1.839643f -[v2.9.0+2.35f07fe]: https://github.com/OpenIMSDK/Open-IM-Server/compare/v2.9.0+1.b5072b1...v2.9.0+2.35f07fe -[v2.9.0+1.b5072b1]: https://github.com/OpenIMSDK/Open-IM-Server/compare/v2.9.0+3.2667a3a...v2.9.0+1.b5072b1 -[v2.9.0+3.2667a3a]: https://github.com/OpenIMSDK/Open-IM-Server/compare/v2.9.0+7.04818ca...v2.9.0+3.2667a3a -[v2.9.0+7.04818ca]: https://github.com/OpenIMSDK/Open-IM-Server/compare/v2.9.0...v2.9.0+7.04818ca +[Unreleased]: https://github.com/openimsdk/Open-IM-Server/compare/v2.9.0+1.839643f...HEAD +[v2.9.0+1.839643f]: https://github.com/openimsdk/Open-IM-Server/compare/v2.9.0+2.35f07fe...v2.9.0+1.839643f +[v2.9.0+2.35f07fe]: https://github.com/openimsdk/Open-IM-Server/compare/v2.9.0+1.b5072b1...v2.9.0+2.35f07fe +[v2.9.0+1.b5072b1]: https://github.com/openimsdk/Open-IM-Server/compare/v2.9.0+3.2667a3a...v2.9.0+1.b5072b1 +[v2.9.0+3.2667a3a]: https://github.com/openimsdk/Open-IM-Server/compare/v2.9.0+7.04818ca...v2.9.0+3.2667a3a +[v2.9.0+7.04818ca]: https://github.com/openimsdk/Open-IM-Server/compare/v2.9.0...v2.9.0+7.04818ca diff --git a/CHANGELOG/CHANGELOG-3.0.md b/CHANGELOG/CHANGELOG-3.0.md index 6f342f515..4b1279302 100644 --- a/CHANGELOG/CHANGELOG-3.0.md +++ b/CHANGELOG/CHANGELOG-3.0.md @@ -102,27 +102,27 @@ ## v1.0.0 - 2021-10-28 -[Unreleased]: https://github.com/OpenIMSDK/openim-sdk-core/compare/v3.0.0-rc.1...HEAD -[v3.0.0-rc.1]: https://github.com/OpenIMSDK/openim-sdk-core/compare/v2.3.3...v3.0.0-rc.1 -[v2.3.3]: https://github.com/OpenIMSDK/openim-sdk-core/compare/v2.3.2...v2.3.3 -[v2.3.2]: https://github.com/OpenIMSDK/openim-sdk-core/compare/v2.3.0-rc0...v2.3.2 -[v2.3.0-rc0]: https://github.com/OpenIMSDK/openim-sdk-core/compare/v2.2.0...v2.3.0-rc0 -[v2.2.0]: https://github.com/OpenIMSDK/openim-sdk-core/compare/v2.1.0...v2.2.0 -[v2.1.0]: https://github.com/OpenIMSDK/openim-sdk-core/compare/v2.0.9...v2.1.0 -[v2.0.9]: https://github.com/OpenIMSDK/openim-sdk-core/compare/v2.0.8...v2.0.9 -[v2.0.8]: https://github.com/OpenIMSDK/openim-sdk-core/compare/v2.0.7...v2.0.8 -[v2.0.7]: https://github.com/OpenIMSDK/openim-sdk-core/compare/v2.0.6...v2.0.7 -[v2.0.6]: https://github.com/OpenIMSDK/openim-sdk-core/compare/v2.0.5...v2.0.6 -[v2.0.5]: https://github.com/OpenIMSDK/openim-sdk-core/compare/v2.0.4...v2.0.5 -[v2.0.4]: https://github.com/OpenIMSDK/openim-sdk-core/compare/v2.0.3...v2.0.4 -[v2.0.3]: https://github.com/OpenIMSDK/openim-sdk-core/compare/v2.0.2...v2.0.3 -[v2.0.2]: https://github.com/OpenIMSDK/openim-sdk-core/compare/v2.0.1...v2.0.2 -[v2.0.1]: https://github.com/OpenIMSDK/openim-sdk-core/compare/v2.0.0...v2.0.1 -[v2.0.0]: https://github.com/OpenIMSDK/openim-sdk-core/compare/v1.0.7...v2.0.0 -[v1.0.7]: https://github.com/OpenIMSDK/openim-sdk-core/compare/v1.0.6...v1.0.7 -[v1.0.6]: https://github.com/OpenIMSDK/openim-sdk-core/compare/v1.0.5...v1.0.6 -[v1.0.5]: https://github.com/OpenIMSDK/openim-sdk-core/compare/v1.0.4...v1.0.5 -[v1.0.4]: https://github.com/OpenIMSDK/openim-sdk-core/compare/v1.0.3...v1.0.4 -[v1.0.3]: https://github.com/OpenIMSDK/openim-sdk-core/compare/v1.0.2...v1.0.3 -[v1.0.2]: https://github.com/OpenIMSDK/openim-sdk-core/compare/v1.0.1...v1.0.2 -[v1.0.1]: https://github.com/OpenIMSDK/openim-sdk-core/compare/v1.0.0...v1.0.1 +[Unreleased]: https://github.com/openimsdk/openim-sdk-core/compare/v3.0.0-rc.1...HEAD +[v3.0.0-rc.1]: https://github.com/openimsdk/openim-sdk-core/compare/v2.3.3...v3.0.0-rc.1 +[v2.3.3]: https://github.com/openimsdk/openim-sdk-core/compare/v2.3.2...v2.3.3 +[v2.3.2]: https://github.com/openimsdk/openim-sdk-core/compare/v2.3.0-rc0...v2.3.2 +[v2.3.0-rc0]: https://github.com/openimsdk/openim-sdk-core/compare/v2.2.0...v2.3.0-rc0 +[v2.2.0]: https://github.com/openimsdk/openim-sdk-core/compare/v2.1.0...v2.2.0 +[v2.1.0]: https://github.com/openimsdk/openim-sdk-core/compare/v2.0.9...v2.1.0 +[v2.0.9]: https://github.com/openimsdk/openim-sdk-core/compare/v2.0.8...v2.0.9 +[v2.0.8]: https://github.com/openimsdk/openim-sdk-core/compare/v2.0.7...v2.0.8 +[v2.0.7]: https://github.com/openimsdk/openim-sdk-core/compare/v2.0.6...v2.0.7 +[v2.0.6]: https://github.com/openimsdk/openim-sdk-core/compare/v2.0.5...v2.0.6 +[v2.0.5]: https://github.com/openimsdk/openim-sdk-core/compare/v2.0.4...v2.0.5 +[v2.0.4]: https://github.com/openimsdk/openim-sdk-core/compare/v2.0.3...v2.0.4 +[v2.0.3]: https://github.com/openimsdk/openim-sdk-core/compare/v2.0.2...v2.0.3 +[v2.0.2]: https://github.com/openimsdk/openim-sdk-core/compare/v2.0.1...v2.0.2 +[v2.0.1]: https://github.com/openimsdk/openim-sdk-core/compare/v2.0.0...v2.0.1 +[v2.0.0]: https://github.com/openimsdk/openim-sdk-core/compare/v1.0.7...v2.0.0 +[v1.0.7]: https://github.com/openimsdk/openim-sdk-core/compare/v1.0.6...v1.0.7 +[v1.0.6]: https://github.com/openimsdk/openim-sdk-core/compare/v1.0.5...v1.0.6 +[v1.0.5]: https://github.com/openimsdk/openim-sdk-core/compare/v1.0.4...v1.0.5 +[v1.0.4]: https://github.com/openimsdk/openim-sdk-core/compare/v1.0.3...v1.0.4 +[v1.0.3]: https://github.com/openimsdk/openim-sdk-core/compare/v1.0.2...v1.0.3 +[v1.0.2]: https://github.com/openimsdk/openim-sdk-core/compare/v1.0.1...v1.0.2 +[v1.0.1]: https://github.com/openimsdk/openim-sdk-core/compare/v1.0.0...v1.0.1 diff --git a/CHANGELOG/CHANGELOG.md b/CHANGELOG/CHANGELOG.md index 2d788d4c4..b9bafd1a1 100644 --- a/CHANGELOG/CHANGELOG.md +++ b/CHANGELOG/CHANGELOG.md @@ -13,7 +13,7 @@ All notable changes to this project will be documented in this file. -+ [https://github.com/OpenIMSDK/Open-IM-Server/releases](https://github.com/OpenIMSDK/Open-IM-Server/releases) ++ [https://github.com/openimsdk/Open-IM-Server/releases](https://github.com/openimsdk/Open-IM-Server/releases) ## command diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index d63f6ce67..b42bdbaed 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -34,7 +34,7 @@ The [Makefile](./Makefile) is for every developer, even if you don't know how to #### Code and doc contribution -Every action to make project OpenIM better is encouraged. On GitHub, every improvement for OpenIM could be via a [PR](https://github.com/OpenIMSDK/openim-sdk-core/pulls) (short for pull request). +Every action to make project OpenIM better is encouraged. On GitHub, every improvement for OpenIM could be via a [PR](https://github.com/openimsdk/openim-sdk-core/pulls) (short for pull request). + If you find a typo, try to fix it! + If you find a bug, try to fix it! @@ -49,22 +49,22 @@ Every action to make project OpenIM better is encouraged. On GitHub, every impro #### Where should I start? -Getting good at GitHub is the first step, we have a [list of labes](https://github.com/OpenIMSDK/openim-sdk-core/labels) and reading some of the [common tags](https://github.com/OpenIMSDK/openim-sdk-core/labels?sort=count-desc) helps us get involved in the community quickly.GitHub allows you to filter out types of issues and pull requests, which helps you discover items in need of triaging. This table includes some predetermined searches for convenience: +Getting good at GitHub is the first step, we have a [list of labes](https://github.com/openimsdk/openim-sdk-core/labels) and reading some of the [common tags](https://github.com/openimsdk/openim-sdk-core/labels?sort=count-desc) helps us get involved in the community quickly.GitHub allows you to filter out types of issues and pull requests, which helps you discover items in need of triaging. This table includes some predetermined searches for convenience: | Search | What it sorts | | ------------------------------------------------------------ | ------------------------------------------------------- | -| [created-asc](https://github.com/OpenIMSDK/openim-sdk-core/issues?q=is%3Aissue+is%3Aopen+sort%3Acreated-asc) | Untriaged issues by age | -| [needs-triage](https://github.com/OpenIMSDK/openim-sdk-core/issues?q=is%3Aissue+is%3Aopen+sort%3Aupdated-desc+no%3Alabel) | Issues that need to be assigned to a Labels | -| [`is:open is:issue`](https://github.com/OpenIMSDK/openim-sdk-core/issues?q=is%3Aopen+is%3Aissue+sort%3Aupdated-desc) | Newest incoming issues | -| [comments-desc](https://github.com/OpenIMSDK/openim-sdk-core/issues?q=is%3Aissue+is%3Aopen+sort%3Acomments-desc) | Busiest untriaged issues, sorted by # of comments | -| [comments-asc](https://github.com/OpenIMSDK/openim-sdk-core/issues?q=is%3Aissue+is%3Aopen+sort%3Acomments-asc) | Issues that need more attention, based on # of comments | +| [created-asc](https://github.com/openimsdk/openim-sdk-core/issues?q=is%3Aissue+is%3Aopen+sort%3Acreated-asc) | Untriaged issues by age | +| [needs-triage](https://github.com/openimsdk/openim-sdk-core/issues?q=is%3Aissue+is%3Aopen+sort%3Aupdated-desc+no%3Alabel) | Issues that need to be assigned to a Labels | +| [`is:open is:issue`](https://github.com/openimsdk/openim-sdk-core/issues?q=is%3Aopen+is%3Aissue+sort%3Aupdated-desc) | Newest incoming issues | +| [comments-desc](https://github.com/openimsdk/openim-sdk-core/issues?q=is%3Aissue+is%3Aopen+sort%3Acomments-desc) | Busiest untriaged issues, sorted by # of comments | +| [comments-asc](https://github.com/openimsdk/openim-sdk-core/issues?q=is%3Aissue+is%3Aopen+sort%3Acomments-asc) | Issues that need more attention, based on # of comments | We suggest preparing your triage by filtering out the oldest, unlabelled issues and pull requests first. -1. If you are new to the project, don't know how to contribute OpenIM, please check out the [good first issue](https://github.com/OpenIMSDK/openim-sdk-core/issues?q=is%3Aopen+label%3A"good+first+issue"+sort%3Aupdated-desc) label and [help wanted](https://github.com/OpenIMSDK/openim-sdk-core/issues?q=is%3Aopen+is%3Aissue+label%3A"help+wanted"+sort%3Aupdated-desc). -2. You should be good at filtering the OpenIM issue tags and finding the ones you like, such as [RFC](https://github.com/OpenIMSDK/openim-sdk-core/issues?q=is%3Aissue+is%3Aopen+RFC+label%3ARFC) for big initiatives, features for [feature](https://github.com/OpenIMSDK/openim-sdk-core/issues?q=is%3Aissue+label%3Akind%2Ffeature+sort%3Aupdated-desc+) proposals, and [bug](https://github.com/OpenIMSDK/openim-sdk-core/issues?q=is%3Aissue+label%3Akind%2Fbug+sort%3Aupdated-desc+) fixes. -3. If you are looking for something to work on, check out our [open issues](https://github.com/OpenIMSDK/openim-sdk-core/issues?q=is%3Aissue+is%3Aopen+sort%3Aupdated-desc). -4. If you have an idea for a new feature, please [open an issue](https://github.com/OpenIMSDK/openim-sdk-core/issues/new/choose), and we can discuss it. +1. If you are new to the project, don't know how to contribute OpenIM, please check out the [good first issue](https://github.com/openimsdk/openim-sdk-core/issues?q=is%3Aopen+label%3A"good+first+issue"+sort%3Aupdated-desc) label and [help wanted](https://github.com/openimsdk/openim-sdk-core/issues?q=is%3Aopen+is%3Aissue+label%3A"help+wanted"+sort%3Aupdated-desc). +2. You should be good at filtering the OpenIM issue tags and finding the ones you like, such as [RFC](https://github.com/openimsdk/openim-sdk-core/issues?q=is%3Aissue+is%3Aopen+RFC+label%3ARFC) for big initiatives, features for [feature](https://github.com/openimsdk/openim-sdk-core/issues?q=is%3Aissue+label%3Akind%2Ffeature+sort%3Aupdated-desc+) proposals, and [bug](https://github.com/openimsdk/openim-sdk-core/issues?q=is%3Aissue+label%3Akind%2Fbug+sort%3Aupdated-desc+) fixes. +3. If you are looking for something to work on, check out our [open issues](https://github.com/openimsdk/openim-sdk-core/issues?q=is%3Aissue+is%3Aopen+sort%3Aupdated-desc). +4. If you have an idea for a new feature, please [open an issue](https://github.com/openimsdk/openim-sdk-core/issues/new/choose), and we can discuss it. > **Note** > Reply to `/assign` or `/assign @yourself` with a question you wish to resolve, and we'll assign the question to you and your name will be listed under `Assignees` @@ -73,7 +73,7 @@ We suggest preparing your triage by filtering out the oldest, unlabelled issues #### Design documents -For any substantial design, there should be a well-crafted design document. This document is not just a simple record, but also a detailed description and manifestation, which can help team members better understand the design thinking and grasp the design direction. In the process of writing the design document, we can choose to use tools such as `Google Docs` or `Notion`, and even mark **RFC** in [issues](https://github.com/OpenIMSDK/openim-sdk-core/issues?q=is%3Aissue+is%3Aopen+RFC+label%3ARFC) or [discussions](https://github.com/OpenIMSDK/openim-sdk-core/discussions) for better collaboration. Of course, after completing the design document, we should also add it to our [Shared Drive](https://drive.google.com/drive/) and notify the appropriate working group to let everyone know of its existence. Only by doing so can we maximize the effectiveness of the design document and provide strong support for the smooth progress of the project. +For any substantial design, there should be a well-crafted design document. This document is not just a simple record, but also a detailed description and manifestation, which can help team members better understand the design thinking and grasp the design direction. In the process of writing the design document, we can choose to use tools such as `Google Docs` or `Notion`, and even mark **RFC** in [issues](https://github.com/openimsdk/openim-sdk-core/issues?q=is%3Aissue+is%3Aopen+RFC+label%3ARFC) or [discussions](https://github.com/openimsdk/openim-sdk-core/discussions) for better collaboration. Of course, after completing the design document, we should also add it to our [Shared Drive](https://drive.google.com/drive/) and notify the appropriate working group to let everyone know of its existence. Only by doing so can we maximize the effectiveness of the design document and provide strong support for the smooth progress of the project. Anybody can access the shared Drive for reading. To get access to comment. Once you've done that, head to the [shared Drive](https://drive.google.com/) and behold all the docs. @@ -104,10 +104,10 @@ To propose PR for the OpenIM item, we assume you have registered a GitHub ID. Th 2. **CLONE** your own repository to master locally. Use `git clone https://github.com//OpenIM.git` to clone repository to your local machine. Then you can create new branches to finish the change you wish to make. -3. **Set Remote** upstream to be `https://github.com/OpenIMSDK/openim-sdk-core.git` using the following two commands: +3. **Set Remote** upstream to be `https://github.com/openimsdk/openim-sdk-core.git` using the following two commands: ```bash - ❯ git remote add upstream https://github.com/OpenIMSDK/openim-sdk-core.git + ❯ git remote add upstream https://github.com/openimsdk/openim-sdk-core.git ❯ git remote set-url --push upstream no-pushing ``` @@ -117,7 +117,7 @@ To propose PR for the OpenIM item, we assume you have registered a GitHub ID. Th ❯ git remote -v origin https://github.com//OpenIM.git (fetch) origin https://github.com//OpenIM.git (push) - upstream https://github.com/OpenIMSDK/openim-sdk-core.git (fetch) + upstream https://github.com/openimsdk/openim-sdk-core.git (fetch) upstream no-pushing (push) ``` @@ -201,11 +201,11 @@ Instead we encourage you to send us a private email to 📮[winxu81@gmail.com](h #### Reporting general issues -To be honest, we regard every user of OpenIMas a very kind contributor. After experiencing OpenIM, you may have some feedback for the project. Then feel free to open an issue via [NEW ISSUE](https://github.com/OpenIMSDK/openim-sdk-core/issues/new/choose). +To be honest, we regard every user of OpenIMas a very kind contributor. After experiencing OpenIM, you may have some feedback for the project. Then feel free to open an issue via [NEW ISSUE](https://github.com/openimsdk/openim-sdk-core/issues/new/choose). Since we collaborate project OpenIM in a distributed way, we appreciate **WELL-WRITTEN**, **DETAILED**, **EXPLICIT** issue reports. To make the communication more efficient, we wish everyone could search if your issue is an existing one in the searching list. If you find it existing, please add your details in comments under the existing issue instead of opening a brand new one. -To make the issue details as standard as possible, we setup an [ISSUE TEMPLATE](https://github.com/OpenIMSDK/.github/tree/main/.github/ISSUE_TEMPLATE) for issue reporters. You can find three kinds of issue templates there: question, bug report and feature request. Please **BE SURE** to follow the instructions to fill fields in template. +To make the issue details as standard as possible, we setup an [ISSUE TEMPLATE](https://github.com/openimsdk/.github/tree/main/.github/ISSUE_TEMPLATE) for issue reporters. You can find three kinds of issue templates there: question, bug report and feature request. Please **BE SURE** to follow the instructions to fill fields in template. **There are a lot of cases when you could open an issue:** @@ -270,9 +270,9 @@ An example for this could be: #### PR Description -PR is the only way to make change to OpenIM project files. To help reviewers better get your purpose, **PR** description could not be too detailed. We encourage contributors to follow the [PR template](https://github.com/OpenIMSDK/.github/tree/main/.github/PULL_REQUEST_TEMPLATE.md) to finish the pull request. +PR is the only way to make change to OpenIM project files. To help reviewers better get your purpose, **PR** description could not be too detailed. We encourage contributors to follow the [PR template](https://github.com/openimsdk/.github/tree/main/.github/PULL_REQUEST_TEMPLATE.md) to finish the pull request. -You can find some very formal PR in [RFC](https://github.com/OpenIMSDK/openim-sdk-core/issues?q=is%3Aissue+is%3Aopen+RFC+label%3ARFC) issues and learn about them. +You can find some very formal PR in [RFC](https://github.com/openimsdk/openim-sdk-core/issues?q=is%3Aissue+is%3Aopen+RFC+label%3ARFC) issues and learn about them. **📖 Opening PRs:** @@ -330,11 +330,11 @@ git() { #### CI actions -We host CI on [GitHub Actions](https://github.com/OpenIMSDK/openim-sdk-core/actions), we will make sure PR pass tests before we can merge it. +We host CI on [GitHub Actions](https://github.com/openimsdk/openim-sdk-core/actions), we will make sure PR pass tests before we can merge it. These two kind of tests: `lint` and `unit test` -`lint` tests if your code matches our code conventions, please consult [golangci-lint](https://golangci-lint.run/) and [lint config](https://github.com/OpenIMSDK/openim-sdk-core/blob/main/.golangci.yml) +`lint` tests if your code matches our code conventions, please consult [golangci-lint](https://golangci-lint.run/) and [lint config](https://github.com/openimsdk/openim-sdk-core/blob/main/.golangci.yml) > **Note** > @@ -354,9 +354,9 @@ Try your best to keep every function has been tested, it keeps the function beha **The documentation for OpenIM includes:** -+ [README.md](https://github.com/OpenIMSDK/openim-sdk-core/blob/main/README.md): This file includes the basic information and instructions for getting started with OpenIM. -+ [README_zh-CN.md](https://github.com/OpenIMSDK/openim-sdk-core/blob/main/README_zh-CN.md): This file includes the basic information and instructions for getting started with OpenIM in Chinese. -+ [CONTRIBUTING.md](https://github.com/OpenIMSDK/openim-sdk-core/blob/main/CONTRIBUTING.md): This file contains guidelines for contributing to OpenIM's codebase, such as how to submit issues, pull requests, and code reviews. ++ [README.md](https://github.com/openimsdk/openim-sdk-core/blob/main/README.md): This file includes the basic information and instructions for getting started with OpenIM. ++ [README_zh-CN.md](https://github.com/openimsdk/openim-sdk-core/blob/main/README_zh-CN.md): This file includes the basic information and instructions for getting started with OpenIM in Chinese. ++ [CONTRIBUTING.md](https://github.com/openimsdk/openim-sdk-core/blob/main/CONTRIBUTING.md): This file contains guidelines for contributing to OpenIM's codebase, such as how to submit issues, pull requests, and code reviews. + [Official Documentation](https://doc.rentsoft.cn): This is the official documentation for OpenIM, which includes comprehensive information on all of its features, configuration options, and troubleshooting tips. **Please obey the following rules to better format the docs, which would greatly improve the reading experience.** @@ -380,9 +380,9 @@ We integrated in the CICD actions [markdownlint](https://github.com/markdownlint We choose GitHub as the primary place for OpenIM to collaborate. So the latest updates of OpenIM are always here. Although contributions via **PR** is an explicit way to help, we still call for any other ways. -+ reply to other's [issues](https://github.com/OpenIMSDK/openim-sdk-core/issues?q=is%3Aissue+is%3Aopen+sort%3Aupdated-desc) if you could; ++ reply to other's [issues](https://github.com/openimsdk/openim-sdk-core/issues?q=is%3Aissue+is%3Aopen+sort%3Aupdated-desc) if you could; + help solve other user's problems; -+ help review other's [PR](https://github.com/OpenIMSDK/openim-sdk-core/pulls?q=is%3Apr+is%3Aopen+sort%3Aupdated-desc) design; ++ help review other's [PR](https://github.com/openimsdk/openim-sdk-core/pulls?q=is%3Apr+is%3Aopen+sort%3Aupdated-desc) design; + discuss about OpenIM to make things clearer; + advocate [OpenIM](https://google.com/search?q=OpenIM) technology beyond GitHub; + write blogs on OpenIM and so on. @@ -430,6 +430,6 @@ In addition to Slack, we also offer the following ways to get in touch: + We also have Slack channels for you to communicate and discuss. To join, visit https://slack.com/ and join our [👀 openim-sdk-core slack](https://join.slack.com/t/openimsdk/shared_invite/zt-1tmoj26uf-_FDy3dowVHBiGvLk9e5Xkg) team channel. + Get in touch with us on [Gmail](https://mail.google.com/mail/u/0/?fs=1&tf=cm&to=winxu81@gmail.com). If you have any questions or issues that need resolving, or any suggestions and feedback for our open source projects, please feel free to contact us via email. + Read our [blog](https://doc.rentsoft.cn/). Our blog is a great place to stay up-to-date with openim-sdk-core projects and trends. On the blog, we share our latest developments, tech trends, and other interesting information. -+ Add [Wechat](https://github.com/OpenIMSDK/OpenIM-Docs/blob/main/docs/images/WechatIMG20.jpeg) and indicate that you are a user or developer of openim-sdk-core. We will process your request as soon as possible. ++ Add [Wechat](https://github.com/openimsdk/OpenIM-Docs/blob/main/docs/images/WechatIMG20.jpeg) and indicate that you are a user or developer of openim-sdk-core. We will process your request as soon as possible. Whether you're looking to join our community or have any questions or suggestions, we welcome you to get in touch with us. diff --git a/Makefile b/Makefile index 4ae5a57a2..57094e124 100644 --- a/Makefile +++ b/Makefile @@ -2,7 +2,7 @@ # define the default goal # -ROOT_PACKAGE=github.com/OpenIMSDK/Open-IM-SDK-Core +ROOT_PACKAGE=github.com/openimsdk/Open-IM-SDK-Core # Copyright 2023 OpenIM. All rights reserved. # Use of this source code is governed by a MIT style @@ -156,7 +156,7 @@ ifeq (${BINS},) $(error Could not determine BINS, set ROOT_DIR or run in source dir) endif -EXCLUDE_TESTS=github.com/OpenIMSDK/openim-sdk-core/test +EXCLUDE_TESTS=github.com/openimsdk/openim-sdk-core/test # ============================================================================== # Build diff --git a/README.md b/README.md index a3252f491..c04d17a95 100644 --- a/README.md +++ b/README.md @@ -8,11 +8,11 @@

-A+ -good first - +A+ +good first + - +

@@ -85,60 +85,60 @@ $ make deploy ## Contributing & Development -OpenIM Our goal is to build a top-level open source community. We have a set of standards, in the [Community repository](https://github.com/OpenIMSDK/community). +OpenIM Our goal is to build a top-level open source community. We have a set of standards, in the [Community repository](https://github.com/openimsdk/community). -If you'd like to contribute to this openim-sdk-core repository, please read our [contributor documentation](https://github.com/OpenIMSDK/openim-sdk-core/blob/main/CONTRIBUTING.md). +If you'd like to contribute to this openim-sdk-core repository, please read our [contributor documentation](https://github.com/openimsdk/openim-sdk-core/blob/main/CONTRIBUTING.md). ## community meeting We welcome everyone to join us and contribute to openim-sdk-core, whether you are new to open source or professional. We are committed to promoting an open source culture, so we offer community members neighborhood prizes and reward money in recognition of their contributions. We believe that by working together, we can build a strong community and make valuable open source tools and resources available to more people. So if you are interested in openim-sdk-core, please join our community and start contributing your ideas and skills! -We take notes of each [biweekly meeting](https://github.com/OpenIMSDK/Open-IM-Server/issues/381) in [GitHub discussions](https://github.com/OpenIMSDK/Open-IM-Server/discussions/categories/meeting), and our minutes are written in [Google Docs](https://docs.google.com/document/d/1nx8MDpuG74NASx081JcCpxPgDITNTpIIos0DS6Vr9GU/edit?usp=sharing). +We take notes of each [biweekly meeting](https://github.com/openimsdk/Open-IM-Server/issues/381) in [GitHub discussions](https://github.com/openimsdk/Open-IM-Server/discussions/categories/meeting), and our minutes are written in [Google Docs](https://docs.google.com/document/d/1nx8MDpuG74NASx081JcCpxPgDITNTpIIos0DS6Vr9GU/edit?usp=sharing). -openim-sdk-core maintains a [public roadmap](https://github.com/OpenIMSDK/community/tree/main/roadmaps). It gives a a high-level view of the main priorities for the project, the maturity of different features and projects, and how to influence the project direction. +openim-sdk-core maintains a [public roadmap](https://github.com/openimsdk/community/tree/main/roadmaps). It gives a a high-level view of the main priorities for the project, the maturity of different features and projects, and how to influence the project direction. ## about OpenIM ### common -+ https://github.com/OpenIMSDK/automation: OpenIM Automation, cicd, and actions, Robotics. -+ https://github.com/OpenIMSDK/community: Community Management for OpenIM ++ https://github.com/openimsdk/automation: OpenIM Automation, cicd, and actions, Robotics. ++ https://github.com/openimsdk/community: Community Management for OpenIM ### OpenIM **Links** Contains some common parts of the OpenIM community. -+ https://github.com/OpenIMSDK/automation: OpenIM Automation, cicd, and actions, Robotics. -+ https://github.com/OpenIMSDK/openim-sdk-core: The IMSDK implemented by golang can be used in IOS, Android, PC and other platforms. -+ https://github.com/OpenIMSDK/openim-sdk-core: Instant messaging IM server. -+ https://github.com/OpenIMSDK/community: Community Management for OpenIM. ++ https://github.com/openimsdk/automation: OpenIM Automation, cicd, and actions, Robotics. ++ https://github.com/openimsdk/openim-sdk-core: The IMSDK implemented by golang can be used in IOS, Android, PC and other platforms. ++ https://github.com/openimsdk/openim-sdk-core: Instant messaging IM server. ++ https://github.com/openimsdk/community: Community Management for OpenIM. ### SDKs -+ [openim-sdk-core](https://github.com/OpenIMSDK/openim-sdk-core): A cross-platform SDK implemented in golang that can be used in IOS, Android, PC, and other platforms. -+ [Open-IM-SDK-iOS](https://github.com/OpenIMSDK/Open-IM-SDK-iOS): An iOS SDK generated based on openim-sdk-core, available for developers to reference. -+ [Open-IM-SDK-Android](https://github.com/OpenIMSDK/Open-IM-SDK-Android): An Android SDK generated based on openim-sdk-core, available for developers to reference. -+ [Open-IM-SDK-Flutter](https://github.com/OpenIMSDK/Open-IM-SDK-Flutter): A Flutter SDK generated based on Open-IM-SDK-iOS and Open-IM-SDK-Android, available for developers to reference. -+ [Open-IM-SDK-Uniapp](https://github.com/OpenIMSDK/Open-IM-SDK-Uniapp): A uni-app SDK generated based on Open-IM-SDK-iOS and Open-IM-SDK-Android, available for developers to reference. ++ [openim-sdk-core](https://github.com/openimsdk/openim-sdk-core): A cross-platform SDK implemented in golang that can be used in IOS, Android, PC, and other platforms. ++ [Open-IM-SDK-iOS](https://github.com/openimsdk/Open-IM-SDK-iOS): An iOS SDK generated based on openim-sdk-core, available for developers to reference. ++ [Open-IM-SDK-Android](https://github.com/openimsdk/Open-IM-SDK-Android): An Android SDK generated based on openim-sdk-core, available for developers to reference. ++ [Open-IM-SDK-Flutter](https://github.com/openimsdk/Open-IM-SDK-Flutter): A Flutter SDK generated based on Open-IM-SDK-iOS and Open-IM-SDK-Android, available for developers to reference. ++ [Open-IM-SDK-Uniapp](https://github.com/openimsdk/Open-IM-SDK-Uniapp): A uni-app SDK generated based on Open-IM-SDK-iOS and Open-IM-SDK-Android, available for developers to reference. ### Demos -+ [Open-IM-iOS-Demo](https://github.com/OpenIMSDK/Open-IM-iOS-Demo): An iOS demo based on Open-IM-SDK-iOS, available for developers to reference. -+ [Open-IM-Android-Demo](https://github.com/OpenIMSDK/Open-IM-Android-Demo): An Android demo based on Open-IM-SDK-Android, available for developers to reference. -+ [Open-IM-Flutter-Demo](https://github.com/OpenIMSDK/Open-IM-Flutter-Demo): A Flutter demo based on Open-IM-SDK-Flutter, available for developers to reference. ++ [Open-IM-iOS-Demo](https://github.com/openimsdk/Open-IM-iOS-Demo): An iOS demo based on Open-IM-SDK-iOS, available for developers to reference. ++ [Open-IM-Android-Demo](https://github.com/openimsdk/Open-IM-Android-Demo): An Android demo based on Open-IM-SDK-Android, available for developers to reference. ++ [Open-IM-Flutter-Demo](https://github.com/openimsdk/Open-IM-Flutter-Demo): A Flutter demo based on Open-IM-SDK-Flutter, available for developers to reference. ## Used By -OpenIM is used by the following companies ,let's write it down in [ADOPTER](https://github.com/OpenIMSDK/community/blob/main/ADOPTERS.md). +OpenIM is used by the following companies ,let's write it down in [ADOPTER](https://github.com/openimsdk/community/blob/main/ADOPTERS.md). -Please leave your use cases in the comments [here](https://github.com/OpenIMSDK/Open-IM-Server/issues/379). +Please leave your use cases in the comments [here](https://github.com/openimsdk/Open-IM-Server/issues/379). ## License -[openim-sdk-core](https://github.com/OpenIMSDK/openim-sdk-core) is licensed under the Apache License, Version 2.0. See [LICENSE](https://github.com/OpenIMSDK/openim-sdk-core/tree/main/LICENSE) for the full license text. +[openim-sdk-core](https://github.com/openimsdk/openim-sdk-core) is licensed under the Apache License, Version 2.0. See [LICENSE](https://github.com/openimsdk/openim-sdk-core/tree/main/LICENSE) for the full license text. ## Thanks to our contributors! - + diff --git a/README_zh-CN.md b/README_zh-CN.md index a5bbfb2f6..3c7a22db4 100644 --- a/README_zh-CN.md +++ b/README_zh-CN.md @@ -8,11 +8,11 @@

-A+ -good first - +A+ +good first + - +

diff --git a/cmd/gordon_main.go b/cmd/gordon_main.go index 0d5349ec2..949e7a33b 100644 --- a/cmd/gordon_main.go +++ b/cmd/gordon_main.go @@ -18,11 +18,11 @@ import ( "context" "encoding/json" "errors" - "github.com/OpenIMSDK/tools/log" "github.com/openimsdk/openim-sdk-core/v3/pkg/network" "github.com/openimsdk/openim-sdk-core/v3/pkg/server_api_params" "github.com/openimsdk/openim-sdk-core/v3/pkg/utils" "github.com/openimsdk/openim-sdk-core/v3/test" + "github.com/openimsdk/tools/log" "time" ) diff --git a/cmd/press_open_im.go b/cmd/press_open_im.go index 5a8bf1e7d..bf52fc3a1 100644 --- a/cmd/press_open_im.go +++ b/cmd/press_open_im.go @@ -17,8 +17,8 @@ package main import ( "errors" "flag" - "github.com/OpenIMSDK/tools/log" "github.com/openimsdk/openim-sdk-core/v3/test" + "github.com/openimsdk/tools/log" ) func main() { diff --git a/cmd/reliability_open_im.go b/cmd/reliability_open_im.go index a670a036c..07a15d6fb 100644 --- a/cmd/reliability_open_im.go +++ b/cmd/reliability_open_im.go @@ -17,8 +17,8 @@ package main import ( "errors" "flag" - "github.com/OpenIMSDK/tools/log" "github.com/openimsdk/openim-sdk-core/v3/test" + "github.com/openimsdk/tools/log" ) func main() { diff --git a/cmd/sk_main.go b/cmd/sk_main.go index 18f7a7dab..b797984ac 100644 --- a/cmd/sk_main.go +++ b/cmd/sk_main.go @@ -16,10 +16,10 @@ package main import ( "errors" - "github.com/OpenIMSDK/tools/log" "github.com/openimsdk/openim-sdk-core/v3/pkg/db" "github.com/openimsdk/openim-sdk-core/v3/pkg/utils" "github.com/openimsdk/openim-sdk-core/v3/test" + "github.com/openimsdk/tools/log" "time" ) diff --git a/docs/contrib/git_workflow.md b/docs/contrib/git_workflow.md index 22b658464..3b97b9590 100644 --- a/docs/contrib/git_workflow.md +++ b/docs/contrib/git_workflow.md @@ -18,7 +18,7 @@ OpenIM project uses the [GitHub flow](https://docs.github.com/en/get-started/qui ### Branch naming conventions -Every forked repository works independently, meaning that any contributor can create branches with the name they see fit. However, it is worth noting that OpenIM mirrors [OpenIM version skew policy](https://github.com/OpenIMSDK/openim-sdk-core/releases) by maintaining release branches for the most recent three minor releases. The only exception is that the main branch mirrors the latest OpenIM release (3.10) instead of using a `release-` prefixed one. +Every forked repository works independently, meaning that any contributor can create branches with the name they see fit. However, it is worth noting that OpenIM mirrors [OpenIM version skew policy](https://github.com/openimsdk/openim-sdk-core/releases) by maintaining release branches for the most recent three minor releases. The only exception is that the main branch mirrors the latest OpenIM release (3.10) instead of using a `release-` prefixed one. ```text main -------------------------------------------. (OpenIM 3.10) @@ -39,7 +39,7 @@ There are everyday tasks related to git that every contributor needs to perform, Creating a OpenIM fork, cloning it, and setting its upstream remote can be summarized on: -1. Visit +1. Visit 2. Click the `Fork` button (top right) to establish a cloud-based fork 3. Clone fork to local storage 4. Add to your fork OpenIM remote as upstream @@ -54,7 +54,7 @@ git clone https://github.com/$user/OpenIM.git ## Add OpenIM as upstream to your fork cd OpenIM -git remote add upstream https://github.com/OpenIMSDK/openim-sdk-core.git +git remote add upstream https://github.com/openimsdk/openim-sdk-core.git # or: git remote add upstream git@github.com:OpenIMSDK/openim-sdk-core.git ## Ensure to never push to upstream directly diff --git a/go.mod b/go.mod index 4910a6146..2f25f6d3e 100644 --- a/go.mod +++ b/go.mod @@ -1,41 +1,43 @@ module github.com/openimsdk/openim-sdk-core/v3 -go 1.18 +go 1.21 + +toolchain go1.22.0 require ( - github.com/golang/protobuf v1.5.3 + github.com/golang/protobuf v1.5.4 github.com/gorilla/websocket v1.4.2 - github.com/jinzhu/copier v0.3.5 + github.com/jinzhu/copier v0.4.0 github.com/lestrrat-go/file-rotatelogs v2.4.0+incompatible // indirect github.com/pkg/errors v0.9.1 - google.golang.org/protobuf v1.31.0 // indirect - gorm.io/driver/sqlite v1.3.6 + google.golang.org/protobuf v1.33.0 // indirect + gorm.io/driver/sqlite v1.5.5 nhooyr.io/websocket v1.8.10 ) -require golang.org/x/net v0.19.0 +require golang.org/x/net v0.22.0 require ( - github.com/OpenIMSDK/protocol v0.0.45 - github.com/OpenIMSDK/tools v0.0.24 - github.com/google/go-cmp v0.5.9 + github.com/google/go-cmp v0.6.0 + github.com/openimsdk/protocol v0.0.66 + github.com/openimsdk/tools v0.0.49-alpha.9 github.com/patrickmn/go-cache v2.1.0+incompatible - golang.org/x/image v0.14.0 - gorm.io/gorm v1.23.8 + go.etcd.io/etcd/api/v3 v3.5.13 + golang.org/x/image v0.15.0 + gorm.io/gorm v1.25.10 ) require ( - github.com/bwmarrin/snowflake v0.3.0 // indirect + github.com/coreos/go-semver v0.3.0 // indirect github.com/jinzhu/inflection v1.0.0 // indirect github.com/jinzhu/now v1.1.5 // indirect github.com/lestrrat-go/strftime v1.0.6 // indirect - github.com/mattn/go-sqlite3 v1.14.12 // indirect - github.com/nfnt/resize v0.0.0-20180221191011-83c6a9932646 // indirect + github.com/mattn/go-sqlite3 v1.14.22 // indirect go.uber.org/atomic v1.7.0 // indirect go.uber.org/multierr v1.6.0 // indirect go.uber.org/zap v1.24.0 // indirect - golang.org/x/sys v0.15.0 // indirect + golang.org/x/sys v0.18.0 // indirect golang.org/x/text v0.14.0 // indirect - google.golang.org/genproto/googleapis/rpc v0.0.0-20230717213848-3f92550aa753 // indirect - google.golang.org/grpc v1.56.2 // indirect + google.golang.org/genproto/googleapis/rpc v0.0.0-20240318140521-94a12d6c2237 // indirect + google.golang.org/grpc v1.62.1 // indirect ) diff --git a/go.sum b/go.sum index d43e428d6..1af3a2f24 100644 --- a/go.sum +++ b/go.sum @@ -1,29 +1,25 @@ -github.com/OpenIMSDK/protocol v0.0.45 h1:0MxdGddw09k17xgR6Kn6ZLtcTrEosTCWXA/rhgSmbQQ= -github.com/OpenIMSDK/protocol v0.0.45/go.mod h1:F25dFrwrIx3lkNoiuf6FkCfxuwf8L4Z8UIsdTHP/r0Y= -github.com/OpenIMSDK/tools v0.0.24 h1:P8n7ZtsZEbm4W3dQAem29O+bigzy6YPXxFzd/D8Vh3U= -github.com/OpenIMSDK/tools v0.0.24/go.mod h1:eg+q4A34Qmu73xkY0mt37FHGMCMfC6CtmOnm0kFEGFI= github.com/benbjohnson/clock v1.1.0 h1:Q92kusRqC1XV2MjkWETPvjJVqKetz1OzxZB7mHJLju8= -github.com/bwmarrin/snowflake v0.3.0 h1:xm67bEhkKh6ij1790JB83OujPR5CzNe8QuQqAgISZN0= -github.com/bwmarrin/snowflake v0.3.0/go.mod h1:NdZxfVWX+oR6y2K0o6qAYv6gIOP9rjG0/E9WsDpxqwE= +github.com/benbjohnson/clock v1.1.0/go.mod h1:J11/hYXuz8f4ySSvYwY0FKfm+ezbsZBKZxNJlLklBHA= +github.com/coreos/go-semver v0.3.0 h1:wkHLiw0WNATZnSG7epLsujiMCgPAc9xhjJ4tgnAxmfM= +github.com/coreos/go-semver v0.3.0/go.mod h1:nnelYz7RCh+5ahJtPPxZlU+153eP4D4r3EedlOD2RNk= github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= -github.com/golang/protobuf v1.5.0/go.mod h1:FsONVRAS9T7sI+LIUmWTfcYkHO4aIWwzhcaSAoJOfIk= -github.com/golang/protobuf v1.5.3 h1:KhyjKVUg7Usr/dYsdSqoFveMYd5ko72D+zANwlG1mmg= -github.com/golang/protobuf v1.5.3/go.mod h1:XVQd3VNwM+JqD3oG2Ue2ip4fOMUkwXdXDdiuN0vRsmY= -github.com/google/go-cmp v0.5.5/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= -github.com/google/go-cmp v0.5.9 h1:O2Tfq5qg4qc4AmwVlvv0oLiVAGB7enBSJ2x2DqQFi38= -github.com/google/go-cmp v0.5.9/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY= +github.com/golang/protobuf v1.5.4 h1:i7eJL8qZTpSEXOPTxNKhASYpMn+8e5Q6AdndVa1dWek= +github.com/golang/protobuf v1.5.4/go.mod h1:lnTiLA8Wa4RWRcIUkrtSVa5nRhsEGBg48fD6rSs7xps= +github.com/google/go-cmp v0.6.0 h1:ofyhxvXcZhMsU5ulbFiLKl/XBFqE1GSq7atu8tAmTRI= +github.com/google/go-cmp v0.6.0/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY= github.com/gorilla/websocket v1.4.2 h1:+/TMaTYc4QFitKJxsQ7Yye35DkWvkdLcvGKqM+x0Ufc= github.com/gorilla/websocket v1.4.2/go.mod h1:YR8l580nyteQvAITg2hZ9XVh4b55+EU/adAjf1fMHhE= -github.com/jinzhu/copier v0.3.5 h1:GlvfUwHk62RokgqVNvYsku0TATCF7bAHVwEXoBh3iJg= -github.com/jinzhu/copier v0.3.5/go.mod h1:DfbEm0FYsaqBcKcFuvmOZb218JkPGtvSHsKg8S8hyyg= +github.com/jinzhu/copier v0.4.0 h1:w3ciUoD19shMCRargcpm0cm91ytaBhDvuRpz1ODO/U8= +github.com/jinzhu/copier v0.4.0/go.mod h1:DfbEm0FYsaqBcKcFuvmOZb218JkPGtvSHsKg8S8hyyg= github.com/jinzhu/inflection v1.0.0 h1:K317FqzuhWc8YvSVlFMCCUb36O/S9MCKRDI7QkRKD/E= github.com/jinzhu/inflection v1.0.0/go.mod h1:h+uFLlag+Qp1Va5pdKtLDYj+kHp5pxUVkryuEj+Srlc= github.com/jinzhu/now v1.1.4/go.mod h1:d3SSVoowX0Lcu0IBviAWJpolVfI5UJVZZ7cO71lE/z8= github.com/jinzhu/now v1.1.5 h1:/o9tlHleP7gOFmsnYNz3RGnqzefHA47wQpKrrdTIwXQ= github.com/jinzhu/now v1.1.5/go.mod h1:d3SSVoowX0Lcu0IBviAWJpolVfI5UJVZZ7cO71lE/z8= github.com/jonboulle/clockwork v0.4.0 h1:p4Cf1aMWXnXAUh8lVfewRBx1zaTSYKrKMF2g3ST4RZ4= +github.com/jonboulle/clockwork v0.4.0/go.mod h1:xgRqUGwRcjKCO1vbZUEtSLrqKoPSsUpK7fnezOII0kc= github.com/lestrrat-go/envload v0.0.0-20180220234015-a3eb8ddeffcc h1:RKf14vYWi2ttpEmkA4aQ3j4u9dStX2t4M8UM6qqNsG8= github.com/lestrrat-go/envload v0.0.0-20180220234015-a3eb8ddeffcc/go.mod h1:kopuH9ugFRkIXf3YoqHKyrJ9YfUFsckUU9S7B+XP+is= github.com/lestrrat-go/file-rotatelogs v2.4.0+incompatible h1:Y6sqxHMyB1D2YSzWkLibYKgg+SwmyFU9dF2hn6MdTj4= @@ -32,8 +28,12 @@ github.com/lestrrat-go/strftime v1.0.6 h1:CFGsDEt1pOpFNU+TJB0nhz9jl+K0hZSLE205Ah github.com/lestrrat-go/strftime v1.0.6/go.mod h1:f7jQKgV5nnJpYgdEasS+/y7EsTb8ykN2z68n3TtcTaw= github.com/mattn/go-sqlite3 v1.14.12 h1:TJ1bhYJPV44phC+IMu1u2K/i5RriLTPe+yc68XDJ1Z0= github.com/mattn/go-sqlite3 v1.14.12/go.mod h1:NyWgC/yNuGj7Q9rpYnZvas74GogHl5/Z4A/KQRfk6bU= -github.com/nfnt/resize v0.0.0-20180221191011-83c6a9932646 h1:zYyBkD/k9seD2A7fsi6Oo2LfFZAehjjQMERAvZLEDnQ= -github.com/nfnt/resize v0.0.0-20180221191011-83c6a9932646/go.mod h1:jpp1/29i3P1S/RLdc7JQKbRpFeM1dOBd8T9ki5s+AY8= +github.com/mattn/go-sqlite3 v1.14.22 h1:2gZY6PC6kBnID23Tichd1K+Z0oS6nE/XwU+Vz/5o4kU= +github.com/mattn/go-sqlite3 v1.14.22/go.mod h1:Uh1q+B4BYcTPb+yiD3kU8Ct7aC0hY9fxUwlHK0RXw+Y= +github.com/openimsdk/protocol v0.0.66 h1:AVYufQ+A7pQpemjaOtr62dwVa6Z2o6lN4d8erPch8NE= +github.com/openimsdk/protocol v0.0.66/go.mod h1:OZQA9FR55lseYoN2Ql1XAHYKHJGu7OMNkUbuekrKCM8= +github.com/openimsdk/tools v0.0.49-alpha.9 h1:yoa3GS6t0d1mRv/S86niFBGDgSjy2EWWwBI5NAH1Kgk= +github.com/openimsdk/tools v0.0.49-alpha.9/go.mod h1:g7mkHXYUPi0/8aAX8VPMHpnb3hqdV69Jph+bXOGvvNM= github.com/patrickmn/go-cache v2.1.0+incompatible h1:HRMgzkcYKYpi3C8ajMPV8OFXaaRUnok+kx1WdO15EQc= github.com/patrickmn/go-cache v2.1.0+incompatible/go.mod h1:3Qf8kWWT7OJRJbdiICTKqZju1ZixQ/KpMGzzAfe6+WQ= github.com/pkg/errors v0.9.1 h1:FEBLx1zS214owpjy7qsBeixbURkuhQAwrK5UwLGTwt4= @@ -42,36 +42,44 @@ github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZb github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI= -github.com/stretchr/testify v1.8.3 h1:RP3t2pwF7cMEbC1dqtB6poj3niw/9gnV4Cjg5oW5gtY= +github.com/stretchr/testify v1.8.4 h1:CcVxjf3Q8PM0mHUKJCdn+eZZtm5yQwehR5yeSVQQcUk= +github.com/stretchr/testify v1.8.4/go.mod h1:sz/lmYIOXD/1dqDmKjjqLyZ2RngseejIcXlSw2iwfAo= +go.etcd.io/etcd/api/v3 v3.5.13 h1:8WXU2/NBge6AUF1K1gOexB6e07NgsN1hXK0rSTtgSp4= +go.etcd.io/etcd/api/v3 v3.5.13/go.mod h1:gBqlqkcMMZMVTMm4NDZloEVJzxQOQIls8splbqBDa0c= go.uber.org/atomic v1.7.0 h1:ADUqmZGgLDDfbSL9ZmPxKTybcoEYHgpYfELNoN+7hsw= go.uber.org/atomic v1.7.0/go.mod h1:fEN4uk6kAWBTFdckzkM89CLk9XfWZrxpCo0nPH17wJc= go.uber.org/goleak v1.1.11 h1:wy28qYRKZgnJTxGxvye5/wgWr1EKjmUDGYox5mGlRlI= +go.uber.org/goleak v1.1.11/go.mod h1:cwTWslyiVhfpKIDGSZEM2HlOvcqm+tG4zioyIeLoqMQ= go.uber.org/multierr v1.6.0 h1:y6IPFStTAIT5Ytl7/XYmHvzXQ7S3g/IeZW9hyZ5thw4= go.uber.org/multierr v1.6.0/go.mod h1:cdWPpRnG4AhwMwsgIHip0KRBQjJy5kYEpYjJxpXp9iU= go.uber.org/zap v1.24.0 h1:FiJd5l1UOLj0wCgbSE0rwwXHzEdAZS6hiiSnxJN/D60= go.uber.org/zap v1.24.0/go.mod h1:2kMP+WWQ8aoFoedH3T2sq6iJ2yDWpHbP0f6MQbS9Gkg= -golang.org/x/image v0.14.0 h1:tNgSxAFe3jC4uYqvZdTr84SZoM1KfwdC9SKIFrLjFn4= -golang.org/x/image v0.14.0/go.mod h1:HUYqC05R2ZcZ3ejNQsIHQDQiwWM4JBqmm6MKANTp4LE= -golang.org/x/net v0.19.0 h1:zTwKpTd2XuCqf8huc7Fo2iSy+4RHPd10s4KzeTnVr1c= -golang.org/x/net v0.19.0/go.mod h1:CfAk/cbD4CthTvqiEl8NpboMuiuOYsAr/7NOjZJtv1U= -golang.org/x/sys v0.15.0 h1:h48lPFYpsTvQJZF4EKyI4aLHaev3CxivZmv7yZig9pc= -golang.org/x/sys v0.15.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= +golang.org/x/image v0.15.0 h1:kOELfmgrmJlw4Cdb7g/QGuB3CvDrXbqEIww/pNtNBm8= +golang.org/x/image v0.15.0/go.mod h1:HUYqC05R2ZcZ3ejNQsIHQDQiwWM4JBqmm6MKANTp4LE= +golang.org/x/net v0.22.0 h1:9sGLhx7iRIHEiX0oAJ3MRZMUCElJgy7Br1nO+AMN3Tc= +golang.org/x/net v0.22.0/go.mod h1:JKghWKKOSdJwpW2GEx0Ja7fmaKnMsbu+MWVZTokSYmg= +golang.org/x/sys v0.18.0 h1:DBdB3niSjOA/O0blCZBqDefyWNYveAYMNF1Wum0DYQ4= +golang.org/x/sys v0.18.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= golang.org/x/text v0.14.0 h1:ScX5w1eTa3QqT8oi6+ziP7dTV1S2+ALU0bI+0zXKWiQ= golang.org/x/text v0.14.0/go.mod h1:18ZOQIKpY8NJVqYksKHtTdi31H5itFRjB5/qKTNYzSU= -golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= -google.golang.org/genproto/googleapis/rpc v0.0.0-20230717213848-3f92550aa753 h1:XUODHrpzJEUeWmVo/jfNTLj0YyVveOo28oE6vkFbkO4= -google.golang.org/genproto/googleapis/rpc v0.0.0-20230717213848-3f92550aa753/go.mod h1:TUfxEVdsvPg18p6AslUXFoLdpED4oBnGwyqk3dV1XzM= -google.golang.org/grpc v1.56.2 h1:fVRFRnXvU+x6C4IlHZewvJOVHoOv1TUuQyoRsYnB4bI= -google.golang.org/grpc v1.56.2/go.mod h1:I9bI3vqKfayGqPUAwGdOSu7kt6oIJLixfffKrpXqQ9s= -google.golang.org/protobuf v1.26.0-rc.1/go.mod h1:jlhhOSvTdKEhbULTjvd4ARK9grFBp09yW+WbY/TyQbw= -google.golang.org/protobuf v1.26.0/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc= -google.golang.org/protobuf v1.31.0 h1:g0LDEJHgrBl9N9r17Ru3sqWhkIx2NB67okBHPwC7hs8= -google.golang.org/protobuf v1.31.0/go.mod h1:HV8QOd/L58Z+nl8r43ehVNZIU/HEI6OcFqwMG9pJV4I= +google.golang.org/genproto/googleapis/rpc v0.0.0-20240318140521-94a12d6c2237 h1:NnYq6UN9ReLM9/Y01KWNOWyI5xQ9kbIms5GGJVwS/Yc= +google.golang.org/genproto/googleapis/rpc v0.0.0-20240318140521-94a12d6c2237/go.mod h1:WtryC6hu0hhx87FDGxWCDptyssuo68sk10vYjF+T9fY= +google.golang.org/grpc v1.62.1 h1:B4n+nfKzOICUXMgyrNd19h/I9oH0L1pizfk1d4zSgTk= +google.golang.org/grpc v1.62.1/go.mod h1:IWTG0VlJLCh1SkC58F7np9ka9mx/WNkjl4PGJaiq+QE= +google.golang.org/protobuf v1.33.0 h1:uNO2rsAINq/JlFpSdYEKIZ0uKD/R9cpdv0T+yoGwGmI= +google.golang.org/protobuf v1.33.0/go.mod h1:c6P6GXX6sHbq/GpV6MGZEdwhWPcYBgnhAHhKbcUYpos= +gopkg.in/yaml.v2 v2.4.0 h1:D8xgwECY7CYvx+Y2n4sBz93Jn9JRvxdiyyo8CTfuKaY= +gopkg.in/yaml.v2 v2.4.0/go.mod h1:RDklbk79AGWmwhnvt/jBztapEOGDOx6ZbXqjP6csGnQ= gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= +gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= gorm.io/driver/sqlite v1.3.6 h1:Fi8xNYCUplOqWiPa3/GuCeowRNBRGTf62DEmhMDHeQQ= gorm.io/driver/sqlite v1.3.6/go.mod h1:Sg1/pvnKtbQ7jLXxfZa+jSHvoX8hoZA8cn4xllOMTgE= +gorm.io/driver/sqlite v1.5.5 h1:7MDMtUZhV065SilG62E0MquljeArQZNfJnjd9i9gx3E= +gorm.io/driver/sqlite v1.5.5/go.mod h1:6NgQ7sQWAIFsPrJJl1lSNSu2TABh0ZZ/zm5fosATavE= gorm.io/gorm v1.23.4/go.mod h1:l2lP/RyAtc1ynaTjFksBde/O8v9oOGIApu2/xRitmZk= -gorm.io/gorm v1.23.8 h1:h8sGJ+biDgBA1AD1Ha9gFCx7h8npU7AsLdlkX0n2TpE= -gorm.io/gorm v1.23.8/go.mod h1:l2lP/RyAtc1ynaTjFksBde/O8v9oOGIApu2/xRitmZk= +gorm.io/gorm v1.25.8 h1:WAGEZ/aEcznN4D03laj8DKnehe1e9gYQAjW8xyPRdeo= +gorm.io/gorm v1.25.8/go.mod h1:hbnx/Oo0ChWMn1BIhpy1oYozzpM15i4YPuHDmfYtwg8= +gorm.io/gorm v1.25.10 h1:dQpO+33KalOA+aFYGlK+EfxcI5MbO7EP2yYygwh9h+s= +gorm.io/gorm v1.25.10/go.mod h1:hbnx/Oo0ChWMn1BIhpy1oYozzpM15i4YPuHDmfYtwg8= nhooyr.io/websocket v1.8.10 h1:mv4p+MnGrLDcPlBoWsvPP7XCzTYMXP9F9eIGoKbgx7Q= nhooyr.io/websocket v1.8.10/go.mod h1:rN9OFWIUwuxg4fR5tELlYC04bXYowCP9GX47ivo2l+c= diff --git a/internal/business/business.go b/internal/business/business.go index 614f6a7b4..ecc02cec9 100644 --- a/internal/business/business.go +++ b/internal/business/business.go @@ -21,9 +21,9 @@ import ( "github.com/openimsdk/openim-sdk-core/v3/pkg/utils" "github.com/openimsdk/openim-sdk-core/v3/sdk_struct" - "github.com/OpenIMSDK/protocol/sdkws" + "github.com/openimsdk/protocol/sdkws" - "github.com/OpenIMSDK/tools/log" + "github.com/openimsdk/tools/log" ) type Business struct { diff --git a/internal/common/common.go b/internal/common/common.go index 17da2935d..76250b5c0 100644 --- a/internal/common/common.go +++ b/internal/common/common.go @@ -17,8 +17,8 @@ package common import ( "github.com/openimsdk/openim-sdk-core/v3/pkg/utils" - "github.com/OpenIMSDK/protocol/sdkws" "github.com/golang/protobuf/proto" + "github.com/openimsdk/protocol/sdkws" ) func UnmarshalTips(msg *sdkws.MsgData, detail proto.Message) error { diff --git a/internal/conversation_msg/conversation.go b/internal/conversation_msg/conversation.go index e949b4228..8fbbd1d20 100644 --- a/internal/conversation_msg/conversation.go +++ b/internal/conversation_msg/conversation.go @@ -33,12 +33,12 @@ import ( "github.com/jinzhu/copier" - "github.com/OpenIMSDK/tools/log" + "github.com/openimsdk/tools/log" - "github.com/OpenIMSDK/protocol/msg" - "github.com/OpenIMSDK/protocol/sdkws" + "github.com/openimsdk/protocol/msg" + "github.com/openimsdk/protocol/sdkws" - pbConversation "github.com/OpenIMSDK/protocol/conversation" + pbConversation "github.com/openimsdk/protocol/conversation" ) func (c *Conversation) setConversation(ctx context.Context, apiReq *pbConversation.SetConversationsReq, localConversation *model_struct.LocalConversation) error { diff --git a/internal/conversation_msg/conversation_msg.go b/internal/conversation_msg/conversation_msg.go index b5b876b12..fbfbd5481 100644 --- a/internal/conversation_msg/conversation_msg.go +++ b/internal/conversation_msg/conversation_msg.go @@ -18,8 +18,6 @@ import ( "context" "encoding/json" "errors" - "github.com/OpenIMSDK/tools/log" - utils2 "github.com/OpenIMSDK/tools/utils" "github.com/openimsdk/openim-sdk-core/v3/internal/business" "github.com/openimsdk/openim-sdk-core/v3/internal/cache" "github.com/openimsdk/openim-sdk-core/v3/internal/file" @@ -37,6 +35,8 @@ import ( sdk "github.com/openimsdk/openim-sdk-core/v3/pkg/sdk_params_callback" "github.com/openimsdk/openim-sdk-core/v3/pkg/sdkerrs" "github.com/openimsdk/openim-sdk-core/v3/pkg/syncer" + "github.com/openimsdk/tools/log" + "github.com/openimsdk/tools/utils/datautil" "github.com/openimsdk/openim-sdk-core/v3/pkg/utils" "github.com/openimsdk/openim-sdk-core/v3/sdk_struct" @@ -992,7 +992,7 @@ func (c *Conversation) batchGetUserNameAndFaceURL(ctx context.Context, userIDs . log.ZWarn(ctx, "BatchGetUserNameAndFaceURL", err, "userIDs", userIDs) notInFriend = userIDs } else { - notInFriend = utils2.SliceSub(userIDs, utils2.Slice(friendList, func(e *model_struct.LocalFriend) string { + notInFriend = datautil.SliceSub(userIDs, datautil.Slice(friendList, func(e *model_struct.LocalFriend) string { return e.FriendUserID })) } @@ -1049,7 +1049,7 @@ func (c *Conversation) getUserNameAndFaceURL(ctx context.Context, userID string) return "", "", err } if len(users) == 0 { - return "", "", sdkerrs.ErrUserIDNotFound.Wrap(userID) + return "", "", sdkerrs.ErrUserIDNotFound.WrapMsg(userID) } c.user.UserBasicCache.Store(userID, &user.BasicInfo{FaceURL: users[0].FaceURL, Nickname: users[0].Nickname}) return users[0].FaceURL, users[0].Nickname, nil diff --git a/internal/conversation_msg/conversation_notification.go b/internal/conversation_msg/conversation_notification.go index 2c7738bd0..a8c4e9e30 100644 --- a/internal/conversation_msg/conversation_notification.go +++ b/internal/conversation_msg/conversation_notification.go @@ -22,11 +22,11 @@ import ( "github.com/openimsdk/openim-sdk-core/v3/pkg/db/model_struct" "github.com/openimsdk/openim-sdk-core/v3/pkg/utils" "github.com/openimsdk/openim-sdk-core/v3/sdk_struct" + "github.com/openimsdk/tools/utils/datautil" "time" - "github.com/OpenIMSDK/protocol/sdkws" - "github.com/OpenIMSDK/tools/log" - utils2 "github.com/OpenIMSDK/tools/utils" + "github.com/openimsdk/protocol/sdkws" + "github.com/openimsdk/tools/log" ) func (c *Conversation) Work(c2v common.Cmd2Value) { @@ -680,7 +680,7 @@ func (c *Conversation) doNotificationNew(c2v common.Cmd2Value) { c.friend.DoNotification(ctx, v) } else if v.ContentType > constant.UserNotificationBegin && v.ContentType < constant.UserNotificationEnd { c.user.DoNotification(ctx, v) - } else if utils2.Contain(v.ContentType, constant.GroupApplicationRejectedNotification, constant.GroupApplicationAcceptedNotification, constant.JoinGroupApplicationNotification) { + } else if datautil.Contain(v.ContentType, constant.GroupApplicationRejectedNotification, constant.GroupApplicationAcceptedNotification, constant.JoinGroupApplicationNotification) { c.group.DoNotification(ctx, v) } else if v.ContentType > constant.SignalingNotificationBegin && v.ContentType < constant.SignalingNotificationEnd { diff --git a/internal/conversation_msg/convert.go b/internal/conversation_msg/convert.go index 535924086..78180d430 100644 --- a/internal/conversation_msg/convert.go +++ b/internal/conversation_msg/convert.go @@ -17,7 +17,7 @@ package conversation_msg import ( "github.com/openimsdk/openim-sdk-core/v3/pkg/db/model_struct" - pbConversation "github.com/OpenIMSDK/protocol/conversation" + pbConversation "github.com/openimsdk/protocol/conversation" ) func ServerConversationToLocal(conversation *pbConversation.Conversation) *model_struct.LocalConversation { diff --git a/internal/conversation_msg/create_message.go b/internal/conversation_msg/create_message.go index db06d2fd9..ace457bea 100644 --- a/internal/conversation_msg/create_message.go +++ b/internal/conversation_msg/create_message.go @@ -17,8 +17,8 @@ package conversation_msg import ( "context" "errors" - "github.com/OpenIMSDK/tools/log" "github.com/openimsdk/openim-sdk-core/v3/pkg/constant" + "github.com/openimsdk/tools/log" "github.com/openimsdk/openim-sdk-core/v3/pkg/sdkerrs" "github.com/openimsdk/openim-sdk-core/v3/pkg/utils" diff --git a/internal/conversation_msg/delete.go b/internal/conversation_msg/delete.go index 982efc987..8cfa3e22c 100644 --- a/internal/conversation_msg/delete.go +++ b/internal/conversation_msg/delete.go @@ -24,10 +24,10 @@ import ( "github.com/openimsdk/openim-sdk-core/v3/pkg/utils" "github.com/openimsdk/openim-sdk-core/v3/sdk_struct" - pbMsg "github.com/OpenIMSDK/protocol/msg" - "github.com/OpenIMSDK/protocol/sdkws" - "github.com/OpenIMSDK/tools/log" "github.com/jinzhu/copier" + pbMsg "github.com/openimsdk/protocol/msg" + "github.com/openimsdk/protocol/sdkws" + "github.com/openimsdk/tools/log" ) // Delete the local and server diff --git a/internal/conversation_msg/entering.go b/internal/conversation_msg/entering.go index 2b0ecd299..5db1055e4 100644 --- a/internal/conversation_msg/entering.go +++ b/internal/conversation_msg/entering.go @@ -3,15 +3,15 @@ package conversation_msg import ( "context" "encoding/json" - "github.com/OpenIMSDK/protocol/sdkws" - "github.com/OpenIMSDK/tools/errs" - "github.com/OpenIMSDK/tools/log" - utils2 "github.com/OpenIMSDK/tools/utils" "github.com/jinzhu/copier" "github.com/openimsdk/openim-sdk-core/v3/pkg/constant" "github.com/openimsdk/openim-sdk-core/v3/pkg/db/model_struct" "github.com/openimsdk/openim-sdk-core/v3/pkg/utils" "github.com/openimsdk/openim-sdk-core/v3/sdk_struct" + "github.com/openimsdk/protocol/sdkws" + "github.com/openimsdk/tools/errs" + "github.com/openimsdk/tools/log" + "github.com/openimsdk/tools/utils/datautil" "github.com/patrickmn/go-cache" "time" ) @@ -40,7 +40,7 @@ func newTyping(c *Conversation) *typing { e.platformIDSet[int32(id)] = struct{}{} e.platformIDs = append(e.platformIDs, int32(id)) } - utils2.Sort(e.platformIDs, true) + datautil.Sort(e.platformIDs, true) e.state.OnEvicted(func(key string, val interface{}) { var data inputStatesKey if err := json.Unmarshal([]byte(key), &data); err != nil { @@ -63,7 +63,7 @@ type typing struct { func (e *typing) ChangeInputStates(ctx context.Context, conversationID string, focus bool) error { if conversationID == "" { - return errs.ErrArgs.Wrap("conversationID can't be empty") + return errs.ErrArgs.WrapMsg("conversationID can't be empty") } conversation, err := e.conv.db.GetConversation(ctx, conversationID) if err != nil { diff --git a/internal/conversation_msg/image.go b/internal/conversation_msg/image.go index 4f87bb6f9..309776486 100644 --- a/internal/conversation_msg/image.go +++ b/internal/conversation_msg/image.go @@ -1,8 +1,8 @@ package conversation_msg import ( - "github.com/OpenIMSDK/tools/errs" "github.com/openimsdk/openim-sdk-core/v3/sdk_struct" + "github.com/openimsdk/tools/errs" _ "golang.org/x/image/bmp" _ "golang.org/x/image/tiff" _ "golang.org/x/image/webp" @@ -16,7 +16,7 @@ import ( func getImageInfo(filePath string) (*sdk_struct.ImageInfo, error) { file, err := os.Open(filePath) if err != nil { - return nil, errs.Wrap(err, "image file open err") + return nil, errs.WrapMsg(err, "image file open err") } defer file.Close() info, err := file.Stat() @@ -25,7 +25,7 @@ func getImageInfo(filePath string) (*sdk_struct.ImageInfo, error) { } img, format, err := image.Decode(file) if err != nil { - return nil, errs.Wrap(err, "image file decode err") + return nil, errs.WrapMsg(err, "image file decode err") } size := img.Bounds().Max return &sdk_struct.ImageInfo{Width: int32(size.X), Height: int32(size.Y), Type: "image/" + format, Size: info.Size()}, nil diff --git a/internal/conversation_msg/message_check.go b/internal/conversation_msg/message_check.go index aa5cf086a..3dd820825 100644 --- a/internal/conversation_msg/message_check.go +++ b/internal/conversation_msg/message_check.go @@ -21,11 +21,11 @@ import ( "github.com/openimsdk/openim-sdk-core/v3/pkg/db/model_struct" sdk "github.com/openimsdk/openim-sdk-core/v3/pkg/sdk_params_callback" "github.com/openimsdk/openim-sdk-core/v3/pkg/utils" + "github.com/openimsdk/tools/utils/datautil" - "github.com/OpenIMSDK/tools/log" + "github.com/openimsdk/tools/log" - "github.com/OpenIMSDK/protocol/sdkws" - utils2 "github.com/OpenIMSDK/tools/utils" + "github.com/openimsdk/protocol/sdkws" ) // 检测其内部连续性,如果不连续,则向前补齐,获取这一组消息的最大最小seq,以及需要补齐的seq列表长度 @@ -326,14 +326,14 @@ func (c *Conversation) singleHandle(ctx context.Context, self, others []*model_s } func (c *Conversation) groupHandle(ctx context.Context, self, others []*model_struct.LocalChatLog, lc *model_struct.LocalConversation) { allMessage := append(self, others...) - localGroupMemberInfo, err := c.group.GetSpecifiedGroupMembersInfo(ctx, lc.GroupID, utils2.Slice(allMessage, func(e *model_struct.LocalChatLog) string { + localGroupMemberInfo, err := c.group.GetSpecifiedGroupMembersInfo(ctx, lc.GroupID, datautil.Slice(allMessage, func(e *model_struct.LocalChatLog) string { return e.SendID })) if err != nil { log.ZError(ctx, "get group member info err", err) return } - groupMap := utils2.SliceToMap(localGroupMemberInfo, func(e *model_struct.LocalGroupMember) string { + groupMap := datautil.SliceToMap(localGroupMemberInfo, func(e *model_struct.LocalGroupMember) string { return e.UserID }) for _, chatLog := range allMessage { diff --git a/internal/conversation_msg/message_controller.go b/internal/conversation_msg/message_controller.go index 6d5195957..59678a3fb 100644 --- a/internal/conversation_msg/message_controller.go +++ b/internal/conversation_msg/message_controller.go @@ -25,8 +25,8 @@ import ( "github.com/openimsdk/openim-sdk-core/v3/pkg/utils" "github.com/openimsdk/openim-sdk-core/v3/sdk_struct" - "github.com/OpenIMSDK/protocol/sdkws" - "github.com/OpenIMSDK/tools/log" + "github.com/openimsdk/protocol/sdkws" + "github.com/openimsdk/tools/log" ) type MessageController struct { diff --git a/internal/conversation_msg/progress.go b/internal/conversation_msg/progress.go index dddc894d2..c19798231 100644 --- a/internal/conversation_msg/progress.go +++ b/internal/conversation_msg/progress.go @@ -21,7 +21,7 @@ import ( "github.com/openimsdk/openim-sdk-core/v3/pkg/db/db_interface" "github.com/openimsdk/openim-sdk-core/v3/sdk_struct" - "github.com/OpenIMSDK/tools/log" + "github.com/openimsdk/tools/log" ) func NewUploadFileCallback(ctx context.Context, progress func(progress int), msg *sdk_struct.MsgStruct, conversationID string, db db_interface.DataBase) file.UploadFileCallback { diff --git a/internal/conversation_msg/read_drawing.go b/internal/conversation_msg/read_drawing.go index 61ff561c0..6b96d3147 100644 --- a/internal/conversation_msg/read_drawing.go +++ b/internal/conversation_msg/read_drawing.go @@ -18,7 +18,6 @@ import ( "context" "encoding/json" "errors" - utils2 "github.com/OpenIMSDK/tools/utils" "github.com/openimsdk/openim-sdk-core/v3/internal/util" "github.com/openimsdk/openim-sdk-core/v3/pkg/common" "github.com/openimsdk/openim-sdk-core/v3/pkg/constant" @@ -26,10 +25,11 @@ import ( "github.com/openimsdk/openim-sdk-core/v3/pkg/sdkerrs" "github.com/openimsdk/openim-sdk-core/v3/pkg/utils" "github.com/openimsdk/openim-sdk-core/v3/sdk_struct" + "github.com/openimsdk/tools/utils/datautil" - pbMsg "github.com/OpenIMSDK/protocol/msg" - "github.com/OpenIMSDK/protocol/sdkws" - "github.com/OpenIMSDK/tools/log" + pbMsg "github.com/openimsdk/protocol/msg" + "github.com/openimsdk/protocol/sdkws" + "github.com/openimsdk/tools/log" ) func (c *Conversation) markMsgAsRead2Svr(ctx context.Context, conversationID string, seqs []int64) error { @@ -209,7 +209,7 @@ func (c *Conversation) doUnreadCount(ctx context.Context, conversation *model_st if err := json.Unmarshal([]byte(conversation.LatestMsg), latestMsg); err != nil { log.ZError(ctx, "Unmarshal err", err, "conversationID", conversation.ConversationID, "latestMsg", conversation.LatestMsg) } - if (!latestMsg.IsRead) && utils2.Contain(latestMsg.Seq, seqs...) { + if (!latestMsg.IsRead) && datautil.Contain(latestMsg.Seq, seqs...) { latestMsg.IsRead = true conversation.LatestMsg = utils.StructToJsonString(&latestMsg) _ = common.TriggerCmdUpdateConversation(ctx, common.UpdateConNode{ConID: conversation.ConversationID, Action: constant.AddConOrUpLatMsg, Args: *conversation}, c.GetCh()) diff --git a/internal/conversation_msg/revoke.go b/internal/conversation_msg/revoke.go index 5e5a3b192..d2743a394 100644 --- a/internal/conversation_msg/revoke.go +++ b/internal/conversation_msg/revoke.go @@ -23,12 +23,12 @@ import ( "github.com/openimsdk/openim-sdk-core/v3/pkg/db/model_struct" "github.com/openimsdk/openim-sdk-core/v3/pkg/utils" "github.com/openimsdk/openim-sdk-core/v3/sdk_struct" + "github.com/openimsdk/tools/utils/timeutil" - pbMsg "github.com/OpenIMSDK/protocol/msg" - "github.com/OpenIMSDK/protocol/sdkws" - "github.com/OpenIMSDK/tools/log" - utils2 "github.com/OpenIMSDK/tools/utils" "github.com/jinzhu/copier" + pbMsg "github.com/openimsdk/protocol/msg" + "github.com/openimsdk/protocol/sdkws" + "github.com/openimsdk/tools/log" ) func (c *Conversation) doRevokeMsg(ctx context.Context, msg *sdkws.MsgData) { @@ -195,7 +195,7 @@ func (c *Conversation) revokeOneMessage(ctx context.Context, conversationID, cli ConversationID: conversationID, Seq: message.Seq, RevokerUserID: c.loginUserID, - RevokeTime: utils2.GetCurrentTimestampBySecond(), + RevokeTime: timeutil.GetCurrentTimestampBySecond(), SesstionType: conversation.ConversationType, ClientMsgID: clientMsgID, }) diff --git a/internal/conversation_msg/sdk.go b/internal/conversation_msg/sdk.go index 59b535b2f..cb0d06288 100644 --- a/internal/conversation_msg/sdk.go +++ b/internal/conversation_msg/sdk.go @@ -36,11 +36,11 @@ import ( "sync" "time" - "github.com/OpenIMSDK/tools/log" + "github.com/openimsdk/tools/log" - pbConversation "github.com/OpenIMSDK/protocol/conversation" - "github.com/OpenIMSDK/protocol/sdkws" - "github.com/OpenIMSDK/protocol/wrapperspb" + pbConversation "github.com/openimsdk/protocol/conversation" + "github.com/openimsdk/protocol/sdkws" + "github.com/openimsdk/protocol/wrapperspb" "github.com/jinzhu/copier" ) @@ -1107,7 +1107,7 @@ func (c *Conversation) GetMessageListReactionExtensions(ctx context.Context, con func (c *Conversation) SearchConversation(ctx context.Context, searchParam string) ([]*server_api_params.Conversation, error) { // Check if search parameter is empty if searchParam == "" { - return nil, sdkerrs.ErrArgs.Wrap("search parameter cannot be empty") + return nil, sdkerrs.ErrArgs.WrapMsg("search parameter cannot be empty") } // Perform the search in your database or data source diff --git a/internal/conversation_msg/sync.go b/internal/conversation_msg/sync.go index ca8ec86d6..b2a289605 100644 --- a/internal/conversation_msg/sync.go +++ b/internal/conversation_msg/sync.go @@ -16,14 +16,14 @@ package conversation_msg import ( "context" - utils2 "github.com/OpenIMSDK/tools/utils" "github.com/openimsdk/openim-sdk-core/v3/pkg/common" "github.com/openimsdk/openim-sdk-core/v3/pkg/constant" "github.com/openimsdk/openim-sdk-core/v3/pkg/db/model_struct" "github.com/openimsdk/openim-sdk-core/v3/pkg/syncer" + "github.com/openimsdk/tools/utils/datautil" "time" - "github.com/OpenIMSDK/tools/log" + "github.com/openimsdk/tools/log" ) func (c *Conversation) SyncConversationsAndTriggerCallback(ctx context.Context, conversationsOnServer []*model_struct.LocalConversation) error { @@ -80,7 +80,7 @@ func (c *Conversation) SyncAllConversationHashReadSeqs(ctx context.Context) erro log.ZWarn(ctx, "get all conversations err", err) return err } - conversationsOnLocalMap := utils2.SliceToMap(conversationsOnLocal, func(e *model_struct.LocalConversation) string { + conversationsOnLocalMap := datautil.SliceToMap(conversationsOnLocal, func(e *model_struct.LocalConversation) string { return e.ConversationID }) for conversationID, v := range seqs { diff --git a/internal/file/upload.go b/internal/file/upload.go index b693a4ad0..4c9714e4d 100644 --- a/internal/file/upload.go +++ b/internal/file/upload.go @@ -21,11 +21,11 @@ import ( "encoding/hex" "errors" "fmt" - "github.com/OpenIMSDK/tools/errs" "github.com/openimsdk/openim-sdk-core/v3/internal/util" "github.com/openimsdk/openim-sdk-core/v3/pkg/constant" "github.com/openimsdk/openim-sdk-core/v3/pkg/db/db_interface" "github.com/openimsdk/openim-sdk-core/v3/pkg/db/model_struct" + "github.com/openimsdk/tools/errs" "io" "net/http" "net/url" @@ -34,8 +34,8 @@ import ( "sync/atomic" "time" - "github.com/OpenIMSDK/protocol/third" - "github.com/OpenIMSDK/tools/log" + "github.com/openimsdk/protocol/third" + "github.com/openimsdk/tools/log" ) type UploadFileReq struct { @@ -247,7 +247,7 @@ func (f *File) initiateMultipartUploadResp(ctx context.Context, req *third.Initi func (f *File) authSign(ctx context.Context, req *third.AuthSignReq) (*third.AuthSignResp, error) { if len(req.PartNumbers) == 0 { - return nil, errs.ErrArgs.Wrap("partNumbers is empty") + return nil, errs.ErrArgs.WrapMsg("partNumbers is empty") } return util.CallApi[third.AuthSignResp](ctx, constant.ObjectAuthSign, req) } @@ -412,7 +412,7 @@ func (u *UploadInfo) GetPartSign(ctx context.Context, partNumber int32) (*url.UR u.CreateTime = time.Now() index := u.getIndex(partNumber) if index < 0 { - return nil, nil, errs.ErrInternalServer.Wrap("server part sign invalid") + return nil, nil, errs.ErrInternalServer.WrapMsg("server part sign invalid") } return u.buildRequest(index) } diff --git a/internal/friend/conversion.go b/internal/friend/conversion.go index 52687e94f..0917f76cd 100644 --- a/internal/friend/conversion.go +++ b/internal/friend/conversion.go @@ -17,7 +17,7 @@ package friend import ( "github.com/openimsdk/openim-sdk-core/v3/pkg/db/model_struct" - "github.com/OpenIMSDK/protocol/sdkws" + "github.com/openimsdk/protocol/sdkws" ) func ServerFriendRequestToLocalFriendRequest(info *sdkws.FriendRequest) *model_struct.LocalFriendRequest { diff --git a/internal/friend/friend.go b/internal/friend/friend.go index 6c4056ad4..5aa850678 100644 --- a/internal/friend/friend.go +++ b/internal/friend/friend.go @@ -26,8 +26,8 @@ import ( "github.com/openimsdk/openim-sdk-core/v3/pkg/syncer" "github.com/openimsdk/openim-sdk-core/v3/pkg/utils" - "github.com/OpenIMSDK/protocol/sdkws" - "github.com/OpenIMSDK/tools/log" + "github.com/openimsdk/protocol/sdkws" + "github.com/openimsdk/tools/log" ) func NewFriend(loginUserID string, db db_interface.DataBase, user *user.User, conversationCh chan common.Cmd2Value) *Friend { diff --git a/internal/friend/sdk.go b/internal/friend/sdk.go index d1fd837a3..fcf345cf5 100644 --- a/internal/friend/sdk.go +++ b/internal/friend/sdk.go @@ -16,17 +16,17 @@ package friend import ( "context" - "github.com/OpenIMSDK/protocol/wrapperspb" - "github.com/OpenIMSDK/tools/errs" "github.com/openimsdk/openim-sdk-core/v3/internal/util" "github.com/openimsdk/openim-sdk-core/v3/pkg/constant" "github.com/openimsdk/openim-sdk-core/v3/pkg/db/model_struct" sdk "github.com/openimsdk/openim-sdk-core/v3/pkg/sdk_params_callback" "github.com/openimsdk/openim-sdk-core/v3/pkg/sdkerrs" "github.com/openimsdk/openim-sdk-core/v3/pkg/server_api_params" + "github.com/openimsdk/protocol/wrapperspb" + "github.com/openimsdk/tools/errs" - "github.com/OpenIMSDK/protocol/friend" - "github.com/OpenIMSDK/tools/log" + "github.com/openimsdk/protocol/friend" + "github.com/openimsdk/tools/log" ) func (f *Friend) GetSpecifiedFriendsInfo(ctx context.Context, friendUserIDList []string) ([]*server_api_params.FullUserInfo, error) { @@ -190,7 +190,7 @@ func (f *Friend) GetFriendListPage(ctx context.Context, offset, count int32) ([] func (f *Friend) SearchFriends(ctx context.Context, param *sdk.SearchFriendsParam) ([]*sdk.SearchFriendItem, error) { if len(param.KeywordList) == 0 || (!param.IsSearchNickname && !param.IsSearchUserID && !param.IsSearchRemark) { - return nil, sdkerrs.ErrArgs.Wrap("keyword is null or search field all false") + return nil, sdkerrs.ErrArgs.WrapMsg("keyword is null or search field all false") } localFriendList, err := f.db.SearchFriendList(ctx, param.KeywordList[0], param.IsSearchUserID, param.IsSearchNickname, param.IsSearchRemark) if err != nil { @@ -259,7 +259,7 @@ func (f *Friend) SetFriendsEx(ctx context.Context, friendIDs []string, ex string // Check if the specified ID is a friend friendResults, err := f.CheckFriend(ctx, friendIDs) if err != nil { - return errs.Wrap(err, "Error checking friend status") + return errs.WrapMsg(err, "Error checking friend status") } // Determine if friendID is indeed a friend @@ -277,7 +277,7 @@ func (f *Friend) SetFriendsEx(ctx context.Context, friendIDs []string, ex string // If this friendID is not a friend, return an error if !isFriend { - return errs.ErrRecordNotFound.Wrap("Not friend") + return errs.ErrRecordNotFound.WrapMsg("Not friend") } } @@ -286,7 +286,7 @@ func (f *Friend) SetFriendsEx(ctx context.Context, friendIDs []string, ex string updateErr := f.db.UpdateColumnsFriend(ctx, friendIDs, map[string]interface{}{"Ex": ex}) if updateErr != nil { - return errs.Wrap(updateErr, "Error updating friend information") + return errs.WrapMsg(updateErr, "Error updating friend information") } return nil } diff --git a/internal/friend/sync.go b/internal/friend/sync.go index 87a009af0..7e24a025d 100644 --- a/internal/friend/sync.go +++ b/internal/friend/sync.go @@ -20,9 +20,9 @@ import ( "github.com/openimsdk/openim-sdk-core/v3/pkg/constant" "github.com/openimsdk/openim-sdk-core/v3/pkg/sdkerrs" - "github.com/OpenIMSDK/protocol/friend" - "github.com/OpenIMSDK/protocol/sdkws" - "github.com/OpenIMSDK/tools/log" + "github.com/openimsdk/protocol/friend" + "github.com/openimsdk/protocol/sdkws" + "github.com/openimsdk/tools/log" ) func (f *Friend) SyncBothFriendRequest(ctx context.Context, fromUserID, toUserID string) error { @@ -95,7 +95,7 @@ func (f *Friend) deleteFriend(ctx context.Context, friendUserID string) error { return err } if len(friends) == 0 { - return sdkerrs.ErrUserIDNotFound.Wrap("friendUserID not found") + return sdkerrs.ErrUserIDNotFound.WrapMsg("friendUserID not found") } if err := f.db.DeleteFriendDB(ctx, friendUserID); err != nil { return err diff --git a/internal/full/open_im_sdk_full.go b/internal/full/open_im_sdk_full.go index 5af5471dd..ca26b5d6a 100644 --- a/internal/full/open_im_sdk_full.go +++ b/internal/full/open_im_sdk_full.go @@ -16,12 +16,12 @@ package full import ( "context" - "github.com/OpenIMSDK/protocol/sdkws" - "github.com/OpenIMSDK/tools/log" "github.com/openimsdk/openim-sdk-core/v3/pkg/common" "github.com/openimsdk/openim-sdk-core/v3/pkg/constant" "github.com/openimsdk/openim-sdk-core/v3/pkg/db/model_struct" api "github.com/openimsdk/openim-sdk-core/v3/pkg/server_api_params" + "github.com/openimsdk/protocol/sdkws" + "github.com/openimsdk/tools/log" ) func (u *Full) GetUsersInfo(ctx context.Context, userIDs []string) ([]*api.FullUserInfo, error) { diff --git a/internal/group/conversion.go b/internal/group/conversion.go index 2bd851d89..27d7be6fd 100644 --- a/internal/group/conversion.go +++ b/internal/group/conversion.go @@ -17,7 +17,7 @@ package group import ( "github.com/openimsdk/openim-sdk-core/v3/pkg/db/model_struct" - "github.com/OpenIMSDK/protocol/sdkws" + "github.com/openimsdk/protocol/sdkws" ) func ServerGroupToLocalGroup(info *sdkws.GroupInfo) *model_struct.LocalGroup { diff --git a/internal/group/group.go b/internal/group/group.go index 150814d08..031cc15b6 100644 --- a/internal/group/group.go +++ b/internal/group/group.go @@ -16,10 +16,6 @@ package group import ( "context" - "github.com/OpenIMSDK/protocol/group" - "github.com/OpenIMSDK/protocol/sdkws" - "github.com/OpenIMSDK/tools/log" - utils2 "github.com/OpenIMSDK/tools/utils" "github.com/openimsdk/openim-sdk-core/v3/internal/util" "github.com/openimsdk/openim-sdk-core/v3/open_im_sdk_callback" "github.com/openimsdk/openim-sdk-core/v3/pkg/common" @@ -29,6 +25,10 @@ import ( "github.com/openimsdk/openim-sdk-core/v3/pkg/sdkerrs" "github.com/openimsdk/openim-sdk-core/v3/pkg/syncer" "github.com/openimsdk/openim-sdk-core/v3/pkg/utils" + "github.com/openimsdk/protocol/group" + "github.com/openimsdk/protocol/sdkws" + "github.com/openimsdk/tools/log" + "github.com/openimsdk/tools/utils/datautil" ) func NewGroup(loginUserID string, db db_interface.DataBase, @@ -217,7 +217,7 @@ func (g *Group) GetGroupInfoFromLocal2Svr(ctx context.Context, groupID string) ( return nil, err } if len(svrGroup) == 0 { - return nil, sdkerrs.ErrGroupIDNotFound.Wrap("server not this group") + return nil, sdkerrs.ErrGroupIDNotFound.WrapMsg("server not this group") } return ServerGroupToLocalGroup(svrGroup[0]), nil } @@ -232,11 +232,11 @@ func (g *Group) GetGroupsInfoFromLocal2Svr(ctx context.Context, groupIDs ...stri return nil, err } var groupIDsNeedSync []string - localGroupIDs := utils2.Slice(groups, func(group *model_struct.LocalGroup) string { + localGroupIDs := datautil.Slice(groups, func(group *model_struct.LocalGroup) string { return group.GroupID }) for _, groupID := range groupIDs { - if !utils2.Contain(groupID, localGroupIDs...) { + if !datautil.Contain(groupID, localGroupIDs...) { groupIDsNeedSync = append(groupIDsNeedSync, groupID) } } diff --git a/internal/group/notification.go b/internal/group/notification.go index 79f5b3baf..f699ff13b 100644 --- a/internal/group/notification.go +++ b/internal/group/notification.go @@ -22,8 +22,8 @@ import ( "github.com/openimsdk/openim-sdk-core/v3/pkg/constant" "github.com/openimsdk/openim-sdk-core/v3/pkg/utils" - "github.com/OpenIMSDK/protocol/sdkws" - "github.com/OpenIMSDK/tools/log" + "github.com/openimsdk/protocol/sdkws" + "github.com/openimsdk/tools/log" ) func (g *Group) DoNotification(ctx context.Context, msg *sdkws.MsgData) { diff --git a/internal/group/sdk.go b/internal/group/sdk.go index df3d0c538..b54c45323 100644 --- a/internal/group/sdk.go +++ b/internal/group/sdk.go @@ -16,6 +16,7 @@ package group import ( "context" + "github.com/openimsdk/tools/utils/datautil" "time" "github.com/openimsdk/openim-sdk-core/v3/internal/util" @@ -23,13 +24,12 @@ import ( "github.com/openimsdk/openim-sdk-core/v3/pkg/db/model_struct" "github.com/openimsdk/openim-sdk-core/v3/pkg/sdk_params_callback" "github.com/openimsdk/openim-sdk-core/v3/pkg/sdkerrs" + pconstant "github.com/openimsdk/protocol/constant" + "github.com/openimsdk/tools/log" - "github.com/OpenIMSDK/tools/log" - - "github.com/OpenIMSDK/protocol/group" - "github.com/OpenIMSDK/protocol/sdkws" - "github.com/OpenIMSDK/protocol/wrapperspb" - "github.com/OpenIMSDK/tools/utils" + "github.com/openimsdk/protocol/group" + "github.com/openimsdk/protocol/sdkws" + "github.com/openimsdk/protocol/wrapperspb" ) // // deprecated use CreateGroup @@ -185,7 +185,7 @@ func (g *Group) GetSpecifiedGroupsInfo(ctx context.Context, groupIDs []string) ( if err != nil { return nil, err } - groupIDMap := utils.SliceSet(groupIDs) + groupIDMap := datautil.SliceSet(groupIDs) res := make([]*model_struct.LocalGroup, 0, len(groupIDs)) for i, v := range groupList { if _, ok := groupIDMap[v.GroupID]; ok { @@ -194,7 +194,7 @@ func (g *Group) GetSpecifiedGroupsInfo(ctx context.Context, groupIDs []string) ( } } if len(groupIDMap) > 0 { - groups, err := util.CallApi[group.GetGroupsInfoResp](ctx, constant.GetGroupsInfoRouter, &group.GetGroupsInfoReq{GroupIDs: utils.Keys(groupIDMap)}) + groups, err := util.CallApi[group.GetGroupsInfoResp](ctx, constant.GetGroupsInfoRouter, &group.GetGroupsInfoReq{GroupIDs: datautil.Keys(groupIDMap)}) if err != nil { log.ZError(ctx, "Call GetGroupsInfoRouter", err) } @@ -210,7 +210,7 @@ func (g *Group) GetSpecifiedGroupsInfo(ctx context.Context, groupIDs []string) ( func (g *Group) SearchGroups(ctx context.Context, param sdk_params_callback.SearchGroupsParam) ([]*model_struct.LocalGroup, error) { if len(param.KeywordList) == 0 || (!param.IsSearchGroupName && !param.IsSearchGroupID) { - return nil, sdkerrs.ErrArgs.Wrap("keyword is null or search field all false") + return nil, sdkerrs.ErrArgs.WrapMsg("keyword is null or search field all false") } groups, err := g.db.GetAllGroupInfoByGroupIDOrGroupName(ctx, param.KeywordList[0], param.IsSearchGroupID, param.IsSearchGroupName) // todo param.KeywordList[0] if err != nil { @@ -346,3 +346,39 @@ func (g *Group) IsJoinGroup(ctx context.Context, groupID string) (bool, error) { } return false, nil } + +func (g *Group) SearchGroupMembersV2(ctx context.Context, req *group.SearchGroupMemberReq) ([]*model_struct.LocalGroupMember, error) { + if err := req.Check(); err != nil { + return nil, err + } + info, err := g.db.GetGroupInfoByGroupID(ctx, req.GroupID) + if err != nil { + return nil, err + } + if info.MemberCount <= pconstant.MaxSyncPullNumber { + return g.db.SearchGroupMembersDB(ctx, req.Keyword, req.GroupID, true, false, + int((req.Pagination.PageNumber-1)*req.Pagination.ShowNumber), int(req.Pagination.ShowNumber)) + } + resp, err := util.CallApi[group.SearchGroupMemberResp](ctx, constant.SearchGroupMember, req) + if err != nil { + return nil, err + } + return datautil.Slice(resp.Members, g.pbGroupMemberToLocal), nil +} + +func (g *Group) pbGroupMemberToLocal(pb *sdkws.GroupMemberFullInfo) *model_struct.LocalGroupMember { + return &model_struct.LocalGroupMember{ + GroupID: pb.GroupID, + UserID: pb.UserID, + Nickname: pb.Nickname, + FaceURL: pb.FaceURL, + RoleLevel: pb.RoleLevel, + JoinTime: pb.JoinTime, + JoinSource: pb.JoinSource, + InviterUserID: pb.InviterUserID, + MuteEndTime: pb.MuteEndTime, + OperatorUserID: pb.OperatorUserID, + Ex: pb.Ex, + //AttachedInfo: pb.AttachedInfo, + } +} diff --git a/internal/group/sync.go b/internal/group/sync.go index afeac3161..71dadc042 100644 --- a/internal/group/sync.go +++ b/internal/group/sync.go @@ -20,22 +20,22 @@ import ( "encoding/binary" "encoding/json" "errors" - "github.com/OpenIMSDK/protocol/group" - "github.com/OpenIMSDK/protocol/sdkws" - "github.com/OpenIMSDK/tools/log" - utils2 "github.com/OpenIMSDK/tools/utils" "github.com/openimsdk/openim-sdk-core/v3/internal/util" "github.com/openimsdk/openim-sdk-core/v3/pkg/constant" "github.com/openimsdk/openim-sdk-core/v3/pkg/db/model_struct" "github.com/openimsdk/openim-sdk-core/v3/pkg/utils" + "github.com/openimsdk/protocol/group" + "github.com/openimsdk/protocol/sdkws" + "github.com/openimsdk/tools/log" + "github.com/openimsdk/tools/utils/datautil" "sync" ) func (g *Group) getGroupHash(members []*model_struct.LocalGroupMember) uint64 { - userIDs := utils2.Slice(members, func(member *model_struct.LocalGroupMember) string { + userIDs := datautil.Slice(members, func(member *model_struct.LocalGroupMember) string { return member.UserID }) - utils2.Sort(userIDs, true) + datautil.Sort(userIDs, true) memberMap := make(map[string]*sdkws.GroupMemberFullInfo) for _, member := range members { memberMap[member.UserID] = &sdkws.GroupMemberFullInfo{ diff --git a/internal/interaction/context.go b/internal/interaction/context.go index 841f5444a..9845010c1 100644 --- a/internal/interaction/context.go +++ b/internal/interaction/context.go @@ -17,7 +17,7 @@ package interaction import ( "time" - "github.com/OpenIMSDK/protocol/constant" + "github.com/openimsdk/protocol/constant" ) type ConnContext struct { diff --git a/internal/interaction/long_conn_mgr.go b/internal/interaction/long_conn_mgr.go index d437a343d..5869a8f2b 100644 --- a/internal/interaction/long_conn_mgr.go +++ b/internal/interaction/long_conn_mgr.go @@ -33,11 +33,11 @@ import ( "sync" "time" - "github.com/OpenIMSDK/protocol/sdkws" - "github.com/OpenIMSDK/tools/errs" - "github.com/OpenIMSDK/tools/log" "github.com/golang/protobuf/proto" "github.com/gorilla/websocket" + "github.com/openimsdk/protocol/sdkws" + "github.com/openimsdk/tools/errs" + "github.com/openimsdk/tools/log" ) const ( @@ -369,7 +369,7 @@ func (c *LongConnMgr) writeBinaryMsgAndRetry(msg *GeneralWsReq) (chan *GeneralWs msgIncr, tempChan := c.Syncer.AddCh(msg.SendID) msg.MsgIncr = msgIncr if c.GetConnectionStatus() != Connected && msg.ReqIdentifier == constant.GetNewestSeq { - return tempChan, sdkerrs.ErrNetwork.Wrap("connection closed,conning...") + return tempChan, sdkerrs.ErrNetwork.WrapMsg("connection closed,conning...") } for i := 0; i < maxReconnectAttempts; i++ { err := c.writeBinaryMsg(*msg) @@ -383,7 +383,7 @@ func (c *LongConnMgr) writeBinaryMsgAndRetry(msg *GeneralWsReq) (chan *GeneralWs return tempChan, nil } } - return nil, sdkerrs.ErrNetwork.Wrap("send binary message error") + return nil, sdkerrs.ErrNetwork.WrapMsg("send binary message error") } func (c *LongConnMgr) writeBinaryMsg(req GeneralWsReq) error { @@ -394,7 +394,7 @@ func (c *LongConnMgr) writeBinaryMsg(req GeneralWsReq) error { return err } if c.GetConnectionStatus() != Connected { - return sdkerrs.ErrNetwork.Wrap("connection closed,re conning...") + return sdkerrs.ErrNetwork.WrapMsg("connection closed,re conning...") } _ = c.conn.SetWriteDeadline(writeWait) if c.IsCompression { @@ -527,12 +527,9 @@ func (c *LongConnMgr) reConn(ctx context.Context, num *int) (needRecon bool, err switch apiResp.ErrCode { case errs.TokenExpiredError, - errs.TokenInvalidError, errs.TokenMalformedError, errs.TokenNotValidYetError, - errs.TokenUnknownError, - errs.TokenNotExistError, - errs.TokenKickedError: + errs.TokenUnknownError: return false, err default: return true, err diff --git a/internal/interaction/msg_sync.go b/internal/interaction/msg_sync.go index e24e0b86a..42c39fc0a 100644 --- a/internal/interaction/msg_sync.go +++ b/internal/interaction/msg_sync.go @@ -22,8 +22,8 @@ import ( "github.com/openimsdk/openim-sdk-core/v3/sdk_struct" "strings" - "github.com/OpenIMSDK/protocol/sdkws" - "github.com/OpenIMSDK/tools/log" + "github.com/openimsdk/protocol/sdkws" + "github.com/openimsdk/tools/log" ) const ( diff --git a/internal/interaction/ws_js.go b/internal/interaction/ws_js.go index 2b31f269c..1f2b243e4 100644 --- a/internal/interaction/ws_js.go +++ b/internal/interaction/ws_js.go @@ -22,7 +22,7 @@ import ( "context" "encoding/json" "fmt" - "github.com/OpenIMSDK/tools/log" + "github.com/openimsdk/tools/log" "io" "net/http" "net/url" diff --git a/internal/interaction/ws_resp_asyn.go b/internal/interaction/ws_resp_asyn.go index d6018f5e5..b798cb06c 100644 --- a/internal/interaction/ws_resp_asyn.go +++ b/internal/interaction/ws_resp_asyn.go @@ -21,7 +21,7 @@ import ( "sync" "time" - "github.com/OpenIMSDK/tools/log" + "github.com/openimsdk/tools/log" ) type GeneralWsResp struct { diff --git a/internal/third/log.go b/internal/third/log.go index 756b132e4..aff0b6e82 100644 --- a/internal/third/log.go +++ b/internal/third/log.go @@ -4,11 +4,11 @@ import ( "context" "errors" "fmt" - "github.com/OpenIMSDK/protocol/third" "github.com/openimsdk/openim-sdk-core/v3/internal/file" "github.com/openimsdk/openim-sdk-core/v3/internal/util" "github.com/openimsdk/openim-sdk-core/v3/pkg/ccontext" "github.com/openimsdk/openim-sdk-core/v3/pkg/constant" + "github.com/openimsdk/protocol/third" "io" "math/rand" "os" diff --git a/internal/third/third.go b/internal/third/third.go index 7d7ae70a8..a7bf83545 100644 --- a/internal/third/third.go +++ b/internal/third/third.go @@ -16,9 +16,9 @@ package third import ( "context" - "github.com/OpenIMSDK/protocol/third" "github.com/openimsdk/openim-sdk-core/v3/internal/util" "github.com/openimsdk/openim-sdk-core/v3/pkg/constant" + "github.com/openimsdk/protocol/third" "github.com/openimsdk/openim-sdk-core/v3/internal/file" ) diff --git a/internal/user/convert.go b/internal/user/convert.go index 5993d3601..2f68844a3 100644 --- a/internal/user/convert.go +++ b/internal/user/convert.go @@ -15,10 +15,10 @@ package user import ( - "github.com/OpenIMSDK/protocol/user" "github.com/openimsdk/openim-sdk-core/v3/pkg/db/model_struct" + "github.com/openimsdk/protocol/user" - "github.com/OpenIMSDK/protocol/sdkws" + "github.com/openimsdk/protocol/sdkws" ) func ServerUserToLocalUser(user *sdkws.UserInfo) *model_struct.LocalUser { diff --git a/internal/user/sdk.go b/internal/user/sdk.go index 601a23e2a..6a97c913a 100644 --- a/internal/user/sdk.go +++ b/internal/user/sdk.go @@ -16,13 +16,13 @@ package user import ( "context" - pbUser "github.com/OpenIMSDK/protocol/user" - userPb "github.com/OpenIMSDK/protocol/user" "github.com/openimsdk/openim-sdk-core/v3/internal/util" "github.com/openimsdk/openim-sdk-core/v3/pkg/constant" "github.com/openimsdk/openim-sdk-core/v3/pkg/db/model_struct" + pbUser "github.com/openimsdk/protocol/user" + userPb "github.com/openimsdk/protocol/user" - "github.com/OpenIMSDK/protocol/sdkws" + "github.com/openimsdk/protocol/sdkws" ) func (u *User) GetUsersInfo(ctx context.Context, userIDs []string) ([]*model_struct.LocalUser, error) { diff --git a/internal/user/sync.go b/internal/user/sync.go index 25de3b1b5..0eb5c186d 100644 --- a/internal/user/sync.go +++ b/internal/user/sync.go @@ -17,14 +17,14 @@ package user import ( "context" "errors" - userPb "github.com/OpenIMSDK/protocol/user" "github.com/openimsdk/openim-sdk-core/v3/internal/util" "github.com/openimsdk/openim-sdk-core/v3/pkg/constant" "github.com/openimsdk/openim-sdk-core/v3/pkg/db/model_struct" "github.com/openimsdk/openim-sdk-core/v3/pkg/utils" + userPb "github.com/openimsdk/protocol/user" - "github.com/OpenIMSDK/tools/errs" - "github.com/OpenIMSDK/tools/log" + "github.com/openimsdk/tools/errs" + "github.com/openimsdk/tools/log" "gorm.io/gorm" ) diff --git a/internal/user/user.go b/internal/user/user.go index 00c5b41a6..0588a6dee 100644 --- a/internal/user/user.go +++ b/internal/user/user.go @@ -17,22 +17,22 @@ package user import ( "context" "fmt" - authPb "github.com/OpenIMSDK/protocol/auth" - "github.com/OpenIMSDK/protocol/sdkws" - userPb "github.com/OpenIMSDK/protocol/user" - "github.com/OpenIMSDK/tools/log" "github.com/openimsdk/openim-sdk-core/v3/internal/cache" "github.com/openimsdk/openim-sdk-core/v3/internal/util" "github.com/openimsdk/openim-sdk-core/v3/pkg/db/db_interface" "github.com/openimsdk/openim-sdk-core/v3/pkg/db/model_struct" "github.com/openimsdk/openim-sdk-core/v3/pkg/sdkerrs" "github.com/openimsdk/openim-sdk-core/v3/pkg/syncer" + authPb "github.com/openimsdk/protocol/auth" + "github.com/openimsdk/protocol/sdkws" + userPb "github.com/openimsdk/protocol/user" + "github.com/openimsdk/tools/log" - PbConstant "github.com/OpenIMSDK/protocol/constant" "github.com/openimsdk/openim-sdk-core/v3/open_im_sdk_callback" "github.com/openimsdk/openim-sdk-core/v3/pkg/common" "github.com/openimsdk/openim-sdk-core/v3/pkg/constant" "github.com/openimsdk/openim-sdk-core/v3/pkg/utils" + PbConstant "github.com/openimsdk/protocol/constant" ) type BasicInfo struct { @@ -260,7 +260,7 @@ func (u *User) userCommandUpdateNotification(ctx context.Context, msg *sdkws.Msg func (u *User) GetUsersInfoFromSvr(ctx context.Context, userIDs []string) ([]*model_struct.LocalUser, error) { resp, err := util.CallApi[userPb.GetDesignateUsersResp](ctx, constant.GetUsersInfoRouter, userPb.GetDesignateUsersReq{UserIDs: userIDs}) if err != nil { - return nil, sdkerrs.Warp(err, "GetUsersInfoFromSvr failed") + return nil, sdkerrs.WrapMsg(err, "GetUsersInfoFromSvr failed") } return util.Batch(ServerUserToLocalUser, resp.UsersInfo), nil } @@ -274,7 +274,7 @@ func (u *User) GetSingleUserFromSvr(ctx context.Context, userID string) (*model_ if len(users) > 0 { return users[0], nil } - return nil, sdkerrs.ErrUserIDNotFound.Wrap(fmt.Sprintf("getSelfUserInfo failed, userID: %s not exist", userID)) + return nil, sdkerrs.ErrUserIDNotFound.WrapMsg(fmt.Sprintf("getSelfUserInfo failed, userID: %s not exist", userID)) } // getSelfUserInfo retrieves the user's information. diff --git a/internal/util/post.go b/internal/util/post.go index fcf48b391..17a0004e1 100644 --- a/internal/util/post.go +++ b/internal/util/post.go @@ -25,8 +25,8 @@ import ( "net/http" "time" - "github.com/OpenIMSDK/protocol/sdkws" - "github.com/OpenIMSDK/tools/log" + "github.com/openimsdk/protocol/sdkws" + "github.com/openimsdk/tools/log" ) // apiClient is a global HTTP client with a timeout of one minute. @@ -54,7 +54,7 @@ func ApiPost(ctx context.Context, api string, req, resp any) (err error) { // Extract operationID from context and validate. operationID, _ := ctx.Value("operationID").(string) if operationID == "" { - err := sdkerrs.ErrArgs.Wrap("call api operationID is empty") + err := sdkerrs.ErrArgs.WrapMsg("call api operationID is empty") log.ZError(ctx, "ApiRequest", err, "type", "ctx not set operationID") return err } @@ -73,7 +73,7 @@ func ApiPost(ctx context.Context, api string, req, resp any) (err error) { reqBody, err := json.Marshal(req) if err != nil { log.ZError(ctx, "ApiRequest", err, "type", "json.Marshal(req) failed") - return sdkerrs.ErrSdkInternal.Wrap("json.Marshal(req) failed " + err.Error()) + return sdkerrs.ErrSdkInternal.WrapMsg("json.Marshal(req) failed " + err.Error()) } // Construct the full API URL and create a new HTTP request with context. @@ -82,7 +82,7 @@ func ApiPost(ctx context.Context, api string, req, resp any) (err error) { request, err := http.NewRequestWithContext(ctx, http.MethodPost, reqUrl, bytes.NewReader(reqBody)) if err != nil { log.ZError(ctx, "ApiRequest", err, "type", "http.NewRequestWithContext failed") - return sdkerrs.ErrSdkInternal.Wrap("sdk http.NewRequestWithContext failed " + err.Error()) + return sdkerrs.ErrSdkInternal.WrapMsg("sdk http.NewRequestWithContext failed " + err.Error()) } // Set headers for the request. @@ -96,7 +96,7 @@ func ApiPost(ctx context.Context, api string, req, resp any) (err error) { response, err := apiClient.Do(request) if err != nil { log.ZError(ctx, "ApiRequest", err, "type", "network error") - return sdkerrs.ErrNetwork.Wrap("ApiPost http.Client.Do failed " + err.Error()) + return sdkerrs.ErrNetwork.WrapMsg("ApiPost http.Client.Do failed " + err.Error()) } // Ensure the response body is closed after processing. @@ -106,7 +106,7 @@ func ApiPost(ctx context.Context, api string, req, resp any) (err error) { respBody, err := io.ReadAll(response.Body) if err != nil { log.ZError(ctx, "ApiResponse", err, "type", "read body", "status", response.Status) - return sdkerrs.ErrSdkInternal.Wrap("io.ReadAll(ApiResponse) failed " + err.Error()) + return sdkerrs.ErrSdkInternal.WrapMsg("io.ReadAll(ApiResponse) failed " + err.Error()) } // Log the response for debugging purposes. @@ -116,7 +116,7 @@ func ApiPost(ctx context.Context, api string, req, resp any) (err error) { var baseApi ApiResponse if err := json.Unmarshal(respBody, &baseApi); err != nil { log.ZError(ctx, "ApiResponse", err, "type", "api code parse") - return sdkerrs.ErrSdkInternal.Wrap(fmt.Sprintf("api %s json.Unmarshal(%q, %T) failed %s", api, string(respBody), &baseApi, err.Error())) + return sdkerrs.ErrSdkInternal.WrapMsg(fmt.Sprintf("api %s json.Unmarshal(%q, %T) failed %s", api, string(respBody), &baseApi, err.Error())) } // Check if the API returned an error code and handle it. @@ -135,7 +135,7 @@ func ApiPost(ctx context.Context, api string, req, resp any) (err error) { // Unmarshal the actual data part of the response into the provided response object. if err := json.Unmarshal(baseApi.Data, resp); err != nil { log.ZError(ctx, "ApiResponse", err, "type", "api data parse", "data", string(baseApi.Data), "bind", fmt.Sprintf("%T", resp)) - return sdkerrs.ErrSdkInternal.Wrap(fmt.Sprintf("json.Unmarshal(%q, %T) failed %s", string(baseApi.Data), resp, err.Error())) + return sdkerrs.ErrSdkInternal.WrapMsg(fmt.Sprintf("json.Unmarshal(%q, %T) failed %s", string(baseApi.Data), resp, err.Error())) } return nil diff --git a/internal/work_moments/work_moments.go b/internal/work_moments/work_moments.go index 2a38e45f8..2eacd31fe 100644 --- a/internal/work_moments/work_moments.go +++ b/internal/work_moments/work_moments.go @@ -21,7 +21,7 @@ package workMoments // "open_im_sdk/pkg/db/model_struct" // "open_im_sdk/pkg/utils" // -// "github.com/OpenIMSDK/tools/log" +// "github.com/openimsdk/tools/log" //) // //type WorkMoments struct { diff --git a/msgtest/message_test.go b/msgtest/message_test.go index 5ef1a2e78..f4f7c5755 100644 --- a/msgtest/message_test.go +++ b/msgtest/message_test.go @@ -2,11 +2,11 @@ package msgtest import ( "context" - "github.com/OpenIMSDK/tools/log" "github.com/openimsdk/openim-sdk-core/v3/msgtest/module" "github.com/openimsdk/openim-sdk-core/v3/msgtest/sdk_user_simulator" "github.com/openimsdk/openim-sdk-core/v3/pkg/ccontext" "github.com/openimsdk/openim-sdk-core/v3/pkg/utils" + "github.com/openimsdk/tools/log" "testing" ) diff --git a/msgtest/module/api_msg_sender.go b/msgtest/module/api_msg_sender.go index 4b46e62a5..d16596597 100644 --- a/msgtest/module/api_msg_sender.go +++ b/msgtest/module/api_msg_sender.go @@ -6,8 +6,8 @@ import ( "github.com/openimsdk/openim-sdk-core/v3/pkg/utils" "github.com/openimsdk/openim-sdk-core/v3/sdk_struct" - "github.com/OpenIMSDK/protocol/msg" - "github.com/OpenIMSDK/protocol/sdkws" + "github.com/openimsdk/protocol/msg" + "github.com/openimsdk/protocol/sdkws" ) type ApiMsgSender struct { diff --git a/msgtest/module/friend_manager.go b/msgtest/module/friend_manager.go index 4f63b609b..2861f45e7 100644 --- a/msgtest/module/friend_manager.go +++ b/msgtest/module/friend_manager.go @@ -3,7 +3,7 @@ package module import ( "github.com/openimsdk/openim-sdk-core/v3/pkg/constant" - "github.com/OpenIMSDK/protocol/friend" + "github.com/openimsdk/protocol/friend" ) type TestFriendManager struct { diff --git a/msgtest/module/group_manager.go b/msgtest/module/group_manager.go index 22cf6bfcd..3dc9033cf 100644 --- a/msgtest/module/group_manager.go +++ b/msgtest/module/group_manager.go @@ -6,8 +6,8 @@ import ( "github.com/openimsdk/openim-sdk-core/v3/pkg/constant" "time" - "github.com/OpenIMSDK/protocol/group" - "github.com/OpenIMSDK/protocol/sdkws" + "github.com/openimsdk/protocol/group" + "github.com/openimsdk/protocol/sdkws" ) type TestGroupManager struct { diff --git a/msgtest/module/manager.go b/msgtest/module/manager.go index 4c18455cf..d99dcaf0f 100644 --- a/msgtest/module/manager.go +++ b/msgtest/module/manager.go @@ -5,14 +5,14 @@ import ( "context" "encoding/json" "fmt" - authPB "github.com/OpenIMSDK/protocol/auth" - "github.com/OpenIMSDK/protocol/msg" - "github.com/OpenIMSDK/tools/log" - "github.com/OpenIMSDK/tools/mcontext" "github.com/openimsdk/openim-sdk-core/v3/internal/util" "github.com/openimsdk/openim-sdk-core/v3/pkg/constant" "github.com/openimsdk/openim-sdk-core/v3/pkg/sdkerrs" "github.com/openimsdk/openim-sdk-core/v3/pkg/utils" + authPB "github.com/openimsdk/protocol/auth" + "github.com/openimsdk/protocol/msg" + "github.com/openimsdk/tools/log" + "github.com/openimsdk/tools/mcontext" "io" "net/http" ) diff --git a/msgtest/module/msg_sender.go b/msgtest/module/msg_sender.go index 7460b5e84..8878766ac 100644 --- a/msgtest/module/msg_sender.go +++ b/msgtest/module/msg_sender.go @@ -12,9 +12,9 @@ import ( "github.com/openimsdk/openim-sdk-core/v3/sdk_struct" "time" - "github.com/OpenIMSDK/protocol/sdkws" - "github.com/OpenIMSDK/tools/log" - "github.com/OpenIMSDK/tools/mcontext" + "github.com/openimsdk/protocol/sdkws" + "github.com/openimsdk/tools/log" + "github.com/openimsdk/tools/mcontext" ) type SendMsgUser struct { diff --git a/msgtest/module/user_manager.go b/msgtest/module/user_manager.go index 2af08b957..da98bf40b 100644 --- a/msgtest/module/user_manager.go +++ b/msgtest/module/user_manager.go @@ -5,8 +5,8 @@ import ( "github.com/openimsdk/openim-sdk-core/v3/pkg/constant" "time" - "github.com/OpenIMSDK/protocol/sdkws" - userPB "github.com/OpenIMSDK/protocol/user" + "github.com/openimsdk/protocol/sdkws" + userPB "github.com/openimsdk/protocol/user" ) type TestUserManager struct { diff --git a/msgtest/pressure_test.go b/msgtest/pressure_test.go index 835128c24..e0b1f229f 100644 --- a/msgtest/pressure_test.go +++ b/msgtest/pressure_test.go @@ -10,7 +10,7 @@ import ( "testing" "time" - "github.com/OpenIMSDK/tools/log" + "github.com/openimsdk/tools/log" ) const ( diff --git a/msgtest/sdk_user_simulator/listener.go b/msgtest/sdk_user_simulator/listener.go index 412ae384b..7f652ed51 100644 --- a/msgtest/sdk_user_simulator/listener.go +++ b/msgtest/sdk_user_simulator/listener.go @@ -210,6 +210,8 @@ func (testGroupListener) OnGroupDismissed(callbackInfo string) { type testConnListener struct { } +func (t *testConnListener) OnUserTokenInvalid(errMsg string) {} + func (t *testConnListener) OnUserTokenExpired() { } diff --git a/msgtest/sdk_user_simulator/user.go b/msgtest/sdk_user_simulator/user.go index e0c8a66b5..a92a1cc87 100644 --- a/msgtest/sdk_user_simulator/user.go +++ b/msgtest/sdk_user_simulator/user.go @@ -3,12 +3,13 @@ package sdk_user_simulator import ( "context" "fmt" - "github.com/OpenIMSDK/tools/log" - "github.com/openimsdk/openim-sdk-core/v3/internal/login" + "github.com/openimsdk/openim-sdk-core/v3/open_im_sdk" "github.com/openimsdk/openim-sdk-core/v3/pkg/ccontext" "github.com/openimsdk/openim-sdk-core/v3/pkg/constant" "github.com/openimsdk/openim-sdk-core/v3/pkg/utils" "github.com/openimsdk/openim-sdk-core/v3/sdk_struct" + "github.com/openimsdk/tools/log" + "go.etcd.io/etcd/api/v3/version" ) var ( @@ -33,7 +34,7 @@ func GetRelativeServerTime() int64 { } func InitSDKAndLogin(userID, token string) error { - userForSDK := login.NewLoginMgr() + userForSDK := open_im_sdk.NewLoginMgr() var cf sdk_struct.IMConfig cf.ApiAddr = APIADDR cf.PlatformID = int32(PLATFORMID) @@ -45,7 +46,7 @@ func InitSDKAndLogin(userID, token string) error { cf.LogFilePath = "" var testConnListener testConnListener userForSDK.InitSDK(cf, &testConnListener) - if err := log.InitFromConfig(userID+"_open-im-sdk-core", "", int(LogLevel), true, false, cf.DataDir, 0, 24); err != nil { + if err := log.InitFromConfig(userID+"_open-im-sdk-core", "", int(LogLevel), true, false, cf.DataDir, 0, 24, version.Version); err != nil { return err } ctx := ccontext.WithOperationID(userForSDK.BaseCtx(), utils.OperationIDGenerator()) @@ -58,7 +59,7 @@ func InitSDKAndLogin(userID, token string) error { return nil } -func SetListener(userForSDK *login.LoginMgr, userID string) { +func SetListener(userForSDK *open_im_sdk.LoginMgr, userID string) { var testConversation conversationCallBack userForSDK.SetConversationListener(&testConversation) diff --git a/open_im_sdk/apicb.go b/open_im_sdk/apicb.go index 392eee1da..c36b3126b 100644 --- a/open_im_sdk/apicb.go +++ b/open_im_sdk/apicb.go @@ -2,10 +2,10 @@ package open_im_sdk import ( "context" - "github.com/OpenIMSDK/tools/errs" - "github.com/OpenIMSDK/tools/log" "github.com/openimsdk/openim-sdk-core/v3/open_im_sdk_callback" "github.com/openimsdk/openim-sdk-core/v3/pkg/common" + "github.com/openimsdk/tools/errs" + "github.com/openimsdk/tools/log" "sync/atomic" ) @@ -36,18 +36,14 @@ func (c *apiErrCallback) OnError(ctx context.Context, err error) { _ = common.TriggerCmdLogOut(ctx, c.loginMgrCh) } case - errs.TokenInvalidError, errs.TokenMalformedError, errs.TokenNotValidYetError, - errs.TokenUnknownError, - errs.TokenNotExistError: + errs.TokenUnknownError: if atomic.CompareAndSwapInt32(&c.tokenInvalidState, 0, 1) { log.ZError(ctx, "OnUserTokenInvalid callback", err) c.listener.OnUserTokenInvalid(err.Error()) _ = common.TriggerCmdLogOut(ctx, c.loginMgrCh) } - - case errs.TokenKickedError: if atomic.CompareAndSwapInt32(&c.kickedOfflineState, 0, 1) { log.ZError(ctx, "OnKickedOffline callback", err) c.listener.OnKickedOffline() diff --git a/open_im_sdk/caller.go b/open_im_sdk/caller.go index f638b702a..484aa080f 100644 --- a/open_im_sdk/caller.go +++ b/open_im_sdk/caller.go @@ -27,9 +27,9 @@ import ( "runtime/debug" "time" - "github.com/OpenIMSDK/tools/log" + "github.com/openimsdk/tools/log" - "github.com/OpenIMSDK/tools/errs" + "github.com/openimsdk/tools/errs" ) func isNumeric(kind reflect.Kind) bool { @@ -91,10 +91,10 @@ func call_(operationID string, fn any, args ...any) (res any, err error) { funcPtr := reflect.ValueOf(fn).Pointer() funcName := runtime.FuncForPC(funcPtr).Name() if operationID == "" { - return nil, sdkerrs.ErrArgs.Wrap("call function operationID is empty") + return nil, sdkerrs.ErrArgs.WrapMsg("call function operationID is empty") } if err := CheckResourceLoad(UserForSDK, funcName); err != nil { - return nil, sdkerrs.ErrResourceLoad.Wrap("not load resource") + return nil, sdkerrs.ErrResourceLoad.WrapMsg("not load resource") } ctx := ccontext.WithOperationID(UserForSDK.BaseCtx(), operationID) defer func(start time.Time) { @@ -115,12 +115,12 @@ func call_(operationID string, fn any, args ...any) (res any, err error) { log.ZInfo(ctx, "func call req", "function name", funcName, "args", args) fnv := reflect.ValueOf(fn) if fnv.Kind() != reflect.Func { - return nil, sdkerrs.ErrSdkInternal.Wrap(fmt.Sprintf("call function fn is not function, is %T", fn)) + return nil, sdkerrs.ErrSdkInternal.WrapMsg(fmt.Sprintf("call function fn is not function, is %T", fn)) } fnt := fnv.Type() nin := fnt.NumIn() if len(args)+1 != nin { - return nil, sdkerrs.ErrSdkInternal.Wrap(fmt.Sprintf("go code error: fn in args num is not match")) + return nil, sdkerrs.ErrSdkInternal.WrapMsg(fmt.Sprintf("go code error: fn in args num is not match")) } ins := make([]reflect.Value, 0, nin) ins = append(ins, reflect.ValueOf(ctx)) @@ -141,7 +141,7 @@ func call_(operationID string, fn any, args ...any) (res any, err error) { case reflect.Struct, reflect.Slice, reflect.Array, reflect.Map: v := reflect.New(inFnField) if err := json.Unmarshal([]byte(args[i].(string)), v.Interface()); err != nil { - return nil, sdkerrs.ErrSdkInternal.Wrap(fmt.Sprintf("go call json.Unmarshal error: %s", err)) + return nil, sdkerrs.ErrSdkInternal.WrapMsg(fmt.Sprintf("go call json.Unmarshal error: %s", err)) } if ptr == 0 { v = v.Elem() @@ -162,7 +162,7 @@ func call_(operationID string, fn any, args ...any) (res any, err error) { // ins = append(ins, reflect.ValueOf(v)) // continue //} - return nil, sdkerrs.ErrSdkInternal.Wrap(fmt.Sprintf("go code error: fn in args type is not match")) + return nil, sdkerrs.ErrSdkInternal.WrapMsg(fmt.Sprintf("go code error: fn in args type is not match")) } outs := fnv.Call(ins) if len(outs) == 0 { @@ -361,7 +361,7 @@ func messageCall_(callback open_im_sdk_callback.SendMsgCallBack, operationID str } }() if operationID == "" { - callback.OnError(sdkerrs.ArgsError, sdkerrs.ErrArgs.Wrap("operationID is empty").Error()) + callback.OnError(sdkerrs.ArgsError, sdkerrs.ErrArgs.WrapMsg("operationID is empty").Error()) return } if err := CheckResourceLoad(UserForSDK, ""); err != nil { diff --git a/open_im_sdk/em.go b/open_im_sdk/em.go index de39cd358..9ef80a8fd 100644 --- a/open_im_sdk/em.go +++ b/open_im_sdk/em.go @@ -17,8 +17,8 @@ package open_im_sdk import ( "context" "errors" - "github.com/OpenIMSDK/tools/log" "github.com/openimsdk/openim-sdk-core/v3/open_im_sdk_callback" + "github.com/openimsdk/tools/log" ) var ErrNotImplemented = errors.New("not set listener") diff --git a/open_im_sdk/init_login.go b/open_im_sdk/init_login.go index 20bb1f79d..cb95e4675 100644 --- a/open_im_sdk/init_login.go +++ b/open_im_sdk/init_login.go @@ -22,10 +22,11 @@ import ( "github.com/openimsdk/openim-sdk-core/v3/pkg/ccontext" "github.com/openimsdk/openim-sdk-core/v3/pkg/constant" "github.com/openimsdk/openim-sdk-core/v3/sdk_struct" + "go.etcd.io/etcd/api/v3/version" "strings" - "github.com/OpenIMSDK/tools/log" - "github.com/OpenIMSDK/tools/mcontext" + "github.com/openimsdk/tools/log" + "github.com/openimsdk/tools/mcontext" ) func GetSdkVersion() string { @@ -54,7 +55,7 @@ func InitSDK(listener open_im_sdk_callback.OnConnListener, operationID string, c if configArgs.PlatformID == 0 { return false } - if err := log.InitFromConfig("open-im-sdk-core", "", int(configArgs.LogLevel), configArgs.IsLogStandardOutput, false, configArgs.LogFilePath, rotateCount, rotationTime); err != nil { + if err := log.InitFromConfig("open-im-sdk-core", "", int(configArgs.LogLevel), configArgs.IsLogStandardOutput, false, configArgs.LogFilePath, rotateCount, rotationTime, version.Version); err != nil { fmt.Println(operationID, "log init failed ", err.Error()) } fmt.Println("init log success") diff --git a/open_im_sdk/userRelated.go b/open_im_sdk/userRelated.go index 9d77afae7..c4b6a366d 100644 --- a/open_im_sdk/userRelated.go +++ b/open_im_sdk/userRelated.go @@ -19,9 +19,6 @@ import ( "encoding/json" "errors" "fmt" - "github.com/OpenIMSDK/protocol/push" - "github.com/OpenIMSDK/protocol/sdkws" - "github.com/OpenIMSDK/tools/log" "github.com/openimsdk/openim-sdk-core/v3/internal/business" conv "github.com/openimsdk/openim-sdk-core/v3/internal/conversation_msg" "github.com/openimsdk/openim-sdk-core/v3/internal/file" @@ -41,6 +38,9 @@ import ( "github.com/openimsdk/openim-sdk-core/v3/pkg/sdkerrs" "github.com/openimsdk/openim-sdk-core/v3/pkg/utils" "github.com/openimsdk/openim-sdk-core/v3/sdk_struct" + "github.com/openimsdk/protocol/push" + "github.com/openimsdk/protocol/sdkws" + "github.com/openimsdk/tools/log" "strings" "sync" "time" @@ -335,7 +335,7 @@ func (u *LoginMgr) login(ctx context.Context, userID, token string) error { var err error u.db, err = db.NewDataBase(ctx, userID, u.info.DataDir, int(u.info.LogLevel)) if err != nil { - return sdkerrs.ErrSdkInternal.Wrap("init database " + err.Error()) + return sdkerrs.ErrSdkInternal.WrapMsg("init database " + err.Error()) } u.checkSendingMessage(ctx) log.ZDebug(ctx, "NewDataBase ok", "userID", userID, "dataDir", u.info.DataDir, "login cost time", time.Since(t1)) diff --git a/open_im_sdk_callback/callback_go_sdk.go b/open_im_sdk_callback/callback_go_sdk.go index ad9d778b8..b38005e6d 100644 --- a/open_im_sdk_callback/callback_go_sdk.go +++ b/open_im_sdk_callback/callback_go_sdk.go @@ -19,7 +19,7 @@ import ( "github.com/openimsdk/openim-sdk-core/v3/pkg/db/model_struct" "github.com/openimsdk/openim-sdk-core/v3/pkg/utils" - "github.com/OpenIMSDK/tools/log" + "github.com/openimsdk/tools/log" ) type OnFriendshipListenerSdk interface { diff --git a/pkg/ccontext/context.go b/pkg/ccontext/context.go index 7c012899d..67855a596 100644 --- a/pkg/ccontext/context.go +++ b/pkg/ccontext/context.go @@ -20,7 +20,7 @@ import ( "github.com/openimsdk/openim-sdk-core/v3/open_im_sdk_callback" "github.com/openimsdk/openim-sdk-core/v3/sdk_struct" - "github.com/OpenIMSDK/tools/mcontext" + "github.com/openimsdk/tools/mcontext" ) const ( diff --git a/pkg/common/trigger_channel.go b/pkg/common/trigger_channel.go index 5d0ca4f0a..a0a4a89c1 100644 --- a/pkg/common/trigger_channel.go +++ b/pkg/common/trigger_channel.go @@ -22,9 +22,9 @@ import ( "github.com/openimsdk/openim-sdk-core/v3/sdk_struct" "time" - "github.com/OpenIMSDK/tools/log" + "github.com/openimsdk/tools/log" - "github.com/OpenIMSDK/protocol/sdkws" + "github.com/openimsdk/protocol/sdkws" ) func TriggerCmdJoinedSuperGroup(cmd sdk_struct.CmdJoinedSuperGroup, joinedSuperGroupCh chan Cmd2Value) error { diff --git a/pkg/constant/server_api_router.go b/pkg/constant/server_api_router.go index ae0875f10..3e67f3c76 100644 --- a/pkg/constant/server_api_router.go +++ b/pkg/constant/server_api_router.go @@ -103,6 +103,7 @@ const ( SetGroupMemberNicknameRouter = RouterGroup + "/set_group_member_nickname" SetGroupMemberInfoRouter = RouterGroup + "/set_group_member_info" GetGroupAbstractInfoRouter = RouterGroup + "/get_group_abstract_info" + SearchGroupMember = RouterGroup + "/search_group_member" SetReceiveMessageOptRouter = "/conversation/set_receive_message_opt" GetReceiveMessageOptRouter = "/conversation/get_receive_message_opt" diff --git a/pkg/db/chat_log_model_v3.go b/pkg/db/chat_log_model_v3.go index d3d82ef6c..043cc6c05 100644 --- a/pkg/db/chat_log_model_v3.go +++ b/pkg/db/chat_log_model_v3.go @@ -26,7 +26,7 @@ import ( "github.com/openimsdk/openim-sdk-core/v3/pkg/utils" "github.com/openimsdk/openim-sdk-core/v3/sdk_struct" - "github.com/OpenIMSDK/tools/log" + "github.com/openimsdk/tools/log" ) func (d *DataBase) initChatLog(ctx context.Context, conversationID string) { diff --git a/pkg/db/conversation_model.go b/pkg/db/conversation_model.go index 7c5e6c427..1fcba2dc5 100644 --- a/pkg/db/conversation_model.go +++ b/pkg/db/conversation_model.go @@ -25,8 +25,8 @@ import ( "github.com/openimsdk/openim-sdk-core/v3/pkg/db/model_struct" "github.com/openimsdk/openim-sdk-core/v3/pkg/utils" - "github.com/OpenIMSDK/tools/errs" - "github.com/OpenIMSDK/tools/log" + "github.com/openimsdk/tools/errs" + "github.com/openimsdk/tools/log" "gorm.io/gorm" ) diff --git a/pkg/db/db_init.go b/pkg/db/db_init.go index 76774dbf9..bad5d67a2 100644 --- a/pkg/db/db_init.go +++ b/pkg/db/db_init.go @@ -28,7 +28,7 @@ import ( "github.com/openimsdk/openim-sdk-core/v3/pkg/db/model_struct" "github.com/openimsdk/openim-sdk-core/v3/pkg/utils" - "github.com/OpenIMSDK/tools/log" + "github.com/openimsdk/tools/log" "gorm.io/driver/sqlite" "gorm.io/gorm" "gorm.io/gorm/logger" diff --git a/pkg/db/upload_model.go b/pkg/db/upload_model.go index 9b3cd36ee..986c12836 100644 --- a/pkg/db/upload_model.go +++ b/pkg/db/upload_model.go @@ -22,7 +22,7 @@ import ( "github.com/openimsdk/openim-sdk-core/v3/pkg/db/model_struct" "time" - "github.com/OpenIMSDK/tools/errs" + "github.com/openimsdk/tools/errs" ) func (d *DataBase) GetUpload(ctx context.Context, partHash string) (*model_struct.LocalUpload, error) { diff --git a/pkg/sdk_params_callback/friend_sdk_struct.go b/pkg/sdk_params_callback/friend_sdk_struct.go index 6cee3f015..e58e0b24f 100644 --- a/pkg/sdk_params_callback/friend_sdk_struct.go +++ b/pkg/sdk_params_callback/friend_sdk_struct.go @@ -15,10 +15,10 @@ package sdk_params_callback import ( - "github.com/OpenIMSDK/protocol/wrapperspb" "github.com/openimsdk/openim-sdk-core/v3/pkg/constant" "github.com/openimsdk/openim-sdk-core/v3/pkg/db/model_struct" "github.com/openimsdk/openim-sdk-core/v3/pkg/server_api_params" + "github.com/openimsdk/protocol/wrapperspb" ) // 1 diff --git a/pkg/sdk_params_callback/group_sdk_struct.go b/pkg/sdk_params_callback/group_sdk_struct.go index 3b5877ccd..200e296b1 100644 --- a/pkg/sdk_params_callback/group_sdk_struct.go +++ b/pkg/sdk_params_callback/group_sdk_struct.go @@ -60,9 +60,11 @@ type SearchGroupMembersParam struct { IsSearchUserID bool `json:"isSearchUserID"` IsSearchMemberNickname bool `json:"isSearchMemberNickname"` //offset, count int - Offset int `json:"offset"` - Count int `json:"count"` + Offset int `json:"offset"` + Count int `json:"count"` + PageNumber int `json:"pageNumber"` } + type SearchGroupMembersCallback []*model_struct.LocalGroupMember type SetGroupInfoParam struct { diff --git a/pkg/sdkerrs/error.go b/pkg/sdkerrs/error.go index 56e31b354..0470a72b9 100644 --- a/pkg/sdkerrs/error.go +++ b/pkg/sdkerrs/error.go @@ -14,10 +14,13 @@ package sdkerrs -import "github.com/OpenIMSDK/tools/errs" +import "github.com/openimsdk/tools/errs" func New(code int, msg string, dtl string) errs.CodeError { return errs.NewCodeError(code, msg).WithDetail(dtl) } -var Warp = errs.Wrap +var ( + Wrap = errs.Wrap + WrapMsg = errs.WrapMsg +) diff --git a/pkg/sdkerrs/predefine.go b/pkg/sdkerrs/predefine.go index bf0af003f..076d1fbdc 100644 --- a/pkg/sdkerrs/predefine.go +++ b/pkg/sdkerrs/predefine.go @@ -14,7 +14,7 @@ package sdkerrs -import "github.com/OpenIMSDK/tools/errs" +import "github.com/openimsdk/tools/errs" var ( ErrArgs = errs.NewCodeError(ArgsError, "ArgsError") diff --git a/pkg/server_api_params/auth_api_struct.go b/pkg/server_api_params/auth_api_struct.go index 44ea50de6..9868e3e0a 100644 --- a/pkg/server_api_params/auth_api_struct.go +++ b/pkg/server_api_params/auth_api_struct.go @@ -14,7 +14,7 @@ package server_api_params -import "github.com/OpenIMSDK/protocol/sdkws" +import "github.com/openimsdk/protocol/sdkws" //UserID string `protobuf:"bytes,1,opt,name=UserID" json:"UserID,omitempty"` // Nickname string `protobuf:"bytes,2,opt,name=Nickname" json:"Nickname,omitempty"` diff --git a/pkg/server_api_params/friend_api_struct.go b/pkg/server_api_params/friend_api_struct.go index d26bb0b93..7bfa3b871 100644 --- a/pkg/server_api_params/friend_api_struct.go +++ b/pkg/server_api_params/friend_api_struct.go @@ -14,7 +14,7 @@ package server_api_params -import "github.com/OpenIMSDK/protocol/sdkws" +import "github.com/openimsdk/protocol/sdkws" type ParamsCommFriend struct { OperationID string `json:"operationID" binding:"required"` diff --git a/pkg/server_api_params/group_api_struct.go b/pkg/server_api_params/group_api_struct.go index 381357ca6..4ff561227 100644 --- a/pkg/server_api_params/group_api_struct.go +++ b/pkg/server_api_params/group_api_struct.go @@ -14,7 +14,7 @@ package server_api_params -import "github.com/OpenIMSDK/protocol/sdkws" +import "github.com/openimsdk/protocol/sdkws" type CommResp struct { ErrCode int32 `json:"errCode"` diff --git a/pkg/server_api_params/user_api_struct.go b/pkg/server_api_params/user_api_struct.go index a4109b6b6..4db647f0e 100644 --- a/pkg/server_api_params/user_api_struct.go +++ b/pkg/server_api_params/user_api_struct.go @@ -15,7 +15,7 @@ package server_api_params import ( - "github.com/OpenIMSDK/protocol/sdkws" + "github.com/openimsdk/protocol/sdkws" ) type GetUsersInfoReq struct { diff --git a/pkg/syncer/syncer.go b/pkg/syncer/syncer.go index e4be19f01..38aeab161 100644 --- a/pkg/syncer/syncer.go +++ b/pkg/syncer/syncer.go @@ -20,7 +20,7 @@ import ( "github.com/google/go-cmp/cmp" - "github.com/OpenIMSDK/tools/log" + "github.com/openimsdk/tools/log" ) // New creates a new Syncer instance with the provided synchronization functions. diff --git a/scripts/template/head.md.tmpl b/scripts/template/head.md.tmpl index c759ef5c5..dd4f12c85 100644 --- a/scripts/template/head.md.tmpl +++ b/scripts/template/head.md.tmpl @@ -4,9 +4,9 @@ We are excited to release {{.Tag}}, Branch: https://github.com/{{ .Env.USERNAME Learn more about versions of OpenIM: -+ For information on versions of OpenIM and how to maintain branches, read [📚this article](https://github.com/OpenIMSDK/Open-IM-Server/blob/main/docs/conversions/version.md) ++ For information on versions of OpenIM and how to maintain branches, read [📚this article](https://github.com/openimsdk/Open-IM-Server/blob/main/docs/conversions/version.md) -+ If you wish to use mirroring, read OpenIM's [🤲image management policy](https://github.com/OpenIMSDK/Open-IM-Server/blob/main/docs/conversions/images.md) ++ If you wish to use mirroring, read OpenIM's [🤲image management policy](https://github.com/openimsdk/Open-IM-Server/blob/main/docs/conversions/images.md) **Want to be one of them 😘?** diff --git a/sdk_struct/sdk_struct.go b/sdk_struct/sdk_struct.go index 20a246afe..3698854d7 100644 --- a/sdk_struct/sdk_struct.go +++ b/sdk_struct/sdk_struct.go @@ -15,7 +15,7 @@ package sdk_struct import ( - "github.com/OpenIMSDK/protocol/sdkws" + "github.com/openimsdk/protocol/sdkws" ) ////////////////////////// message///////////////////////// diff --git a/test/account.go b/test/account.go index e3456a53b..99b9ae0f3 100644 --- a/test/account.go +++ b/test/account.go @@ -28,10 +28,10 @@ import ( "sync" "time" - authPB "github.com/OpenIMSDK/protocol/auth" - "github.com/OpenIMSDK/protocol/sdkws" - userPB "github.com/OpenIMSDK/protocol/user" - "github.com/OpenIMSDK/tools/log" + authPB "github.com/openimsdk/protocol/auth" + "github.com/openimsdk/protocol/sdkws" + userPB "github.com/openimsdk/protocol/user" + "github.com/openimsdk/tools/log" ) func GenUid(uid int, prefix string) string { diff --git a/test/login.go b/test/login.go index 46bf8b608..e457db619 100644 --- a/test/login.go +++ b/test/login.go @@ -18,11 +18,11 @@ import ( "encoding/json" "errors" "fmt" - "github.com/OpenIMSDK/tools/log" "github.com/openimsdk/openim-sdk-core/v3/open_im_sdk" "github.com/openimsdk/openim-sdk-core/v3/pkg/constant" "github.com/openimsdk/openim-sdk-core/v3/pkg/utils" "github.com/openimsdk/openim-sdk-core/v3/sdk_struct" + "github.com/openimsdk/tools/log" "time" ) diff --git a/test/reliability.go b/test/reliability.go index 2f05caa8b..5ddb760bf 100644 --- a/test/reliability.go +++ b/test/reliability.go @@ -17,8 +17,8 @@ package test import ( "errors" "fmt" - "github.com/OpenIMSDK/tools/log" "github.com/openimsdk/openim-sdk-core/v3/pkg/utils" + "github.com/openimsdk/tools/log" "io/ioutil" "math/rand" "os" diff --git a/test/sendMessage.go b/test/sendMessage.go index 198a0c491..7472c7305 100644 --- a/test/sendMessage.go +++ b/test/sendMessage.go @@ -15,11 +15,11 @@ package test import ( - "github.com/OpenIMSDK/protocol/sdkws" - "github.com/OpenIMSDK/tools/log" "github.com/openimsdk/openim-sdk-core/v3/open_im_sdk" "github.com/openimsdk/openim-sdk-core/v3/pkg/constant" "github.com/openimsdk/openim-sdk-core/v3/pkg/utils" + "github.com/openimsdk/protocol/sdkws" + "github.com/openimsdk/tools/log" ) func init() { diff --git a/test/t_conversation_msg.go b/test/t_conversation_msg.go index 0a555076b..57e877070 100644 --- a/test/t_conversation_msg.go +++ b/test/t_conversation_msg.go @@ -17,18 +17,18 @@ package test import ( "encoding/json" "fmt" - "github.com/OpenIMSDK/tools/log" "github.com/openimsdk/openim-sdk-core/v3/open_im_sdk" "github.com/openimsdk/openim-sdk-core/v3/pkg/constant" "github.com/openimsdk/openim-sdk-core/v3/pkg/sdk_params_callback" "github.com/openimsdk/openim-sdk-core/v3/pkg/server_api_params" "github.com/openimsdk/openim-sdk-core/v3/pkg/utils" "github.com/openimsdk/openim-sdk-core/v3/sdk_struct" + "github.com/openimsdk/tools/log" "sync" - "github.com/OpenIMSDK/protocol/sdkws" + "github.com/openimsdk/protocol/sdkws" - "github.com/OpenIMSDK/tools/mcontext" + "github.com/openimsdk/tools/mcontext" ) //funcation DotestSetConversationRecvMessageOpt() { diff --git a/test/t_friend_sdk.go b/test/t_friend_sdk.go index 14aeb2054..6a3859579 100644 --- a/test/t_friend_sdk.go +++ b/test/t_friend_sdk.go @@ -18,20 +18,20 @@ import ( "encoding/json" "errors" "fmt" - "github.com/OpenIMSDK/tools/log" "github.com/openimsdk/openim-sdk-core/v3/open_im_sdk" "github.com/openimsdk/openim-sdk-core/v3/pkg/ccontext" "github.com/openimsdk/openim-sdk-core/v3/pkg/sdk_params_callback" "github.com/openimsdk/openim-sdk-core/v3/pkg/utils" "github.com/openimsdk/openim-sdk-core/v3/sdk_struct" + "github.com/openimsdk/tools/log" X "log" "os" "runtime" "time" - "github.com/OpenIMSDK/protocol/sdkws" + "github.com/openimsdk/protocol/sdkws" - "github.com/OpenIMSDK/tools/mcontext" + "github.com/openimsdk/tools/mcontext" ) var loggerf *X.Logger diff --git a/test/t_group_sdk.go b/test/t_group_sdk.go index 294e39db6..e0d040661 100644 --- a/test/t_group_sdk.go +++ b/test/t_group_sdk.go @@ -22,8 +22,8 @@ import ( // "encoding/json" "fmt" - "github.com/OpenIMSDK/tools/log" "github.com/openimsdk/openim-sdk-core/v3/pkg/utils" + "github.com/openimsdk/tools/log" //"open_im_sdk/internal/open_im_sdk" //"open_im_sdk/pkg/utils" // "open_im_sdk/internal/common" diff --git a/test/t_signaling.go b/test/t_signaling.go index b8c99dc95..052bf1ddf 100644 --- a/test/t_signaling.go +++ b/test/t_signaling.go @@ -17,7 +17,7 @@ package test import ( "github.com/openimsdk/openim-sdk-core/v3/pkg/utils" - "github.com/OpenIMSDK/tools/log" + "github.com/openimsdk/tools/log" "golang.org/x/net/context" ) diff --git a/test/work_group_create.go b/test/work_group_create.go index 2807fef8d..4bcca7958 100644 --- a/test/work_group_create.go +++ b/test/work_group_create.go @@ -17,15 +17,15 @@ package test import ( "encoding/json" "errors" - "github.com/OpenIMSDK/tools/log" "github.com/openimsdk/openim-sdk-core/v3/pkg/constant" "github.com/openimsdk/openim-sdk-core/v3/pkg/network" "github.com/openimsdk/openim-sdk-core/v3/pkg/server_api_params" "github.com/openimsdk/openim-sdk-core/v3/pkg/utils" + "github.com/openimsdk/tools/log" "sync" "time" - "github.com/OpenIMSDK/protocol/sdkws" + "github.com/openimsdk/protocol/sdkws" ) var ( diff --git a/testv2/config.go b/testv2/config.go index 94f24a22e..1822cb3ff 100644 --- a/testv2/config.go +++ b/testv2/config.go @@ -15,8 +15,8 @@ package testv2 import ( - "github.com/OpenIMSDK/protocol/constant" "github.com/openimsdk/openim-sdk-core/v3/sdk_struct" + "github.com/openimsdk/protocol/constant" ) const ( diff --git a/testv2/empty_test.go b/testv2/empty_test.go index 3824f62d7..fa94f1ae9 100644 --- a/testv2/empty_test.go +++ b/testv2/empty_test.go @@ -15,8 +15,8 @@ package testv2 import ( - "github.com/OpenIMSDK/tools/log" "github.com/openimsdk/openim-sdk-core/v3/open_im_sdk" + "github.com/openimsdk/tools/log" "testing" "time" ) diff --git a/testv2/friend_test.go b/testv2/friend_test.go index 56b8f2084..0e794f84e 100644 --- a/testv2/friend_test.go +++ b/testv2/friend_test.go @@ -15,13 +15,13 @@ package testv2 import ( - "github.com/OpenIMSDK/protocol/wrapperspb" "github.com/openimsdk/openim-sdk-core/v3/open_im_sdk" "github.com/openimsdk/openim-sdk-core/v3/pkg/sdk_params_callback" + "github.com/openimsdk/protocol/wrapperspb" "testing" "time" - friend2 "github.com/OpenIMSDK/protocol/friend" + friend2 "github.com/openimsdk/protocol/friend" ) func Test_GetSpecifiedFriendsInfo(t *testing.T) { diff --git a/testv2/group_test.go b/testv2/group_test.go index 84c4ab300..73061fd9c 100644 --- a/testv2/group_test.go +++ b/testv2/group_test.go @@ -15,12 +15,12 @@ package testv2 import ( - "github.com/OpenIMSDK/protocol/group" - "github.com/OpenIMSDK/protocol/sdkws" - "github.com/OpenIMSDK/protocol/wrapperspb" "github.com/openimsdk/openim-sdk-core/v3/open_im_sdk" "github.com/openimsdk/openim-sdk-core/v3/pkg/constant" "github.com/openimsdk/openim-sdk-core/v3/pkg/sdk_params_callback" + "github.com/openimsdk/protocol/group" + "github.com/openimsdk/protocol/sdkws" + "github.com/openimsdk/protocol/wrapperspb" "testing" ) diff --git a/testv2/init.go b/testv2/init.go index 9cc0afe4a..354cb7393 100644 --- a/testv2/init.go +++ b/testv2/init.go @@ -19,16 +19,16 @@ import ( "context" "encoding/json" "fmt" - "github.com/OpenIMSDK/protocol/constant" "github.com/openimsdk/openim-sdk-core/v3/open_im_sdk" "github.com/openimsdk/openim-sdk-core/v3/pkg/ccontext" + "github.com/openimsdk/protocol/constant" "io" "math/rand" "net/http" "strconv" "time" - "github.com/OpenIMSDK/tools/log" + "github.com/openimsdk/tools/log" ) var ( diff --git a/testv2/listener.go b/testv2/listener.go index 52eb3a4bf..085552304 100644 --- a/testv2/listener.go +++ b/testv2/listener.go @@ -16,6 +16,8 @@ package testv2 type OnConnListener struct{} +func (c *OnConnListener) OnUserTokenInvalid(errMsg string) {} + func (c *OnConnListener) OnConnecting() { // fmt.Println("OnConnecting") } diff --git a/testv2/user_test.go b/testv2/user_test.go index b77139911..229928f76 100644 --- a/testv2/user_test.go +++ b/testv2/user_test.go @@ -16,14 +16,14 @@ package testv2 import ( "fmt" - "github.com/OpenIMSDK/protocol/user" - "github.com/OpenIMSDK/protocol/wrapperspb" + "github.com/openimsdk/protocol/user" + "github.com/openimsdk/protocol/wrapperspb" "testing" "time" "github.com/openimsdk/openim-sdk-core/v3/open_im_sdk" - "github.com/OpenIMSDK/protocol/sdkws" + "github.com/openimsdk/protocol/sdkws" ) func Test_GetSelfUserInfo(t *testing.T) { diff --git a/wasm/event_listener/caller.go b/wasm/event_listener/caller.go index 992370353..efe71ea50 100644 --- a/wasm/event_listener/caller.go +++ b/wasm/event_listener/caller.go @@ -21,9 +21,9 @@ import ( "bytes" "context" "errors" - "github.com/OpenIMSDK/tools/log" "github.com/openimsdk/openim-sdk-core/v3/pkg/utils" "github.com/openimsdk/openim-sdk-core/v3/wasm/exec" + "github.com/openimsdk/tools/log" "reflect" "strconv" "strings" diff --git a/wasm/exec/executor.go b/wasm/exec/executor.go index 983efd580..82d1d2d89 100644 --- a/wasm/exec/executor.go +++ b/wasm/exec/executor.go @@ -20,9 +20,9 @@ package exec import ( "context" "errors" - "github.com/OpenIMSDK/tools/errs" - "github.com/OpenIMSDK/tools/log" "github.com/openimsdk/openim-sdk-core/v3/pkg/utils" + "github.com/openimsdk/tools/errs" + "github.com/openimsdk/tools/log" "runtime" "syscall/js" "time" From 15d11505243b191c5be58d4bbcbc9c2de936bf9b Mon Sep 17 00:00:00 2001 From: withchao <993506633@qq.com> Date: Wed, 15 May 2024 18:03:42 +0800 Subject: [PATCH 4/4] friend hash --- internal/friend/hash.go | 33 +++++++++++++++++++++++++++++++ internal/friend/sync.go | 28 +++++++++++++++++++++++++- pkg/constant/server_api_router.go | 1 + 3 files changed, 61 insertions(+), 1 deletion(-) create mode 100644 internal/friend/hash.go diff --git a/internal/friend/hash.go b/internal/friend/hash.go new file mode 100644 index 000000000..7e5313802 --- /dev/null +++ b/internal/friend/hash.go @@ -0,0 +1,33 @@ +package friend + +import ( + "crypto/md5" + "encoding/binary" + "github.com/openimsdk/openim-sdk-core/v3/pkg/db/model_struct" + "github.com/openimsdk/protocol/constant" + "github.com/openimsdk/tools/utils/datautil" + "strconv" + "strings" +) + +func (f *Friend) CalculateHash(friends []*model_struct.LocalFriend) uint64 { + datautil.SortAny(friends, func(a, b *model_struct.LocalFriend) bool { + return a.CreateTime > b.CreateTime + }) + if len(friends) > constant.MaxSyncPullNumber { + friends = friends[:constant.MaxSyncPullNumber] + } + hashStr := strings.Join(datautil.Slice(friends, func(f *model_struct.LocalFriend) string { + return strings.Join([]string{ + f.FriendUserID, + f.Remark, + strconv.FormatInt(f.CreateTime, 10), + strconv.Itoa(int(f.AddSource)), + f.OperatorUserID, + f.Ex, + strconv.FormatBool(f.IsPinned), + }, ",") + }), ";") + sum := md5.Sum([]byte(hashStr)) + return binary.BigEndian.Uint64(sum[:]) +} diff --git a/internal/friend/sync.go b/internal/friend/sync.go index 7e24a025d..31bf27007 100644 --- a/internal/friend/sync.go +++ b/internal/friend/sync.go @@ -19,7 +19,7 @@ import ( "github.com/openimsdk/openim-sdk-core/v3/internal/util" "github.com/openimsdk/openim-sdk-core/v3/pkg/constant" "github.com/openimsdk/openim-sdk-core/v3/pkg/sdkerrs" - + pconstant "github.com/openimsdk/protocol/constant" "github.com/openimsdk/protocol/friend" "github.com/openimsdk/protocol/sdkws" "github.com/openimsdk/tools/log" @@ -117,6 +117,32 @@ func (f *Friend) SyncFriends(ctx context.Context, friendIDs []string) error { return f.friendSyncer.Sync(ctx, util.Batch(ServerFriendToLocalFriend, resp.FriendsInfo), localData, nil) } +func (f *Friend) SyncFriendPart(ctx context.Context) error { + hashResp, err := util.CallApi[friend.GetFriendHashResp](ctx, constant.GetFriendHash, &friend.GetFriendHashReq{UserID: f.loginUserID}) + if err != nil { + return err + } + friends, err := f.db.GetAllFriendList(ctx) + if err != nil { + return err + } + hashCode := f.CalculateHash(friends) + log.ZDebug(ctx, "SyncFriendPart", "serverHash", hashResp.Hash, "serverTotal", hashResp.Total, "localHash", hashCode, "localTotal", len(friends)) + if hashCode == hashResp.Hash { + return nil + } + req := &friend.GetPaginationFriendsReq{ + UserID: f.loginUserID, + Pagination: &sdkws.RequestPagination{PageNumber: pconstant.FirstPageNumber, ShowNumber: pconstant.MaxSyncPullNumber}, + } + resp, err := util.CallApi[friend.GetPaginationFriendsResp](ctx, constant.GetFriendListRouter, req) + if err != nil { + return err + } + serverFriends := util.Batch(ServerFriendToLocalFriend, resp.FriendsInfo) + return f.friendSyncer.Sync(ctx, serverFriends, friends, nil) +} + func (f *Friend) SyncAllBlackList(ctx context.Context) error { req := &friend.GetPaginationBlacksReq{UserID: f.loginUserID, Pagination: &sdkws.RequestPagination{}} fn := func(resp *friend.GetPaginationBlacksResp) []*sdkws.BlackInfo { return resp.Blacks } diff --git a/pkg/constant/server_api_router.go b/pkg/constant/server_api_router.go index 3e67f3c76..269d7dd8c 100644 --- a/pkg/constant/server_api_router.go +++ b/pkg/constant/server_api_router.go @@ -45,6 +45,7 @@ const ( AddFriendResponse = "/friend/add_friend_response" SetFriendRemark = "/friend/set_friend_remark" UpdateFriends = "/friend/update_friends" + GetFriendHash = "/friend/friend_hash" AddBlackRouter = "/friend/add_black" RemoveBlackRouter = "/friend/remove_black"