cmsend 0.2.0__tar.gz → 0.3.0__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: cmsend
3
- Version: 0.2.0
3
+ Version: 0.3.0
4
4
  Summary: ping messages between chatmail relays
5
5
  Project-URL: Repository, https://github.com/chatmail/cmsend
6
6
  Project-URL: Changelog, https://github.com/chatmail/cmsend/blob/master/CHANGELOG.md
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: cmsend
3
- Version: 0.2.0
3
+ Version: 0.3.0
4
4
  Summary: ping messages between chatmail relays
5
5
  Project-URL: Repository, https://github.com/chatmail/cmsend
6
6
  Project-URL: Changelog, https://github.com/chatmail/cmsend/blob/master/CHANGELOG.md
@@ -25,14 +25,18 @@ def main():
25
25
  help="setup a chat using the specified invite link",
26
26
  )
27
27
  parser.add_argument(
28
- "--msg",
28
+ "-m",
29
29
  type=str,
30
+ dest="msg",
30
31
  default=None,
31
32
  help="the text message to send (defaults to reading from stdin)",
32
33
  )
33
34
  parser.add_argument(
34
35
  "-v", dest="verbose", action="count", default=0, help="increase verbosity"
35
36
  )
37
+ parser.add_argument(
38
+ "-a", dest="filename", type=str, default=None, help="add file attachment"
39
+ )
36
40
  args = parser.parse_args()
37
41
 
38
42
  try:
@@ -54,7 +58,7 @@ def perform_main(args):
54
58
  else:
55
59
  if args.msg is None:
56
60
  args.msg = sys.stdin.read()
57
- profile.perform_send(args.msg)
61
+ profile.perform_send(args.msg, filename=args.filename)
58
62
 
59
63
 
60
64
  class Profile:
@@ -110,12 +114,12 @@ class Profile:
110
114
  print(f"joining completed with contact_id == {ev.contact_id}")
111
115
  return 0
112
116
 
113
- def perform_send(self, text):
117
+ def perform_send(self, text, filename=None):
114
118
  self._account.start_io()
115
119
  for chat in self._account.get_chatlist():
116
120
  snap = chat.get_full_snapshot()
117
121
  if snap.is_encrypted and snap.can_send:
118
- msg = chat.send_text(text)
122
+ msg = chat.send_message(text=text, file=filename)
119
123
  print(f"message {msg.id} was queued, waiting for delivery")
120
124
  msg.wait_until_delivered()
121
125
  return 0
File without changes
File without changes
File without changes
File without changes