-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fixed many bugs, updated dependencies
- Loading branch information
Showing
19 changed files
with
646 additions
and
385 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
29 changes: 17 additions & 12 deletions
29
examples/gammu/synapse/matrix-kotlin-sdk-it-synapse.log.config
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,28 +1,33 @@ | ||
|
||
version: 1 | ||
|
||
formatters: | ||
precise: | ||
format: '%(asctime)s - %(name)s - %(lineno)d - %(levelname)s - %(request)s - %(message)s' | ||
precise: | ||
format: '%(asctime)s - %(name)s - %(lineno)d - %(levelname)s - %(request)s - %(message)s' | ||
|
||
filters: | ||
context: | ||
(): synapse.logging.context.LoggingContextFilter | ||
request: "" | ||
context: | ||
(): synapse.util.logcontext.LoggingContextFilter | ||
request: "" | ||
|
||
handlers: | ||
console: | ||
class: logging.StreamHandler | ||
formatter: precise | ||
filters: [context] | ||
console: | ||
class: logging.StreamHandler | ||
formatter: precise | ||
filters: [context] | ||
|
||
loggers: | ||
synapse: | ||
level: WARNING | ||
|
||
synapse.storage.SQL: | ||
# beware: increasing this to DEBUG will make synapse log sensitive | ||
# information such as access tokens. | ||
level: WARNING | ||
|
||
rest_auth_provider: | ||
level: INFO | ||
|
||
root: | ||
level: INFO | ||
level: WARNING | ||
handlers: [console] | ||
|
||
disable_existing_loggers: false |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
24 changes: 24 additions & 0 deletions
24
src/main/kotlin/net/folivo/matrix/bridge/sms/provider/PhoneNumberService.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
package net.folivo.matrix.bridge.sms.provider | ||
|
||
import com.google.i18n.phonenumbers.NumberParseException | ||
import com.google.i18n.phonenumbers.NumberParseException.ErrorType.NOT_A_NUMBER | ||
import com.google.i18n.phonenumbers.PhoneNumberUtil | ||
import net.folivo.matrix.bridge.sms.SmsBridgeProperties | ||
import org.springframework.stereotype.Service | ||
|
||
@Service | ||
class PhoneNumberService(private val smsBridgeProperties: SmsBridgeProperties) { | ||
|
||
private val phoneNumberUtil = PhoneNumberUtil.getInstance() | ||
|
||
fun parseToInternationalNumber(raw: String): String { | ||
return phoneNumberUtil.parse(raw, smsBridgeProperties.defaultRegion) | ||
.let { | ||
if (!phoneNumberUtil.isValidNumber(it)) throw NumberParseException( | ||
NOT_A_NUMBER, | ||
"not a valid number" | ||
) | ||
"+${it.countryCode}${it.nationalNumber}" | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.