Do not set room name for PM room
This commit is contained in:
parent
1370a6b35f
commit
65ddb6be2b
4 changed files with 5 additions and 7 deletions
|
@ -125,7 +125,7 @@ func dbGetMxPmRoom(protocol string, them connector.UserID, themMxId string, usMx
|
||||||
if must_create {
|
if must_create {
|
||||||
name := fmt.Sprintf("%s (%s)", them, protocol)
|
name := fmt.Sprintf("%s (%s)", them, protocol)
|
||||||
|
|
||||||
mx_room_id, err := mxCreateDirectRoomAs(name, []string{usMxId}, themMxId)
|
mx_room_id, err := mxCreateDirectRoomAs([]string{usMxId}, themMxId)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.Printf("Could not create room for %s: %s", name, err)
|
log.Printf("Could not create room for %s: %s", name, err)
|
||||||
return "", err
|
return "", err
|
||||||
|
|
|
@ -179,10 +179,9 @@ func mxCreateRoom(name string, alias string, invite []string) (string, error) {
|
||||||
return rep.RoomId, nil
|
return rep.RoomId, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func mxCreateDirectRoomAs(name string, invite []string, as_user string) (string, error) {
|
func mxCreateDirectRoomAs(invite []string, as_user string) (string, error) {
|
||||||
rq := CreateRoomNoAliasRequest{
|
rq := CreateDirectRoomRequest{
|
||||||
Preset: "private_chat",
|
Preset: "private_chat",
|
||||||
Name: name,
|
|
||||||
Topic: "",
|
Topic: "",
|
||||||
Invite: invite,
|
Invite: invite,
|
||||||
CreationContent: map[string]interface{}{
|
CreationContent: map[string]interface{}{
|
||||||
|
|
|
@ -37,7 +37,7 @@ func Start(r *mxlib.Registration, c *Config) (chan error, error) {
|
||||||
if mxe, ok := err.(*mxlib.MxError); !ok || mxe.ErrCode != "M_USER_IN_USE" {
|
if mxe, ok := err.(*mxlib.MxError); !ok || mxe.ErrCode != "M_USER_IN_USE" {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
err = mxProfileDisplayname(ezbrMxId(), "Easybridge")
|
err = mxProfileDisplayname(ezbrMxId(), fmt.Sprintf("Easybridge (%s)", EASYBRIDGE_SYSTEM_PROTOCOL))
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
|
|
@ -50,9 +50,8 @@ type CreateRoomRequest struct {
|
||||||
PowerLevels map[string]interface{} `json:"power_level_content_override"`
|
PowerLevels map[string]interface{} `json:"power_level_content_override"`
|
||||||
}
|
}
|
||||||
|
|
||||||
type CreateRoomNoAliasRequest struct {
|
type CreateDirectRoomRequest struct {
|
||||||
Preset string `json:"preset"`
|
Preset string `json:"preset"`
|
||||||
Name string `json:"name"`
|
|
||||||
Topic string `json:"topic"`
|
Topic string `json:"topic"`
|
||||||
Invite []string `json:"invite"`
|
Invite []string `json:"invite"`
|
||||||
CreationContent map[string]interface{} `json:"creation_content"`
|
CreationContent map[string]interface{} `json:"creation_content"`
|
||||||
|
|
Loading…
Reference in a new issue