summaryrefslogtreecommitdiffstatshomepage
path: root/parsing.c
diff options
context:
space:
mode:
Diffstat (limited to 'parsing.c')
-rw-r--r--parsing.c23
1 files changed, 14 insertions, 9 deletions
diff --git a/parsing.c b/parsing.c
index 599f61e..5b4b1f4 100644
--- a/parsing.c
+++ b/parsing.c
@@ -17,7 +17,8 @@
*/
void cgit_parse_url(const char *url)
{
- char *cmd, *p;
+ char *c, *cmd, *p;
+ struct cgit_repo *repo;
ctx.repo = NULL;
if (!url || url[0] == '\0')
@@ -29,16 +30,20 @@ void cgit_parse_url(const char *url)
return;
}
- cmd = strchr(url, '/');
- while (!ctx.repo && cmd) {
- cmd[0] = '\0';
- ctx.repo = cgit_get_repoinfo(url);
- if (ctx.repo == NULL) {
- cmd[0] = '/';
- cmd = strchr(cmd + 1, '/');
- continue;
+ cmd = NULL;
+ c = strchr(url, '/');
+ while (c) {
+ c[0] = '\0';
+ repo = cgit_get_repoinfo(url);
+ if (repo) {
+ ctx.repo = repo;
+ cmd = c;
}
+ c[0] = '/';
+ c = strchr(c + 1, '/');
+ }
+ if (ctx.repo) {
ctx.qry.repo = ctx.repo->url;
p = strchr(cmd + 1, '/');
if (p) {
='n145' href='#n145'>145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
 <class>MainWindow</class>
 <widget class="QMainWindow" name="MainWindow">
  <property name="geometry">
   <rect>
    <x>0</x>
    <y>0</y>
    <width>800</width>
    <height>600</height>
   </rect>
  </property>
  <property name="windowTitle">
   <string>Actor Viewer</string>
  </property>
  <widget class="QWidget" name="centralwidget">
   <layout class="QHBoxLayout" name="horizontalLayout_2">
    <item>
     <widget class="QListWidget" name="listWidget"/>
    </item>
    <item>
     <widget class="QTextBrowser" name="statusInfoText">
      <property name="html">
       <string>&lt;!DOCTYPE HTML PUBLIC &quot;-//W3C//DTD HTML 4.0//EN&quot; &quot;http://www.w3.org/TR/REC-html40/strict.dtd&quot;&gt;
&lt;html&gt;&lt;head&gt;&lt;meta name=&quot;qrichtext&quot; content=&quot;1&quot; /&gt;&lt;style type=&quot;text/css&quot;&gt;
p, li { white-space: pre-wrap; }
&lt;/style&gt;&lt;/head&gt;&lt;body style=&quot; font-family:'Noto Sans'; font-size:10pt; font-weight:400; font-style:normal;&quot;&gt;
&lt;p align=&quot;center&quot; style=&quot; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;&lt;span style=&quot; font-style:italic;&quot;&gt;Select Status to display from list.&lt;/span&gt;&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
      </property>
     </widget>
    </item>
   </layout>
  </widget>
  <widget class="QMenuBar" name="menubar">
   <property name="geometry">
    <rect>
     <x>0</x>
     <y>0</y>
     <width>800</width>
     <height>30</height>
    </rect>
   </property>
   <widget class="QMenu" name="menuFile">
    <property name="title">
     <string>File</string>
    </property>
    <addaction name="actionOpen"/>
    <addaction name="actionQuit"/>
   </widget>
   <widget class="QMenu" name="menuHelp">
    <property name="title">
     <string>Help</string>
    </property>
    <addaction name="actionAbout"/>
   </widget>
   <widget class="QMenu" name="menuView">
    <property name="title">
     <string>View</string>
    </property>
    <addaction name="actionAll_toots"/>
    <addaction name="actionPublic_toots"/>
    <addaction name="actionUnlisted_toots"/>
    <addaction name="actionPrivate_toots"/>
    <addaction name="actionDirect_messages"/>
    <addaction name="separator"/>
    <addaction name="actionOnly_with_attachment"/>
   </widget>
   <addaction name="menuFile"/>
   <addaction name="menuView"/>
   <addaction name="menuHelp"/>
  </widget>
  <widget class="QStatusBar" name="statusbar"/>
  <action name="actionOpen">
   <property name="checkable">
    <bool>false</bool>
   </property>
   <property name="text">
    <string>Open...</string>
   </property>
   <property name="iconText">
    <string>Open...</string>
   </property>
   <property name="toolTip">
    <string>Open...</string>
   </property>
   <property name="statusTip">
    <string>Open a Mastodon data archive</string>
   </property>
   <property name="shortcut">
    <string>Ctrl+O</string>
   </property>
  </action>
  <action name="actionQuit">
   <property name="text">
    <string>Quit</string>
   </property>
   <property name="shortcut">
    <string>Ctrl+Q</string>
   </property>
   <property name="menuRole">
    <enum>QAction::QuitRole</enum>
   </property>
  </action>
  <action name="actionAbout">
   <property name="text">
    <string>About</string>
   </property>
   <property name="menuRole">
    <enum>QAction::AboutRole</enum>
   </property>
  </action>
  <action name="actionAll_toots">
   <property name="checkable">
    <bool>true</bool>
   </property>
   <property name="checked">
    <bool>true</bool>
   </property>
   <property name="text">
    <string>All toots</string>
   </property>
  </action>
  <action name="actionPublic_toots">
   <property name="checkable">
    <bool>true</bool>
   </property>
   <property name="text">
    <string>Public toots</string>
   </property>
  </action>
  <action name="actionUnlisted_toots">
   <property name="checkable">
    <bool>true</bool>
   </property>
   <property name="text">
    <string>Unlisted toots</string>
   </property>
  </action>
  <action name="actionPrivate_toots">
   <property name="checkable">
    <bool>true</bool>
   </property>
   <property name="text">
    <string>Private toots</string>
   </property>
  </action>
  <action name="actionDirect_messages">
   <property name="checkable">
    <bool>true</bool>
   </property>
   <property name="text">
    <string>Direct messages</string>
   </property>
  </action>
  <action name="actionOnly_with_attachment">
   <property name="checkable">
    <bool>true</bool>
   </property>
   <property name="text">
    <string>Only with attachment</string>
   </property>
   <property name="statusTip">
    <string>Only list toots that have an attachment</string>
   </property>
  </action>
 </widget>
 <tabstops>
  <tabstop>listWidget</tabstop>
  <tabstop>statusInfoText</tabstop>
 </tabstops>
 <resources/>
 <connections/>
</ui>